notes on documenting elements and plugins
[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 <example>
26 <title>Create a pad from a padtemplate</title>
27   <programlisting>
28   GstStaticPadTemplate my_template =
29   GST_STATIC_PAD_TEMPLATE (
30     "sink",             /* the name of the pad */
31     GST_PAD_SINK,       /* the direction of the pad */
32     GST_PAD_ALWAYS,     /* when this pad will be present */
33     GST_STATIC_CAPS (   /* the capabilities of the padtemplate */
34       "audio/x-raw-int, "
35         "channels = (int) [ 1, 6 ]"
36     )
37   )
38
39   void
40   my_method (void) 
41   {
42     GstPad *pad;
43   
44     pad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (my_template_factory), "sink");
45     ...
46   }
47   </programlisting>
48 </example>
49 </para>
50 <para>
51 The following example shows you how to add the padtemplate to an elementfactory:
52 <programlisting>
53   gboolean
54   my_factory_init (GstPlugin *plugin)
55   {
56     GstElementFactory *factory;
57
58     factory = gst_element_factory_new ("my_factory", GST_TYPE_MYFACTORY, &amp;gst_myfactory_details);
59     g_return_val_if_fail (factory != NULL, FALSE);
60
61     gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (my_template_factory));
62
63     gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
64
65     return TRUE;
66   }
67
68 </programlisting>
69 </para>
70
71 <!-- ##### SECTION See_Also ##### -->
72 <para>
73 #GstPad, #GstElementFactory
74 </para>
75
76 <!-- ##### STRUCT GstPadTemplate ##### -->
77 <para>
78 The padtemplate object.
79 </para>
80
81
82 <!-- ##### SIGNAL GstPadTemplate::pad-created ##### -->
83 <para>
84 This signal is fired when an element creates a pad from this 
85 template.
86 </para>
87
88 @gstpadtemplate: the object which received the signal.
89 @arg1: The pad that was created.
90
91 <!-- ##### STRUCT GstStaticPadTemplate ##### -->
92 <para>
93
94 </para>
95
96 @name_template: 
97 @direction: 
98 @presence: 
99 @static_caps: 
100
101 <!-- ##### MACRO GST_IS_PAD_FAST ##### -->
102 <para>
103
104 </para>
105
106 @obj: 
107
108
109 <!-- ##### MACRO GST_PAD_TEMPLATE_NAME_TEMPLATE ##### -->
110 <para>
111 Get the nametemplate of the padtemplate.
112 </para>
113
114 @templ: the template to query
115
116
117 <!-- ##### MACRO GST_PAD_TEMPLATE_DIRECTION ##### -->
118 <para>
119 Get the direction of the padtemplate.
120 </para>
121
122 @templ: the template to query
123
124
125 <!-- ##### MACRO GST_PAD_TEMPLATE_PRESENCE ##### -->
126 <para>
127 Get the presence of the padtemplate.
128 </para>
129
130 @templ: the template to query
131
132
133 <!-- ##### MACRO GST_PAD_TEMPLATE_CAPS ##### -->
134 <para>
135 Get a handle to the padtemplate #GstCaps
136 </para>
137
138 @templ: the template to query
139
140
141 <!-- ##### MACRO GST_PAD_TEMPLATE_IS_FIXED ##### -->
142 <para>
143 Check if the properties of the padtemplate are fixed
144 </para>
145
146 @templ: the template to query
147
148
149 <!-- ##### ENUM GstPadTemplateFlags ##### -->
150 <para>
151 Flags for the padtemplate
152 </para>
153
154 @GST_PAD_TEMPLATE_FIXED: the padtemplate has no variable properties
155 @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
156
157 <!-- ##### FUNCTION gst_pad_template_new ##### -->
158 <para>
159
160 </para>
161
162 @name_template: 
163 @direction: 
164 @presence: 
165 @caps: 
166 @Returns: 
167 <!-- # Unused Parameters # -->
168 @Varargs: 
169
170
171 <!-- ##### FUNCTION gst_static_pad_template_get ##### -->
172 <para>
173
174 </para>
175
176 @pad_template: 
177 @Returns: 
178 <!-- # Unused Parameters # -->
179 @templ: 
180
181
182 <!-- ##### FUNCTION gst_static_pad_template_get_caps ##### -->
183 <para>
184
185 </para>
186
187 @templ: 
188 @Returns: 
189
190
191 <!-- ##### FUNCTION gst_pad_template_get_caps ##### -->
192 <para>
193
194 </para>
195
196 @templ: 
197 @Returns: 
198
199