## GstPad

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

## Synopsis

    struct      GstPad;
    struct      GstPadLink;
    enum        GstPadLinkReturn;
    #define     GST_PAD_LINK_FAILED             (ret)
    #define     GST_PAD_LINK_SUCCESSFUL         (ret)
    #define     GST_PAD_QUERY_TYPE_FUNCTION     (functionname, ...)
    #define     GST_PAD_FORMATS_FUNCTION        (functionname, ...)
    #define     GST_PAD_EVENT_MASK_FUNCTION     (functionname, ...)
    void        (*GstPadChainFunction)          (GstPad *pad,
                                                 GstData *data);
    GstData*    (*GstPadGetFunction)            (GstPad *pad);
    gboolean    (*GstPadEventFunction)          (GstPad *pad,
                                                 GstEvent *event);
    gboolean    (*GstPadConvertFunction)        (GstPad *pad,
                                                 GstFormat src_format,
                                                 gint64 src_value,
                                                 GstFormat *dest_format,
                                                 gint64 *dest_value);
    gboolean    (*GstPadQueryFunction)          (GstPad *pad,
                                                 GstQueryType type,
                                                 GstFormat *format,
                                                 gint64 *value);
    GList*      (*GstPadIntLinkFunction)        (GstPad *pad);
    const GstFormat* (*GstPadFormatsFunction)   (GstPad *pad);
    const GstEventMask* (*GstPadEventMaskFunction)
                                                (GstPad *pad);
    const GstQueryType* (*GstPadQueryTypeFunction)
                                                (GstPad *pad);
    GstPadLinkReturn (*GstPadLinkFunction)      (GstPad *pad,
                                                 const GstCaps *caps);
    void        (*GstPadUnlinkFunction)         (GstPad *pad);
    GstCaps*    (*GstPadGetCapsFunction)        (GstPad *pad);
    GstCaps*    (*GstPadFixateFunction)         (GstPad *pad,
                                                 const GstCaps *caps);
    GstBuffer*  (*GstPadBufferAllocFunction)    (GstPad *pad,
                                                 guint64 offset,
                                                 guint size);
    gboolean    (*GstPadDispatcherFunction)     (GstPad *pad,
                                                 gpointer data);
    enum        GstPadDirection;
    enum        GstPadFlags;
    #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_REALIZE                 (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_ACTIVE               (pad)
    #define     GST_PAD_IS_NEGOTIATING          (pad)
    #define     GST_PAD_IS_DISPATCHING          (pad)
    #define     GST_PAD_IS_USABLE               (pad)
    #define     GST_PAD_CAN_PULL                (pad)
    #define     GST_PAD_IS_SRC                  (pad)
    #define     GST_PAD_IS_SINK                 (pad)
    #define     GST_TYPE_PAD_TEMPLATE
    enum        GstPadPresence;
    GstPad*     gst_pad_new                     (const gchar *name,
                                                 GstPadDirection direction);
    GstPad*     gst_pad_new_from_template       (GstPadTemplate *templ,
                                                 const gchar *name);
    GstPad*     gst_pad_custom_new              (GType type,
                                                 const gchar *name,
                                                 GstPadDirection direction);
    GstPad*     gst_pad_custom_new_from_template
                                                (GType type,
                                                 GstPadTemplate *templ,
                                                 const gchar *name);
    void        gst_pad_set_name                (GstPad *pad,
                                                 const gchar *name);
    G_CONST_RETURN gchar* gst_pad_get_name      (GstPad *pad);
    GstPadDirection gst_pad_get_direction       (GstPad *pad);
    void        gst_pad_set_active              (GstPad *pad,
                                                 gboolean active);
    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);
    void        gst_pad_set_parent              (GstPad *pad,
                                                 GstElement *parent);
    GstElement* gst_pad_get_parent              (GstPad *pad);
    GstElement* gst_pad_get_real_parent         (GstPad *pad);
    GstScheduler* gst_pad_get_scheduler         (GstPad *pad);
    void        gst_pad_add_ghost_pad           (GstPad *pad,
                                                 GstPad *ghostpad);
    void        gst_pad_remove_ghost_pad        (GstPad *pad,
                                                 GstPad *ghostpad);
    GList*      gst_pad_get_ghost_pad_list      (GstPad *pad);
    GstPadTemplate* gst_pad_get_pad_template    (GstPad *pad);
    void        gst_pad_set_bufferalloc_function
                                                (GstPad *pad,
                                                 GstPadBufferAllocFunction bufalloc);
    GstBuffer*  gst_pad_alloc_buffer            (GstPad *pad,
                                                 guint64 offset,
                                                 gint size);
    void        gst_pad_set_chain_function      (GstPad *pad,
                                                 GstPadChainFunction chain);
    void        gst_pad_set_get_function        (GstPad *pad,
                                                 GstPadGetFunction get);
    void        gst_pad_set_event_function      (GstPad *pad,
                                                 GstPadEventFunction event);
    void        gst_pad_set_event_mask_function (GstPad *pad,
                                                 GstPadEventMaskFunction mask_func);
    G_CONST_RETURN GstEventMask* gst_pad_get_event_masks
                                                (GstPad *pad);
    G_CONST_RETURN GstEventMask* gst_pad_get_event_masks_default
                                                (GstPad *pad);
    void        gst_pad_set_link_function       (GstPad *pad,
                                                 GstPadLinkFunction link);
    gboolean    gst_pad_can_link                (GstPad *srcpad,
                                                 GstPad *sinkpad);
    gboolean    gst_pad_can_link_filtered       (GstPad *srcpad,
                                                 GstPad *sinkpad,
                                                 const GstCaps *filtercaps);
    void        gst_pad_set_unlink_function     (GstPad *pad,
                                                 GstPadUnlinkFunction unlink);
    gboolean    gst_pad_link                    (GstPad *srcpad,
                                                 GstPad *sinkpad);
    gboolean    gst_pad_link_filtered           (GstPad *srcpad,
                                                 GstPad *sinkpad,
                                                 const GstCaps *filtercaps);
    void        gst_pad_unlink                  (GstPad *srcpad,
                                                 GstPad *sinkpad);
    gboolean    gst_pad_is_linked               (GstPad *pad);
    GstPad*     gst_pad_get_peer                (GstPad *pad);
    G_CONST_RETURN GstCaps* gst_pad_get_negotiated_caps
                                                (GstPad *pad);
    gboolean    gst_pad_is_negotiated           (GstPad *pad);
    GstCaps*    gst_pad_get_caps                (GstPad *pad);
    G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps
                                                (GstPad *pad);
    GstPadLinkReturn gst_pad_try_set_caps       (GstPad *pad,
                                                 const GstCaps *caps);
    GstPadLinkReturn gst_pad_try_set_caps_nonfixed
                                                (GstPad *pad,
                                                 const GstCaps *caps);
    gboolean    gst_pad_check_compatibility     (GstPad *srcpad,
                                                 GstPad *sinkpad);
    void        gst_pad_set_getcaps_function    (GstPad *pad,
                                                 GstPadGetCapsFunction getcaps);
    void        gst_pad_set_fixate_function     (GstPad *pad,
                                                 GstPadFixateFunction fixate);
    GstCaps*    gst_pad_proxy_getcaps           (GstPad *pad);
    GstPadLinkReturn gst_pad_proxy_pad_link     (GstPad *pad,
                                                 const GstCaps *caps);
    GstCaps*    gst_pad_proxy_fixate            (GstPad *pad,
                                                 const GstCaps *caps);
    GstPadLinkReturn gst_pad_proxy_link         (GstPad *pad,
                                                 const GstCaps *caps);
    gboolean    gst_pad_set_explicit_caps       (GstPad *pad,
                                                 const GstCaps *caps);
    void        gst_pad_use_explicit_caps       (GstPad *pad);
    gboolean    gst_pad_relink_filtered         (GstPad *srcpad,
                                                 GstPad *sinkpad,
                                                 const GstCaps *filtercaps);
    gboolean    gst_pad_perform_negotiate       (GstPad *srcpad,
                                                 GstPad *sinkpad);
    GstPadLinkReturn gst_pad_renegotiate        (GstPad *pad);
    void        gst_pad_unnegotiate             (GstPad *pad);
    gboolean    gst_pad_try_relink_filtered     (GstPad *srcpad,
                                                 GstPad *sinkpad,
                                                 const GstCaps *filtercaps);
    GstCaps*    gst_pad_get_allowed_caps        (GstPad *pad);
    void        gst_pad_caps_change_notify      (GstPad *pad);
    gboolean    gst_pad_recover_caps_error      (GstPad *pad,
                                                 const GstCaps *allowed);
    void        gst_pad_push                    (GstPad *pad,
                                                 GstData *data);
    GstData*    gst_pad_pull                    (GstPad *pad);
    gboolean    gst_pad_send_event              (GstPad *pad,
                                                 GstEvent *event);
    gboolean    gst_pad_event_default           (GstPad *pad,
                                                 GstEvent *event);
    GstPad*     gst_pad_select                  (GstPad *pad,
                                                 ...);
    GstPad*     gst_pad_selectv                 (GList *padlist);
    GstPad*     gst_pad_select_valist           (GstPad *pad,
                                                 va_list varargs);
    GstData*    gst_pad_collect                 (GstPad **selected,
                                                 GstPad *pad,
                                                 ...);
    GstData*    gst_pad_collectv                (GstPad **selected,
                                                 const GList *padlist);
    GstData*    gst_pad_collect_valist          (GstPad **selected,
                                                 GstPad *pad,
                                                 va_list varargs);
    void        gst_pad_set_formats_function    (GstPad *pad,
                                                 GstPadFormatsFunction formats);
    G_CONST_RETURN GstFormat* gst_pad_get_formats
                                                (GstPad *pad);
    G_CONST_RETURN GstFormat* gst_pad_get_formats_default
                                                (GstPad *pad);
    void        gst_pad_set_convert_function    (GstPad *pad,
                                                 GstPadConvertFunction convert);
    gboolean    gst_pad_convert                 (GstPad *pad,
                                                 GstFormat src_format,
                                                 gint64 src_value,
                                                 GstFormat *dest_format,
                                                 gint64 *dest_value);
    gboolean    gst_pad_convert_default         (GstPad *pad,
                                                 GstFormat src_format,
                                                 gint64 src_value,
                                                 GstFormat *dest_format,
                                                 gint64 *dest_value);
    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,
                                                 GstQueryType type,
                                                 GstFormat *format,
                                                 gint64 *value);
    gboolean    gst_pad_query_default           (GstPad *pad,
                                                 GstQueryType type,
                                                 GstFormat *format,
                                                 gint64 *value);
    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
                   +----GstRealPad
                   +----GstGhostPad

