GstPad

GstPad — Object contained by elements that allows links to other elements

Synopsis


#include <gst/gst.h>


struct      GstPad;
#define     GST_PAD_LINK_FAILED             (ret)
#define     GST_PAD_LINK_SUCCESSFUL         (ret)
GstFlowReturn (*GstPadChainFunction)        (GstPad *pad,
                                             GstBuffer *buffer);
gboolean    (*GstPadEventFunction)          (GstPad *pad,
                                             GstEvent *event);
gboolean    (*GstPadQueryFunction)          (GstPad *pad,
                                             GstQuery *query);
GList*      (*GstPadIntLinkFunction)        (GstPad *pad);
const GstQueryType* (*GstPadQueryTypeFunction)
                                            (GstPad *pad);
GstPadLinkReturn (*GstPadLinkFunction)      (GstPad *pad,
                                             GstPad *peer);
void        (*GstPadUnlinkFunction)         (GstPad *pad);
GstCaps*    (*GstPadGetCapsFunction)        (GstPad *pad);
GstFlowReturn (*GstPadBufferAllocFunction)  (GstPad *pad,
                                             guint64 offset,
                                             guint size,
                                             GstCaps *caps,
                                             GstBuffer **buf);
gboolean    (*GstPadDispatcherFunction)     (GstPad *pad,
                                             gpointer data);
enum        GstPadDirection;
enum        GstPadFlags;
enum        GstPadLinkReturn;
enum        GstPadPresence;
#define     GST_PAD_NAME                    (pad)
#define     GST_PAD_PARENT                  (pad)
#define     GST_PAD_ELEMENT_PRIVATE         (pad)
#define     GST_PAD_PAD_TEMPLATE            (pad)
#define     GST_PAD_DIRECTION               (pad)
#define     GST_PAD_CAPS                    (pad)
#define     GST_PAD_PEER                    (pad)
#define     GST_PAD_IS_LINKED               (pad)
#define     GST_PAD_IS_USABLE               (pad)
#define     GST_PAD_IS_SRC                  (pad)
#define     GST_PAD_IS_SINK                 (pad)
GstPad*     gst_pad_new                     (const gchar *name,
                                             GstPadDirection direction);
GstPad*     gst_pad_new_from_template       (GstPadTemplate *templ,
                                             const gchar *name);
#define     gst_pad_get_name                (pad)
GstPadDirection gst_pad_get_direction       (GstPad *pad);
gboolean    gst_pad_set_active              (GstPad *pad,
                                             GstActivateMode mode);
gboolean    gst_pad_is_active               (GstPad *pad);
void        gst_pad_set_element_private     (GstPad *pad,
                                             gpointer priv);
gpointer    gst_pad_get_element_private     (GstPad *pad);
GstElement* gst_pad_get_parent              (GstPad *pad);
GstPadTemplate* gst_pad_get_pad_template    (GstPad *pad);
void        gst_pad_set_bufferalloc_function
                                            (GstPad *pad,
                                             GstPadBufferAllocFunction bufalloc);
GstFlowReturn gst_pad_alloc_buffer          (GstPad *pad,
                                             guint64 offset,
                                             gint size,
                                             GstCaps *caps,
                                             GstBuffer **buf);
void        gst_pad_set_chain_function      (GstPad *pad,
                                             GstPadChainFunction chain);
void        gst_pad_set_event_function      (GstPad *pad,
                                             GstPadEventFunction event);
void        gst_pad_set_link_function       (GstPad *pad,
                                             GstPadLinkFunction link);
gboolean    gst_pad_can_link                (GstPad *srcpad,
                                             GstPad *sinkpad);
void        gst_pad_set_unlink_function     (GstPad *pad,
                                             GstPadUnlinkFunction unlink);
GstPadLinkReturn gst_pad_link               (GstPad *srcpad,
                                             GstPad *sinkpad);
gboolean    gst_pad_unlink                  (GstPad *srcpad,
                                             GstPad *sinkpad);
gboolean    gst_pad_is_linked               (GstPad *pad);
GstPad*     gst_pad_get_peer                (GstPad *pad);
GstCaps*    gst_pad_get_negotiated_caps     (GstPad *pad);
GstCaps*    gst_pad_get_caps                (GstPad *pad);
G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps
                                            (GstPad *pad);
