GStreamer Library Reference Manual (Core) | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
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().
Pads are typically created from a GstPadTemplate with gst_pad_new_from_template().
Pad 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 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). gst_pad_select() and gst_pad_selectv() are use by plugins to wait on a set of pads for a new GstBuffer or GstEvent.
To send an event on a pad, use gst_pad_send_event().
#define GST_PAD_ELEMENT_PRIVATE(pad) (((GstPad *)(pad))->element_private) |
Get the private data set by the element that owns the pad.
#define GST_PAD_PARENT(pad) ((GstElement *)(GST_OBJECT_PARENT(pad))) |
Get the parent element of this pad.
#define GST_PAD_PADTEMPLATE(pad) (((GstPad *)(pad))->padtemplate) |
Get the padtemplate that was used to create this pad. NULL if no padtemplate was used.
#define GST_PAD_REALIZE(pad) (GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad)) |
Return the real pad of this pad.
#define GST_PAD_DIRECTION(pad) GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad)) |
Get the pad direction.
#define GST_PAD_CAPS(pad) GST_RPAD_CAPS(GST_PAD_REALIZE(pad)) |
Get the capabilities of a pad.
#define GST_PAD_PEER(pad) GST_PAD_CAST(GST_RPAD_PEER(GST_PAD_REALIZE(pad))) |
Get the peerpad of this pad.
#define GST_PAD_CAN_PULL(pad) (GST_IS_REAL_PAD(pad) && GST_REAL_PAD(pad)->gethandler != NULL) |
Can this pad be used to pull a buffer.
void (*GstPadChainFunction) (GstPad *pad, GstBuffer *buf); |
The function that will be called when chaining buffers.
GstBuffer* (*GstPadGetFunction) (GstPad *pad); |
The function that will be called when pulling a buffer.
pad : | the pad to get a buffer from |
Returns : | a GstBuffer |
GstBuffer* (*GstPadGetRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len); |
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.
pad : | the pad to get a buffer from |
type : | the type of region to get (time or offset based) |
offset : | the offset of the region to get |
len : | the length of the region to get |
Returns : | a GstBuffer |
GstBufferPool* (*GstPadBufferPoolFunction) (GstPad *pad); |
The function that will be called when a bufferpool is requested from this pad.
typedef enum { GST_REGION_VOID, GST_REGION_OFFSET_LEN, GST_REGION_TIME_LEN, } GstRegionType; |
the region types for gst_pad_pullregion.
GstBuffer* (*GstPadPullRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len); |
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.
pad : | the pad to get a buffer from |
type : | the type of region to get (time or offset based) |
offset : | the offset of the region to get |
len : | the length of the region to get |
Returns : | a GstBuffer |
typedef enum { GST_PAD_CONNECT_REFUSED = 0, GST_PAD_CONNECT_OK = 1, GST_PAD_CONNECT_DONE = 2, GST_PAD_CONNECT_DELAYED = 3, } GstPadConnectReturn; |
typedef enum { GST_PAD_UNKNOWN, GST_PAD_SRC, GST_PAD_SINK, } GstPadDirection; |
The direction this pad is.
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.
GstPad* gst_pad_new (gchar *name, GstPadDirection direction); |
Create a new pad with given name.
GstPad* gst_pad_new_from_template (GstPadTemplate *templ, gchar *name); |
Create a new pad with given name from the given template.
GstPadDirection gst_pad_get_direction (GstPad *pad); |
Get the direction of the pad.
void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain); |
Set the given chain function for the pad.
void gst_pad_set_get_function (GstPad *pad, GstPadGetFunction get); |
Set the given get function for the pad.
void gst_pad_set_getregion_function (GstPad *pad, GstPadGetRegionFunction getregion); |
Set the given getregion function for the pad.
void gst_pad_set_bufferpool_function (GstPad *pad, GstPadBufferPoolFunction bufpool); |
Set the given bufferpool function for the pad.
void gst_pad_set_connect_function (GstPad *pad, GstPadConnectFunction connect); |
Set the given connect function for the pad. It will be called when the pad is connected or reconnected with caps.
void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps); |
Set the given getcaps function for the pad.
gboolean gst_pad_try_set_caps (GstPad *pad, GstCaps *caps); |
Try to set the caps on the given pad.
gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad); |
Check if two pads have compatible capabilities.
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.
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.
void gst_pad_set_parent (GstPad *pad, GstObject *parent); |
Sets the parent object of a pad.
GstElement* gst_pad_get_parent (GstPad *pad); |
Get the parent object of this pad.
void gst_pad_set_sched (GstPad *pad, GstScheduler *sched); |
Set the scheduler for the pad
GstElement* gst_pad_get_real_parent (GstPad *pad); |
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().
void gst_pad_add_ghost_pad (GstPad *pad, GstPad *ghostpad); |
Add a ghost pad to a pad.
void gst_pad_remove_ghost_pad (GstPad *pad, GstPad *ghostpad); |
Remove a ghost pad from a pad.
GList* gst_pad_get_ghost_pad_list (GstPad *pad); |
Get the ghost parents of this pad.
gboolean gst_pad_connect (GstPad *srcpad, GstPad *sinkpad); |
Connects the source pad to the sink pad.
gboolean gst_pad_connect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps); |
Connects the source pad to the sink pad. The filter indicates the media type that should flow trought this connection.
gboolean gst_pad_reconnect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps); |
Try to reconnect this pad and its peer with the specified caps.
gboolean gst_pad_try_reconnect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps); |
Try to reconnect this pad and its peer with the specified caps
void gst_pad_disconnect (GstPad *srcpad, GstPad *sinkpad); |
Disconnects the source pad from the sink pad.
void gst_pad_push (GstPad *pad, GstBuffer *buf); |
Push a buffer to the peer of the pad.
GstBuffer* gst_pad_pullregion (GstPad *pad, GstRegionType type, guint64 offset, guint64 len); |
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.
GstBufferPool* gst_pad_get_bufferpool (GstPad *pad); |
Get the bufferpool of the peer pad of the given pad.
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.
GstPadConnectReturn gst_pad_proxy_connect (GstPad *pad, GstCaps *caps); |
Proxy the connect function to the specified pad.
GstPadTemplate* gst_pad_get_padtemplate (GstPad *pad); |
Get the padtemplate object of this pad.
GstCaps* gst_pad_get_padtemplate_caps (GstPad *pad); |
Get the capabilities of this pad.
GstCaps* gst_pad_get_allowed_caps (GstPad *pad); |
Get the caps of the allowed media types that can go through this pad.
xmlNodePtr gst_pad_ghost_save_thyself (GstPad *pad, GstElement *bin, xmlNodePtr parent); |
Saves the ghost pad into an xml representation.
GstPad* gst_pad_select (GList *padlist); |
Wait for a buffer on the list of pads.
padlist : | A list of pads |
Returns : | The pad that has a buffer available, use gst_pad_pull to get the buffer. |
GstPad* gst_pad_selectv (GstPad *pad, ...); |
Wait for a buffer on the given of pads.
pad : | The first pad to perform the select on |
... : | More pads |
Returns : | The pad that has a buffer available, use gst_pad_pull to get the buffer. |
gboolean gst_pad_send_event (GstPad *pad, GstEvent *event); |
Send the event to the pad.
void gst_pad_event_default (GstPad *pad, GstEvent *event); |
Invoke the default event handler for the given pad.
void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event); |
Set the given event handler for the pad.
struct GstRealPad { GstPad pad; GstCaps *caps; GstCaps *filter; GstCaps *appfilter; GstPadDirection direction; GstScheduler *sched; gpointer sched_private; GstRealPad *peer; GstBuffer *bufpen; GstRegionType regiontype; guint64 offset; guint64 len; GstPadChainFunction chainfunc; GstPadChainFunction chainhandler; GstPadGetFunction getfunc; GstPadGetFunction gethandler; GstPadEventFunction eventfunc; GstPadEventFunction eventhandler; GstPadGetRegionFunction getregionfunc; GstPadPullRegionFunction pullregionfunc; GstPadGetCapsFunction getcapsfunc; GstPadConnectFunction connectfunc; GstPadBufferPoolFunction bufferpoolfunc; GList *ghostpads; }; |
#define GST_RPAD_LEN(pad) (((GstRealPad *)(pad))->len) |
Get the length of the region that is being pulled.
#define GST_RPAD_OFFSET(pad) (((GstRealPad *)(pad))->offset) |
Get the offset of the region that is being pulled.
#define GST_RPAD_SCHED(pad) (((GstRealPad *)(pad))->sched) |
Get the scheduler of this real pad.
#define GST_RPAD_REGIONTYPE(pad) (((GstRealPad *)(pad))->regiontype) |
Get the type of the region that is being pulled.
#define GST_RPAD_DIRECTION(pad) (((GstRealPad *)(pad))->direction) |
Get the direction of the real pad.
#define GST_RPAD_CAPS(pad) (((GstRealPad *)(pad))->caps) |
Get the caps of the real pad.
#define GST_RPAD_PEER(pad) (((GstRealPad *)(pad))->peer) |
Get the peer element of the real pad.
#define GST_RPAD_BUFPEN(pad) (((GstRealPad *)(pad))->bufpen) |
Get the bufpen of the real pad.
#define GST_RPAD_CHAINFUNC(pad) (((GstRealPad *)(pad))->chainfunc) |
Get the chain function of the real pad.
#define GST_RPAD_GETFUNC(pad) (((GstRealPad *)(pad))->getfunc) |
Get get getfunction of the real pad.
#define GST_RPAD_GETREGIONFUNC(pad) (((GstRealPad *)(pad))->getregionfunc) |
Get the getregion function of the real pad.
#define GST_RPAD_PULLREGIONFUNC(pad) (((GstRealPad *)(pad))->pullregionfunc) |
Get the pullregion function of the real pad.
#define GST_RPAD_BUFFERPOOLFUNC(pad) (((GstRealPad *)(pad))->bufferpoolfunc) |
Get the bufferpoolfunction from the real pad.
#define GST_RPAD_CHAINHANDLER(pad) (((GstRealPad *)(pad))->chainhandler) |
Get the eventhandler function from the real pad.
#define GST_RPAD_EVENTFUNC(pad) (((GstRealPad *)(pad))->eventfunc) |
Get the event function of this real pad.
#define GST_RPAD_EVENTHANDLER(pad) (((GstRealPad *)(pad))->eventhandler) |
Get the eventhandler function of this real pad.
#define GST_RPAD_GETHANDLER(pad) (((GstRealPad *)(pad))->gethandler) |
Get the gethandler function of this real pad.
#define GST_GPAD_REALPAD(pad) (((GstGhostPad *)(pad))->realpad) |
Get the real pad of this ghost pad.