## 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;

### struct GstPadLink

    struct GstPadLink;

### enum GstPadLinkReturn

    typedef enum {
      GST_PAD_LINK_REFUSED = -1,
      GST_PAD_LINK_DELAYED =  0,
      GST_PAD_LINK_OK      =  1,
      GST_PAD_LINK_DONE    =  2
    } GstPadLinkReturn;

The result of a pad link.

`GST_PAD_LINK_REFUSED` | the link was refused.
`GST_PAD_LINK_DELAYED` | the link was delayed, probably because the element needs more specific pad capabilitiess.
`GST_PAD_LINK_OK` | the link succeeded.
`GST_PAD_LINK_DONE` | the link succeeded, any more attempts are not needed.

### GST_PAD_LINK_FAILED()

    #define GST_PAD_LINK_FAILED(ret) (ret < GST_PAD_LINK_OK)

`ret` : |

### GST_PAD_LINK_SUCCESSFUL()

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

`ret` : |

### GST_PAD_QUERY_TYPE_FUNCTION()

    #define     GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...)

A convenience macro to construct query type functions

`functionname` : | the name of the function
`...` : | query types, 0 to mark the last element

### GST_PAD_FORMATS_FUNCTION()

    #define     GST_PAD_FORMATS_FUNCTION(functionname, ...)

