Description
GstElement are connected to each other via "pads", which are extremely light-weight generic
connections. After two pad are retrieved from an element with gst_element_get_pad(), the pads
can be connected with gst_pad_connect().
PedTemplates are use to describe the runtime behaviour of an element and what pads it
will have during its lifetime. Pads are typically created from a padtemplate with
GST_PADTEMPLATE_NEW() or with the factory macro GST_PADTEMPLATE_FACTORY().
Pad and PadTemplates 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. gst_padtemplate_get_caps() is used to get the
caps of a padtemplate. It's not possible to modify the caps of a padtemplate after
creation. The following code example shows the code to create a pad from a padtemplate.
GST_PADTEMPLATE_FACTORY (my_factory,
"sink", /* the name of the pad */
GST_PAD_SINK, /* the direction of the pad */
GST_PAD_ALWAYS, /* when this pad will be present */
GST_CAPS_NEW ( /* the capabilities of the padtemplate */
"my_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"channels", GST_PROPS_INT_RANGE (1, 6)
)
)
void
my_method (void)
{
GstPad *pad;
pad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (my_factory), "sink");
...
} |
Pads created from a padtemplate cannot set capabilities that are incompatible with
the padtemplates capabilities.
Pads without padtemplates can be created with gst_pad_new() which takes a direction and
a name as an argument.
gst_pad_get_parent() will retrieve the GstElement that owns the pad.
GstElements creating a pad will typicilally 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 a buffer in. The
gst_pad_pullregion() function can be used to request for a buffer with a specific offset (in
time or in bytes).
Details
GST_PAD_NAME()
#define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad)) |
Get the name of the pad.
GST_PAD_ELEMENT_PRIVATE()
#define GST_PAD_ELEMENT_PRIVATE(pad) (((GstPad *)(pad))->element_private) |
Get the private data set by the element that owns the pad.
GST_PAD_PARENT()
#define GST_PAD_PARENT(pad) ((GstElement *)(GST_OBJECT_PARENT(pad))) |
Get the parent element of this pad.
GST_PAD_PADTEMPLATE()
#define GST_PAD_PADTEMPLATE(pad) (((GstPad *)(pad))->padtemplate) |
Get the padtemplate that was used to create this pad. NULL if no padtemplate
was used.
GST_PAD_REALIZE()
#define GST_PAD_REALIZE(pad) (GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad)) |
Return the real pad of this pad.
GST_PAD_DIRECTION()
#define GST_PAD_DIRECTION(pad) GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad)) |
Get the pad direction.
GST_PAD_CAPS()
#define GST_PAD_CAPS(pad) GST_RPAD_CAPS(GST_PAD_REALIZE(pad)) |
Get the capabilities of a pad.
GST_PAD_PEER()
#define GST_PAD_PEER(pad) GST_RPAD_PEER(GST_PAD_REALIZE(pad)) |
Get the peerpad of this pad.
GST_PAD_CONNECTED()
#define GST_PAD_CONNECTED(pad) (GST_PAD_PEER(pad) != NULL) |
Is this pad connected.
GST_PAD_CAN_PULL()
#define GST_PAD_CAN_PULL(pad) (GST_IS_REAL_PAD(pad) && GST_REAL_PAD(pad)->pullfunc != NULL) |
Can this pad be used to pull a buffer.
GstPadChainFunction ()
The function that will be called when chaining buffers.
GstPadGetFunction ()
The function that will be called when pulling a buffer.
GstPadGetRegionFunction ()
The function that will be called when pulling a region buffer.
You can specify which buffer to get using an offset/length pair or
a start/stop timecode pair.
GstPadQoSFunction ()
void (*GstPadQoSFunction) (GstPad *pad,
glong qos_message); |
The function that will be called when a QoS message is sent.
GstPadEOSFunction ()
gboolean (*GstPadEOSFunction) (GstPad *pad); |
The function that will be called in an EOS case.
GstPadNewCapsFunction ()
The function that will be called when the caps of the pad has
changed.
GstPadBufferPoolFunction ()
The function that will be called when a bufferpool is requested
from this pad.
enum GstPadNegotiateReturn
typedef enum {
GST_PAD_NEGOTIATE_FAIL,
GST_PAD_NEGOTIATE_AGREE,
GST_PAD_NEGOTIATE_TRY,
} GstPadNegotiateReturn; |
The possible results from padnegotiation.
GstPadNegotiateFunction ()
The function that will be called when negotiating.
GstPadPushFunction ()
The function that will be called when pushing a buffers.
GstPadPullFunction ()
The function that will be called when pulling buffers.
enum GstRegionType
typedef enum {
GST_REGION_NONE,
GST_REGION_OFFSET_LEN,
GST_REGION_TIME_LEN,
} GstRegionType; |
the region types for gst_pad_pullregion.
GstPadPullRegionFunction ()
The function that will be called when pulling a region buffer.
You can specify which buffer to get using an offset/length pair or
a start/stop timecode pair.
enum GstPadDirection
typedef enum {
GST_PAD_UNKNOWN,
GST_PAD_SRC,
GST_PAD_SINK,
} GstPadDirection; |
The direction this pad is.
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 ()
Create a new pad with given name.
gst_pad_destroy()
#define gst_pad_destroy(pad) gst_object_destroy (GST_OBJECT (pad)) |
Destroy the pad.
gst_pad_new_from_template ()
Create a new pad with given name from the given template.
gst_pad_get_direction ()
Get the direction of the pad.
gst_pad_set_chain_function ()
Set the given chain function for the pad.
gst_pad_set_get_function ()
Set the given get function for the pad.
gst_pad_set_getregion_function ()
Set the given getregion function for the pad.
gst_pad_set_negotiate_function ()
Set the given negotiate function for the pad.
gst_pad_set_qos_function ()
Set the given qos function for the pad.
gst_pad_set_eos_function ()
Set the given EOS function for the pad.
gst_pad_set_newcaps_function ()
Set the given newcaps function for the pad.
gst_pad_set_bufferpool_function ()
Set the given bufferpool function for the pad.
gst_pad_set_caps ()
Set the capabilities of this pad.
gst_pad_get_caps ()
Get the capabilities of this pad.
gst_pad_check_compatibility ()
gboolean gst_pad_check_compatibility (GstPad *srcpad,
GstPad *sinkpad); |
Check if two pads have compatible capabilities.
gst_pad_set_name ()
void gst_pad_set_name (GstPad *pad,
const gchar *name); |
Set the name of a pad.
gst_pad_get_name ()
const gchar* gst_pad_get_name (GstPad *pad); |
Get 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 pointer to the pad. This
function can only be used by the element that own the
pad.
gst_pad_get_element_private ()
gpointer gst_pad_get_element_private (GstPad *pad); |
Get the private data of a pad. The private data can
only be set by the parent element of this pad.
gst_pad_set_parent ()
Sets the parent object of a pad.
gst_pad_get_parent ()
Get the parent object of this pad.
gst_pad_get_sched ()
GstSchedule* gst_pad_get_sched (GstPad *pad); |
Get the scheduler of the pad
gst_pad_set_sched ()
void gst_pad_set_sched (GstPad *pad,
GstSchedule *sched); |
Set the sceduler for the pad
gst_pad_get_real_parent ()
Get the real parent object of this pad. If the pad
is a ghostpad, the actual owner of the real pad is
returned, as opposed to the gst_pad_get_parent().
gst_pad_add_ghost_pad ()
Add a ghost pad to a pad.
gst_pad_remove_ghost_pad ()
void gst_pad_remove_ghost_pad (GstPad *pad,
GstPad *ghostpad); |
Remove a ghost pad from a pad.
gst_pad_get_ghost_pad_list ()
GList* gst_pad_get_ghost_pad_list (GstPad *pad); |
Get the ghost parents of this pad.
gst_pad_get_peer ()
Get the peer pad of this pad.
gst_pad_connect ()
Connects the source pad to the sink pad.
gst_pad_disconnect ()
Disconnects the source pad from the sink pad.
gst_pad_push ()
Push a buffer to the peer of the pad.
gst_pad_pull ()
Pull a buffer from the peer pad.
gst_pad_pullregion ()
Pull a buffer region from the peer pad. The region to pull can be
specified with a offset/lenght pair or with a start/legnth time
indicator as specified by the type parameter.
gst_pad_get_bufferpool ()
Get the bufferpool of the peer pad of the given
pad
gst_pad_set_eos ()
gboolean gst_pad_set_eos (GstPad *pad); |
Sets the given pad to the EOS state.
gst_pad_handle_qos ()
void gst_pad_handle_qos (GstPad *pad,
glong qos_message); |
Pass the qos message downstream.
gst_pad_eos()
#define gst_pad_eos(pad) (GST_RPAD_EOSFUNC(GST_RPAD_PEER(pad))(GST_PAD(GST_RPAD_PEER(pad)))) |
Call the EOS function of the pad
gst_pad_load_and_connect ()
void gst_pad_load_and_connect (xmlNodePtr self,
GstObject *parent); |
Read the pad definition from the XML node and connect the given pad
in element to a pad of an element up in the hierarchy.
gst_pad_negotiate_proxy ()
Proxies the negotiation pad from srcpad to destpad. Further
negotiation is done on the peers of both pad instead.
gst_pad_renegotiate ()
gboolean gst_pad_renegotiate (GstPad *pad); |
Perform the negotiation process with the peer pad.
gst_pad_get_padtemplate ()
Get the padtemplate object of this pad.
gst_pad_get_padtemplate_caps ()
Get the capabilities of this pad.
gst_pad_eos_func ()
gboolean gst_pad_eos_func (GstPad *pad); |
struct GstRealPad
struct GstRealPad {
GstPad pad;
GstCaps *caps;
GstPadDirection direction;
cothread_state *threadstate;
GstRealPad *peer;
GstBuffer *bufpen;
GstRegionType regiontype;
guint64 offset;
guint64 len;
GstSchedule *sched;
GstPadChainFunction chainfunc;
GstPadGetFunction getfunc;
GstPadGetRegionFunction getregionfunc;
GstPadQoSFunction qosfunc;
GstPadEOSFunction eosfunc;
GstPadPushFunction pushfunc;
GstPadPullFunction pullfunc;
GstPadPullRegionFunction pullregionfunc;
GstPadNegotiateFunction negotiatefunc;
GstPadNewCapsFunction newcapsfunc;
GstPadBufferPoolFunction bufferpoolfunc;
GList *ghostpads;
}; |
GST_RPAD_LEN()
#define GST_RPAD_LEN(pad) (((GstRealPad *)(pad))->len) |
Get the length of the region that is being pulled.
GST_RPAD_OFFSET()
#define GST_RPAD_OFFSET(pad) (((GstRealPad *)(pad))->offset) |
Get the offset of the region that is being pulled.
GST_RPAD_SCHED()
#define GST_RPAD_SCHED(pad) (((GstRealPad *)(pad))->sched) |
GST_RPAD_REGIONTYPE()
#define GST_RPAD_REGIONTYPE(pad) (((GstRealPad *)(pad))->regiontype) |
Get the type of the region that is being pulled.
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_BUFPEN()
#define GST_RPAD_BUFPEN(pad) (((GstRealPad *)(pad))->bufpen) |
Get the bufpen 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_GETFUNC()
#define GST_RPAD_GETFUNC(pad) (((GstRealPad *)(pad))->getfunc) |
Get get getfunction of the real pad.
GST_RPAD_GETREGIONFUNC()
#define GST_RPAD_GETREGIONFUNC(pad) (((GstRealPad *)(pad))->getregionfunc) |
Get the getregion function of the real pad.
GST_RPAD_PUSHFUNC()
#define GST_RPAD_PUSHFUNC(pad) (((GstRealPad *)(pad))->pushfunc) |
Get the pushfunction of the real pad.
GST_RPAD_PULLFUNC()
#define GST_RPAD_PULLFUNC(pad) (((GstRealPad *)(pad))->pullfunc) |
Get the pullfunction of the real pad.
GST_RPAD_PULLREGIONFUNC()
#define GST_RPAD_PULLREGIONFUNC(pad) (((GstRealPad *)(pad))->pullregionfunc) |
Get the pullregion function of the real pad.
GST_RPAD_QOSFUNC()
#define GST_RPAD_QOSFUNC(pad) (((GstRealPad *)(pad))->qosfunc) |
Get the QoS function of the real pad.
GST_RPAD_EOSFUNC()
#define GST_RPAD_EOSFUNC(pad) (((GstRealPad *)(pad))->eosfunc) |
Get the EOS function of the real pad.
GST_RPAD_NEGOTIATEFUNC()
#define GST_RPAD_NEGOTIATEFUNC(pad) (((GstRealPad *)(pad))->negotiatefunc) |
Get the negotiate function from the real pad.
GST_RPAD_NEWCAPSFUNC()
#define GST_RPAD_NEWCAPSFUNC(pad) (((GstRealPad *)(pad))->newcapsfunc) |
Get the newcaps function from the real pad.
GST_RPAD_BUFFERPOOLFUNC()
#define GST_RPAD_BUFFERPOOLFUNC(pad) (((GstRealPad *)(pad))->bufferpoolfunc) |
Get the bufferpoolfunction from the real pad.
GST_GPAD_REALPAD()
#define GST_GPAD_REALPAD(pad) (((GstGhostPad *)(pad))->realpad) |
Get the real pad of this ghost pad.
struct GstGhostPad
struct GstGhostPad {
GstPad pad;
GstRealPad *realpad;
}; |
gst_ghost_pad_new ()
Create a new ghost pad associated with the given pad.
enum GstPadPresence
typedef enum {
GST_PAD_ALWAYS,
GST_PAD_SOMETIMES,
GST_PAD_REQUEST,
} GstPadPresence; |
Indicates when this pad will become available.
struct GstPadTemplate
struct GstPadTemplate {
GstObject object;
gchar *name_template;
GstPadDirection direction;
GstPadPresence presence;
GstCaps *caps;
}; |
GST_PADTEMPLATE_CAPS()
#define GST_PADTEMPLATE_CAPS(templ) (((GstPadTemplate *)(templ))->caps) |
Get a handle to the padtemplate GstCaps
GST_PADTEMPLATE_DIRECTION()
#define GST_PADTEMPLATE_DIRECTION(templ) (((GstPadTemplate *)(templ))->direction) |
Get the direction of the padtemplate.
GST_PADTEMPLATE_NAME_TEMPLATE()
#define GST_PADTEMPLATE_NAME_TEMPLATE(templ) (((GstPadTemplate *)(templ))->name_template) |
Get the nametemplate of the padtemplate.
GST_PADTEMPLATE_PRESENCE()
#define GST_PADTEMPLATE_PRESENCE(templ) (((GstPadTemplate *)(templ))->presence) |
Get the presence of the padtemplate.
GST_PADTEMPLATE_NEW()
#define GST_PADTEMPLATE_NEW(padname, dir, pres, a...) |
Create a new padtemplate.
GST_PADTEMPLATE_FACTORY()
#define GST_PADTEMPLATE_FACTORY(name, padname, dir, pres, a...) |
Create a factory for a padtemplate. This can be used if you only want one instance
of the padtemplate. Use GST_PADTEMPLATE_GET() to get the unique padtemplate.
GST_PADTEMPLATE_GET()
#define GST_PADTEMPLATE_GET(fact) (fact)() |
Get the padtemplate of the factory created with GST_PADTEMPLATE_FACTORY()
gst_padtemplate_new ()
Creates a new padtemplate from the given arguments.
gst_padtemplate_load_thyself ()
Loads a padtemplate from the XML tree.
gst_padtemplate_save_thyself ()
xmlNodePtr gst_padtemplate_save_thyself (GstPadTemplate *templ,
xmlNodePtr parent); |
Saves the padtemplate into XML.
gst_padtemplate_get_caps ()
Get the capabilities of the padtemplate
gst_padtemplate_get_caps_by_name ()
Get the capability with the given name from this padtemplate.