void        gst_pad_set_getcaps_function    (GstPad *pad,
                                             GstPadGetCapsFunction getcaps);
GstCaps*    gst_pad_proxy_getcaps           (GstPad *pad);
GstCaps*    gst_pad_get_allowed_caps        (GstPad *srcpad);
GstFlowReturn gst_pad_push                  (GstPad *pad,
                                             GstBuffer *buffer);
gboolean    gst_pad_send_event              (GstPad *pad,
                                             GstEvent *event);
gboolean    gst_pad_event_default           (GstPad *pad,
                                             GstEvent *event);
void        gst_pad_set_query_function      (GstPad *pad,
                                             GstPadQueryFunction query);
void        gst_pad_set_query_type_function (GstPad *pad,
                                             GstPadQueryTypeFunction type_func);
G_CONST_RETURN GstQueryType* gst_pad_get_query_types
                                            (GstPad *pad);
G_CONST_RETURN GstQueryType* gst_pad_get_query_types_default
                                            (GstPad *pad);
gboolean    gst_pad_query                   (GstPad *pad,
                                             GstQuery *query);
gboolean    gst_pad_query_default           (GstPad *pad,
                                             GstQuery *query);
void        gst_pad_set_internal_link_function
                                            (GstPad *pad,
                                             GstPadIntLinkFunction intlink);
GList*      gst_pad_get_internal_links      (GstPad *pad);
GList*      gst_pad_get_internal_links_default
                                            (GstPad *pad);
gboolean    gst_pad_dispatcher              (GstPad *pad,
                                             GstPadDispatcherFunction dispatch,
                                             gpointer data);
#define     gst_pad_add_probe               (pad, probe)
#define     gst_pad_remove_probe            (pad, probe)
void        gst_pad_load_and_link           (xmlNodePtr self,
                                             GstObject *parent);


Object Hierarchy


  GObject
   +----GstObject
         +----GstPad
               +----GstProxyPad

Properties


  "caps"                 GstCaps              : Read
  "direction"            GstPadDirection      : Read / Write / Construct Only
  "template"             GstPadTemplate       : Read / Write / Construct Only

Signal Prototypes


"linked"    void        user_function      (GstPad *gstpad,
                                            GstPad *arg1,
                                            gpointer user_data);
"request-link"
            void        user_function      (GstPad *gstpad,
                                            gpointer user_data);
"unlinked"  void        user_function      (GstPad *gstpad,
                                            GstPad *arg1,
                                            gpointer user_data);

Description

