1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 Describe the media type of a pad.
7 <!-- ##### SECTION Long_Description ##### -->
9 Padtemplates describe the possible media types a pad or an elementfactory can
13 Pad and PadTemplates have #GstCaps attached to it to describe the media type they
14 are capable of dealing with. gst_padtemplate_get_caps() is used to get the
15 caps of a padtemplate. It's not possible to modify the caps of a padtemplate after
19 Padtemplates can be created with gst_padtemplate_new() or with the convenient
20 GST_PADTEMPLATE_FACTORY() macro. A padtemplate can be used to create a pad or
21 to add to an elementfactory.
24 The following code example shows the code to create a pad from a padtemplate.
26 GST_PADTEMPLATE_FACTORY (my_template_factory,
27 "sink", /* the name of the pad */
28 GST_PAD_SINK, /* the direction of the pad */
29 GST_PAD_ALWAYS, /* when this pad will be present */
30 GST_CAPS_NEW ( /* the capabilities of the padtemplate */
33 "format", GST_PROPS_STRING ("int"),
34 "channels", GST_PROPS_INT_RANGE (1, 6)
43 pad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (my_template_factory), "sink");
49 The following example shows you how to add the padtemplate to an elementfactory:
52 my_factory_init (GstPlugin *plugin)
54 GstElementFactory *factory;
56 factory = gst_elementfactory_new ("my_factory", GST_TYPE_MYFACTORY, &gst_myfactory_details);
57 g_return_val_if_fail (factory != NULL, FALSE);
59 gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (my_template_factory));
61 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
69 <!-- ##### SECTION See_Also ##### -->
71 #GstPad, #GstElementFactory
74 <!-- ##### ENUM GstPadPresence ##### -->
76 Indicates when this pad will become available.
79 @GST_PAD_ALWAYS: the pad is always available
80 @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
81 @GST_PAD_REQUEST: th pad is only available on request with
82 gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
84 <!-- ##### STRUCT GstPadTemplate ##### -->
90 <!-- ##### MACRO GST_PADTEMPLATE_CAPS ##### -->
92 Get a handle to the padtemplate #GstCaps
95 @templ: the template to query
98 <!-- ##### MACRO GST_PADTEMPLATE_DIRECTION ##### -->
100 Get the direction of the padtemplate.
103 @templ: the template to query
106 <!-- ##### MACRO GST_PADTEMPLATE_NAME_TEMPLATE ##### -->
108 Get the nametemplate of the padtemplate.
111 @templ: the template to query
114 <!-- ##### MACRO GST_PADTEMPLATE_PRESENCE ##### -->
116 Get the presence of the padtemplate.
119 @templ: the template to query
122 <!-- ##### MACRO GST_PADTEMPLATE_NEW ##### -->
124 Create a new padtemplate.
127 @padname: the nametemplate for the pads that will be created with this template
128 @dir: the direction of the pads.
129 @pres: the presence of the pads.
130 @a...: the capabilities of this padtemplate usually created with GST_CAPS_NEW()
133 <!-- ##### MACRO GST_PADTEMPLATE_FACTORY ##### -->
135 Create a factory for a padtemplate. This can be used if you only want one instance
136 of the padtemplate. Use GST_PADTEMPLATE_GET() to get the unique padtemplate.
139 @name: th name of the factory
140 @padname: the nametemplate of the pads
141 @dir: the direction of the pads.
142 @pres: the presence of the pads.
143 @a...: the capabilities of this padtemplate, usually created with GST_CAPS_NEW()
146 <!-- ##### MACRO GST_PADTEMPLATE_GET ##### -->
148 Get the padtemplate of the factory created with GST_PADTEMPLATE_FACTORY()
151 @fact: the factory name to get the padtemplate from.
154 <!-- ##### FUNCTION gst_padtemplate_new ##### -->
167 <!-- ##### FUNCTION gst_padtemplate_load_thyself ##### -->
176 <!-- ##### FUNCTION gst_padtemplate_save_thyself ##### -->
186 <!-- ##### FUNCTION gst_padtemplate_get_caps ##### -->
195 <!-- ##### FUNCTION gst_padtemplate_get_caps_by_name ##### -->
205 <!-- ##### SIGNAL GstPadTemplate::pad-created ##### -->
210 @gstpadtemplate: the object which received the signal.