GstPad

GstPad — The link between Elements

Synopsis


#include <gst/gst.h>


#define     GST_PAD_NAME                    (pad)
#define     GST_PAD_ELEMENT_PRIVATE         (pad)
#define     GST_PAD_PARENT                  (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_CAN_PULL                (pad)
#define     GST_PAD_IS_SINK                 (pad)
#define     GST_PAD_IS_SRC                  (pad)
#define     GST_PAD_IS_LINKED               (pad)
#define     GST_PAD_IS_ACTIVE               (pad)
#define     GST_PAD_IS_USABLE               (pad)
struct      GstPad;
void        (*GstPadChainFunction)          (GstPad *pad,
                                             GstData *data);
GstData*    (*GstPadGetFunction)            (GstPad *pad);
GstCaps*    (*GstPadGetCapsFunction)        (GstPad *pad);
gboolean    (*GstPadEventFunction)          (GstPad *pad,
                                             GstEvent *event);
GstPadLinkReturn (*GstPadLinkFunction)      (GstPad *pad,
                                             const GstCaps *caps);
enum        GstPadLinkReturn;
gboolean    (*GstPadConvertFunction)        (GstPad *pad,
                                             GstFormat src_format,
                                             gint64 src_value,
                                             GstFormat *dest_format,
                                             gint64 *dest_value);
gboolean    (*GstPadDispatcherFunction)     (GstPad *pad,
                                             gpointer data);
GList*      (*GstPadIntLinkFunction)        (GstPad *pad);
gboolean    (*GstPadQueryFunction)          (GstPad *pad,
                                             GstQueryType type,
                                             GstFormat *format,
                                             gint64 *value);
const GstEventMask* (*GstPadEventMaskFunction)
                                            (GstPad *pad);
const GstFormat* (*GstPadFormatsFunction)   (GstPad *pad);
const GstQueryType* (*GstPadQueryTypeFunction)
                                            (GstPad *pad);
#define     GST_PAD_QUERY_TYPE_FUNCTION     (functionname, ...)
#define     GST_PAD_FORMATS_FUNCTION        (functionname, ...)
#define     GST_PAD_EVENT_MASK_FUNCTION     (functionname, ...)
enum        GstPadDirection;
enum        GstPadFlags;
GstPad*     gst_pad_new                     (const gchar *name,
                                             GstPadDirection direction);
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);
GstPad*     gst_pad_new_from_template       (GstPadTemplate *templ,
                                             const gchar *name);
GstPadDirection gst_pad_get_direction       (GstPad *pad);
void        gst_pad_set_chain_function      (GstPad *pad,
                                             GstPadChainFunction chain);
void        gst_pad_set_get_function        (GstPad *pad,
                                             GstPadGetFunction get);
void        gst_pad_set_link_function       (GstPad *pad,
                                             GstPadLinkFunction link);
void        gst_pad_set_getcaps_function    (GstPad *pad,
                                             GstPadGetCapsFunction getcaps);
GstPadLinkReturn gst_pad_try_set_caps       (GstPad *pad,
                                             const GstCaps *caps);
GstCaps*    gst_pad_get_caps                (GstPad *pad);
gboolean    gst_pad_check_compatibility     (GstPad *srcpad,
                                             GstPad *sinkpad);
void        gst_pad_set_name                (GstPad *pad,
                                             const gchar *name);
G_CONST_RETURN gchar* gst_pad_get_name      (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);
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);
GstPad*     gst_pad_get_peer                (GstPad *pad);
gboolean    gst_pad_link                    (GstPad *srcpad,
                                             GstPad *sinkpad);
gboolean    gst_pad_link_filtered           (GstPad *srcpad,
                                             GstPad *sinkpad,
                                             const GstCaps *filtercaps);
gboolean    gst_pad_relink_filtered         (GstPad *srcpad,
                                             GstPad *sinkpad,
                                             const GstCaps *filtercaps);
gboolean    gst_pad_try_relink_filtered     (GstPad *srcpad,
                                             GstPad *sinkpad,
                                             const GstCaps *filtercaps);
void        gst_pad_unlink                  (GstPad *srcpad,
                                             GstPad *sinkpad);
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_push                    (GstPad *pad,
                                             GstData *data);
GstData*    gst_pad_pull                    (GstPad *pad);
void        gst_pad_load_and_link           (xmlNodePtr self,
                                             GstObject *parent);
GstPadLinkReturn gst_pad_proxy_link         (GstPad *pad,
                                             const GstCaps *caps);
GstPadTemplate* gst_pad_get_pad_template    (GstPad *pad);
G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps
                                            (GstPad *pad);
GstCaps*    gst_pad_get_allowed_caps        (GstPad *pad);
gboolean    gst_pad_perform_negotiate       (GstPad *srcpad,
                                             GstPad *sinkpad);
xmlNodePtr  gst_ghost_pad_save_thyself      (GstPad *pad,
                                             xmlNodePtr parent);
