GstPad

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

Synopsis


#include <gst/gst.h>


            GstPad;
enum        GstPadDirection;
enum        GstPadFlags;
enum        GstPadLinkReturn;
#define     GST_PAD_LINK_FAILED             (ret)
#define     GST_PAD_LINK_SUCCESSFUL         (ret)
enum        GstFlowReturn;
enum        GstActivateMode;

#define     gst_pad_get_name                (pad)
GstPadDirection gst_pad_get_direction       (GstPad *pad);
#define     gst_pad_get_parent              (pad)
GstElement* gst_pad_get_parent_element      (GstPad *pad);
GstPadTemplate* gst_pad_get_pad_template    (GstPad *pad);
GstPadLinkReturn gst_pad_link               (GstPad *srcpad,
                                             GstPad *sinkpad);
gboolean    gst_pad_unlink                  (GstPad *srcpad,
                                             GstPad *sinkpad);
gboolean    gst_pad_is_linked               (GstPad *pad);
gboolean    gst_pad_can_link                (GstPad *srcpad,
                                             GstPad *sinkpad);
GstCaps*    gst_pad_get_caps                (GstPad *pad);
GstCaps*    gst_pad_get_allowed_caps        (GstPad *srcpad);
GstCaps*    gst_pad_get_negotiated_caps     (GstPad *pad);
const GstCaps* gst_pad_get_pad_template_caps
                                            (GstPad *pad);
gboolean    gst_pad_set_caps                (GstPad *pad,
                                             GstCaps *caps);
GstPad*     gst_pad_get_peer                (GstPad *pad);
GstCaps*    gst_pad_peer_get_caps           (GstPad *pad);
void        gst_pad_use_fixed_caps          (GstPad *pad);
gboolean    gst_pad_is_active               (GstPad *pad);
gboolean    gst_pad_set_blocked             (GstPad *pad,
                                             gboolean blocked);
gboolean    gst_pad_set_blocked_async       (GstPad *pad,
                                             gboolean blocked,
                                             GstPadBlockCallback callback,
                                             gpointer user_data);
void        (*GstPadBlockCallback)          (GstPad *pad,
                                             gboolean blocked,
                                             gpointer user_data);
gboolean    gst_pad_is_blocked              (GstPad *pad);
gulong      gst_pad_add_data_probe          (GstPad *pad,
                                             GCallback handler,
                                             gpointer data);
gulong      gst_pad_add_buffer_probe        (GstPad *pad,
                                             GCallback handler,
                                             gpointer data);
gulong      gst_pad_add_event_probe         (GstPad *pad,
                                             GCallback handler,
                                             gpointer data);
void        gst_pad_remove_data_probe       (GstPad *pad,
                                             guint handler_id);
void        gst_pad_remove_buffer_probe     (GstPad *pad,
                                             guint handler_id);
void        gst_pad_remove_event_probe      (GstPad *pad,
                                             guint handler_id);

GstPad*     gst_pad_new                     (const gchar *name,
                                             GstPadDirection direction);
GstPad*     gst_pad_new_from_template       (GstPadTemplate *templ,
                                             const gchar *name);
GstPad*     gst_pad_new_from_static_template
                                            (GstStaticPadTemplate *templ,
                                             const gchar *name);
GstFlowReturn gst_pad_alloc_buffer          (GstPad *pad,
                                             guint64 offset,
                                             gint size,
                                             GstCaps *caps,
                                             GstBuffer **buf);
GstFlowReturn gst_pad_alloc_buffer_and_set_caps
                                            (GstPad *pad,
                                             guint64 offset,
                                             gint size,
                                             GstCaps *caps,
                                             GstBuffer **buf);
void        gst_pad_set_bufferalloc_function
                                            (GstPad *pad,
                                             GstPadBufferAllocFunction bufalloc);
GstFlowReturn (*GstPadBufferAllocFunction)  (GstPad *pad,
                                             guint64 offset,
                                             guint size,
                                             GstCaps *caps,
                                             GstBuffer **buf);
void        gst_pad_set_chain_function      (GstPad *pad,
                                             GstPadChainFunction chain);
GstFlowReturn (*GstPadChainFunction)        (GstPad *pad,
                                             GstBuffer *buffer);
void        gst_pad_set_checkgetrange_function
                                            (GstPad *pad,
                                             GstPadCheckGetRangeFunction check);
gboolean    (*GstPadCheckGetRangeFunction)  (GstPad *pad);
GstFlowReturn gst_pad_get_range             (GstPad *pad,
                                             guint64 offset,
                                             guint size,
                                             GstBuffer **buffer);
void        gst_pad_set_getrange_function   (GstPad *pad,
                                             GstPadGetRangeFunction get);
GstFlowReturn (*GstPadGetRangeFunction)     (GstPad *pad,
                                             guint64 offset,
                                             guint length,
                                             GstBuffer **buffer);
void        gst_pad_set_event_function      (GstPad *pad,
                                             GstPadEventFunction event);
gboolean    (*GstPadEventFunction)          (GstPad *pad,
                                             GstEvent *event);
void        gst_pad_set_link_function       (GstPad *pad,
                                             GstPadLinkFunction link);
GstPadLinkReturn (*GstPadLinkFunction)      (GstPad *pad,
                                             GstPad *peer);
void        gst_pad_set_unlink_function     (GstPad *pad,
                                             GstPadUnlinkFunction unlink);
void        (*GstPadUnlinkFunction)         (GstPad *pad);
gboolean    gst_pad_accept_caps             (GstPad *pad,
                                             GstCaps *caps);
void        gst_pad_set_acceptcaps_function (GstPad *pad,
                                             GstPadAcceptCapsFunction acceptcaps);
gboolean    (*GstPadAcceptCapsFunction)     (GstPad *pad,
                                             GstCaps *caps);
void        gst_pad_set_getcaps_function    (GstPad *pad,
                                             GstPadGetCapsFunction getcaps);
GstCaps*    (*GstPadGetCapsFunction)        (GstPad *pad);
GstCaps*    gst_pad_proxy_getcaps           (GstPad *pad);
void        gst_pad_set_setcaps_function    (GstPad *pad,
                                             GstPadSetCapsFunction setcaps);
gboolean    (*GstPadSetCapsFunction)        (GstPad *pad,
                                             GstCaps *caps);
gboolean    gst_pad_proxy_setcaps           (GstPad *pad,
                                             GstCaps *caps);
void        gst_pad_fixate_caps             (GstPad *pad,
                                             GstCaps *caps);
void        gst_pad_set_fixatecaps_function (GstPad *pad,
                                             GstPadFixateCapsFunction fixatecaps);
void        (*GstPadFixateCapsFunction)     (GstPad *pad,
                                             GstCaps *caps);
GstCaps*    gst_pad_get_fixed_caps_func     (GstPad *pad);
gboolean    gst_pad_peer_accept_caps        (GstPad *pad,
                                             GstCaps *caps);
void        gst_pad_set_activate_function   (GstPad *pad,
                                             GstPadActivateFunction activate);
gboolean    (*GstPadActivateFunction)       (GstPad *pad);
void        gst_pad_set_activatepush_function
                                            (GstPad *pad,
                                             GstPadActivateModeFunction activatepush);
void        gst_pad_set_activatepull_function
                                            (GstPad *pad,
                                             GstPadActivateModeFunction activatepull);
gboolean    (*GstPadActivateModeFunction)   (GstPad *pad,
                                             gboolean active);
GstFlowReturn gst_pad_push                  (GstPad *pad,
                                             GstBuffer *buffer);
gboolean    gst_pad_push_event              (GstPad *pad,
                                             GstEvent *event);
gboolean    gst_pad_check_pull_range        (GstPad *pad);
GstFlowReturn gst_pad_pull_range            (GstPad *pad,
                                             guint64 offset,
                                             guint size,
                                             GstBuffer **buffer);
gboolean    gst_pad_activate_pull           (GstPad *pad,
                                             gboolean active);
gboolean    gst_pad_activate_push           (GstPad *pad,
                                             gboolean active);
gboolean    gst_pad_send_event              (GstPad *pad,
                                             GstEvent *event);
gboolean    gst_pad_event_default           (GstPad *pad,
                                             GstEvent *event);
gboolean    gst_pad_query                   (GstPad *pad,
                                             GstQuery *query);
gboolean    gst_pad_query_default           (GstPad *pad,
                                             GstQuery *query);
gboolean    gst_pad_query_position          (GstPad *pad,
                                             GstFormat *format,
                                             gint64 *cur);
gboolean    gst_pad_query_duration          (GstPad *pad,
                                             GstFormat *format,
                                             gint64 *duration);
