Updated the API docs
[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_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
16 creation. 
17 </para>
18 <para>
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.
22 </para>
23 <para>
24 The following code example shows the code to create a pad from a padtemplate.
25 <programlisting>
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 */
31       "my_caps",
32       "audio/raw",
33         "format",       GST_PROPS_STRING ("int"),
34         "channels",     GST_PROPS_INT_RANGE (1, 6)
35     )
36   )
37
38   void
39   my_method (void) 
40   {
41     GstPad *pad;
42   
43     pad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (my_template_factory), "sink");
44     ...
45   }
46 </programlisting>
47 </para>
48 <para>
49 The following example shows you how to add the padtemplate to an elementfactory:
50 <programlisting>
51   gboolean
52   my_factory_init (GstPlugin *plugin)
53   {
54     GstElementFactory *factory;
55
56     factory = gst_elementfactory_new ("my_factory", GST_TYPE_MYFACTORY, &amp;gst_myfactory_details);
57     g_return_val_if_fail (factory != NULL, FALSE);
58
59     gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (my_template_factory));
60
61     gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
62
63     return TRUE;
64   }
65
66 </programlisting>
67 </para>
68
69 <!-- ##### SECTION See_Also ##### -->
70 <para>
71 #GstPad, #GstElementFactory
72 </para>
73
74 <!-- ##### ENUM GstPadPresence ##### -->
75 <para>
76 Indicates when this pad will become available.
77 </para>
78
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().
83
84 <!-- ##### STRUCT GstPadTemplate ##### -->
85 <para>
86
87 </para>
88
89 @object: 
90 @name_template: 
91 @direction: 
92 @presence: 
93 @caps: 
94
95 <!-- ##### MACRO GST_PADTEMPLATE_CAPS ##### -->
96 <para>
97 Get a handle to the padtemplate #GstCaps
98 </para>
99
100 @templ: the template to query
101
102
103 <!-- ##### MACRO GST_PADTEMPLATE_DIRECTION ##### -->
104 <para>
105 Get the direction of the padtemplate.
106 </para>
107
108 @templ: the template to query
109
110
111 <!-- ##### MACRO GST_PADTEMPLATE_NAME_TEMPLATE ##### -->
112 <para>
113 Get the nametemplate of the padtemplate.
114 </para>
115
116 @templ: the template to query
117
118
119 <!-- ##### MACRO GST_PADTEMPLATE_PRESENCE ##### -->
120 <para>
121 Get the presence of the padtemplate.
122 </para>
123
124 @templ: the template to query
125
126
127 <!-- ##### MACRO GST_PADTEMPLATE_NEW ##### -->
128 <para>
129 Create a new padtemplate.
130 </para>
131
132 @padname: the nametemplate for the pads that will be created with this template
133 @dir: the direction of the pads.
134 @pres: the presence of the pads.
135 @a...: the capabilities of this padtemplate usually created with GST_CAPS_NEW()
136
137
138 <!-- ##### MACRO GST_PADTEMPLATE_FACTORY ##### -->
139 <para>
140 Create a factory for a padtemplate. This can be used if you only want one instance
141 of the padtemplate. Use GST_PADTEMPLATE_GET() to get the unique padtemplate.
142 </para>
143
144 @name: th name of the factory
145 @padname: the nametemplate of the pads
146 @dir: the direction of the pads.
147 @pres: the presence of the pads.
148 @a...: the capabilities of this padtemplate, usually created with GST_CAPS_NEW()
149
150
151 <!-- ##### MACRO GST_PADTEMPLATE_GET ##### -->
152 <para>
153 Get the padtemplate of the factory created with GST_PADTEMPLATE_FACTORY()
154 </para>
155
156 @fact: the factory name to get the padtemplate from.
157
158
159 <!-- ##### FUNCTION gst_padtemplate_new ##### -->
160 <para>
161
162 </para>
163
164 @name_template: 
165 @direction: 
166 @presence: 
167 @caps: 
168 @Varargs: 
169 @Returns: 
170
171
172 <!-- ##### FUNCTION gst_padtemplate_load_thyself ##### -->
173 <para>
174
175 </para>
176
177 @parent: 
178 @Returns: 
179
180
181 <!-- ##### FUNCTION gst_padtemplate_save_thyself ##### -->
182 <para>
183
184 </para>
185
186 @templ: 
187 @parent: 
188 @Returns: 
189
190
191 <!-- ##### FUNCTION gst_padtemplate_get_caps ##### -->
192 <para>
193
194 </para>
195
196 @templ: 
197 @Returns: 
198
199
200 <!-- ##### FUNCTION gst_padtemplate_get_caps_by_name ##### -->
201 <para>
202
203 </para>
204
205 @templ: 
206 @name: 
207 @Returns: 
208
209