1 | /* GStreamer |
2 | * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> |
3 | * 2000,2004 Wim Taymans <wim@fluendo.com> |
4 | * |
5 | * gstelement.h: Header for GstElement |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Library General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Library General Public |
18 | * License along with this library; if not, write to the |
19 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | * Boston, MA 02111-1307, USA. |
21 | */ |
22 | |
23 | |
24 | #ifndef __GST_ELEMENT_FACTORY_H__ |
25 | #define __GST_ELEMENT_FACTORY_H__ |
26 | |
27 | typedef struct _GstElementFactory GstElementFactory; |
28 | typedef struct _GstElementFactoryClass GstElementFactoryClass; |
29 | |
30 | #include <gst/gstconfig.h> |
31 | #include <gst/gstelement.h> |
32 | #include <gst/gstobject.h> |
33 | #include <gst/gstplugin.h> |
34 | #include <gst/gstpluginfeature.h> |
35 | #include <gst/gstiterator.h> |
36 | |
37 | G_BEGIN_DECLS |
38 | |
39 | /* FIXME 0.11: Move GstElementDetails into a private header and use it internally |
40 | * in GstElementFactory, GstElementClass and the registry |
41 | */ |
42 | |
43 | typedef struct _GstElementDetails GstElementDetails; |
44 | |
45 | /** |
46 | * GstElementDetails: |
47 | * @longname: long, english name |
48 | * @klass: string describing the type of element, as an unordered list |
49 | * separated with slashes ('/'). See draft-klass.txt of the design docs |
50 | * for more details and common types |
51 | * @description: what the element is about |
52 | * @author: who wrote this thing? |
53 | * |
54 | * This struct defines the public information about a #GstElement. It contains |
55 | * meta-data about the element that is mostly for the benefit of editors. |
56 | * |
57 | * The @klass member can be used by applications to filter elements based |
58 | * on functionality. |
59 | */ |
60 | /* FIXME: need translatable stuff in here (how handle in registry)? |
61 | * can't we use _N("long name") in element implementations and use _(longname) |
62 | * in gst_element_factory_get_longname() |
63 | */ |
64 | struct _GstElementDetails |
65 | { |
66 | /*< public > */ |
67 | gchar *longname; |
68 | gchar *klass; |
69 | gchar *description; |
70 | gchar *author; |
71 | |
72 | /*< private >*/ |
73 | gpointer _gst_reserved[GST_PADDING]; |
74 | }; |
75 | |
76 | /** |
77 | * GST_ELEMENT_DETAILS: |
78 | * @longname: long, english name |
79 | * @klass: string describing the type of element, as an unordered list |
80 | * separated with slashes ('/'). See draft-klass.txt of the design docs |
81 | * for more details and common types |
82 | * @description: what the element is about |
83 | * @author: who wrote this element |
84 | * |
85 | * Macro to initialize #GstElementDetails. |
86 | */ |
87 | #define GST_ELEMENT_DETAILS(longname,klass,description,author) \ |
88 | { longname, klass, description, author, {NULL} } |
89 | |
90 | /** |
91 | * GST_IS_ELEMENT_DETAILS: |
92 | * @details: the #GstElementDetails to check |
93 | * |
94 | * Tests if element details are initialized. |
95 | */ |
96 | /* FIXME: what about adding '&& (*__gst_reserved==NULL)' */ |
97 | #define GST_IS_ELEMENT_DETAILS(details) ( \ |
98 | (details) && ((details)->longname != NULL) && ((details)->klass != NULL) \ |
99 | && ((details)->description != NULL) && ((details)->author != NULL)) |
100 | |
101 | #define GST_TYPE_ELEMENT_FACTORY (gst_element_factory_get_type()) |
102 | #define GST_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ELEMENT_FACTORY,\ |
103 | GstElementFactory)) |
104 | #define GST_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ELEMENT_FACTORY,\ |
105 | GstElementFactoryClass)) |
106 | #define GST_IS_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY)) |
107 | #define GST_IS_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY)) |
108 | #define GST_ELEMENT_FACTORY_CAST(obj) ((GstElementFactory *)(obj)) |
109 | |
110 | /** |
111 | * GstElementFactory: |
112 | * |
113 | * The opaque #GstElementFactory data structure. |
114 | */ |
115 | struct _GstElementFactory { |
116 | GstPluginFeature parent; |
117 | |
118 | GType type; /* unique GType of element or 0 if not loaded */ |
119 | |
120 | /* FIXME-0.11: deprecate this in favour of meta_data */ |
121 | GstElementDetails details; |
122 | |
123 | GList * staticpadtemplates; /* GstStaticPadTemplate list */ |
124 | guint numpadtemplates; |
125 | |
126 | /* URI interface stuff */ |
127 | guint uri_type; |
128 | gchar ** uri_protocols; |
129 | |
130 | GList * interfaces; /* interface type names this element implements */ |
131 | |
132 | /*< private >*/ |
133 | /* FIXME-0.11: move up and replace details */ |
134 | gpointer meta_data; |
135 | gpointer _gst_reserved[GST_PADDING - 1]; |
136 | }; |
137 | |
138 | struct _GstElementFactoryClass { |
139 | GstPluginFeatureClass parent_class; |
140 | |
141 | gpointer _gst_reserved[GST_PADDING]; |
142 | }; |
143 | |
144 | GType gst_element_factory_get_type (void); |
145 | |
146 | GstElementFactory * gst_element_factory_find (const gchar *name); |
147 | |
148 | GType gst_element_factory_get_element_type (GstElementFactory *factory); |
149 | const gchar * gst_element_factory_get_longname (GstElementFactory *factory); |
150 | const gchar * gst_element_factory_get_klass (GstElementFactory *factory); |
151 | const gchar * gst_element_factory_get_description (GstElementFactory *factory); |
152 | const gchar * gst_element_factory_get_author (GstElementFactory *factory); |
153 | const gchar * gst_element_factory_get_documentation_uri (GstElementFactory *factory); |
154 | const gchar * gst_element_factory_get_icon_name (GstElementFactory *factory); |
155 | guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory); |
156 | const GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory); |
157 | gint gst_element_factory_get_uri_type (GstElementFactory *factory); |
158 | gchar ** gst_element_factory_get_uri_protocols (GstElementFactory *factory); |
159 | gboolean gst_element_factory_has_interface (GstElementFactory *factory, |
160 | const gchar *interfacename); |
161 | |
162 | GstElement* gst_element_factory_create (GstElementFactory *factory, |
163 | const gchar *name) G_GNUC_MALLOC; |
164 | GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name) G_GNUC_MALLOC; |
165 | |
166 | /* FIXME 0.11: move these two into our private headers */ |
167 | void __gst_element_factory_add_static_pad_template (GstElementFactory *elementfactory, |
168 | GstStaticPadTemplate *templ); |
169 | void __gst_element_factory_add_interface (GstElementFactory *elementfactory, |
170 | const gchar *interfacename); |
171 | gboolean gst_element_register (GstPlugin *plugin, const gchar *name, |
172 | guint rank, GType type); |
173 | |
174 | /* Factory list functions */ |
175 | |
176 | /** |
177 | * GstFactoryListType: |
178 | * @GST_ELEMENT_FACTORY_TYPE_DECODER: Decoder elements |
179 | * @GST_ELEMENT_FACTORY_TYPE_ENCODER: Encoder elements |
180 | * @GST_ELEMENT_FACTORY_TYPE_SINK: Sink elements |
181 | * @GST_ELEMENT_FACTORY_TYPE_SRC: Source elements |
182 | * @GST_ELEMENT_FACTORY_TYPE_MUXER: Muxer elements |
183 | * @GST_ELEMENT_FACTORY_TYPE_DEMUXER: Demuxer elements |
184 | * @GST_ELEMENT_FACTORY_TYPE_PARSER: Parser elements |
185 | * @GST_ELEMENT_FACTORY_TYPE_PAYLOADER: Payloader elements |
186 | * @GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER: Depayloader elements |
187 | * @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS: Private, do not use |
188 | * @GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO: Elements handling video media types |
189 | * @GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO: Elements handling audio media types |
190 | * @GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE: Elements handling image media types |
191 | * @GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE: Elements handling subtitle media types |
192 | * @GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA: Elements handling metadata media types |
193 | * |
194 | * The type of #GstElementFactory to filter. |
195 | * |
196 | * All @GstFactoryListType up to @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS are exclusive. |
197 | * |
198 | * If one or more of the MEDIA types are specified, then only elements |
199 | * matching the specified media types will be selected. |
200 | * |
201 | * Since: 0.10.31 |
202 | */ |
203 | |
204 | typedef guint64 GstElementFactoryListType; |
205 | |
206 | #define GST_ELEMENT_FACTORY_TYPE_DECODER (G_GUINT64_CONSTANT (1) << 0) |
207 | #define GST_ELEMENT_FACTORY_TYPE_ENCODER (G_GUINT64_CONSTANT (1) << 1) |
208 | #define GST_ELEMENT_FACTORY_TYPE_SINK (G_GUINT64_CONSTANT (1) << 2) |
209 | #define GST_ELEMENT_FACTORY_TYPE_SRC (G_GUINT64_CONSTANT (1) << 3) |
210 | #define GST_ELEMENT_FACTORY_TYPE_MUXER (G_GUINT64_CONSTANT (1) << 4) |
211 | #define GST_ELEMENT_FACTORY_TYPE_DEMUXER (G_GUINT64_CONSTANT (1) << 5) |
212 | #define GST_ELEMENT_FACTORY_TYPE_PARSER (G_GUINT64_CONSTANT (1) << 6) |
213 | #define GST_ELEMENT_FACTORY_TYPE_PAYLOADER (G_GUINT64_CONSTANT (1) << 7) |
214 | #define GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER (G_GUINT64_CONSTANT (1) << 8) |
215 | #define GST_ELEMENT_FACTORY_TYPE_FORMATTER (G_GUINT64_CONSTANT (1) << 9) |
216 | |
217 | #define GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS (G_GUINT64_CONSTANT (1) << 48) |
218 | |
219 | #define GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO (G_GUINT64_CONSTANT (1) << 49) |
220 | #define GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO (G_GUINT64_CONSTANT (1) << 50) |
221 | #define GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE (G_GUINT64_CONSTANT (1) << 51) |
222 | #define GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE (G_GUINT64_CONSTANT (1) << 52) |
223 | #define GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA (G_GUINT64_CONSTANT (1) << 53) |
224 | |
225 | /** |
226 | * GST_ELEMENT_FACTORY_TYPE_ANY: |
227 | * |
228 | * Elements of any of the defined GST_ELEMENT_FACTORY_LIST types |
229 | * |
230 | * Since: 0.10.31 |
231 | */ |
232 | #define GST_ELEMENT_FACTORY_TYPE_ANY ((G_GUINT64_CONSTANT (1) << 49) - 1) |
233 | |
234 | /** |
235 | * GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY: |
236 | * |
237 | * Elements matching any of the defined GST_ELEMENT_FACTORY_TYPE_MEDIA types |
238 | * |
239 | * Note: Do not use this if you wish to not filter against any of the defined |
240 | * media types. If you wish to do this, simply don't specify any |
241 | * GST_ELEMENT_FACTORY_TYPE_MEDIA flag. |
242 | * |
243 | * Since: 0.10.31 |
244 | */ |
245 | #define GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY (~G_GUINT64_CONSTANT (0) << 48) |
246 | |
247 | /** |
248 | * GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER: |
249 | * |
250 | * All encoders handling video or image media types |
251 | * |
252 | * Since: 0.10.31 |
253 | */ |
254 | #define GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER (GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE) |
255 | |
256 | /** |
257 | * GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER: |
258 | * |
259 | * All encoders handling audio media types |
260 | * |
261 | * Since: 0.10.31 |
262 | */ |
263 | #define GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER (GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO) |
264 | |
265 | /** |
266 | * GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS: |
267 | * |
268 | * All sinks handling audio, video or image media types |
269 | * |
270 | * Since: 0.10.31 |
271 | */ |
272 | #define GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS (GST_ELEMENT_FACTORY_TYPE_SINK | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE) |
273 | |
274 | /** |
275 | * GST_ELEMENT_FACTORY_TYPE_DECODABLE: |
276 | * |
277 | * All elements used to 'decode' streams (decoders, demuxers, parsers, depayloaders) |
278 | * |
279 | * Since: 0.10.31 |
280 | */ |
281 | #define GST_ELEMENT_FACTORY_TYPE_DECODABLE \ |
282 | (GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_DEMUXER | GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER | GST_ELEMENT_FACTORY_TYPE_PARSER) |
283 | |
284 | /* Element klass defines */ |
285 | #define GST_ELEMENT_FACTORY_KLASS_DECODER "Decoder" |
286 | #define GST_ELEMENT_FACTORY_KLASS_ENCODER "Encoder" |
287 | #define GST_ELEMENT_FACTORY_KLASS_SINK "Sink" |
288 | #define GST_ELEMENT_FACTORY_KLASS_SRC "Source" |
289 | #define GST_ELEMENT_FACTORY_KLASS_MUXER "Muxer" |
290 | #define GST_ELEMENT_FACTORY_KLASS_DEMUXER "Demuxer" |
291 | #define GST_ELEMENT_FACTORY_KLASS_PARSER "Parser" |
292 | #define GST_ELEMENT_FACTORY_KLASS_PAYLOADER "Payloader" |
293 | #define GST_ELEMENT_FACTORY_KLASS_DEPAYLOADER "Depayloader" |
294 | #define GST_ELEMENT_FACTORY_KLASS_FORMATTER "Formatter" |
295 | |
296 | #define GST_ELEMENT_FACTORY_KLASS_MEDIA_VIDEO "Video" |
297 | #define GST_ELEMENT_FACTORY_KLASS_MEDIA_AUDIO "Audio" |
298 | #define GST_ELEMENT_FACTORY_KLASS_MEDIA_IMAGE "Image" |
299 | #define GST_ELEMENT_FACTORY_KLASS_MEDIA_SUBTITLE "Subtitle" |
300 | #define GST_ELEMENT_FACTORY_KLASS_MEDIA_METADATA "Metadata" |
301 | |
302 | gboolean gst_element_factory_list_is_type (GstElementFactory *factory, |
303 | GstElementFactoryListType type); |
304 | |
305 | GList * gst_element_factory_list_get_elements (GstElementFactoryListType type, |
306 | GstRank minrank) G_GNUC_MALLOC; |
307 | |
308 | |
309 | GList * gst_element_factory_list_filter (GList *list, const GstCaps *caps, |
310 | GstPadDirection direction, |
311 | gboolean subsetonly) G_GNUC_MALLOC; |
312 | G_END_DECLS |
313 | |
314 | #endif /* __GST_ELEMENT_FACTORY_H__ */ |
315 | |