gboolean    gst_pad_query_convert           (GstPad *pad,
                                             GstFormat src_format,
                                             gint64 src_val,
                                             GstFormat *dest_format,
                                             gint64 *dest_val);
void        gst_pad_set_query_function      (GstPad *pad,
                                             GstPadQueryFunction query);
gboolean    (*GstPadQueryFunction)          (GstPad *pad,
                                             GstQuery *query);
void        gst_pad_set_query_type_function (GstPad *pad,
                                             GstPadQueryTypeFunction type_func);
const GstQueryType* (*GstPadQueryTypeFunction)
                                            (GstPad *pad);
const GstQueryType* gst_pad_get_query_types (GstPad *pad);
const GstQueryType* gst_pad_get_query_types_default
                                            (GstPad *pad);
void        gst_pad_set_internal_link_function
                                            (GstPad *pad,
                                             GstPadIntLinkFunction intlink);
GList*      (*GstPadIntLinkFunction)        (GstPad *pad);
GList*      gst_pad_get_internal_links      (GstPad *pad);
GList*      gst_pad_get_internal_links_default
                                            (GstPad *pad);
void        gst_pad_load_and_link           (xmlNodePtr self,
                                             GstObject *parent);
gboolean    gst_pad_dispatcher              (GstPad *pad,
                                             GstPadDispatcherFunction dispatch,
                                             gpointer data);
gboolean    (*GstPadDispatcherFunction)     (GstPad *pad,
                                             gpointer data);
void        gst_pad_set_element_private     (GstPad *pad,
                                             gpointer priv);
gpointer    gst_pad_get_element_private     (GstPad *pad);

GstFlowReturn gst_pad_chain                 (GstPad *pad,
                                             GstBuffer *buffer);
gboolean    gst_pad_start_task              (GstPad *pad,
                                             GstTaskFunction func,
                                             gpointer data);
gboolean    gst_pad_pause_task              (GstPad *pad);
gboolean    gst_pad_stop_task               (GstPad *pad);
gboolean    gst_pad_set_active              (GstPad *pad,
                                             gboolean active);
#define     GST_PAD_GET_STREAM_LOCK         (pad)
#define     GST_PAD_STREAM_LOCK             (pad)
#define     GST_PAD_STREAM_LOCK_FULL        (pad,t)
#define     GST_PAD_STREAM_TRYLOCK          (pad)
#define     GST_PAD_STREAM_UNLOCK           (pad)
#define     GST_PAD_STREAM_UNLOCK_FULL      (pad)
#define     GST_FLOW_IS_FATAL               (ret)


Object Hierarchy


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

Properties


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

Signal Prototypes


"have-data" gboolean    user_function      (GstPad *pad,
                                            GstMiniObject mini_obj,
                                            gpointer user_data);
"linked"    void        user_function      (GstPad *pad,
                                            GstPad *peer,
                                            gpointer user_data);
"request-link"
            void        user_function      (GstPad *pad,
                                            gpointer user_data);