Convenience function to define an array of formats that can be used as GstPadGetFormatsFunction.

`functionname` : | The name of the function
`...` : | comma separated list of formats, 0 to mark the end

### GST_PAD_EVENT_MASK_FUNCTION()

    #define     GST_PAD_EVENT_MASK_FUNCTION(functionname, ...)

Convenience function to define an array of event masks that can be used as GstPadGetEventMaskFunction.

`functionname` : | The name of the function
`...` : | comma separated list of event maks, { 0, } to mark the end

### GstPadChainFunction ()

    void        (*GstPadChainFunction)          (GstPad *pad,
                                                 GstData *data);

A function that will be called when chaining buffers.

`pad` : | the GstPad that performed the chain.
`data` : |

### GstPadGetFunction ()

    GstData*    (*GstPadGetFunction)            (GstPad *pad);

A function that will be called when pulling a buffer.

`pad` : | the GstPad to get a buffer from.
Returns : | the GstBuffer pulled.

### 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.

### GstPadConvertFunction ()

    gboolean    (*GstPadConvertFunction)        (GstPad *pad,
                                                 GstFormat src_format,
                                                 gint64 src_value,
                                                 GstFormat *dest_format,
                                                 gint64 *dest_value);

The signature of a convert function.

`pad` : | the GstPad to perform the convert on.
`src_format` : | the source GstFormat of the conversion.
`src_value` : | the source value of the conversion.
`dest_format` : | a pointer to the destination GstFormat.
`dest_value` : | a pointer to the destination value.
Returns : | TRUE if the conversion could be performed.

### GstPadQueryFunction ()

    gboolean    (*GstPadQueryFunction)          (GstPad *pad,
                                                 GstQueryType type,
                                                 GstFormat *format,
                                                 gint64 *value);

The signature of the query function.

`pad` : | the GstPad to query.
`type` : | the GstPadQueryType.
`format` : | a pointer to the target GstFormat.
`value` : | a pointer to the target value.
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.

### GstPadFormatsFunction ()

    const GstFormat* (*GstPadFormatsFunction)   (GstPad *pad);

The signature of the formats function.

`pad` : | a GstPad to query
Returns : | an array of formats

### GstPadEventMaskFunction ()

    const GstEventMask* (*GstPadEventMaskFunction)
                                                (GstPad *pad);

The signature of the eventmask function.

`pad` : | the GstPad to query
Returns : | an array of event masks

### 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,
                                                 const GstCaps *caps);

Function signature to handle a new link on the pad.

`pad` : | the GstPad that is linked.
`caps` : | the peer's GstCaps.
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.

### GstPadFixateFunction ()

    GstCaps*    (*GstPadFixateFunction)         (GstPad *pad,
                                                 const GstCaps *caps);

`pad` : |
`caps` : |
Returns : |

### GstPadBufferAllocFunction ()

    GstBuffer*  (*GstPadBufferAllocFunction)    (GstPad *pad,
                                                 guint64 offset,
                                                 guint size);

`pad` : |
`offset` : |
`size` : |
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_UNKNOWN` | direction is unknown.
`GST_PAD_SRC` | the pad is a source pad.
`GST_PAD_SINK` | the pad is a sink pad.

### enum GstPadFlags

    typedef enum {
      GST_PAD_DISABLED		= GST_OBJECT_FLAG_LAST,
      GST_PAD_NEGOTIATING,
      GST_PAD_DISPATCHING,

      GST_PAD_FLAG_LAST		= GST_OBJECT_FLAG_LAST + 4
    } GstPadFlags;

Flags for the pad.

`GST_PAD_DISABLED` | the pad is disabled.
`GST_PAD_NEGOTIATING` |
`GST_PAD_DISPATCHING` |
`GST_PAD_FLAG_LAST` | subclasses can use this number to enumerate their flags.

### 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)		((GstElement *)(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)	(((GstPad *)(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)	(((GstPad *)(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_REALIZE()

    #define GST_PAD_REALIZE(pad)		(GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad))

Returns the real pad of this pad.

`pad` : | a GstPad to realize.
Returns : | the actual GstPad.

### GST_PAD_DIRECTION()

    #define GST_PAD_DIRECTION(pad)		GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad))

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_get_negotiated_caps(GST_PAD (pad)))

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(GST_RPAD_PEER(GST_PAD_REALIZE(pad)))

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_ACTIVE()

    #define GST_PAD_IS_ACTIVE(pad)		(!GST_FLAG_IS_SET(GST_PAD_REALIZE(pad), GST_PAD_DISABLED))

Checks if the pad is active.

`pad` : | a GstPad to check

### GST_PAD_IS_NEGOTIATING()

    #define GST_PAD_IS_NEGOTIATING(pad)	(GST_FLAG_IS_SET (pad, GST_PAD_NEGOTIATING))

`pad` : |

### GST_PAD_IS_DISPATCHING()

    #define GST_PAD_IS_DISPATCHING(pad)	(GST_FLAG_IS_SET (pad, GST_PAD_DISPATCHING))

`pad` : |

### 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_CAN_PULL()

    #define GST_PAD_CAN_PULL(pad)		(GST_IS_REAL_PAD(pad) && GST_REAL_PAD(pad)->gethandler != NULL)

Checks if buffers can be pulled from this buffer.

`pad` : | a GstPad to check on if a buffer can be pulled from it.

### 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_TYPE_PAD_TEMPLATE

    #define GST_TYPE_PAD_TEMPLATE		(gst_pad_template_get_type ())

### enum GstPadPresence

    typedef enum {
      GST_PAD_ALWAYS,
      GST_PAD_SOMETIMES,
      GST_PAD_REQUEST
    } GstPadPresence;

Indicates when this pad will become available.

`GST_PAD_ALWAYS` | the pad is always available
`GST_PAD_SOMETIMES` | the pad will become available depending on the media stream
`GST_PAD_REQUEST` | th pad is only available on request with `gst_element_request_pad_by_name()` or `gst_element_request_compatible_pad()`.

### gst_pad_new ()

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

Creates a new real pad with the given name in the given direction. If name is NULL, a guaranteed unique name (across all pads) will be assigned.

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

### gst_pad_new_from_template ()

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

Creates a new real pad with the given name from the given template. If name is NULL, a guaranteed unique name (across all pads) will be assigned.

`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_custom_new ()

    GstPad*     gst_pad_custom_new              (GType type,
                                                 const gchar *name,
                                                 GstPadDirection direction);

Creates a new pad with the given name and type in the given direction. If name is NULL, a guaranteed unique name (across all pads) will be assigned.

`type` : | the Gtype of the pad.
`name` : | the name of the new pad.
`direction` : | the GstPadDirection of the pad.
Returns : | a new GstPad, or NULL in case of an error.

### gst_pad_custom_new_from_template ()

    GstPad*     gst_pad_custom_new_from_template
                                                (GType type,
                                                 GstPadTemplate *templ,
                                                 const gchar *name);

Creates a new custom pad with the given name from the given template. If name is NULL, a guaranteed unique name (across all pads) will be assigned.

`type` : | the custom GType of the pad.
`templ` : | the GstPadTemplate to instantiate from.
`name` : | the name of the new pad.
Returns : | a new GstPad, or NULL in case of an error.

### gst_pad_set_name ()

    void        gst_pad_set_name                (GstPad *pad,
                                                 const gchar *name);

Sets the name of a pad. If name is NULL, then a guaranteed unique name will be assigned.

`pad` : | a GstPad to set the name of.
`name` : | the name of the pad.

### gst_pad_get_name ()

    G_CONST_RETURN gchar* gst_pad_get_name      (GstPad *pad);

Gets the name of a pad.

`pad` : | a GstPad to get the name of.
Returns : | the name of the pad. This is not a newly allocated pointer so you must not free it.

### gst_pad_get_direction ()

    GstPadDirection gst_pad_get_direction       (GstPad *pad);

Gets the direction of the pad.

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

### gst_pad_set_active ()

    void        gst_pad_set_active              (GstPad *pad,
                                                 gboolean active);

Activates or deactivates the given pad.

`pad` : | the GstPad to activate or deactivate.
`active` : | TRUE to activate the pad.

### 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.

### 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_set_parent ()

    void        gst_pad_set_parent              (GstPad *pad,
                                                 GstElement *parent);

Sets the parent object of a pad. Deprecated, use `gst_object_set_parent()` instead.

`pad` : | a GstPad to set the parent of.
`parent` : | the new parent GstElement.

### gst_pad_get_parent ()

    GstElement* gst_pad_get_parent              (GstPad *pad);

Gets the parent object of this pad. Deprecated, use `gst_object_get_parent()` instead.

`pad` : | the GstPad to get the parent of.
Returns : | the parent GstElement.

### gst_pad_get_real_parent ()

    GstElement* gst_pad_get_real_parent         (GstPad *pad);

Gets the real parent object of this pad. If the pad is a ghost pad, the actual owner of the real pad is returned, as opposed to #`gst_pad_get_parent()`.

