2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gsttype.h: Header for type management
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_TYPE_H__
25 #define __GST_TYPE_H__
27 #include <gst/gstbuffer.h>
28 #include <gst/gstcaps.h>
29 #include <gst/gstpluginfeature.h>
33 /* type of function used to check a stream for equality with type */
34 typedef GstCaps *(*GstTypeFindFunc) (GstBuffer *buf, gpointer priv);
36 typedef struct _GstType GstType;
37 typedef struct _GstTypeDefinition GstTypeDefinition;
38 typedef struct _GstTypeFactory GstTypeFactory;
39 typedef struct _GstTypeFactoryClass GstTypeFactoryClass;
42 guint16 id; /* type id (assigned) */
44 gchar *mime; /* MIME type */
45 gchar *exts; /* space-delimited list of extensions */
47 GSList *factories; /* factories providing this type */
50 struct _GstTypeDefinition {
54 GstTypeFindFunc typefindfunc;
57 #define GST_TYPE_TYPE_FACTORY \
58 (gst_type_factory_get_type())
59 #define GST_TYPE_FACTORY(obj) \
60 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TYPE_FACTORY,GstTypeFactory))
61 #define GST_TYPE_FACTORY_CLASS(klass) \
62 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TYPE_FACTORY,GstTypeFactoryClass))
63 #define GST_IS_TYPE_FACTORY(obj) \
64 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TYPE_FACTORY))
65 #define GST_IS_TYPE_FACTORY_CLASS(klass) \
66 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TYPE_FACTORY))
68 struct _GstTypeFactory {
69 GstPluginFeature feature;
73 GstTypeFindFunc typefindfunc;
76 struct _GstTypeFactoryClass {
77 GstPluginFeatureClass parent;
81 GType gst_type_factory_get_type (void);
83 GstTypeFactory* gst_type_factory_new (GstTypeDefinition *definition);
85 GstTypeFactory* gst_type_factory_find (const gchar *name);
88 /* create a new type, or find/merge an existing one */
89 guint16 gst_type_register (GstTypeFactory *factory);
91 /* look up a type by mime or extension */
92 guint16 gst_type_find_by_mime (const gchar *mime);
93 guint16 gst_type_find_by_ext (const gchar *ext);
95 /* get GstType by id */
96 GstType* gst_type_find_by_id (guint16 id);
98 /* get the list of registered types (returns list of GstType!) */
99 const GList* gst_type_get_list (void);
103 #endif /* __GST_TYPE_H__ */