2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000,2004 Wim Taymans <wim@fluendo.com>
5 * gstelement.h: Header for GstElement
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.
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.
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.
24 #ifndef __GST_ELEMENT_FACTORY_H__
25 #define __GST_ELEMENT_FACTORY_H__
27 typedef struct _GstElementFactory GstElementFactory;
28 typedef struct _GstElementFactoryClass GstElementFactoryClass;
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>
39 /* FIXME 0.11: Move GstElementDetails into a private header and use it internally
40 * in GstElementFactory, GstElementClass and the registry
43 typedef struct _GstElementDetails 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?
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.
57 * The @klass member can be used by applications to filter elements based
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()
64 struct _GstElementDetails
73 gpointer _gst_reserved[GST_PADDING];
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
85 * Macro to initialize #GstElementDetails.
87 #define GST_ELEMENT_DETAILS(longname,klass,description,author) \
88 { longname, klass, description, author, {NULL} }
91 * GST_IS_ELEMENT_DETAILS:
92 * @details: the #GstElementDetails to check
94 * Tests if element details are initialized.
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))
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,\
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))
113 * The opaque #GstElementFactory data structure.
115 struct _GstElementFactory {
116 GstPluginFeature parent;
118 GType type; /* unique GType of element or 0 if not loaded */
120 GstElementDetails details;
122 GList * staticpadtemplates;
123 guint numpadtemplates;
125 /* URI interface stuff */
127 gchar ** uri_protocols;
129 GList * interfaces; /* interfaces this element implements */
131 gpointer _gst_reserved[GST_PADDING];
134 struct _GstElementFactoryClass {
135 GstPluginFeatureClass parent_class;
137 gpointer _gst_reserved[GST_PADDING];
140 GType gst_element_factory_get_type (void);
142 GstElementFactory * gst_element_factory_find (const gchar *name);
144 GType gst_element_factory_get_element_type (GstElementFactory *factory);
145 G_CONST_RETURN gchar * gst_element_factory_get_longname (GstElementFactory *factory);
146 G_CONST_RETURN gchar * gst_element_factory_get_klass (GstElementFactory *factory);
147 G_CONST_RETURN gchar * gst_element_factory_get_description (GstElementFactory *factory);
148 G_CONST_RETURN gchar * gst_element_factory_get_author (GstElementFactory *factory);
149 guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory);
150 G_CONST_RETURN GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
151 gint gst_element_factory_get_uri_type (GstElementFactory *factory);
152 gchar ** gst_element_factory_get_uri_protocols (GstElementFactory *factory);
153 gboolean gst_element_factory_has_interface (GstElementFactory *factory,
154 const gchar *interfacename);
156 GstElement* gst_element_factory_create (GstElementFactory *factory,
158 GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name);
160 /* FIXME 0.11: move these two into our private headers */
161 void __gst_element_factory_add_static_pad_template (GstElementFactory *elementfactory,
162 GstStaticPadTemplate *templ);
163 void __gst_element_factory_add_interface (GstElementFactory *elementfactory,
164 const gchar *interfacename);
165 gboolean gst_element_register (GstPlugin *plugin, const gchar *name,
166 guint rank, GType type);
172 #endif /* __GST_ELEMENT_FACTORY_H__ */