`pad` : | a GstPad to get the real parent of.
Returns : | the parent GstElement.

### gst_pad_get_scheduler ()

    GstScheduler* gst_pad_get_scheduler         (GstPad *pad);

Gets the scheduler of the pad. Since the pad does not have a scheduler of its own, the scheduler of the parent is taken. For decoupled pads, the scheduler of the peer parent is taken.

`pad` : | a GstPad to get the scheduler of.
Returns : | the GstScheduler of the pad, or `NULL` if there is no parent or the parent is not yet in a managing bin.

### gst_pad_add_ghost_pad ()

    void        gst_pad_add_ghost_pad           (GstPad *pad,
                                                 GstPad *ghostpad);

Adds a ghost pad to a pad. Private function, will be removed from the API in 0.9.

`pad` : | a GstPad to attach the ghost pad to.
`ghostpad` : | the ghost GstPad to to the pad.

### gst_pad_remove_ghost_pad ()

    void        gst_pad_remove_ghost_pad        (GstPad *pad,
                                                 GstPad *ghostpad);

Removes a ghost pad from a pad. Private, will be removed from the API in 0.9.

`pad` : | a GstPad to remove the ghost pad from.
`ghostpad` : | the ghost GstPad to remove from the pad.

### gst_pad_get_ghost_pad_list ()

    GList*      gst_pad_get_ghost_pad_list      (GstPad *pad);

Gets the ghost pads of this pad.

`pad` : | a GstPad to get the ghost pads of.
Returns : | a GList of ghost pads.

### 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.

### 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 real sink GstPad.
`bufalloc` : | the GstPadBufferAllocFunction to set.

### gst_pad_alloc_buffer ()

    GstBuffer*  gst_pad_alloc_buffer            (GstPad *pad,
                                                 guint64 offset,
                                                 gint size);

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

`pad` : | a source GstPad
`offset` : | the offset of the new buffer in the stream
`size` : | the size of the new buffer
Returns : | a new, empty GstBuffer, or NULL if there is an error

### 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 GstData input buffer.

`pad` : | a real sink GstPad.
`chain` : | the GstPadChainFunction to set.

### gst_pad_set_get_function ()

    void        gst_pad_set_get_function        (GstPad *pad,
                                                 GstPadGetFunction get);

Sets the given get function for the pad. The get function is called to produce a new GstData to start the processing pipeline. Get functions cannot return `NULL`.

`pad` : | a real source GstPad.
`get` : | the GstPadGetFunction 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 real source GstPad.
`event` : | the GstPadEventFunction to set.

### gst_pad_set_event_mask_function ()

    void        gst_pad_set_event_mask_function (GstPad *pad,
                                                 GstPadEventMaskFunction mask_func);

Sets the given event mask function for the pad.

`pad` : | a real GstPad of either direction.
`mask_func` : | the GstPadEventMaskFunction to set.

### gst_pad_get_event_masks ()

    G_CONST_RETURN GstEventMask* gst_pad_get_event_masks
                                                (GstPad *pad);

Gets the array of eventmasks from the given pad.

`pad` : | a GstPad.
Returns : | a zero-terminated array of GstEventMask, or NULL if the pad does not have an event mask function.

### gst_pad_get_event_masks_default ()

    G_CONST_RETURN GstEventMask* gst_pad_get_event_masks_default
                                                (GstPad *pad);

Invokes the default event masks dispatcher on the pad.

`pad` : | a GstPad.
Returns : | a zero-terminated array of GstEventMask, or NULL if none of the internally-linked pads have an event mask function.

### 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 are guaranteed to be fixed. This means that you can assume that the caps is not ANY or EMPTY, and that there is exactly one structure in the caps, and that all the fields in the structure are fixed.

The return value GST_PAD_LINK_OK should be used when the caps are acceptable, and you've extracted all the necessary information from the caps and set the element's internal state appropriately.

The return value GST_PAD_LINK_REFUSED should be used when the caps are unacceptable for whatever reason.

The return value GST_PAD_LINK_DELAYED should be used when the element is in a state where it can't determine whether the caps are acceptable or not. This is often used if the element needs to open a device or process data before determining acceptable caps.

`link` must not call `gst_caps_try_set_caps()` on the pad that was specified as a parameter, although it may (and often should) call `gst_caps_try_set_caps()` on other pads.

`pad` : | a real 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.

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

### gst_pad_can_link_filtered ()

    gboolean    gst_pad_can_link_filtered       (GstPad *srcpad,
                                                 GstPad *sinkpad,
                                                 const GstCaps *filtercaps);

Checks if the source pad and the sink pad can be linked when constrained by the given filter caps. Both `srcpad` and `sinkpad` must be unlinked.

`srcpad` : | the source GstPad to link.
`sinkpad` : | the sink GstPad to link.
`filtercaps` : | the filter GstCaps.
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 real GstPad.
`unlink` : | the GstPadUnlinkFunction to set.

### gst_pad_link ()

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

Links the source pad to the sink pad.

`srcpad` : | the source GstPad to link.
`sinkpad` : | the sink GstPad to link.
Returns : | TRUE if the pad could be linked, FALSE otherwise.

