gst.pad_template

Module for [PadTemplate] class

Types 3

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 #GstCaps attached to it to describe the media type they are capable of dealing with. [gst.pad_template.PadTemplate.getCaps] 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 #GstPadPresence 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 #GstPadTemplate 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.Element.requestPadSimple] call to instantiate a pad from this template.

Padtemplates can be created with [gst.pad_template.PadTemplate.new_] or with gst_static_pad_template_get (), which creates a #GstPadTemplate from a #GstStaticPadTemplate that can be filled with the convenient GST_STATIC_PAD_TEMPLATE() macro.

A padtemplate can be used to create a pad (see [gst.pad.Pad.newFromTemplate] or gst_pad_new_from_static_template ()) or to add to an element class (see gst_element_class_add_static_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, "
       "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 class_init of the class:

static void
 my_element_class_init (GstMyElementClass *klass)
 {
   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);

   gst_element_class_add_static_pad_template (gstelement_class, &my_template);
 }

Methods
GType _gType() @property
PadTemplate self()Returns `this`, for use in `with` statements.
PadTemplateGidBuilder builder()Get builder for [gst.pad_template.PadTemplate] Returns: New builder object
gst.caps.Caps caps() @propertyGet `caps` property. Returns: The capabilities of the pad described by the pad template.
gst.types.PadDirection direction() @propertyGet `direction` property. Returns: The direction of the pad described by the pad template.
gobject.types.GType gtype() @propertyGet `gtype` property. Returns: The type of the pad described by the pad template.
string nameTemplate() @propertyGet `nameTemplate` property. Returns: The name template of the pad template.
gst.types.PadPresence presence() @propertyGet `presence` property. Returns: When the pad described by the pad template will become available.
gst.pad_template.PadTemplate newFromStaticPadTemplateWithGtype(gst.static_pad_template.StaticPadTemplate padTemplate, gobject.types.GType padType)Converts a #GstStaticPadTemplate into a #GstPadTemplate with a type.
gst.pad_template.PadTemplate newWithGtype(string nameTemplate, gst.types.PadDirection direction, gst.types.PadPresence presence, gst.caps.Caps caps, gobject.types.GType padType)Creates a new pad template with a name according to the given template and with the given arguments.
gst.caps.Caps getCaps()Gets the capabilities of the pad template. Returns: the #GstCaps of the pad template. Unref after usage.
gst.caps.Caps getDocumentationCaps()See [gst.padtemplate.PadTemplate.setDocumentationCaps]. Returns: The caps to document. For convenience, this will return [gst.padtemplate.PadTemplate.getCaps] when no documentation caps were set.
void padCreated(gst.pad.Pad pad)Emit the pad-created signal for this template when created by this pad.
void setDocumentationCaps(gst.caps.Caps caps)Certain elements will dynamically construct the caps of their pad templates. In order not to let environment-specific information into the documentation, element authors should use this method to e...
gulong connectPadCreated(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gst.pad.Pad))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gst.pad_template.PadTemplate))) && Parameters!T.length < 3)Connect to `PadCreated` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this(string nameTemplate, gst.types.PadDirection direction, gst.types.PadPresence presence, gst.caps.Caps caps)Creates a new pad template with a name according to the given template and with the given arguments.
Methods
T caps(gst.caps.Caps propval)Set `caps` property. Params: propval = The capabilities of the pad described by the pad template. Returns: Builder instance for fluent chaining
T direction(gst.types.PadDirection propval)Set `direction` property. Params: propval = The direction of the pad described by the pad template. Returns: Builder instance for fluent chaining
T gtype(gobject.types.GType propval)Set `gtype` property. Params: propval = The type of the pad described by the pad template. Returns: Builder instance for fluent chaining
T nameTemplate(string propval)Set `nameTemplate` property. Params: propval = The name template of the pad template. Returns: Builder instance for fluent chaining
T presence(gst.types.PadPresence propval)Set `presence` property. Params: propval = When the pad described by the pad template will become available. Returns: Builder instance for fluent chaining

Fluent builder for [gst.pad_template.PadTemplate]