0955989f15297e809d8bfc2f12d000b951d3d3d5
[platform/upstream/gstreamer.git] / docs / gst / tmpl / gstpadtemplate.sgml
1 <!-- ##### SECTION Title ##### -->
2 GstPadTemplate
3
4 <!-- ##### SECTION Short_Description ##### -->
5 Describe the media type of a pad.
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 Padtemplates describe the possible media types a pad or an elementfactory can
10 handle. 
11 </para>
12 <para>
13 Pad and PadTemplates have #GstCaps attached to it to describe the media type they
14 are capable of dealing with.  gst_pad_template_get_caps() is used to get the
15 caps of a padtemplate. It's not possible to modify the caps of a padtemplate after
16 creation. 
17 </para>
18 <para>
19 Padtemplates can be created with gst_pad_template_new() or with the convenient
20 GST_PAD_TEMPLATE_FACTORY() macro. A padtemplate can be used to create a pad or 
21 to add to an elementfactory.
22 </para>
23 <para>
24 The following code example shows the code to create a pad from a padtemplate.
25 <programlisting>
26   GstStaticPadTemplate my_template =
27   GST_STATIC_PAD_TEMPLATE (
28     "sink",             /* the name of the pad */
29     GST_PAD_SINK,       /* the direction of the pad */
30     GST_PAD_ALWAYS,     /* when this pad will be present */
31     GST_STATIC_CAPS (   /* the capabilities of the padtemplate */
32       "audio/x-raw-int, "
33         "channels = (int) [ 1, 6 ]"
34     )
35   )
36
37   void
38   my_method (void) 
39   {
40     GstPad *pad;
41   
42     pad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (my_template_factory), "sink");
43     ...
44   }
45 </programlisting>
46 </para>
47 <para>
48 The following example shows you how to add the padtemplate to an elementfactory:
49 <programlisting>
50   gboolean
51   my_factory_init (GstPlugin *plugin)
52   {
53     GstElementFactory *factory;
54
55     factory = gst_element_factory_new ("my_factory", GST_TYPE_MYFACTORY, &amp;gst_myfactory_details);
56     g_return_val_if_fail (factory != NULL, FALSE);
57
58     gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (my_template_factory));
59
60     gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
61
62     return TRUE;
63   }
64
65 </programlisting>
66 </para>
67
68 <!-- ##### SECTION See_Also ##### -->
69 <para>
70 #GstPad, #GstElementFactory
71 </para>
72
73 <!-- ##### ENUM GstPadPresence ##### -->
74 <para>
75 Indicates when this pad will become available.
76 </para>
77
78 @GST_PAD_ALWAYS: the pad is always available
79 @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
80 @GST_PAD_REQUEST: th pad is only available on request with 
81 gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
82
83 <!-- ##### STRUCT GstPadTemplate ##### -->
84 <para>
85 The padtemplate object.
86 </para>
87
88
89 <!-- ##### ENUM GstPadTemplateFlags ##### -->
90 <para>
91 Flags for the padtemplate
92 </para>
93
94 @GST_PAD_TEMPLATE_FIXED: The padtemplate has no variable properties
95 @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
96
97 <!-- ##### MACRO GST_PAD_TEMPLATE_CAPS ##### -->
98 <para>
99 Get a handle to the padtemplate #GstCaps
100 </para>
101
102 @templ: the template to query
103
104
105 <!-- ##### MACRO GST_PAD_TEMPLATE_DIRECTION ##### -->
106 <para>
107 Get the direction of the padtemplate.
108 </para>
109
110 @templ: the template to query
111
112
113 <!-- ##### MACRO GST_PAD_TEMPLATE_NAME_TEMPLATE ##### -->
114 <para>
115 Get the nametemplate of the padtemplate.
116 </para>
117
118 @templ: the template to query
119
120
121 <!-- ##### MACRO GST_PAD_TEMPLATE_PRESENCE ##### -->
122 <para>
123 Get the presence of the padtemplate.
124 </para>
125
126 @templ: the template to query
127
128
129 <!-- ##### MACRO GST_PAD_TEMPLATE_IS_FIXED ##### -->
130 <para>
131 Check if the properties of the padtemplate are fixed
132 </para>
133
134 @templ: the template to query
135
136
137 <!-- ##### FUNCTION gst_pad_template_new ##### -->
138 <para>
139
140 </para>
141
142 @name_template: 
143 @direction: 
144 @presence: 
145 @caps: 
146 @Returns: 
147 <!-- # Unused Parameters # -->
148 @Varargs: 
149
150
151 <!-- ##### FUNCTION gst_pad_template_get_caps ##### -->
152 <para>
153
154 </para>
155
156 @templ: 
157 @Returns: 
158
159
160 <!-- ##### FUNCTION gst_pad_template_get_caps_by_name ##### -->
161 <para>
162
163 </para>
164
165 @templ: 
166 @name: 
167 @Returns: 
168
169
170 <!-- ##### SIGNAL GstPadTemplate::pad-created ##### -->
171 <para>
172 This signal is fired when an element creates a pad from this 
173 template.
174 </para>
175
176 @gstpadtemplate: the object which received the signal.
177 @arg1: The pad that was created.
178