### gst_pad_link_filtered ()

    gboolean    gst_pad_link_filtered           (GstPad *srcpad,
                                                 GstPad *sinkpad,
                                                 const GstCaps *filtercaps);

Links the source pad and the sink pad, constrained by the given filter caps.

`srcpad` : | the source GstPad to link.
`sinkpad` : | the sink GstPad to link.
`filtercaps` : | the filter GstCaps.
Returns : | TRUE if the pads have been linked, FALSE otherwise.

### gst_pad_unlink ()

    void        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.

### 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.

### gst_pad_get_peer ()

    GstPad*     gst_pad_get_peer                (GstPad *pad);

Gets the peer of `pad`.

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

### gst_pad_get_negotiated_caps ()

    G_CONST_RETURN GstCaps* gst_pad_get_negotiated_caps
                                                (GstPad *pad);

Gets the currently negotiated caps of a pad.

`pad` : | a GstPad to get the negotiated capabilites of
Returns : | the currently negotiated caps of a pad, or NULL if the pad isn't negotiated.

### gst_pad_is_negotiated ()

    gboolean    gst_pad_is_negotiated           (GstPad *pad);

`pad` : | a GstPad to get the negotiation status of
Returns : | TRUE if the pad has successfully negotiated caps.

### 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_free to get rid of it.

### 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_try_set_caps ()

    GstPadLinkReturn gst_pad_try_set_caps       (GstPad *pad,
                                                 const GstCaps *caps);

Try to set the caps on `pad`. `caps` must be fixed. If `pad` is unlinked, returns GST_PAD_LINK_OK without doing anything. Otherwise, start caps negotiation on `pad`.

`pad` : | a GstPad
`caps` : | GstCaps to set on `pad`
Returns : | The return value of `pad`'s link function (see `gst_pad_set_link_function()`), or GST_PAD_LINK_OK if there is no link function. The macros `GST_PAD_LINK_SUCCESSFUL()` and `GST_PAD_LINK_FAILED()` should be used when you just need success/failure information.

### gst_pad_try_set_caps_nonfixed ()

    GstPadLinkReturn gst_pad_try_set_caps_nonfixed
                                                (GstPad *pad,
                                                 const GstCaps *caps);

Like `gst_pad_try_set_caps()`, but allows non-fixed caps.

`pad` : | a real GstPad
`caps` : | GstCaps to set on `pad`
Returns : | a GstPadLinkReturn, like `gst_pad_try_set_caps()`.

### gst_pad_check_compatibility ()

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

Checks if two pads have compatible capabilities. If neither one has yet been negotiated, returns TRUE for no good reason.

`srcpad` : | the source GstPad to check.
`sinkpad` : | the sink GstPad to check against.
Returns : | TRUE if they are compatible or if the capabilities could not be checked, FALSE if the capabilities are not compatible.

### 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.

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. However, the returned caps should not depend on the stream type currently negotiated for `pad`.

Note that the return value from `getcaps` is owned by the caller.

`pad` : | a real GstPad.
`getcaps` : | the GstPadGetCapsFunction to set.

### gst_pad_set_fixate_function ()

    void        gst_pad_set_fixate_function     (GstPad *pad,
                                                 GstPadFixateFunction fixate);

Sets the given fixate function for the pad. Its job is to narrow down the possible caps for a connection. Fixate functions are called with a const caps, and should return a caps that is a strict subset of the given caps. That is, `fixate` should create a caps that is "more fixed" than previously, but it does not have to return fixed caps. If `fixate` can't provide more fixed caps, it should return `NULL`.

Note that `fixate` will only be called after the "fixate" signal is emitted, and only if the caps are still non-fixed.

`pad` : | a real GstPad.
`fixate` : | the GstPadFixateFunction 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_proxy_pad_link ()

    GstPadLinkReturn gst_pad_proxy_pad_link     (GstPad *pad,
                                                 const GstCaps *caps);

Calls `gst_pad_try_set_caps()` for every other pad belonging to the same element as `pad`. If `gst_pad_try_set_caps()` fails on any pad, the proxy link fails. May be used only during negotiation.

`pad` : | a GstPad to proxy from
`caps` : | the GstCaps to link with
Returns : | GST_PAD_LINK_OK if sucessful

### gst_pad_proxy_fixate ()

    GstCaps*    gst_pad_proxy_fixate            (GstPad *pad,
                                                 const GstCaps *caps);

Implements a default fixate function based on the caps set on the other pads in the element. This function should only be used if every pad has the same pad template caps.

`pad` : | a GstPad to proxy.
`caps` : | the GstCaps to fixate
Returns : | a fixated caps, or NULL if caps cannot be fixed

### gst_pad_proxy_link ()

    GstPadLinkReturn gst_pad_proxy_link         (GstPad *pad,
                                                 const GstCaps *caps);

Proxies the link function to the specified pad.

`pad` : | a GstPad to proxy to.
`caps` : | the GstCaps to use in proxying.
Returns : | TRUE if the peer pad accepted the caps, FALSE otherwise.

### gst_pad_set_explicit_caps ()

    gboolean    gst_pad_set_explicit_caps       (GstPad *pad,
                                                 const GstCaps *caps);

If a pad has been told to use explicit caps, this function is used to set the explicit caps. If `caps` is NULL, the explicit caps are unset.

This function calls `gst_pad_try_set_caps()` on the pad. If that call fails, `GST_ELEMENT_ERROR()` is called to indicate a negotiation failure.