"unlinked"  void        user_function      (GstPad *pad,
                                            GstPad *peer,
                                            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_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_range() to push out or pull in a buffer.

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

Last reviewed on 2005-11-23 (0.9.5)

Details

GstPad

typedef struct {
  gpointer			element_private;

  GstPadTemplate		*padtemplate;

  GstPadDirection		 direction;

  /* 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;
  GstPadActivateModeFunction	 activatepushfunc;
  GstPadActivateModeFunction	 activatepullfunc;

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

  gpointer			 sched_private;

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

  GstActivateMode		 mode;

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

  /* internal links */
  GstPadIntLinkFunction		 intlinkfunc;

  GstPadBufferAllocFunction      bufferallocfunc;

  /* whether to emit signals for have-data. counts number
   * of handlers attached. */
  gint				 do_buffer_signals;
  gint				 do_event_signals;
} GstPad;

The GstPad structure. Use the functions to update the variables.

gpointer element_private; private data owned by the parent element
GstPadTemplate *padtemplate; padtemplate for this pad
GstPadDirection direction; the direction of the pad, cannot change after creating the pad.
GStaticRecMutex *stream_rec_lock; recursive stream lock of the pad, used to protect the data used in streaming.
GstTask *task; task for this pad if the pad is actively driving dataflow.
GMutex *preroll_lock; lock used when prerolling
GCond *preroll_cond; conf to signal preroll
GCond *block_cond; conditional to signal pad block
GstPadBlockCallback block_callback; callback for the pad block if any
gpointer block_data; user data for block_callback
GstCaps *caps; the current caps of the pad
GstPadGetCapsFunction getcapsfunc; function to get caps of the pad
GstPadSetCapsFunction setcapsfunc; function to set caps on the pad
GstPadAcceptCapsFunction acceptcapsfunc; function to check if pad can accept caps
GstPadFixateCapsFunction fixatecapsfunc; function to fixate caps
GstPadActivateFunction activatefunc; pad activation function
GstPadActivateModeFunction activatepushfunc; function to activate/deactivate pad in push mode
GstPadActivateModeFunction activatepullfunc; function to activate/deactivate pad in pull mode
GstPadLinkFunction linkfunc; function called when pad is linked
GstPadUnlinkFunction unlinkfunc; function called when pad is unlinked
GstPad *peer; the pad this pad is linked to
gpointer sched_private; private storage for the scheduler
GstPadChainFunction chainfunc; function to chain data to pad
GstPadCheckGetRangeFunction checkgetrangefunc; function to check if pad can operate in pull mode
GstPadGetRangeFunction getrangefunc; function to get a range of data from a pad
GstPadEventFunction eventfunc; function to send an event to a pad
GstActivateMode mode; current activation mode of the pad
GstPadQueryTypeFunction querytypefunc; get list of supported queries
GstPadQueryFunction queryfunc; perform a query on the pad
GstPadIntLinkFunction intlinkfunc; get the internal links of this pad
GstPadBufferAllocFunction bufferallocfunc; function to allocate a buffer for this pad
gint do_buffer_signals; counter counting installed buffer signals
gint do_event_signals; counter counting installed event signals

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_BLOCKED       = (GST_OBJECT_FLAG_LAST << 0),
  GST_PAD_FLUSHING      = (GST_OBJECT_FLAG_LAST << 1),
  GST_PAD_IN_GETCAPS    = (GST_OBJECT_FLAG_LAST << 2),
  GST_PAD_IN_SETCAPS    = (GST_OBJECT_FLAG_LAST << 3),
  /* padding */
  GST_PAD_FLAG_LAST     = (GST_OBJECT_FLAG_LAST << 8)
} GstPadFlags;

Pad state flags

GST_PAD_BLOCKED is dataflow on a pad blocked
GST_PAD_FLUSHING is pad refusing buffers
GST_PAD_IN_GETCAPS GstPadGetCapsFunction() is running now
GST_PAD_IN_SETCAPS GstPadSetCapsFunction() is running now
GST_PAD_FLAG_LAST offset to define more flags

enum GstPadLinkReturn

typedef enum {
  GST_PAD_LINK_OK               =  0,
  GST_PAD_LINK_WRONG_HIERARCHY  = -1,
  GST_PAD_LINK_WAS_LINKED       = -2,
  GST_PAD_LINK_WRONG_DIRECTION  = -3,
  GST_PAD_LINK_NOFORMAT         = -4,
  GST_PAD_LINK_NOSCHED          = -5,
  GST_PAD_LINK_REFUSED          = -6,
} GstPadLinkReturn;

Result values from gst_pad_link and friends.

GST_PAD_LINK_OK link succeeded
GST_PAD_LINK_WRONG_HIERARCHY pads have no common grandparent
GST_PAD_LINK_WAS_LINKED pad was already linked
GST_PAD_LINK_WRONG_DIRECTION pads have wrong direction
GST_PAD_LINK_NOFORMAT pads do not have common format
GST_PAD_LINK_NOSCHED pads cannot cooperate in scheduling
GST_PAD_LINK_REFUSED refused for some reason

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 link step.

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 successful link step.

ret : the GstPadLinkReturn value

enum GstFlowReturn

typedef enum {
  GST_FLOW_RESEND	  =  1,
  GST_FLOW_OK		  =  0,
  /* expected failures */
  GST_FLOW_NOT_LINKED     = -1,
  GST_FLOW_WRONG_STATE    = -2,
  /* error cases */
  GST_FLOW_UNEXPECTED     = -3,
  GST_FLOW_NOT_NEGOTIATED = -4,
  GST_FLOW_ERROR	  = -5,
  GST_FLOW_NOT_SUPPORTED  = -6
} GstFlowReturn;

The result of passing data to a linked pad.

GST_FLOW_RESEND Resend buffer, possibly with new caps.
GST_FLOW_OK Data passing was ok.
GST_FLOW_NOT_LINKED Pad is not linked.
GST_FLOW_WRONG_STATE Pad is in wrong state.
GST_FLOW_UNEXPECTED Did not expect anything, like after EOS.
GST_FLOW_NOT_NEGOTIATED Pad is not negotiated.
GST_FLOW_ERROR Some (fatal) error occured.
GST_FLOW_NOT_SUPPORTED This operation is not supported.

enum GstActivateMode

typedef enum {
  GST_ACTIVATE_NONE,
  GST_ACTIVATE_PUSH,
  GST_ACTIVATE_PULL,
} GstActivateMode;

The status of a GstPad. After activating a pad, which usually happens when the parent element goes from READY to PAUSED, the GstActivateMode defines if the pad operates in push or pull mode.

GST_ACTIVATE_NONE Pad will not handle dataflow
GST_ACTIVATE_PUSH Pad handles dataflow in downstream push mode
GST_ACTIVATE_PULL Pad handles dataflow in upstream pull mode

gst_pad_get_name()

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

Get a copy of the name of the pad. g_free() after usage.

MT safe.

pad : the pad to get the name from

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

#define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))

Get the parent of pad. This function increases the refcount of the parent object so you should gst_object_unref() it after usage. Can return NULL if the pad did not have a parent.

MT safe.

pad : the pad to get the parent of

gst_pad_get_parent_element ()