GstPad*     gst_pad_select                  (GstPad *pad,
                                             ...);
GstPad*     gst_pad_selectv                 (GList *padlist);
gboolean    gst_pad_dispatcher              (GstPad *pad,
                                             GstPadDispatcherFunction dispatch,
                                             gpointer data);
gboolean    gst_pad_send_event              (GstPad *pad,
                                             GstEvent *event);
gboolean    gst_pad_event_default           (GstPad *pad,
                                             GstEvent *event);
void        gst_pad_set_event_function      (GstPad *pad,
                                             GstPadEventFunction event);
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_event_mask_function (GstPad *pad,
                                             GstPadEventMaskFunction mask_func);
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);
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_formats_function    (GstPad *pad,
                                             GstPadFormatsFunction formats);
GList*      gst_pad_get_internal_links      (GstPad *pad);
GList*      gst_pad_get_internal_links_default
                                            (GstPad *pad);
void        gst_pad_set_internal_link_function
                                            (GstPad *pad,
                                             GstPadIntLinkFunction intlink);
void        gst_pad_set_query_function      (GstPad *pad,
                                             GstPadQueryFunction query);
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);
G_CONST_RETURN GstQueryType* gst_pad_get_query_types
                                            (GstPad *pad);
G_CONST_RETURN GstQueryType* gst_pad_get_query_types_default
                                            (GstPad *pad);
void        gst_pad_set_query_type_function (GstPad *pad,
                                             GstPadQueryTypeFunction type_func);
#define     gst_pad_add_probe               (pad, probe)
#define     gst_pad_remove_probe            (pad, probe)
gboolean    gst_pad_is_active               (GstPad *pad);
void        gst_pad_set_active              (GstPad *pad,
                                             gboolean active);
GstScheduler* gst_pad_get_scheduler         (GstPad *pad);
struct      GstRealPad;
#define     GST_RPAD_DIRECTION              (pad)
#define     GST_RPAD_CAPS                   (pad)
#define     GST_RPAD_PEER                   (pad)
#define     GST_RPAD_CHAINFUNC              (pad)
#define     GST_RPAD_APPFILTER              (pad)
#define     GST_RPAD_GETFUNC                (pad)
#define     GST_RPAD_CHAINHANDLER           (pad)
#define     GST_RPAD_EVENTFUNC              (pad)
#define     GST_RPAD_EVENTHANDLER           (pad)
#define     GST_RPAD_GETHANDLER             (pad)
#define     GST_RPAD_LINKFUNC               (pad)
#define     GST_RPAD_GETCAPSFUNC            (pad)
#define     GST_RPAD_CONVERTFUNC            (pad)
#define     GST_RPAD_INTLINKFUNC            (pad)
#define     GST_RPAD_QUERYFUNC              (pad)
#define     GST_RPAD_EVENTMASKFUNC          (pad)
#define     GST_RPAD_FORMATSFUNC            (pad)
#define     GST_RPAD_QUERYTYPEFUNC          (pad)
#define     GST_GPAD_REALPAD                (pad)
struct      GstGhostPad;
GstPad*     gst_ghost_pad_new               (const gchar *name,
                                             GstPad *pad);

Object Hierarchy


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

  GObject
   +----GstObject
         +----GstPad
               +----GstRealPad

  GObject
   +----GstObject
         +----GstPad
               +----GstGhostPad

Properties


  "real-pad"             GstPad               : Read / Write

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

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_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_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_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_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_SINK()

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

Checks if the pad is a sink pad.

pad :a GstPad to check.

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

struct GstPad

struct GstPad;

The GstPad object


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.

GstPadGetCapsFunction ()

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

Returns 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 :the GstCaps of the pad.

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.

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.

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_REFUSEDthe link was refused.
GST_PAD_LINK_DELAYEDthe 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.

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.

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.

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.

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.

GstPadEventMaskFunction ()

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

The signature of the eventmask function.

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

GstPadFormatsFunction ()

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

The signature of the formats function.

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

GstPadQueryTypeFunction ()

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

The signature of the query types function.

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

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

enum GstPadDirection

typedef enum {
  GST_PAD_UNKNOWN,
  GST_PAD_SRC,
  GST_PAD_SINK
} GstPadDirection;

The direction of a pad.

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

enum GstPadFlags

typedef enum {
  GST_PAD_DISABLED		= GST_OBJECT_FLAG_LAST,
  GST_PAD_NEGOTIATING,

  GST_PAD_FLAG_LAST		= GST_OBJECT_FLAG_LAST + 4
} GstPadFlags;

Flags for the pad.

GST_PAD_DISABLEDthe pad is disabled.
GST_PAD_NEGOTIATING
GST_PAD_FLAG_LASTsubclasses can use this number to enumerate their flags.

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

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_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_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_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_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_ghost_pad_save_thyself ()

xmlNodePtr  gst_ghost_pad_save_thyself      (GstPad *pad,
                                             xmlNodePtr parent);

Saves the ghost pad into an xml representation.

pad : a ghost GstPad to save.
parent : the parent xmlNodePtr to save the description in.
Returns : the xmlNodePtr representation of the pad.

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

struct GstRealPad

struct GstRealPad;

The realpad object


GST_RPAD_DIRECTION()

#define GST_RPAD_DIRECTION(pad)		(((GstRealPad *)(pad))->direction)

Get the direction of the real pad.

pad :the realpad to query.

GST_RPAD_CAPS()

#define GST_RPAD_CAPS(pad)		(((GstRealPad *)(pad))->caps)

Get the caps of the real pad.

pad :the real pad to query.

GST_RPAD_PEER()

#define GST_RPAD_PEER(pad)		(((GstRealPad *)(pad))->peer)

Get the peer element of the real pad.

pad :the real pad to query.

GST_RPAD_CHAINFUNC()

#define GST_RPAD_CHAINFUNC(pad)		(((GstRealPad *)(pad))->chainfunc)

Get the chain function of the real pad.

pad :the real pad to query.

GST_RPAD_APPFILTER()

#define GST_RPAD_APPFILTER(pad)		(((GstRealPad *)(pad))->appfilter)

Get the application filter for this pad

pad :the pad to query

GST_RPAD_GETFUNC()

#define GST_RPAD_GETFUNC(pad)		(((GstRealPad *)(pad))->getfunc)

Get get getfunction of the real pad.

pad :the real pad to query.

GST_RPAD_CHAINHANDLER()

#define GST_RPAD_CHAINHANDLER(pad)	(((GstRealPad *)(pad))->chainhandler)

Get the eventhandler function from the real pad.

pad :the real pad to query.

GST_RPAD_EVENTFUNC()

#define GST_RPAD_EVENTFUNC(pad)		(((GstRealPad *)(pad))->eventfunc)

Get the event function of this real pad.

pad :the real pad to query.

GST_RPAD_EVENTHANDLER()

#define GST_RPAD_EVENTHANDLER(pad)	(((GstRealPad *)(pad))->eventhandler)

Get the eventhandler function of this real pad.

pad :the real pad to query.

GST_RPAD_GETHANDLER()

#define GST_RPAD_GETHANDLER(pad)	(((GstRealPad *)(pad))->gethandler)

Get the gethandler function of this real pad.

pad :the real pad to query.

GST_RPAD_LINKFUNC()

#define GST_RPAD_LINKFUNC(pad)		(((GstRealPad *)(pad))->linkfunc)

Get the link function of the pad

pad :the pad to query

GST_RPAD_GETCAPSFUNC()

#define GST_RPAD_GETCAPSFUNC(pad)	(((GstRealPad *)(pad))->getcapsfunc)

Get the getcaps function of this pad

pad :the pad to query

GST_RPAD_CONVERTFUNC()

#define GST_RPAD_CONVERTFUNC(pad)	(((GstRealPad *)(pad))->convertfunc)

Get the convert function of this pad

pad :the pad to query

GST_RPAD_INTLINKFUNC()

#define GST_RPAD_INTLINKFUNC(pad)	(((GstRealPad *)(pad))->intlinkfunc)

Get the internal link function of this pad

pad :the pad to query

GST_RPAD_QUERYFUNC()

#define GST_RPAD_QUERYFUNC(pad)		(((GstRealPad *)(pad))->queryfunc)

Get the query function of this pad

pad :the pad to query

GST_RPAD_EVENTMASKFUNC()

#define GST_RPAD_EVENTMASKFUNC(pad)	(((GstRealPad *)(pad))->eventmaskfunc)

Get the event mask function of this pad

pad :the pad to query

GST_RPAD_FORMATSFUNC()

#define GST_RPAD_FORMATSFUNC(pad)	(((GstRealPad *)(pad))->formatsfunc)

Get the formats function of this pad

pad :the pad to query

GST_RPAD_QUERYTYPEFUNC()

#define GST_RPAD_QUERYTYPEFUNC(pad)	(((GstRealPad *)(pad))->querytypefunc)

Get the query types function of this pad

pad :the pad to query

GST_GPAD_REALPAD()

#define GST_GPAD_REALPAD(pad)		(((GstGhostPad *)(pad))->realpad)

Get the real pad of this ghost pad.

pad :the real pad to query.

struct GstGhostPad

struct GstGhostPad;

The Ghostpad object


gst_ghost_pad_new ()

GstPad*     gst_ghost_pad_new               (const gchar *name,
                                             GstPad *pad);

Creates a new ghost pad associated with pad, and named name. If name is NULL, a guaranteed unique name (across all ghost pads) will be assigned.

name : the name of the new ghost pad.
pad : the GstPad to create a ghost pad for.
Returns : a new ghost GstPad, or NULL in case of an error.

Properties

"real-pad" (GstPad : Read / Write)

The real pad for the ghost pad.

See Also

GstPadTemplate, GstElement, GstEvent