`pad` : | a GstPad to set the explicit caps of
`caps` : | the GstCaps to set
Returns : | TRUE if the caps were set correctly, otherwise FALSE

### gst_pad_use_explicit_caps ()

    void        gst_pad_use_explicit_caps       (GstPad *pad);

This function handles negotiation for pads that need to be set to particular caps under complete control of the element, based on some state in the element. This is often the case with decoders and other elements whose caps is determined by the data stream.

WARNING: This function is a hack and will be replaced with something better in gstreamer-0.9.

`pad` : | a GstPad to set to use explicit caps

### gst_pad_relink_filtered ()

    gboolean    gst_pad_relink_filtered         (GstPad *srcpad,
                                                 GstPad *sinkpad,
                                                 const GstCaps *filtercaps);

Relinks the given source and sink pad, constrained by the given capabilities. If the relink fails, the pads are unlinked and FALSE is returned.

`srcpad` : | the source GstPad to relink.
`sinkpad` : | the sink GstPad to relink.
`filtercaps` : | the GstPad to use as a filter in the relink.
Returns : | TRUE if the pads were succesfully relinked, FALSE otherwise.

### gst_pad_perform_negotiate ()

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

Tries to negotiate the pads. See `gst_pad_renegotiate()` for a brief description of caps negotiation.

`srcpad` : | the source GstPad.
`sinkpad` : | the sink GstPad.
Returns : | TRUE if the pads were succesfully negotiated, FALSE otherwise.

### gst_pad_renegotiate ()

    GstPadLinkReturn gst_pad_renegotiate        (GstPad *pad);

Initiate caps negotiation on `pad`. `pad` must be linked.

If `pad`'s parent is not at least in GST_STATE_READY, returns GST_PAD_LINK_DELAYED.

Otherwise caps are retrieved from both `pad` and its peer by calling their getcaps functions. They are then intersected, returning GST_PAD_LINK_FAIL if there is no intersection.

The intersection is fixated if necessary, and then the link functions of `pad` and its peer are called.

`pad` : | a GstPad
Returns : | The return value of `pad`'s link function (see `gst_pad_set_link_function()`), or GST_PAD_LINK_OK if there is no link function. The macros `GST_PAD_LINK_SUCCESSFUL()` and `GST_PAD_LINK_FAILED()` should be used when you just need success/failure information.

### gst_pad_unnegotiate ()

    void        gst_pad_unnegotiate             (GstPad *pad);

"Unnegotiates" a pad. The currently negotiated caps are cleared and the pad needs renegotiation.

`pad` : | pad to unnegotiate

### gst_pad_try_relink_filtered ()

    gboolean    gst_pad_try_relink_filtered     (GstPad *srcpad,
                                                 GstPad *sinkpad,
                                                 const GstCaps *filtercaps);

Tries to relink the given source and sink pad, constrained by the given capabilities.

`srcpad` : | the source GstPad to relink.
`sinkpad` : | the sink GstPad to relink.
`filtercaps` : | the GstPad to use as a filter in the relink.
Returns : | TRUE if the pads were succesfully renegotiated, FALSE otherwise.

### gst_pad_get_allowed_caps ()

    GstCaps*    gst_pad_get_allowed_caps        (GstPad *pad);

Gets the capabilities of the allowed media types that can flow through `pad`. The caller must free the resulting caps.

`pad` : | a real GstPad.
Returns : | the allowed GstCaps of the pad link. Free the caps when you no longer need it.

### gst_pad_caps_change_notify ()

    void        gst_pad_caps_change_notify      (GstPad *pad);

Called to indicate that the return value of `pad`'s getcaps function may have changed, and that a renegotiation is suggested.

`pad` : | a GstPad

### gst_pad_recover_caps_error ()

    gboolean    gst_pad_recover_caps_error      (GstPad *pad,
                                                 const GstCaps *allowed);

Attempt to recover from a failed caps negotiation. This function is typically called by a plugin that exhausted its list of caps and wants the application to resolve the issue. The application should connect to the pad's caps_nego_failed signal and should resolve the issue by connecting another element for example.

`pad` : | a GstPad that had a failed capsnego
`allowed` : | possible caps for the link
Returns : | TRUE when the issue was resolved, dumps detailed information on the console and returns FALSE otherwise.

### gst_pad_push ()

    void        gst_pad_push                    (GstPad *pad,
                                                 GstData *data);

Pushes a buffer or an event to the peer of `pad`. `pad` must be linked. May only be called by `pad`'s parent.

`pad` : | a source GstPad.
`data` : | the GstData to push.

### gst_pad_pull ()

    GstData*    gst_pad_pull                    (GstPad *pad);

Pulls an event or a buffer from the peer pad. May only be called by `pad`'s parent.

`pad` : | a sink GstPad.
Returns : | a new GstData from the peer pad.

### gst_pad_send_event ()

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

Sends the event to the pad.

