Describe the media type of a pad.
Padtemplates describe the possible media types a pad or an elementfactory can handle. This allows for both inspection of handled types before loading the element plugin as well as identifying pads on elements that are not yet created (request or sometimes pads).
Pad and PadTemplates have <gst-caps>
attached to it to describe the media
type they are capable of dealing with. gst-pad-template-get-caps
or
gst-pad-template-caps
are used to get the caps of a padtemplate. It's not
possible to modify the caps of a padtemplate after creation.
PadTemplates have a <gst-pad-presence>
property which identifies the
lifetime of the pad and that can be retrieved with
gst-pad-template-presence
. Also the direction of the pad can be retrieved
from the <gst-pad-template>
with gst-pad-template-direction
.
The gst-pad-template-name-template
is important for GST_PAD_REQUEST pads
because it has to be used as the name in the
gst-element-request-pad-by-name
call to instantiate a pad from this
template.
Padtemplates can be created with gst-pad-template-new
or with
gst-static-pad-template-get
, which creates a <gst-pad-template>
from a <gst-static-pad-template>
that can be filled with the convenient
gst-static-pad-template
macro.
A padtemplate can be used to create a pad (see gst-pad-new-from-template
or gst-pad-new-from-static-template
) or to add to an element class (see
gst-element-class-add-pad-template
).
The following code example shows the code to create a pad from a padtemplate.
GstStaticPadTemplate my_template = GST_STATIC_PAD_TEMPLATE ( "sink", // the name of the pad GST_PAD_SINK, // the direction of the pad GST_PAD_ALWAYS, // when this pad will be present GST_STATIC_CAPS ( // the capabilities of the padtemplate "audio/x-raw-int, " "channels = (int) [ 1, 6 ]" ) ) void my_method (void) { GstPad *pad; pad = gst_pad_new_from_static_template (&my_template, "sink"); ... }
The following example shows you how to add the padtemplate to an element class, this is usually done in the base_init of the class:
static void my_element_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&my_template)); }
Last reviewed on 2006-02-14 (0.10.3)
This
<gobject>
class defines no properties, other than those defined by its superclasses.
<gst-pad>
)This signal is fired when an element creates a pad from this template.
<gst-static-pad-template*>
) (ret <gst-pad-template>
)Converts a
<gst-static-pad-template>
into a<gst-pad-template>
.
- pad-template
- the static pad template
- ret
- a new
<gst-pad-template>
.
<gst-static-pad-template*>
) (ret <gst-caps>
)Gets the capabilities of the static pad template.
- templ
- a
<gst-static-pad-template>
to get capabilities of.- ret
- the
<gst-caps>
of the static pad template. If you need to keep a reference to the caps, take a ref (seegst-caps-ref
).
mchars
) (direction <gst-pad-direction>
) (presence <gst-pad-presence>
) (caps <gst-caps>
) (ret <gst-pad-template>
)Creates a new pad template with a name according to the given template and with the given arguments. This functions takes ownership of the provided caps, so be sure to not use them afterwards.
- name-template
- the name template.
- direction
- the
<gst-pad-direction>
of the template.- presence
- the
<gst-pad-presence>
of the pad.- caps
- a
<gst-caps>
set for the template. The caps are taken ownership of.- ret
- a new
<gst-pad-template>
.
<gst-pad-template>
) (ret <gst-caps>
)Gets the capabilities of the pad template.
- templ
- a
<gst-pad-template>
to get capabilities of.- ret
- the
<gst-caps>
of the pad template. If you need to keep a reference to the caps, take a ref (seegst-caps-ref
).