GstElement* gst_pad_get_parent_element      (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_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_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_get_caps ()

GstCaps*    gst_pad_get_caps                (GstPad *pad);

Gets the capabilities this pad can produce or consume. Note that this method doesn't necessarily returns the caps set by gst_pad_set_caps - use GST_PAD_CAPS for that instead. gst_pad_get_caps returns all possible caps a pad can operate with, using the pad's get_caps function; this returns the pad template caps if not explicitly set.

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

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 srcpad 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 srcpad has no peer. 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_pad_template_caps ()

const 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_caps ()

gboolean    gst_pad_set_caps                (GstPad *pad,
                                             GstCaps *caps);

Sets the capabilities of this pad. The caps must be fixed. Any previous caps on the pad will be unreffed. This function refs the caps so you should unref if as soon as you don't need it anymore. It is possible to set NULL caps, which will make the pad unnegotiated again.

pad : a GstPad to set the capabilities of.
caps : a GstCaps to set.
Returns : TRUE if the caps could be set. FALSE if the caps were not fixed or bad parameters were provided to this function. 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_peer_get_caps ()

GstCaps*    gst_pad_peer_get_caps           (GstPad *pad);

Gets the capabilities of the peer connected to this pad.

pad : a GstPad to get the peer capabilities of.
Returns : the GstCaps of the peer pad. This function returns a new caps, so use gst_caps_unref to get rid of it. this function returns NULL if there is no peer pad.

gst_pad_use_fixed_caps ()

void        gst_pad_use_fixed_caps          (GstPad *pad);

A helper function you can use that sets the gst_pad_get_fixed_caps_func as the getcaps function for the pad. This way the function will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.

Use this function on a pad that, once _set_caps() has been called on it, cannot be renegotiated to something else.

pad : the pad to use

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

gboolean    gst_pad_set_blocked             (GstPad *pad,
                                             gboolean blocked);

Blocks or unblocks the dataflow on a pad. This function is a shortcut for gst_pad_set_blocked_async() with a NULL callback.

pad : the GstPad to block or unblock
blocked : boolean indicating we should block or unblock
Returns : TRUE if the pad could be blocked. This function can fail wrong parameters were passed or the pad was already in the requested state. MT safe.

gst_pad_set_blocked_async ()

gboolean    gst_pad_set_blocked_async       (GstPad *pad,
                                             gboolean blocked,
                                             GstPadBlockCallback callback,
                                             gpointer user_data);

Blocks or unblocks the dataflow on a pad. The provided callback is called when the operation succeeds; this happens right before the next attempt at pushing a buffer on the pad.

This can take a while as the pad can only become blocked when real dataflow is happening. When the pipeline is stalled, for example in PAUSED, this can take an indeterminate amount of time. You can pass NULL as the callback to make this call block. Be careful with this blocking call as it might not return for reasons stated above.

pad : the GstPad to block or unblock
blocked : boolean indicating whether the pad should be blocked or unblocked
callback : GstPadBlockCallback that will be called when the operation succeeds
user_data : user data passed to the callback
Returns : TRUE if the pad could be blocked. This function can fail if wrong parameters were passed or the pad was already in the requested state. MT safe.

GstPadBlockCallback ()

void        (*GstPadBlockCallback)          (GstPad *pad,
                                             gboolean blocked,
                                             gpointer user_data);

Callback used by gst_pad_set_blocked_async(). Gets called when the blocking operation succeeds.

pad : the GstPad that is blockend or unblocked.
blocked : blocking state for the pad
user_data : the gpointer to optional user data.

gst_pad_is_blocked ()

gboolean    gst_pad_is_blocked              (GstPad *pad);

Checks if the pad is blocked or not. This function returns the last requested state of the pad. It is not certain that the pad is actually blocked at this point.

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

gst_pad_add_data_probe ()

gulong      gst_pad_add_data_probe          (GstPad *pad,
                                             GCallback handler,
                                             gpointer data);

Adds a "data probe" to a pad. This function will be called whenever data passes through a pad. In this case data means both events and buffers. The probe will be called with the data as an argument. Note that the data will have a reference count greater than 1, so it will be immutable -- you must not change it.

For source pads, the probe will be called after the blocking function, if any (see gst_pad_set_blocked_async()), but before looking up the peer to chain to. For sink pads, the probe function will be called before configuring the sink with new caps, if any, and before calling the pad's chain function.

Your data probe should return TRUE to let the data continue to flow, or FALSE to drop it. Dropping data is rarely useful, but occasionally comes in handy with events.

Although probes are implemented internally by connecting handler to the have-data signal on the pad, if you want to remove a probe it is insufficient to only call g_signal_handler_disconnect on the returned handler id. To remove a probe, use the appropriate function, such as gst_pad_remove_data_probe().

pad : pad to add the data probe handler to
handler : function to call when data is passed over pad
data : data to pass along with the handler
Returns : The handler id.

gst_pad_add_buffer_probe ()

gulong      gst_pad_add_buffer_probe        (GstPad *pad,
                                             GCallback handler,
                                             gpointer data);

Adds a probe that will be called for all buffers passing through a pad. See gst_pad_add_data_probe() for more information.

pad : pad to add the buffer probe handler to
handler : function to call when data is passed over pad
data : data to pass along with the handler
Returns : The handler id

gst_pad_add_event_probe ()

gulong      gst_pad_add_event_probe         (GstPad *pad,
                                             GCallback handler,
                                             gpointer data);

Adds a probe that will be called for all events passing through a pad. See gst_pad_add_data_probe() for more information.

pad : pad to add the event probe handler to
handler : function to call when data is passed over pad
data : data to pass along with the handler
Returns : The handler id

gst_pad_remove_data_probe ()

void        gst_pad_remove_data_probe       (GstPad *pad,
                                             guint handler_id);

Removes a data probe from pad.

pad : pad to remove the data probe handler from
handler_id : handler id returned from gst_pad_add_data_probe

gst_pad_remove_buffer_probe ()

void        gst_pad_remove_buffer_probe     (GstPad *pad,
                                             guint handler_id);

Removes a buffer probe from pad.

pad : pad to remove the buffer probe handler from
handler_id : handler id returned from gst_pad_add_buffer_probe

gst_pad_remove_event_probe ()

void        gst_pad_remove_event_probe      (GstPad *pad,
                                             guint handler_id);

Removes an event probe from pad.

pad : pad to remove the event probe handler from
handler_id : handler id returned from gst_pad_add_event_probe

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

GstPad*     gst_pad_new_from_static_template
                                            (GstStaticPadTemplate *templ,
                                             const gchar *name);

Creates a new pad with the given name from the given static 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 GstStaticPadTemplate to use
name : the name of the element
Returns : a new GstPad, or NULL in case of an error.

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

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

In addition to the function gst_pad_alloc_buffer(), this function automatically calls gst_pad_set_caps() when the caps of the newly allocated buffer are different from the pad caps.

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

GstPadBufferAllocFunction ()

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

Ask the sinkpad pad to allocate a buffer with offset, size and caps. The result will be stored in buf.

The purpose of this function is to allocate a buffer that is optimal to be processed by pad. The function is mostly overridden by elements that can provide a hardware buffer in order to avoid additional memcpy operations.

The function can return a buffer that does not have caps, in which case the upstream element requests a format change.

When this function returns anything else than GST_FLOW_OK, the buffer allocation failed and buf does not contain valid data.

By default this function returns a new buffer of size and with caps containing purely malloced data.

pad : a sink GstPad
offset : the desired offset of the buffer
size : the desired size of the buffer
caps : the desired caps of the buffer
buf : pointer to hold the allocated buffer.
Returns : GST_FLOW_OK if buf contains a valid buffer, any other return value means buf does not hold a valid buffer.

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.

GstPadChainFunction ()

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

A function that will be called on sinkpads when chaining buffers.

pad : the GstPad that performed the chain.
buffer : the GstBuffer that is chained.
Returns : GST_FLOW_OK for success

gst_pad_set_checkgetrange_function ()

void        gst_pad_set_checkgetrange_function
                                            (GstPad *pad,
                                             GstPadCheckGetRangeFunction check);

Sets the given checkgetrange function for the pad. Implement this function on a pad if you dynamically support getrange based scheduling on the pad.

pad : a source GstPad.
check : the GstPadCheckGetRangeFunction to set.

GstPadCheckGetRangeFunction ()

gboolean    (*GstPadCheckGetRangeFunction)  (GstPad *pad);

Check if pad can be activated in pull mode.

This function will be deprecated after 0.10; use the seeking query to check if a pad can support random access.

pad : a GstPad
Returns : TRUE if the pad can operate in pull mode.

gst_pad_get_range ()

GstFlowReturn gst_pad_get_range             (GstPad *pad,
                                             guint64 offset,
                                             guint size,
                                             GstBuffer **buffer);

Calls the getrange function of pad.

pad : a src GstPad.
offset : The start offset of the buffer
size : The length of the buffer
buffer : a pointer to hold the GstBuffer.
Returns : a GstFlowReturn from the pad. MT safe.

gst_pad_set_getrange_function ()

void        gst_pad_set_getrange_function   (GstPad *pad,
                                             GstPadGetRangeFunction get);

Sets the given getrange function for the pad. The getrange function is called to produce a new GstBuffer to start the processing pipeline. Getrange functions cannot return NULL.

pad : a source GstPad.
get : the GstPadGetRangeFunction to set.

GstPadGetRangeFunction ()

GstFlowReturn (*GstPadGetRangeFunction)     (GstPad *pad,
                                             guint64 offset,
                                             guint length,
                                             GstBuffer **buffer);

This function will be called on sourcepads when a peer element request a buffer at the specified offset and length. If this function returns GST_FLOW_OK, the result buffer will be stored in buffer. The contents of buffer is invalid for any other return value.

pad : the GstPad to perform the getrange on.
offset : the offset of the range
length : the length of the range
buffer : a memory location to hold the result buffer
Returns : GST_FLOW_OK for success

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.

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.

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 with another pad.

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.

If link is installed on a source pad, it should call the GstPadLinkFunction of the peer sink pad, if present.

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

GstPadLinkFunction ()

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

Function signature to handle a new link on the pad.

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

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.

GstPadUnlinkFunction ()

void        (*GstPadUnlinkFunction)         (GstPad *pad);

Function signature to handle a unlinking the pad prom its peer.

pad : the GstPad that is linked.

gst_pad_accept_caps ()

gboolean    gst_pad_accept_caps             (GstPad *pad,
                                             GstCaps *caps);

Check if the given pad accepts the caps.

pad : a GstPad to check
caps : a GstCaps to check on the pad
Returns : TRUE if the pad can accept the caps.

gst_pad_set_acceptcaps_function ()

void        gst_pad_set_acceptcaps_function (GstPad *pad,
                                             GstPadAcceptCapsFunction acceptcaps);

Sets the given acceptcaps function for the pad. The acceptcaps function will be called to check if the pad can accept the given caps.

pad : a GstPad.
acceptcaps : the GstPadAcceptCapsFunction to set.

GstPadAcceptCapsFunction ()

gboolean    (*GstPadAcceptCapsFunction)     (GstPad *pad,
                                             GstCaps *caps);

Check if pad can accept caps. By default this function will see if caps intersect with the result from gst_pad_get_caps() by can be overridden to perform extra checks.

pad : the GstPad to check
caps : the GstCaps to check
Returns : TRUE if the caps can be accepted by the pad.

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.

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 by elements.

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

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_set_setcaps_function ()</