GstPad
The connection between Elements
#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).
#GstCaps, #GstElement
Get the name of the pad.
@pad: the pad to query
Get the private data set by the element that owns the pad.
@pad: the pad to query
Get the parent element of this pad.
@pad: the pad to query
Get the padtemplate that was used to create this pad. NULL if no padtemplate
was used.
@pad: the pad to query
Return the real pad of this pad.
@pad: the pad to query
Get the pad direction.
@pad: the pad to query
Get the capabilities of a pad.
@pad: the pad to query
Get the peerpad of this pad.
@pad: the pad to query
Is this pad connected.
@pad: the pad to check
Can this pad be used to pull a buffer.
@pad: the pad to check
The function that will be called when chaining buffers.
@pad: the pad that performed the chain
@buf: the buffer that is chained
The function that will be called when pulling a buffer.
@pad: the pad to get a buffer from
@Returns: a #GstBuffer
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
@size: the size of the region to get
The function that will be called when a QoS message is sent.
@pad: the pad that sent the QoS message
@qos_message: the message
The function that will be called in an EOS case.
@pad: the pad that needs to be set to EOS state
@Returns: TRUE if EOS was successful, FALSE otherwise
The function that will be called when the caps of the pad has
changed.
@pad: The pad that has its caps changed
@caps: the new caps of the pad
The function that will be called when a bufferpool is requested
from this pad.
@pad: the pad with the bufferpool
@Returns: the GstBufferPool associated with this pad.
The possible results from padnegotiation.
@GST_PAD_NEGOTIATE_FAIL: The pads could not agree about the media type.
@GST_PAD_NEGOTIATE_AGREE: The pads agreed about the media type.
@GST_PAD_NEGOTIATE_TRY: The pad did not agree and suggests another media type.
The function that will be called when negotiating.
@pad: The pad that is being negotiated
@caps: The current caps that are being negotiated
@data: A generic gpointer that can be used to store user_data
@Returns: The result of the negotiation process
The function that will be called when pushing a buffers.
@pad: the pad to push
@buf: a GstBuffer to push
The function that will be called when pulling buffers.
@pad: the pad to pull
@Returns: a GstBuffer
the region types for #gst_pad_pullregion.
@GST_REGION_NONE: no type specified
@GST_REGION_OFFSET_LEN: an offet/length pair
@GST_REGION_TIME_LEN: a time start/length pair
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
The direction this pad is.
@GST_PAD_UNKNOWN: direction is unknown
@GST_PAD_SRC: this is a source pad
@GST_PAD_SINK: this is a sink pad
Flags for the pad.
@GST_PAD_DISABLED: the pad is disabled
@GST_PAD_EOS: the pad is in end of stream state
@GST_PAD_FLAG_LAST: subclasses can use this number to enumerate their flags
@name:
@direction:
@Returns:
Destroy the pad.
@pad: the pad to destroy
@templ:
@name:
@Returns:
@temp:
@pad:
@Returns:
@pad:
@chain:
@pad:
@get:
@pad:
@getregion:
@pad:
@nego:
@pad:
@qos:
@pad:
@eos:
@pad:
@newcaps:
@pad:
@bufpool:
@pad:
@caps:
@Returns:
@pad:
@Returns:
@srcpad:
@sinkpad:
@Returns:
@pad:
@name:
@pad:
@Returns:
@pad:
@priv:
@pad:
@Returns:
@pad:
@parent:
@pad:
@Returns:
@pad:
@Returns:
@pad:
@sched:
@pad:
@Returns:
@pad:
@ghostpad:
@pad:
@ghostpad:
@pad:
@Returns:
@pad:
@Returns:
@srcpad:
@sinkpad:
@Returns:
@srcpad:
@sinkpad:
@pad:
@buf:
@buffer:
@pad:
@Returns:
@pad:
@type:
@offset:
@len:
@Returns:
@size:
@pad:
@Returns:
@pad:
@Returns:
@pad:
@qos_message:
Call the EOS function of the pad
@pad: the pad to call the eos function of.
@self:
@parent:
@element:
@elements:
@srcpad:
@destpad:
@caps:
@Returns:
@counter:
@count:
@pad:
@Returns:
@pad:
@Returns:
@pad:
@Returns:
@pad:
@Returns:
@pad:
@caps:
@direction:
@threadstate:
@peer:
@bufpen:
@regiontype:
@offset:
@len:
@sched:
@chainfunc:
@getfunc:
@getregionfunc:
@qosfunc:
@eosfunc:
@pushfunc:
@pullfunc:
@pullregionfunc:
@negotiatefunc:
@newcapsfunc:
@bufferpoolfunc:
@ghostpads:
Get the length of the region that is being pulled.
@pad: the real pad to query.
Get the offset of the region that is being pulled.
@pad: the real pad to query.
@pad:
Get the type of the region that is being pulled.
@pad: the real pad to query.
Get the direction of the real pad.
@pad: the realpad to query.
Get the caps of the real pad.
@pad: the real pad to query.
Get the peer element of the real pad.
@pad: the real pad to query.
Get the bufpen of the real pad.
@pad: the real pad to query.
Get the chain function of the real pad.
@pad: the real pad to query.
Get get getfunction of the real pad.
@pad: the real pad to query.
Get the getregion function of the real pad.
@pad: the real pad to query.
Get the pushfunction of the real pad.
@pad: the real pad to query.
Get the pullfunction of the real pad.
@pad: the real pad to query.
Get the pullregion function of the real pad.
@pad: the real pad to query.
Get the QoS function of the real pad.
@pad: the real pad to query.
Get the EOS function of the real pad.
@pad: the real pad to query.
Get the negotiate function from the real pad.
@pad: the real pad to query.
Get the newcaps function from the real pad.
@pad: the real pad to query.
Get the bufferpoolfunction from the real pad.
@pad: the real pad to query.
Get the real pad of this ghost pad.
@pad: the real pad to query.
@pad:
@realpad:
@name:
@pad:
@Returns:
Indicates when this pad will become available.
@GST_PAD_ALWAYS: the pad is always available
@GST_PAD_SOMETIMES: the pad will become available depending on the media stream
@GST_PAD_REQUEST: th pad is only available on request with
gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
@object:
@name_template:
@direction:
@presence:
@caps:
Get a handle to the padtemplate #GstCaps
@templ: the template to query
Get the direction of the padtemplate.
@templ: the template to query
Get the nametemplate of the padtemplate.
@templ: the template to query
Get the presence of the padtemplate.
@templ: the template to query
Create a new padtemplate.
@padname: the nametemplate for the pads that will be created with this template
@dir: the direction of the pads.
@pres: the presence of the pads.
@a...: the capabilities of this padtemplate usually created with GST_CAPS_NEW()
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.
@name: th name of the factory
@padname: the nametemplate of the pads
@dir: the direction of the pads.
@pres: the presence of the pads.
@a...: the capabilities of this padtemplate, usually created with GST_CAPS_NEW()
Get the padtemplate of the factory created with GST_PADTEMPLATE_FACTORY()
@fact: the factory name to get the padtemplate from.
@name_template:
@direction:
@presence:
@caps:
@Varargs:
@Returns:
@parent:
@Returns:
@templ:
@parent:
@Returns:
@templ:
@Returns:
@templ:
@name:
@Returns: