Description
A GstElement is connected to other elements via "pads", which are extremely
light-weight generic connections points.
After two pads are retrieved from an element with gst_element_get_pad(),
the pads can be connected with gst_pad_connect(). (For quick connections,
you can also use gst_element_connect(), which will make the obvious
connection 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.
The gst_pad_pullregion() function can be used to request for a buffer
with a specific offset (in time or in bytes).
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 September 1st, 2002 (0.4.0.1)
Details
GST_PAD_NAME()
#define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad)) |
Gets the name of the pad.
GST_PAD_ELEMENT_PRIVATE()
#define GST_PAD_ELEMENT_PRIVATE(pad) (((GstPad *)(pad))->element_private) |
Gets the private data set by the element that owns the pad.
GST_PAD_PARENT()
#define GST_PAD_PARENT(pad) ((GstElement *)(GST_OBJECT_PARENT(pad))) |
Gets the parent element 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.
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.
GST_PAD_DIRECTION()
#define GST_PAD_DIRECTION(pad) GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad)) |
Gets the pad's direction.
GST_PAD_CAPS()
#define GST_PAD_CAPS(pad) GST_RPAD_CAPS(GST_PAD_REALIZE(pad)) |
Gets the capabilities of a pad.
GST_PAD_PEER()
#define GST_PAD_PEER(pad) GST_PAD_CAST(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 connected through this pad.
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.
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.
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.
GST_PAD_IS_CONNECTED()
#define GST_PAD_IS_CONNECTED(pad) (GST_PAD_PEER(pad) != NULL) |
Checks if the pad is connected.
GstPadChainFunction ()
A function that will be called when chaining buffers.
GstPadGetFunction ()
A function that will be called when pulling a buffer.
GstPadBufferPoolFunction ()
A function that will be called when a buffer pool is requested
from this pad.
GstPadGetCapsFunction ()
Returns the capabilities of the specified pad. By default this function
will return the pad template capabilities, but can optionally be overridden.
GstPadEventFunction ()
Function signature to handle an event for the pad.
GstPadConnectFunction ()
Function signature to handle a new connection on the pad.
enum GstPadConnectReturn
typedef enum {
GST_PAD_CONNECT_REFUSED = -1,
GST_PAD_CONNECT_DELAYED = 0,
GST_PAD_CONNECT_OK = 1,
GST_PAD_CONNECT_DONE = 2
} GstPadConnectReturn; |
The result of a pad connection.
GstPadConvertFunction ()
gboolean (*GstPadConvertFunction) (GstPad *pad,
GstFormat src_format,
gint64 src_value,
GstFormat *dest_format,
gint64 *dest_value); |
The signature of a convert function.
GstPadDispatcherFunction ()
gboolean (*GstPadDispatcherFunction) (GstPad *pad,
gpointer data); |
A dispatcher function is called for all internally connected pads, see
gst_pad_dispatcher().
GstPadIntConnFunction ()
GList* (*GstPadIntConnFunction) (GstPad *pad); |
The signature of the internal pad connection function.
enum GstPadQueryType
typedef enum {
GST_PAD_QUERY_NONE = 0,
GST_PAD_QUERY_TOTAL,
GST_PAD_QUERY_POSITION,
GST_PAD_QUERY_LATENCY,
GST_PAD_QUERY_JITTER,
GST_PAD_QUERY_START,
GST_PAD_QUERY_SEGMENT_END,
GST_PAD_QUERY_RATE
} GstPadQueryType; |
The different supported query types.
GstPadQueryFunction ()
The signature of the query function.
enum GstPadDirection
typedef enum {
GST_PAD_UNKNOWN,
GST_PAD_SRC,
GST_PAD_SINK
} GstPadDirection; |
The direction of a pad.
enum GstPadFlags
typedef enum {
GST_PAD_DISABLED = GST_OBJECT_FLAG_LAST,
GST_PAD_EOS,
GST_PAD_FLAG_LAST = GST_OBJECT_FLAG_LAST + 4
} GstPadFlags; |
Flags for the pad.
gst_pad_new ()
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.
gst_pad_custom_new ()
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.
gst_pad_custom_new_from_template ()
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.
gst_pad_destroy()
#define gst_pad_destroy(pad) gst_object_destroy (GST_OBJECT (pad)) |
Destroy the pad.
gst_pad_new_from_template ()
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.
gst_pad_get_direction ()
Gets the direction of the pad.
gst_pad_set_chain_function ()
Sets the given chain function for the pad.
gst_pad_set_get_function ()
Sets the given get function for the pad.
gst_pad_set_bufferpool_function ()
Sets the given bufferpool function for the pad.
gst_pad_set_connect_function ()
Sets the given connect function for the pad. It will be called
when the pad is connected or reconnected with caps.
gst_pad_set_getcaps_function ()
Sets the given getcaps function for the pad.
gst_pad_try_set_caps ()
Tries to set the caps on the given pad.
gst_pad_get_caps ()
Gets the capabilities of this pad.
gst_pad_check_compatibility ()
gboolean gst_pad_check_compatibility (GstPad *srcpad,
GstPad *sinkpad); |
Checks if two pads have compatible capabilities.
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.
gst_pad_get_name ()
const gchar* gst_pad_get_name (GstPad *pad); |
Gets the name of a pad.
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.
gst_pad_get_element_private ()
gpointer gst_pad_get_element_private (GstPad *pad); |
Gets the private data of a pad.
gst_pad_set_parent ()
Sets the parent object of a pad.
gst_pad_get_parent ()
Gets the parent object of this pad.
gst_pad_get_scheduler ()
Gets the scheduler of the pad.
gst_pad_get_real_parent ()
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().
gst_pad_add_ghost_pad ()
Adds a ghost pad to a pad.
gst_pad_remove_ghost_pad ()
void gst_pad_remove_ghost_pad (GstPad *pad,
GstPad *ghostpad); |
Removes a ghost pad from a pad.
gst_pad_get_ghost_pad_list ()
GList* gst_pad_get_ghost_pad_list (GstPad *pad); |
Gets the ghost pads of this pad.
gst_pad_get_peer ()
Gets the peer pad of this pad.
gst_pad_connect ()
Connects the source pad to the sink pad.
gst_pad_connect_filtered ()
Connects the source pad and the sink pad can be connected, constrained
by the given filter caps.
gst_pad_reconnect_filtered ()
Reconnects the given source and sink pad, constrained by the given
capabilities. If the reconnection fails, the pads are disconnected
and FALSE is returned.
gst_pad_try_reconnect_filtered ()
gboolean gst_pad_try_reconnect_filtered (GstPad *srcpad,
GstPad *sinkpad,
GstCaps *filtercaps); |
Tries to reconnect the given source and sink pad, constrained by the given
capabilities.
gst_pad_disconnect ()
Disconnects the source pad from the sink pad.
gst_pad_can_connect ()
gboolean gst_pad_can_connect (GstPad *srcpad,
GstPad *sinkpad); |
Checks if the source pad and the sink pad can be connected.
gst_pad_can_connect_filtered ()
Checks if the source pad and the sink pad can be connected when constrained
by the given filter caps.
gst_pad_push ()
Pushes a buffer to the peer of the pad.
gst_pad_pull ()
Pulls a buffer from the peer pad.
gst_pad_get_bufferpool ()
Gets the bufferpool of the peer pad of the given pad.
gst_pad_load_and_connect ()
void gst_pad_load_and_connect (xmlNodePtr self,
GstObject *parent); |
Reads the pad definition from the XML node and connects the given pad
in the element to a pad of an element up in the hierarchy.
gst_pad_proxy_connect ()
Proxies the connect function to the specified pad.
gst_pad_get_pad_template ()
Gets the pad template object of this pad.
gst_pad_get_pad_template_caps ()
Gets the template capabilities of this pad.
gst_pad_get_allowed_caps ()
Gets the capabilities of the allowed media types that can
flow through this pad. The caller must free the resulting caps.
gst_pad_recalc_allowed_caps ()
gboolean gst_pad_recalc_allowed_caps (GstPad *pad); |
Attempts to reconnect the pad to its peer through its filter,
set with gst_pad_[re]connect_filtered. This function is useful when a
plug-in has new capabilities on a pad and wants to notify the peer.
gst_pad_perform_negotiate ()
gboolean gst_pad_perform_negotiate (GstPad *srcpad,
GstPad *sinkpad); |
Tries to negotiate the pads.
gst_pad_select ()
GstPad* gst_pad_select (GList *padlist); |
Waits for a buffer on any of the list of pads.
gst_pad_selectv ()
Waits for a buffer on the given set of pads.
gst_pad_dispatcher ()
Invokes the given dispatcher function on all pads that are
internally connected to the given pad.
The GstPadDispatcherFunction should return TRUE when no further pads
need to be processed.
gst_pad_send_event ()
Sends the event to the pad.
gst_pad_event_default ()
Invokes the default event handler for the given pad.
gst_pad_set_event_function ()
Sets the given event handler for the pad.
gst_pad_set_convert_function ()
Sets the given convert function for the pad.
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.
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 connection of
the element.
gst_pad_get_internal_connections ()
GList* gst_pad_get_internal_connections
(GstPad *pad); |
Gets a list of pads to which the given pad is connected to
inside of the parent element.
The caller must free this list after use.
gst_pad_get_internal_connections_default ()
GList* gst_pad_get_internal_connections_default
(GstPad *pad); |
Gets a list of pads to which the given pad is connected 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.
gst_pad_set_internal_connection_function ()
Sets the given internal connection function for the pad.
gst_pad_set_query_function ()
Set the given query function for the pad.
gst_pad_query ()
Queries a pad for one of the available properties.
gst_pad_query_default ()
Invokes the default query function on a pad.
struct GstRealPad
struct GstRealPad {
GstPad pad;
/* the pad capabilities */
GstCaps *caps;
GstCaps *filter;
GstCaps *appfilter;
GstPadGetCapsFunction getcapsfunc;
GstPadDirection direction;
GstPadConnectFunction connectfunc;
GstRealPad *peer;
gpointer sched_private;
/* data transport functions */
GstPadChainFunction chainfunc;
GstPadChainFunction chainhandler;
GstPadGetFunction getfunc;
GstPadGetFunction gethandler;
GstPadEventFunction eventfunc;
GstPadEventFunction eventhandler;
GstPadEventMaskFunction eventmaskfunc;
GList *ghostpads;
/* query/convert/formats functions */
GstPadConvertFunction convertfunc;
GstPadQueryFunction queryfunc;
GstPadFormatsFunction formatsfunc;
GstPadQueryTypeFunction querytypefunc;
GstPadIntConnFunction intconnfunc;
GstPadBufferPoolFunction bufferpoolfunc;
}; |
GST_RPAD_DIRECTION()
#define GST_RPAD_DIRECTION(pad) (((GstRealPad *)(pad))->direction) |
Get the direction of the real pad.
GST_RPAD_CAPS()
#define GST_RPAD_CAPS(pad) (((GstRealPad *)(pad))->caps) |
Get the caps of the real pad.
GST_RPAD_PEER()
#define GST_RPAD_PEER(pad) (((GstRealPad *)(pad))->peer) |
Get the peer element of the real pad.
GST_RPAD_CHAINFUNC()
#define GST_RPAD_CHAINFUNC(pad) (((GstRealPad *)(pad))->chainfunc) |
Get the chain function of the real pad.
GST_RPAD_FILTER()
#define GST_RPAD_FILTER(pad) (((GstRealPad *)(pad))->filter) |
Get the filter from the pad
GST_RPAD_APPFILTER()
#define GST_RPAD_APPFILTER(pad) (((GstRealPad *)(pad))->appfilter) |
Get the application filter for this pad
GST_RPAD_GETFUNC()
#define GST_RPAD_GETFUNC(pad) (((GstRealPad *)(pad))->getfunc) |
Get get getfunction of the real pad.
GST_RPAD_BUFFERPOOLFUNC()
#define GST_RPAD_BUFFERPOOLFUNC(pad) (((GstRealPad *)(pad))->bufferpoolfunc) |
Get the bufferpoolfunction from the real pad.
GST_RPAD_CHAINHANDLER()
#define GST_RPAD_CHAINHANDLER(pad) (((GstRealPad *)(pad))->chainhandler) |
Get the eventhandler function from the real pad.
GST_RPAD_EVENTFUNC()
#define GST_RPAD_EVENTFUNC(pad) (((GstRealPad *)(pad))->eventfunc) |
Get the event function of this real pad.
GST_RPAD_EVENTHANDLER()
#define GST_RPAD_EVENTHANDLER(pad) (((GstRealPad *)(pad))->eventhandler) |
Get the eventhandler function of this real pad.
GST_RPAD_GETHANDLER()
#define GST_RPAD_GETHANDLER(pad) (((GstRealPad *)(pad))->gethandler) |
Get the gethandler function of this real pad.
GST_RPAD_CONNECTFUNC()
#define GST_RPAD_CONNECTFUNC(pad) (((GstRealPad *)(pad))->connectfunc) |
Get the connect function of the pad
GST_RPAD_GETCAPSFUNC()
#define GST_RPAD_GETCAPSFUNC(pad) (((GstRealPad *)(pad))->getcapsfunc) |
Get the getcaps function of this pad
GST_RPAD_CONVERTFUNC()
#define GST_RPAD_CONVERTFUNC(pad) (((GstRealPad *)(pad))->convertfunc) |
Get the convert function of this pad
GST_RPAD_INTCONNFUNC()
#define GST_RPAD_INTCONNFUNC(pad) (((GstRealPad *)(pad))->intconnfunc) |
Get the internal connection function of this pad
GST_RPAD_QUERYFUNC()
#define GST_RPAD_QUERYFUNC(pad) (((GstRealPad *)(pad))->queryfunc) |
Get the query function of this pad
GST_GPAD_REALPAD()
#define GST_GPAD_REALPAD(pad) (((GstGhostPad *)(pad))->realpad) |
Get the real pad of this ghost pad.
gst_ghost_pad_new ()
Creates a new ghost pad associated with the given pad, and names it with
the given name. If name is NULL, a guaranteed unique name (across all
ghost pads) will be assigned (most likely of the form ghostpadd).