GstPadTemplate
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_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 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_request_pad_simple 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 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_new_from_template 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);
}
GstPadTemplate
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstPadTemplate
The padtemplate object.
Members
object
(GstObject)
–
name_template
(gchar *)
–
direction
(GstPadDirection)
–
presence
(GstPadPresence)
–
caps
(GstCaps *)
–
ABI._gst_reserved
(gpointer *)
–
ABI.abi.gtype
(GType)
–
ABI.abi.documentation_caps
(GstCaps *)
–
Class structure
Gst.PadTemplate
GObject.Object ╰──GObject.InitiallyUnowned ╰──Gst.Object ╰──Gst.PadTemplate
The padtemplate object.
Members
object
(Gst.Object)
–
name_template
(String)
–
direction
(Gst.PadDirection)
–
presence
(Gst.PadPresence)
–
caps
(Gst.Caps)
–
Gst.PadTemplate
GObject.Object ╰──GObject.InitiallyUnowned ╰──Gst.Object ╰──Gst.PadTemplate
The padtemplate object.
Members
object
(Gst.Object)
–
name_template
(str)
–
direction
(Gst.PadDirection)
–
presence
(Gst.PadPresence)
–
caps
(Gst.Caps)
–
Constructors
gst_pad_template_new
GstPadTemplate * gst_pad_template_new (const gchar * name_template, GstPadDirection direction, GstPadPresence presence, GstCaps * caps)
Creates a new pad template with a name according to the given template and with the given arguments.
Parameters:
name_template
–
the name template.
direction
–
the GstPadDirection of the template.
presence
–
the GstPadPresence of the pad.
caps
(
[transfer: none])
–
a GstCaps set for the template.
a new GstPadTemplate.
Gst.PadTemplate.prototype.new
function Gst.PadTemplate.prototype.new(name_template: String, direction: Gst.PadDirection, presence: Gst.PadPresence, caps: Gst.Caps): {
// javascript wrapper for 'gst_pad_template_new'
}
Creates a new pad template with a name according to the given template and with the given arguments.
Parameters:
the name template.
the Gst.PadDirection of the template.
the Gst.PadPresence of the pad.
a new Gst.PadTemplate.
Gst.PadTemplate.new
def Gst.PadTemplate.new (name_template, direction, presence, caps):
#python wrapper for 'gst_pad_template_new'
Creates a new pad template with a name according to the given template and with the given arguments.
Parameters:
the name template.
the Gst.PadDirection of the template.
the Gst.PadPresence of the pad.
a new Gst.PadTemplate.
gst_pad_template_new_from_static_pad_template_with_gtype
GstPadTemplate * gst_pad_template_new_from_static_pad_template_with_gtype (GstStaticPadTemplate * pad_template, GType pad_type)
Converts a GstStaticPadTemplate into a GstPadTemplate with a type.
a new GstPadTemplate.
Since : 1.14
Gst.PadTemplate.prototype.new_from_static_pad_template_with_gtype
function Gst.PadTemplate.prototype.new_from_static_pad_template_with_gtype(pad_template: Gst.StaticPadTemplate, pad_type: GObject.Type): {
// javascript wrapper for 'gst_pad_template_new_from_static_pad_template_with_gtype'
}
Converts a Gst.StaticPadTemplate into a Gst.PadTemplate with a type.
a new Gst.PadTemplate.
Since : 1.14
Gst.PadTemplate.new_from_static_pad_template_with_gtype
def Gst.PadTemplate.new_from_static_pad_template_with_gtype (pad_template, pad_type):
#python wrapper for 'gst_pad_template_new_from_static_pad_template_with_gtype'
Converts a Gst.StaticPadTemplate into a Gst.PadTemplate with a type.
a new Gst.PadTemplate.
Since : 1.14
gst_pad_template_new_with_gtype
GstPadTemplate * gst_pad_template_new_with_gtype (const gchar * name_template, GstPadDirection direction, GstPadPresence presence, GstCaps * caps, GType pad_type)
Creates a new pad template with a name according to the given template and with the given arguments.
Parameters:
name_template
–
the name template.
direction
–
the GstPadDirection of the template.
presence
–
the GstPadPresence of the pad.
caps
(
[transfer: none])
–
a GstCaps set for the template.
pad_type
–
The GType of the pad to create
a new GstPadTemplate.
Since : 1.14
Gst.PadTemplate.prototype.new_with_gtype
function Gst.PadTemplate.prototype.new_with_gtype(name_template: String, direction: Gst.PadDirection, presence: Gst.PadPresence, caps: Gst.Caps, pad_type: GObject.Type): {
// javascript wrapper for 'gst_pad_template_new_with_gtype'
}
Creates a new pad template with a name according to the given template and with the given arguments.
Parameters:
the name template.
the Gst.PadDirection of the template.
the Gst.PadPresence of the pad.
The GObject.Type of the pad to create
a new Gst.PadTemplate.
Since : 1.14
Gst.PadTemplate.new_with_gtype
def Gst.PadTemplate.new_with_gtype (name_template, direction, presence, caps, pad_type):
#python wrapper for 'gst_pad_template_new_with_gtype'
Creates a new pad template with a name according to the given template and with the given arguments.
Parameters:
the name template.
the Gst.PadDirection of the template.
the Gst.PadPresence of the pad.
The GObject.Type of the pad to create
a new Gst.PadTemplate.
Since : 1.14
Methods
gst_pad_template_get_caps
GstCaps * gst_pad_template_get_caps (GstPadTemplate * templ)
Gets the capabilities of the pad template.
Parameters:
templ
–
a GstPadTemplate to get capabilities of.
the GstCaps of the pad template. Unref after usage.
Gst.PadTemplate.prototype.get_caps
function Gst.PadTemplate.prototype.get_caps(): {
// javascript wrapper for 'gst_pad_template_get_caps'
}
Gets the capabilities of the pad template.
Parameters:
a Gst.PadTemplate to get capabilities of.
Gst.PadTemplate.get_caps
def Gst.PadTemplate.get_caps (self):
#python wrapper for 'gst_pad_template_get_caps'
Gets the capabilities of the pad template.
Parameters:
a Gst.PadTemplate to get capabilities of.
gst_pad_template_get_documentation_caps
GstCaps * gst_pad_template_get_documentation_caps (GstPadTemplate * templ)
See gst_pad_template_set_documentation_caps.
Parameters:
templ
–
the pad template to get documented capabilities on
The caps to document. For convenience, this will return gst_pad_template_get_caps when no documentation caps were set.
Since : 1.18
Gst.PadTemplate.prototype.get_documentation_caps
function Gst.PadTemplate.prototype.get_documentation_caps(): {
// javascript wrapper for 'gst_pad_template_get_documentation_caps'
}
See Gst.PadTemplate.prototype.set_documentation_caps.
Parameters:
the pad template to get documented capabilities on
The caps to document. For convenience, this will return Gst.PadTemplate.prototype.get_caps when no documentation caps were set.
Since : 1.18
Gst.PadTemplate.get_documentation_caps
def Gst.PadTemplate.get_documentation_caps (self):
#python wrapper for 'gst_pad_template_get_documentation_caps'
See Gst.PadTemplate.set_documentation_caps.
Parameters:
the pad template to get documented capabilities on
The caps to document. For convenience, this will return Gst.PadTemplate.get_caps when no documentation caps were set.
Since : 1.18
gst_pad_template_pad_created
gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad)
Emit the pad-created signal for this template when created by this pad.
Gst.PadTemplate.prototype.pad_created
function Gst.PadTemplate.prototype.pad_created(pad: Gst.Pad): {
// javascript wrapper for 'gst_pad_template_pad_created'
}
Emit the pad-created signal for this template when created by this pad.
Parameters:
a Gst.PadTemplate that has been created
Gst.PadTemplate.pad_created
def Gst.PadTemplate.pad_created (self, pad):
#python wrapper for 'gst_pad_template_pad_created'
Emit the pad-created signal for this template when created by this pad.
Parameters:
a Gst.PadTemplate that has been created
gst_pad_template_set_documentation_caps
gst_pad_template_set_documentation_caps (GstPadTemplate * templ, GstCaps * 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 expose "stable" caps to the reader.
Parameters:
templ
–
the pad template to set documented capabilities on
caps
(
[transfer: none])
–
the documented capabilities
Since : 1.18
Gst.PadTemplate.prototype.set_documentation_caps
function Gst.PadTemplate.prototype.set_documentation_caps(caps: Gst.Caps): {
// javascript wrapper for 'gst_pad_template_set_documentation_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 expose "stable" caps to the reader.
Parameters:
the pad template to set documented capabilities on
the documented capabilities
Since : 1.18
Gst.PadTemplate.set_documentation_caps
def Gst.PadTemplate.set_documentation_caps (self, caps):
#python wrapper for 'gst_pad_template_set_documentation_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 expose "stable" caps to the reader.
Parameters:
the pad template to set documented capabilities on
the documented capabilities
Since : 1.18
Signals
pad-created
pad_created_callback (GstPadTemplate * self, GstPad * pad, gpointer user_data)
This signal is fired when an element creates a pad from this template.
Parameters:
self
–
pad
–
the pad that was created.
user_data
–
Flags: Run Last
pad-created
function pad_created_callback(self: Gst.PadTemplate, pad: Gst.Pad, user_data: Object): {
// javascript callback for the 'pad-created' signal
}
This signal is fired when an element creates a pad from this template.
Parameters:
the pad that was created.
Flags: Run Last
pad-created
def pad_created_callback (self, pad, *user_data):
#python callback for the 'pad-created' signal
This signal is fired when an element creates a pad from this template.
Parameters:
the pad that was created.
Flags: Run Last
Properties
caps
“caps” GstCaps *
The capabilities of the pad described by the pad template.
Flags : Read / Write / Construct Only
caps
“caps” Gst.Caps
The capabilities of the pad described by the pad template.
Flags : Read / Write / Construct Only
caps
“self.props.caps” Gst.Caps
The capabilities of the pad described by the pad template.
Flags : Read / Write / Construct Only
direction
“direction” GstPadDirection *
The direction of the pad described by the pad template.
Flags : Read / Write / Construct Only
direction
“direction” Gst.PadDirection
The direction of the pad described by the pad template.
Flags : Read / Write / Construct Only
direction
“self.props.direction” Gst.PadDirection
The direction of the pad described by the pad template.
Flags : Read / Write / Construct Only
gtype
“gtype” GType
The type of the pad described by the pad template.
Flags : Read / Write / Construct Only
Since : 1.14
gtype
“gtype” GObject.Type
The type of the pad described by the pad template.
Flags : Read / Write / Construct Only
Since : 1.14
gtype
“self.props.gtype” GObject.Type
The type of the pad described by the pad template.
Flags : Read / Write / Construct Only
Since : 1.14
name-template
“name-template” gchar *
The name template of the pad template.
Flags : Read / Write / Construct Only
name-template
“name-template” String
The name template of the pad template.
Flags : Read / Write / Construct Only
name_template
“self.props.name_template” str
The name template of the pad template.
Flags : Read / Write / Construct Only
presence
“presence” GstPadPresence *
When the pad described by the pad template will become available.
Flags : Read / Write / Construct Only
presence
“presence” Gst.PadPresence
When the pad described by the pad template will become available.
Flags : Read / Write / Construct Only
presence
“self.props.presence” Gst.PadPresence
When the pad described by the pad template will become available.
Flags : Read / Write / Construct Only
Virtual Methods
pad_created
pad_created (GstPadTemplate * templ, GstPad * pad)
Parameters:
templ
–
pad
–
vfunc_pad_created
function vfunc_pad_created(templ: Gst.PadTemplate, pad: Gst.Pad): {
// javascript implementation of the 'pad_created' virtual method
}
Parameters:
do_pad_created
def do_pad_created (templ, pad):
#python implementation of the 'pad_created' virtual method
Parameters:
GstStaticPadTemplate
Structure describing the GstStaticPadTemplate.
Members
name_template
(const gchar *)
–
the name of the template
direction
(GstPadDirection)
–
the direction of the template
presence
(GstPadPresence)
–
the presence of the template
static_caps
(GstStaticCaps)
–
the caps of the template.
Gst.StaticPadTemplate
Structure describing the Gst.StaticPadTemplate.
Members
name_template
(String)
–
the name of the template
direction
(Gst.PadDirection)
–
the direction of the template
presence
(Gst.PadPresence)
–
the presence of the template
static_caps
(Gst.StaticCaps)
–
the caps of the template.
Gst.StaticPadTemplate
Structure describing the Gst.StaticPadTemplate.
Members
name_template
(str)
–
the name of the template
direction
(Gst.PadDirection)
–
the direction of the template
presence
(Gst.PadPresence)
–
the presence of the template
static_caps
(Gst.StaticCaps)
–
the caps of the template.
Methods
gst_static_pad_template_get
GstPadTemplate * gst_static_pad_template_get (GstStaticPadTemplate * pad_template)
Converts a GstStaticPadTemplate into a GstPadTemplate.
Parameters:
pad_template
–
the static pad template
a new GstPadTemplate.
Gst.StaticPadTemplate.prototype.get
function Gst.StaticPadTemplate.prototype.get(): {
// javascript wrapper for 'gst_static_pad_template_get'
}
Converts a Gst.StaticPadTemplate into a Gst.PadTemplate.
Parameters:
the static pad template
a new Gst.PadTemplate.
Gst.StaticPadTemplate.get
def Gst.StaticPadTemplate.get (self):
#python wrapper for 'gst_static_pad_template_get'
Converts a Gst.StaticPadTemplate into a Gst.PadTemplate.
Parameters:
the static pad template
a new Gst.PadTemplate.
gst_static_pad_template_get_caps
GstCaps * gst_static_pad_template_get_caps (GstStaticPadTemplate * templ)
Gets the capabilities of the static pad template.
Parameters:
templ
–
a GstStaticPadTemplate to get capabilities of.
the GstCaps of the static pad template. Unref after usage. Since the core holds an additional ref to the returned caps, use gst_caps_make_writable on the returned caps to modify it.
Gst.StaticPadTemplate.prototype.get_caps
function Gst.StaticPadTemplate.prototype.get_caps(): {
// javascript wrapper for 'gst_static_pad_template_get_caps'
}
Gets the capabilities of the static pad template.
Parameters:
a Gst.StaticPadTemplate to get capabilities of.
the Gst.Caps of the static pad template. Unref after usage. Since the core holds an additional ref to the returned caps, use gst_caps_make_writable (not introspectable) on the returned caps to modify it.
Gst.StaticPadTemplate.get_caps
def Gst.StaticPadTemplate.get_caps (self):
#python wrapper for 'gst_static_pad_template_get_caps'
Gets the capabilities of the static pad template.
Parameters:
a Gst.StaticPadTemplate to get capabilities of.
the Gst.Caps of the static pad template. Unref after usage. Since the core holds an additional ref to the returned caps, use gst_caps_make_writable (not introspectable) on the returned caps to modify it.
Function Macros
GST_PAD_TEMPLATE_CAPS
#define GST_PAD_TEMPLATE_CAPS(templ) (((GstPadTemplate *)(templ))->caps)
Get a handle to the padtemplate GstCaps
Parameters:
templ
–
the template to query
GST_PAD_TEMPLATE_DIRECTION
#define GST_PAD_TEMPLATE_DIRECTION(templ) (((GstPadTemplate *)(templ))->direction)
Get the GstPadDirection of the padtemplate.
Parameters:
templ
–
the template to query
GST_PAD_TEMPLATE_GTYPE
#define GST_PAD_TEMPLATE_GTYPE(templ) (((GstPadTemplate *)(templ))->ABI.abi.gtype)
Get the GType of the padtemplate
Parameters:
templ
–
the template to query
Since : 1.14
GST_PAD_TEMPLATE_IS_FIXED
#define GST_PAD_TEMPLATE_IS_FIXED(templ) (GST_OBJECT_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
Check if the properties of the padtemplate are fixed
Parameters:
templ
–
the template to query
GST_PAD_TEMPLATE_NAME_TEMPLATE
#define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ) (((GstPadTemplate *)(templ))->name_template)
Get the nametemplate of the padtemplate.
Parameters:
templ
–
the template to query
GST_PAD_TEMPLATE_PRESENCE
#define GST_PAD_TEMPLATE_PRESENCE(templ) (((GstPadTemplate *)(templ))->presence)
Get the GstPadPresence of the padtemplate.
Parameters:
templ
–
the template to query
GST_STATIC_PAD_TEMPLATE
#define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \ { \ /* name_template */ padname, \ /* direction */ dir, \ /* presence */ pres, \ /* caps */ caps \ }
Convenience macro to fill the values of a GstStaticPadTemplate structure. Example:
static GstStaticPadTemplate my_src_template = \
GST_STATIC_PAD_TEMPLATE("src", GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
Parameters:
padname
–
the name template of the pad
dir
–
the GstPadDirection of the pad
pres
–
the GstPadPresence of the pad
caps
–
the GstStaticCaps of the pad
Enumerations
GstPadPresence
Indicates when this pad will become available.
Members
GST_PAD_ALWAYS
(0)
–
the pad is always available
GST_PAD_SOMETIMES
(1)
–
the pad will become available depending on the media stream
GST_PAD_REQUEST
(2)
–
the pad is only available on request with gst_element_request_pad.
Gst.PadPresence
Indicates when this pad will become available.
Members
Gst.PadPresence.ALWAYS
(0)
–
the pad is always available
Gst.PadPresence.SOMETIMES
(1)
–
the pad will become available depending on the media stream
Gst.PadPresence.REQUEST
(2)
–
the pad is only available on request with Gst.Element.prototype.request_pad.
Gst.PadPresence
Indicates when this pad will become available.
Members
Gst.PadPresence.ALWAYS
(0)
–
the pad is always available
Gst.PadPresence.SOMETIMES
(1)
–
the pad will become available depending on the media stream
Gst.PadPresence.REQUEST
(2)
–
the pad is only available on request with Gst.Element.request_pad.
GstPadTemplateFlags
Flags for the padtemplate
Members
GST_PAD_TEMPLATE_FLAG_LAST
(256)
–
first flag that can be used by subclasses.
Gst.PadTemplateFlags
Flags for the padtemplate
Members
Gst.PadTemplateFlags.LAST
(256)
–
first flag that can be used by subclasses.
Gst.PadTemplateFlags
Flags for the padtemplate
Members
Gst.PadTemplateFlags.LAST
(256)
–
first flag that can be used by subclasses.
The results of the search are