A GstElement is linked to other elements via "pads", which are extremely light-weight generic link points. After two pads are retrieved from an element with gst_element_get_pad(), the pads can be link with gst_pad_link(). (For quick links, you can also use gst_element_link(), which will make the obvious link for you if it's straightforward.)

Pads are typically created from a GstPadTemplate with gst_pad_new_from_template().

Pads have GstCaps attached to it to describe the media type they are capable of dealing with. gst_pad_get_caps() and gst_pad_try_set_caps() are used to manipulate the caps of the pads. Pads created from a pad template cannot set capabilities that are incompatible with the pad template capabilities.

Pads without pad templates can be created with gst_pad_new(), which takes a direction and a name as an argument. If the name is NULL, then a guaranteed unique name will be assigned to it.

gst_pad_get_parent() will retrieve the GstElement that owns the pad.

A GstElement creating a pad will typically use the various gst_pad_set_*_function() calls to register callbacks for various events on the pads.

GstElements will use gst_pad_push() and gst_pad_pull() to push out or pull in a buffer. gst_pad_select() and gst_pad_selectv() are used by plugins to wait for the first incoming buffer or event on any of the given set of pads.

To send a GstEvent on a pad, use gst_pad_send_event().

Last reviewed on December 13th, 2002 (0.5.0.1)

Details

struct GstPad

struct GstPad {
  /* streaming rec_lock */
  GStaticRecMutex		*stream_rec_lock;
  GstTask			*task;
  GMutex			*preroll_lock;
  GCond				*preroll_cond;

  /* block cond, mutex is from the object */
  GCond				*block_cond;
  GstPadBlockCallback		 block_callback;
  gpointer			 block_data;

  /* the pad capabilities */
  GstCaps 			*caps;
  GstPadGetCapsFunction 	 getcapsfunc;
  GstPadSetCapsFunction 	 setcapsfunc;
  GstPadAcceptCapsFunction 	 acceptcapsfunc;
  GstPadFixateCapsFunction 	 fixatecapsfunc;

  GstPadActivateFunction	 activatefunc;

  /* pad link */
  GstPadLinkFunction 		 linkfunc;
  GstPadUnlinkFunction 		 unlinkfunc;
  GstPad 			*peer;

  gpointer 			 sched_private;

  /* data transport functions */
  GstPadLoopFunction 		 loopfunc;
  GstPadChainFunction 		 chainfunc;
  GstPadCheckGetRangeFunction 	 checkgetrangefunc;
  GstPadGetRangeFunction 	 getrangefunc;
  GstPadEventFunction		 eventfunc;

  GstActivateMode		 mode;

  /* generic query method */
  GstPadQueryTypeFunction	 querytypefunc;
  GstPadQueryFunction		 queryfunc;

  /* internal links */
  GstPadIntLinkFunction		 intlinkfunc;

  GstPadBufferAllocFunction      bufferallocfunc;

  GstProbeDispatcher            probedisp;

};


GST_PAD_LINK_FAILED()

#define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)

Macro to test if the given GstPadLinkReturn value indicates a failed negotiation step (REFUSED/DELAYED).

ret :the GstPadLinkReturn value

GST_PAD_LINK_SUCCESSFUL()

#define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)

Macro to test if the given GstPadLinkReturn value indicates a successfull negotiation step (OK/DONE).

ret :the GstPadLinkReturn value

GstPadChainFunction ()

GstFlowReturn (*GstPadChainFunction)        (GstPad *pad,
                                             GstBuffer *buffer);

A function that will be called when chaining buffers.

pad :the GstPad that performed the chain.
buffer :
Returns :

GstPadEventFunction ()

gboolean    (*GstPadEventFunction)          (GstPad *pad,
                                             GstEvent *event);

Function signature to handle an event for the pad.

pad :the GstPad to handle the event.
event :the GstEvent to handle.
Returns :TRUE if the pad could handle the event.

GstPadQueryFunction ()

gboolean    (*GstPadQueryFunction)          (GstPad *pad,
                                             GstQuery *query);

The signature of the query function.

pad :the GstPad to query.
query :
Returns :TRUE if the query could be performed.

GstPadIntLinkFunction ()

GList*      (*GstPadIntLinkFunction)        (GstPad *pad);

The signature of the internal pad link function.

pad :The GstPad to query.
Returns :a newly allocated GList of pads that are linked to the given pad on the inside of the parent element. The caller must call g_list_free() on it after use.

GstPadQueryTypeFunction ()

const GstQueryType* (*GstPadQueryTypeFunction)
                                            (GstPad *pad);

The signature of the query types function.

pad :a GstPad to query
Returns :an array of query types

GstPadLinkFunction ()

GstPadLinkReturn (*GstPadLinkFunction)      (GstPad *pad,
                                             GstPad *peer);

Function signature to handle a new link on the pad.

pad :the GstPad that is linked.
peer :
Returns :the result of the link with the specified caps.

GstPadUnlinkFunction ()

void        (*GstPadUnlinkFunction)         (GstPad *pad);

pad :

GstPadGetCapsFunction ()

GstCaps*    (*GstPadGetCapsFunction)        (GstPad *pad);

Returns a copy of the capabilities of the specified pad. By default this function will return the pad template capabilities, but can optionally be overridden.

pad :the GstPad to get the capabilities of.
Returns :a newly allocated copy GstCaps of the pad.

GstPadBufferAllocFunction ()

GstFlowReturn (*GstPadBufferAllocFunction)  (GstPad *pad,
                                             guint64 offset,
                                             guint size,
                                             GstCaps *caps,
                                             GstBuffer **buf);

pad :
offset :
size :
caps :
buf :
Returns :

GstPadDispatcherFunction ()

gboolean    (*GstPadDispatcherFunction)     (GstPad *pad,
                                             gpointer data);

A dispatcher function is called for all internally linked pads, see gst_pad_dispatcher().

pad :the GstPad that is dispatched.
data :the gpointer to optional user data.
Returns :TRUE if the dispatching procedure has to be stopped.

enum GstPadDirection

typedef enum {
  GST_PAD_UNKNOWN,
  GST_PAD_SRC,
  GST_PAD_SINK
} GstPadDirection;

The direction of a pad.

GST_PAD_UNKNOWNdirection is unknown.
GST_PAD_SRCthe pad is a source pad.
GST_PAD_SINKthe pad is a sink pad.

enum GstPadFlags

typedef enum {
  GST_PAD_BLOCKED		= GST_OBJECT_FLAG_LAST,
  GST_PAD_FLUSHING,
  GST_PAD_IN_GETCAPS,
  GST_PAD_IN_SETCAPS,

  GST_PAD_FLAG_LAST		= GST_OBJECT_FLAG_LAST + 8
} GstPadFlags;


enum GstPadLinkReturn

typedef enum {
  GST_PAD_LINK_NOSCHED          = -5,	/* pads cannot cooperate in scheduling */
  GST_PAD_LINK_NOFORMAT         = -4,	/* pads do not have common format */
  GST_PAD_LINK_REFUSED          = -3,	/* refused for some reason */
  GST_PAD_LINK_WRONG_DIRECTION  = -2,	/* pads have wrong direction */
  GST_PAD_LINK_WAS_LINKED       = -1,	/* pad was already linked */
  GST_PAD_LINK_OK               =  0,	/* link ok */
} GstPadLinkReturn;

The result of a pad link.

GST_PAD_LINK_NOSCHED
GST_PAD_LINK_NOFORMAT
GST_PAD_LINK_REFUSEDthe link was refused.
GST_PAD_LINK_WRONG_DIRECTION
GST_PAD_LINK_WAS_LINKED
GST_PAD_LINK_OK the link succeeded.

enum GstPadPresence

typedef enum {
  GST_PAD_ALWAYS,
  GST_PAD_SOMETIMES,
  GST_PAD_REQUEST
} GstPadPresence;

Indicates when this pad will become available.

GST_PAD_ALWAYSthe pad is always available
GST_PAD_SOMETIMESthe pad will become available depending on the media stream
GST_PAD_REQUESTthe pad is only available on request with gst_element_request_pad_by_name() or gst_element_request_compatible_pad().

GST_PAD_NAME()

#define GST_PAD_NAME(pad)		(GST_OBJECT_NAME(pad))

Gets the name of the pad.

pad :a GstPad to get the name of.
Returns :the pad's name.

GST_PAD_PARENT()

#define GST_PAD_PARENT(pad)		(GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))

Gets the parent element of this pad.

pad :a GstPad to get the parent of.
Returns :the parent GstElement of this pad.

GST_PAD_ELEMENT_PRIVATE()

#define GST_PAD_ELEMENT_PRIVATE(pad)	(GST_PAD_CAST(pad)->element_private)

Gets the private data set by the element that owns the pad.

pad :a GstPad to get the private data of. Returns: a gpointer to the private data.

GST_PAD_PAD_TEMPLATE()

#define GST_PAD_PAD_TEMPLATE(pad)	(GST_PAD_CAST(pad)->padtemplate)

Gets the pad template that was used to create this pad.

pad :a GstPad to get the pad template of. Returns: the GstPadTemplate used to create the pad, or NULL if none was used.

GST_PAD_DIRECTION()

#define GST_PAD_DIRECTION(pad)		(GST_PAD_CAST(pad)->direction)

Gets the pad's direction.

pad :a GstPad to get the direction of.
Returns :the GstPadDirection of the pad.

GST_PAD_CAPS()

#define GST_PAD_CAPS(pad)		(GST_PAD_CAST(pad)->caps)

Gets the capabilities of a pad.

pad :a GstPad to get the capabilities of.
Returns :the GstCaps of the pad.

GST_PAD_PEER()

#define GST_PAD_PEER(pad)		(GST_PAD_CAST(pad)->peer)

Gets the peer pad of this pad. The peer pad is the pad on to which the parent element is linked through this pad.

pad :a GstPad to get the peer pad of.
Returns :the peer GstPad.

GST_PAD_IS_LINKED()

#define GST_PAD_IS_LINKED(pad)		(GST_PAD_PEER(pad) != NULL)

Checks if the pad is linked.

pad :a GstPad to check.

GST_PAD_IS_USABLE()

#define     GST_PAD_IS_USABLE(pad)

Checks if a pad is usable. A usable pad is both linked and active.

pad :a GstPad to check

GST_PAD_IS_SRC()

#define GST_PAD_IS_SRC(pad)		(GST_PAD_DIRECTION(pad) == GST_PAD_SRC)

Checks if the pad is a source pad.

pad :a GstPad to check.

GST_PAD_IS_SINK()

#define GST_PAD_IS_SINK(pad)		(GST_PAD_DIRECTION(pad) == GST_PAD_SINK)

Checks if the pad is a sink pad.

pad :a GstPad to check.

gst_pad_new ()

GstPad*     gst_pad_new                     (const gchar *name,
                                             GstPadDirection direction);

Creates a new pad with the given name in the given direction. If name is NULL, a guaranteed unique name (across all pads) will be assigned. This function makes a copy of the name so you can safely free the name.

name : the name of the new pad.
direction : the GstPadDirection of the pad.
Returns : a new GstPad, or NULL in case of an error. MT safe.

gst_pad_new_from_template ()

GstPad*     gst_pad_new_from_template       (GstPadTemplate *templ,
                                             const gchar *name);

Creates a new pad with the given name from the given template. If name is NULL, a guaranteed unique name (across all pads) will be assigned. This function makes a copy of the name so you can safely free the name.

templ : the pad template to use
name : the name of the element
Returns : a new GstPad, or NULL in case of an error.

gst_pad_get_name()

#define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))

pad :
Returns :

gst_pad_get_direction ()

GstPadDirection gst_pad_get_direction       (GstPad *pad);

Gets the direction of the pad. The direction of the pad is decided at construction time so this function does not take the LOCK.

pad : a GstPad to get the direction of.
Returns : the GstPadDirection of the pad. MT safe.

gst_pad_set_active ()

gboolean    gst_pad_set_active              (GstPad *pad,
                                             GstActivateMode mode);

Activates or deactivates the given pad in the given mode.

For a source pad: PULL mode will call the getrange function, PUSH mode will require the element to call _push() on the pad.

For a sink pad: PULL mode will require the element to call the _pull_range() function, PUSH mode will call the chain function.

pad : the GstPad to activate or deactivate.
mode : the mode of the pad.
Returns : TRUE if the operation was successfull. MT safe.

gst_pad_is_active ()

gboolean    gst_pad_is_active               (GstPad *pad);

Query if a pad is active

pad : the GstPad to query
Returns : TRUE if the pad is active. MT safe.

gst_pad_set_element_private ()

void        gst_pad_set_element_private     (GstPad *pad,
                                             gpointer priv);

Set the given private data gpointer on the pad. This function can only be used by the element that owns the pad.

pad : the GstPad to set the private data of.
priv : The private data to attach to the pad.

gst_pad_get_element_private ()

gpointer    gst_pad_get_element_private     (GstPad *pad);

Gets the private data of a pad.

pad : the GstPad to get the private data of.
Returns : a gpointer to the private data.

gst_pad_get_parent ()

GstElement* gst_pad_get_parent              (GstPad *pad);

Gets the parent of pad, cast to a GstElement. If a pad has no parent or its parent is not an element, return NULL.

pad : a pad
Returns : The parent of the pad. The caller has a reference on the parent, so unref when you're finished with it. MT safe.

gst_pad_get_pad_template ()

GstPadTemplate* gst_pad_get_pad_template    (GstPad *pad);

Gets the template for pad.

pad : a GstPad.
Returns : the GstPadTemplate from which this pad was instantiated, or NULL if this pad has no template. FIXME: currently returns an unrefcounted padtemplate.

gst_pad_set_bufferalloc_function ()

void        gst_pad_set_bufferalloc_function
                                            (GstPad *pad,
                                             GstPadBufferAllocFunction bufalloc);

Sets the given bufferalloc function for the pad. Note that the bufferalloc function can only be set on sinkpads.

pad : a sink GstPad.
bufalloc : the GstPadBufferAllocFunction to set.

gst_pad_alloc_buffer ()

GstFlowReturn gst_pad_alloc_buffer          (GstPad *pad,
                                             guint64 offset,
                                             gint size,
                                             GstCaps *caps,
                                             GstBuffer **buf);

Allocates a new, empty buffer optimized to push to pad pad. This function only works if pad is a source pad and has a peer.

You need to check the caps of the buffer after performing this function and renegotiate to the format if needed.

A new, empty GstBuffer will be put in the buf argument.

pad : a source GstPad
offset : the offset of the new buffer in the stream
size : the size of the new buffer
caps : the caps of the new buffer
buf : a newly allocated buffer
Returns : a result code indicating success of the operation. Any result code other than GST_FLOW_OK is an error and buf should not be used. An error can occur if the pad is not connected or when the downstream peer elements cannot provide an acceptable buffer. MT safe.

gst_pad_set_chain_function ()

void        gst_pad_set_chain_function      (GstPad *pad,
                                             GstPadChainFunction chain);

Sets the given chain function for the pad. The chain function is called to process a GstBuffer input buffer.

pad : a sink GstPad.
chain : the GstPadChainFunction to set.

gst_pad_set_event_function ()

void        gst_pad_set_event_function      (GstPad *pad,
                                             GstPadEventFunction event);

Sets the given event handler for the pad.

pad : a source GstPad.
event : the GstPadEventFunction to set.

gst_pad_set_link_function ()

void        gst_pad_set_link_function       (GstPad *pad,
                                             GstPadLinkFunction link);

Sets the given link function for the pad. It will be called when the pad is linked or relinked with caps. The caps passed to the link function is the caps for the connnection. It can contain a non fixed caps.

The return value GST_PAD_LINK_OK should be used when the connection can be made.

The return value GST_PAD_LINK_REFUSED should be used when the connection cannot be made for some reason.

pad : a GstPad.
link : the GstPadLinkFunction to set.

gst_pad_can_link ()

gboolean    gst_pad_can_link                (GstPad *srcpad,
                                             GstPad *sinkpad);

Checks if the source pad and the sink pad can be linked. Both srcpad and sinkpad must be unlinked.

srcpad : the source GstPad to link.
sinkpad : the sink GstPad to link.
Returns : TRUE if the pads can be linked, FALSE otherwise.

gst_pad_set_unlink_function ()

void        gst_pad_set_unlink_function     (GstPad *pad,
                                             GstPadUnlinkFunction unlink);

Sets the given unlink function for the pad. It will be called when the pad is unlinked.

pad : a GstPad.
unlink : the GstPadUnlinkFunction to set.

gst_pad_link ()

GstPadLinkReturn gst_pad_link               (GstPad *srcpad,
                                             GstPad *sinkpad);

Links the source pad and the sink pad.

srcpad : the source GstPad to link.
sinkpad : the sink GstPad to link.
Returns : A result code indicating if the connection worked or what went wrong. MT Safe.

gst_pad_unlink ()

gboolean    gst_pad_unlink                  (GstPad *srcpad,
                                             GstPad *sinkpad);

Unlinks the source pad from the sink pad. Will emit the "unlinked" signal on both pads.

srcpad : the source GstPad to unlink.
sinkpad : the sink GstPad to unlink.
Returns : TRUE if the pads were unlinked. This function returns FALSE if the pads were not linked together. MT safe.

gst_pad_is_linked ()

gboolean    gst_pad_is_linked               (GstPad *pad);

Checks if a pad is linked to another pad or not.

pad : pad to check
Returns : TRUE if the pad is linked, FALSE otherwise. MT safe.

gst_pad_get_peer ()

GstPad*     gst_pad_get_peer                (GstPad *pad);

Gets the peer of pad. This function refs the peer pad so you need to unref it after use.

pad : a GstPad to get the peer of.
Returns : the peer GstPad. Unref after usage. MT safe.

gst_pad_get_negotiated_caps ()

GstCaps*    gst_pad_get_negotiated_caps     (GstPad *pad);

Gets the capabilities of the media type that currently flows through pad and its peer.

This function can be used on both src and sinkpads. Note that srcpads are always negotiated before sinkpads so it is possible that the negotiated caps on the srcpad do not match the negotiated caps of the peer.

pad : a GstPad.
Returns : the negotiated GstCaps of the pad link. Free the caps when you no longer need it. This function returns NULL when the pad has no peer or is not negotiated yet. MT safe.

gst_pad_get_caps ()

GstCaps*    gst_pad_get_caps                (GstPad *pad);

Gets the capabilities of this pad.

pad : a GstPad to get the capabilities of.
Returns : the GstCaps of this pad. This function returns a new caps, so use gst_caps_unref to get rid of it. MT safe.

gst_pad_get_pad_template_caps ()

G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps
                                            (GstPad *pad);

Gets the capabilities for pad's template.

pad : a GstPad to get the template capabilities from.
Returns : the GstCaps of this pad template. If you intend to keep a reference on the caps, make a copy (see gst_caps_copy()).

gst_pad_set_getcaps_function ()

void        gst_pad_set_getcaps_function    (GstPad *pad,
                                             GstPadGetCapsFunction getcaps);

Sets the given getcaps function for the pad. getcaps should return the allowable caps for a pad in the context of the element's state, its link to other elements, and the devices or files it has opened. These caps must be a subset of the pad template caps. In the NULL state with no links, getcaps should ideally return the same caps as the pad template. In rare circumstances, an object property can affect the caps returned by getcaps, but this is discouraged.

You do not need to call this function if pad's allowed caps are always the same as the pad template caps. This can only be true if the padtemplate has fixed simple caps.

For most filters, the caps returned by getcaps is directly affected by the allowed caps on other pads. For demuxers and decoders, the caps returned by the srcpad's getcaps function is directly related to the stream data. Again, getcaps should return the most specific caps it reasonably can, since this helps with autoplugging.

Note that the return value from getcaps is owned by the caller, so the caller should unref the caps after usage.

pad : a GstPad.
getcaps : the GstPadGetCapsFunction to set.

gst_pad_proxy_getcaps ()

GstCaps*    gst_pad_proxy_getcaps           (GstPad *pad);

Calls gst_pad_get_allowed_caps() for every other pad belonging to the same element as pad, and returns the intersection of the results.

This function is useful as a default getcaps function for an element that can handle any stream format, but requires all its pads to have the same caps. Two such elements are tee and aggregator.

pad : a GstPad to proxy.
Returns : the intersection of the other pads' allowed caps.

gst_pad_get_allowed_caps ()

GstCaps*    gst_pad_get_allowed_caps        (GstPad *srcpad);

Gets the capabilities of the allowed media types that can flow through pad and its peer. The pad must be a source pad. The caller must free the resulting caps.

srcpad : a GstPad, it must a a source pad.
Returns : the allowed GstCaps of the pad link. Free the caps when you no longer need it. This function returns NULL when the pad has no peer. MT safe.

gst_pad_push ()

GstFlowReturn gst_pad_push                  (GstPad *pad,
                                             GstBuffer *buffer);

Pushes a buffer to the peer of pad. pad must be linked.

pad : a source GstPad.
buffer : the GstBuffer to push.
Returns : a GstFlowReturn from the peer pad. MT safe.

gst_pad_send_event ()

gboolean    gst_pad_send_event              (GstPad *pad,
                                             GstEvent *event);

Sends the event to the pad. This function can be used by applications to send events in the pipeline.

pad : a GstPad to send the event to.
event : the GstEvent to send to the pad.
Returns : TRUE if the event was handled.

gst_pad_event_default ()

gboolean    gst_pad_event_default           (GstPad *pad,
                                             GstEvent *event);

Invokes the default event handler for the given pad. End-of-stream and discontinuity events are handled specially, and then the event is sent to all pads internally linked to pad. Note that if there are many possible sink pads that are internally linked to pad, only one will be sent an event. Multi-sinkpad elements should implement custom event handlers.

pad : a GstPad to call the default event handler on.
event : the GstEvent to handle.
Returns : TRUE if the event was sent succesfully.

gst_pad_set_query_function ()

void        gst_pad_set_query_function      (GstPad *pad,
                                             GstPadQueryFunction query);

Set the given query function for the pad.

pad : a GstPad of either direction.
query : the GstPadQueryFunction to set.

gst_pad_set_query_type_function ()

void        gst_pad_set_query_type_function (GstPad *pad,
                                             GstPadQueryTypeFunction type_func);

Set the given query type function for the pad.

pad : a GstPad of either direction.
type_func : the GstPadQueryTypeFunction to set.

gst_pad_get_query_types ()

G_CONST_RETURN GstQueryType* gst_pad_get_query_types
                                            (GstPad *pad);

Get an array of supported queries that can be performed on this pad.

pad : a GstPad.
Returns : a zero-terminated array of GstQueryType.

gst_pad_get_query_types_default ()

G_CONST_RETURN GstQueryType* gst_pad_get_query_types_default
                                            (GstPad *pad);

Invoke the default dispatcher for the query types on the pad.

pad : a GstPad.
Returns : an zero-terminated array of GstQueryType, or NULL if none of the internally-linked pads has a query types function.

gst_pad_query ()

gboolean    gst_pad_query                   (GstPad *pad,
                                             GstQuery *query);

Dispatches a query to a pad. The query should have been allocated by the caller via one of the type-specific allocation functions in gstquery.h. The element is responsible for filling the query with an appropriate response, which should then be parsed with a type-specific query parsing function.

Again, the caller is responsible for both the allocation and deallocation of the query structure.

pad : a GstPad to invoke the default query on.
query : the GstQuery to perform.
Returns : TRUE if the query could be performed.

gst_pad_query_default ()

gboolean    gst_pad_query_default           (GstPad *pad,
                                             GstQuery *query);

pad :
query :
Returns :

gst_pad_set_internal_link_function ()

void        gst_pad_set_internal_link_function
                                            (GstPad *pad,
                                             GstPadIntLinkFunction intlink);

Sets the given internal link function for the pad.

pad : a GstPad of either direction.
intlink : the GstPadIntLinkFunction to set.

gst_pad_get_internal_links ()

GList*      gst_pad_get_internal_links      (GstPad *pad);

Gets a list of pads to which the given pad is linked to inside of the parent element. The caller must free this list after use.

pad : the GstPad to get the internal links of.
Returns : a newly allocated GList of pads. Not MT safe.

gst_pad_get_internal_links_default ()

GList*      gst_pad_get_internal_links_default
                                            (GstPad *pad);

Gets a list of pads to which the given pad is linked to inside of the parent element. This is the default handler, and thus returns a list of all of the pads inside the parent element with opposite direction. The caller must free this list after use.

pad : the GstPad to get the internal links of.
Returns : a newly allocated GList of pads. Not MT safe.

gst_pad_dispatcher ()

gboolean    gst_pad_dispatcher              (GstPad *pad,
                                             GstPadDispatcherFunction dispatch,
                                             gpointer data);

Invokes the given dispatcher function on all pads that are internally linked to the given pad. The GstPadDispatcherFunction should return TRUE when no further pads need to be processed.

pad : a GstPad to dispatch.
dispatch : the GstDispatcherFunction to call.
data : gpointer user data passed to the dispatcher function.
Returns : TRUE if one of the dispatcher functions returned TRUE.

gst_pad_add_probe()

#define     gst_pad_add_probe(pad, probe)

Adds the probe to the given pad

pad :The pad to add the probe to
probe :The probe to add to the pad

gst_pad_remove_probe()

#define     gst_pad_remove_probe(pad, probe)

Remove the probe from the pad

pad :The pad to remove the probe of
probe :The probe to remove

gst_pad_load_and_link ()

void        gst_pad_load_and_link           (xmlNodePtr self,
                                             GstObject *parent);

Reads the pad definition from the XML node and links the given pad in the element to a pad of an element up in the hierarchy.

self : an xmlNodePtr to read the description from.
parent : the GstObject element that owns the pad.

Properties

"caps" (GstCaps : Read)

The capabilities of the pad.

"direction" (GstPadDirection : Read / Write / Construct Only)

The direction of the pad.

"template" (GstPadTemplate : Read / Write / Construct Only)

The GstPadTemplate of this pad.

Signals

The "linked" signal

void        user_function                  (GstPad *gstpad,
                                            GstPad *arg1,
                                            gpointer user_data);

gstpad :the object which received the signal.
arg1 :
user_data :user data set when the signal handler was connected.

The "request-link" signal

void        user_function                  (GstPad *gstpad,
                                            gpointer user_data);

gstpad :the object which received the signal.
user_data :user data set when the signal handler was connected.

The "unlinked" signal

void        user_function                  (GstPad *gstpad,
                                            GstPad *arg1,
                                            gpointer user_data);

gstpad :the object which received the signal.
arg1 :
user_data :user data set when the signal handler was connected.

See Also

GstPadTemplate, GstElement, GstEvent