`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_select ()

    GstPad*     gst_pad_select                  (GstPad *pad,
                                                 ...);

Waits for a buffer on the given set of pads.

`pad` : | a first sink GstPad to perform the select on.
`...` : | A NULL-terminated list of more pads to select on.
Returns : | the GstPad that has a buffer available. Use #`gst_pad_pull()` to get the buffer.

### gst_pad_selectv ()

    GstPad*     gst_pad_selectv                 (GList *padlist);

Waits for a buffer on any of the list of pads. Each GstPad in `padlist` must be owned by the calling code.

`padlist` : | a GList of sink pads.
Returns : | the GstPad that has a buffer available. Use #`gst_pad_pull()` to get the buffer.

### gst_pad_select_valist ()

    GstPad*     gst_pad_select_valist           (GstPad *pad,
                                                 va_list varargs);

Waits for a buffer on the given set of pads.

`pad` : | a first GstPad to perform the select on.
`varargs` : | A va_list of more pads to select on.
Returns : | the GstPad that has a buffer available. Use #`gst_pad_pull()` to get the buffer.

### gst_pad_collect ()

    GstData*    gst_pad_collect                 (GstPad **selected,
                                                 GstPad *pad,
                                                 ...);

Waits for a buffer on the given set of pads.

`selected` : | set to the pad the buffer comes from if not NULL
`pad` : | first pad
`...` : | more sink pads.
Returns : | the GstData that was available.

### gst_pad_collectv ()

    GstData*    gst_pad_collectv                (GstPad **selected,
                                                 const GList *padlist);

Waits for a buffer on any of the list of pads. Each GstPad in `padlist` must belong to the same element and be owned by the caller.

`selected` : | set to the pad the buffer comes from if not NULL
`padlist` : | a GList of sink pads.
Returns : | the GstData that was available

### gst_pad_collect_valist ()

    GstData*    gst_pad_collect_valist          (GstPad **selected,
                                                 GstPad *pad,
                                                 va_list varargs);

Waits for a buffer on the given set of pads.

`selected` : | set to the pad the buffer comes from if not NULL
`pad` : | first pad
`varargs` : | more sink pads.
Returns : | the GstData that was available.

### gst_pad_set_formats_function ()

    void        gst_pad_set_formats_function    (GstPad *pad,
                                                 GstPadFormatsFunction formats);

Sets the given formats function for the pad.

`pad` : | a real GstPad of either direction.
`formats` : | the GstPadFormatsFunction to set.

### gst_pad_get_formats ()

    G_CONST_RETURN GstFormat* gst_pad_get_formats
                                                (GstPad *pad);

Gets the list of supported formats from the pad.

`pad` : | a GstPad to query
Returns : | An array of GstFormats ended with a 0 value.

### gst_pad_get_formats_default ()

    G_CONST_RETURN GstFormat* gst_pad_get_formats_default
                                                (GstPad *pad);

Invoke the default format dispatcher for the pad.

`pad` : | a GstPad to query
Returns : | An array of GstFormats ended with a 0 value.

### gst_pad_set_convert_function ()

    void        gst_pad_set_convert_function    (GstPad *pad,
                                                 GstPadConvertFunction convert);

Sets the given convert function for the pad.

`pad` : | a real GstPad of either direction.
`convert` : | the GstPadConvertFunction to set.

### gst_pad_convert ()

    gboolean    gst_pad_convert                 (GstPad *pad,
                                                 GstFormat src_format,
                                                 gint64 src_value,
                                                 GstFormat *dest_format,
                                                 gint64 *dest_value);

Invokes a conversion on the pad.

`pad` : | a GstPad to invoke the default converter on.
`src_format` : | the source GstFormat.
`src_value` : | the source value.
`dest_format` : | a pointer to the destination GstFormat.
`dest_value` : | a pointer to the destination value.
Returns : | TRUE if the conversion could be performed.

### gst_pad_convert_default ()

    gboolean    gst_pad_convert_default         (GstPad *pad,
                                                 GstFormat src_format,
                                                 gint64 src_value,
                                                 GstFormat *dest_format,
                                                 gint64 *dest_value);

Invokes the default converter on a pad. This will forward the call to the pad obtained using the internal link of the element.

`pad` : | a GstPad to invoke the default converter on.
`src_format` : | the source GstFormat.
`src_value` : | the source value.
`dest_format` : | a pointer to the destination GstFormat.
`dest_value` : | a pointer to the destination value.
Returns : | TRUE if the conversion could be performed.

### 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 real 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 real 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,
                                                 GstQueryType type,
                                                 GstFormat *format,
                                                 gint64 *value);

Queries a pad for one of the available properties. The format will be adjusted to the actual format used when specifying formats such as GST_FORMAT_DEFAULT. FIXME: Tell if the format can be adjusted when specifying a definite format.

`pad` : | a GstPad to invoke the default query on.
`type` : | the GstQueryType of the query to perform.
`format` : | a pointer to the GstFormat asked for. On return contains the GstFormat used.
`value` : | a pointer to the result.
Returns : | TRUE if the query could be performed.

### gst_pad_query_default ()

    gboolean    gst_pad_query_default           (GstPad *pad,
                                                 GstQueryType type,
                                                 GstFormat *format,
                                                 gint64 *value);

Invokes the default query function on a pad.

`pad` : | a GstPad to invoke the default query on.
`type` : | the GstQueryType of the query to perform.
`format` : | a pointer to the GstFormat of the result.
`value` : | a pointer to the result.
Returns : | TRUE if the query could be performed.

### 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 real 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.

### 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.

### 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.

## See Also

GstPadTemplate, GstElement, GstEvent