Merge branch 'master' into 0.11
[platform/upstream/gstreamer.git] / gst / gstelementfactory.h
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 #define GST_TYPE_ELEMENT_FACTORY                (gst_element_factory_get_type())
40 #define GST_ELEMENT_FACTORY(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ELEMENT_FACTORY,\
41                                                  GstElementFactory))
42 #define GST_ELEMENT_FACTORY_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ELEMENT_FACTORY,\
43                                                  GstElementFactoryClass))
44 #define GST_IS_ELEMENT_FACTORY(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY))
45 #define GST_IS_ELEMENT_FACTORY_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY))
46 #define GST_ELEMENT_FACTORY_CAST(obj)           ((GstElementFactory *)(obj))
47
48 /**
49  * GstElementFactory:
50  *
51  * The opaque #GstElementFactory data structure.
52  */
53 struct _GstElementFactory {
54   GstPluginFeature      parent;
55
56   GType                 type;                   /* unique GType of element or 0 if not loaded */
57
58   gpointer              metadata;
59
60   GList *               staticpadtemplates;     /* GstStaticPadTemplate list */
61   guint                 numpadtemplates;
62
63   /* URI interface stuff */
64   guint                 uri_type;
65   gchar **              uri_protocols;
66
67   GList *               interfaces;             /* interface type names this element implements */
68
69   /*< private >*/
70   gpointer _gst_reserved[GST_PADDING];
71 };
72
73 struct _GstElementFactoryClass {
74   GstPluginFeatureClass parent_class;
75
76   gpointer _gst_reserved[GST_PADDING];
77 };
78
79 GType                   gst_element_factory_get_type            (void);
80
81 GstElementFactory *     gst_element_factory_find                (const gchar *name);
82
83 GType                   gst_element_factory_get_element_type    (GstElementFactory *factory);
84
85 G_CONST_RETURN gchar *  gst_element_factory_get_metadata        (GstElementFactory *factory, const gchar *key);
86
87 guint                   gst_element_factory_get_num_pad_templates (GstElementFactory *factory);
88 G_CONST_RETURN GList *  gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
89
90 gint                    gst_element_factory_get_uri_type        (GstElementFactory *factory);
91 gchar **                gst_element_factory_get_uri_protocols   (GstElementFactory *factory);
92
93 gboolean                gst_element_factory_has_interface       (GstElementFactory *factory,
94                                                                  const gchar *interfacename);
95
96 GstElement*             gst_element_factory_create              (GstElementFactory *factory,
97                                                                  const gchar *name);
98 GstElement*             gst_element_factory_make                (const gchar *factoryname, const gchar *name);
99
100 /* FIXME 0.11: move these two into our private headers */
101 void                    __gst_element_factory_add_static_pad_template (GstElementFactory *elementfactory,
102                                                                  GstStaticPadTemplate *templ);
103 void                    __gst_element_factory_add_interface     (GstElementFactory *elementfactory,
104                                                                  const gchar *interfacename);
105 gboolean                gst_element_register                    (GstPlugin *plugin, const gchar *name,
106                                                                  guint rank, GType type);
107
108 /* Factory list functions */
109
110 /**
111  * GstFactoryListType:
112  * @GST_ELEMENT_FACTORY_TYPE_DECODER: Decoder elements
113  * @GST_ELEMENT_FACTORY_TYPE_ENCODER: Encoder elements
114  * @GST_ELEMENT_FACTORY_TYPE_SINK: Sink elements
115  * @GST_ELEMENT_FACTORY_TYPE_SRC: Source elements
116  * @GST_ELEMENT_FACTORY_TYPE_MUXER: Muxer elements
117  * @GST_ELEMENT_FACTORY_TYPE_DEMUXER: Demuxer elements
118  * @GST_ELEMENT_FACTORY_TYPE_PARSER: Parser elements
119  * @GST_ELEMENT_FACTORY_TYPE_PAYLOADER: Payloader elements
120  * @GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER: Depayloader elements
121  * @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS: Private, do not use
122  * @GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO: Elements handling video media types
123  * @GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO: Elements handling audio media types
124  * @GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE: Elements handling image media types
125  * @GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE: Elements handling subtitle media types
126  * @GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA: Elements handling metadata media types
127  *
128  * The type of #GstElementFactory to filter.
129  *
130  * All @GstFactoryListType up to @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS are exclusive.
131  *
132  * If one or more of the MEDIA types are specified, then only elements
133  * matching the specified media types will be selected.
134  *
135  * Since: 0.10.31
136  */
137
138 typedef guint64 GstElementFactoryListType;
139
140 #define  GST_ELEMENT_FACTORY_TYPE_DECODER        (G_GUINT64_CONSTANT (1) << 0)
141 #define  GST_ELEMENT_FACTORY_TYPE_ENCODER        (G_GUINT64_CONSTANT (1) << 1)
142 #define  GST_ELEMENT_FACTORY_TYPE_SINK           (G_GUINT64_CONSTANT (1) << 2)
143 #define  GST_ELEMENT_FACTORY_TYPE_SRC            (G_GUINT64_CONSTANT (1) << 3)
144 #define  GST_ELEMENT_FACTORY_TYPE_MUXER          (G_GUINT64_CONSTANT (1) << 4)
145 #define  GST_ELEMENT_FACTORY_TYPE_DEMUXER        (G_GUINT64_CONSTANT (1) << 5)
146 #define  GST_ELEMENT_FACTORY_TYPE_PARSER         (G_GUINT64_CONSTANT (1) << 6)
147 #define  GST_ELEMENT_FACTORY_TYPE_PAYLOADER      (G_GUINT64_CONSTANT (1) << 7)
148 #define  GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER    (G_GUINT64_CONSTANT (1) << 8)
149 #define  GST_ELEMENT_FACTORY_TYPE_FORMATTER      (G_GUINT64_CONSTANT (1) << 9)
150
151 #define  GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS   (G_GUINT64_CONSTANT (1) << 48)
152
153 #define  GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO    (G_GUINT64_CONSTANT (1) << 49)
154 #define  GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO    (G_GUINT64_CONSTANT (1) << 50)
155 #define  GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE    (G_GUINT64_CONSTANT (1) << 51)
156 #define  GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE (G_GUINT64_CONSTANT (1) << 52)
157 #define  GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA (G_GUINT64_CONSTANT (1) << 53)
158
159 /**
160  * GST_ELEMENT_FACTORY_TYPE_ANY:
161  *
162  * Elements of any of the defined GST_ELEMENT_FACTORY_LIST types
163  *
164  * Since: 0.10.31
165  */
166 #define  GST_ELEMENT_FACTORY_TYPE_ANY ((G_GUINT64_CONSTANT (1) << 49) - 1)
167
168 /**
169  * GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY:
170  *
171  * Elements matching any of the defined GST_ELEMENT_FACTORY_TYPE_MEDIA types
172  *
173  * Note: Do not use this if you wish to not filter against any of the defined
174  * media types. If you wish to do this, simply don't specify any 
175  * GST_ELEMENT_FACTORY_TYPE_MEDIA flag.
176  *
177  * Since: 0.10.31
178  */
179 #define GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY (~G_GUINT64_CONSTANT (0) << 48)
180
181 /**
182  * GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER:
183  *
184  * All encoders handling video or image media types
185  *
186  * Since: 0.10.31
187  */
188 #define GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER (GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE)
189
190 /**
191  * GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER:
192  *
193  * All encoders handling audio media types
194  *
195  * Since: 0.10.31
196  */
197 #define GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER (GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO)
198
199 /**
200  * GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS:
201  *
202  * All sinks handling audio, video or image media types
203  *
204  * Since: 0.10.31
205  */
206 #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)
207
208 /**
209  * GST_ELEMENT_FACTORY_TYPE_DECODABLE:
210  *
211  * All elements used to 'decode' streams (decoders, demuxers, parsers, depayloaders)
212  *
213  * Since: 0.10.31
214  */
215 #define GST_ELEMENT_FACTORY_TYPE_DECODABLE \
216   (GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_DEMUXER | GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER | GST_ELEMENT_FACTORY_TYPE_PARSER)
217
218 /* Element klass defines */
219 #define GST_ELEMENT_FACTORY_KLASS_DECODER               "Decoder"
220 #define GST_ELEMENT_FACTORY_KLASS_ENCODER               "Encoder"
221 #define GST_ELEMENT_FACTORY_KLASS_SINK                  "Sink"
222 #define GST_ELEMENT_FACTORY_KLASS_SRC                   "Source"
223 #define GST_ELEMENT_FACTORY_KLASS_MUXER                 "Muxer"
224 #define GST_ELEMENT_FACTORY_KLASS_DEMUXER               "Demuxer"
225 #define GST_ELEMENT_FACTORY_KLASS_PARSER                "Parser"
226 #define GST_ELEMENT_FACTORY_KLASS_PAYLOADER             "Payloader"
227 #define GST_ELEMENT_FACTORY_KLASS_DEPAYLOADER           "Depayloader"
228 #define GST_ELEMENT_FACTORY_KLASS_FORMATTER             "Formatter"
229
230 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_VIDEO           "Video"
231 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_AUDIO           "Audio"
232 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_IMAGE           "Image"
233 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_SUBTITLE        "Subtitle"
234 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_METADATA        "Metadata"
235
236 gboolean      gst_element_factory_list_is_type      (GstElementFactory *factory,
237                                                      GstElementFactoryListType type);
238
239 GList *       gst_element_factory_list_get_elements (GstElementFactoryListType type,
240                                                      GstRank minrank);
241
242
243 GList *       gst_element_factory_list_filter       (GList *list, const GstCaps *caps,
244                                                      GstPadDirection direction,
245                                                      gboolean subsetonly);
246 G_END_DECLS
247
248 #endif /* __GST_ELEMENT_FACTORY_H__ */