2 * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
4 * gsttypefind.h: typefinding subsystem
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 #ifndef __GST_TYPE_FIND_H__
24 #define __GST_TYPE_FIND_H__
26 #include <gst/gstbuffer.h>
27 #include <gst/gstcaps2.h>
28 #include <gst/gstplugin.h>
29 #include <gst/gstpluginfeature.h>
30 #include <gst/gsttypes.h>
34 #define GST_TYPE_TYPE_FIND_FACTORY (gst_type_find_factory_get_type())
35 #define GST_TYPE_FIND_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactory))
36 #define GST_IS_TYPE_FIND_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TYPE_FIND_FACTORY))
37 #define GST_TYPE_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass))
38 #define GST_IS_TYPE_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TYPE_FIND_FACTORY))
39 #define GST_TYPE_FIND_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass))
41 typedef struct _GstTypeFind GstTypeFind;
42 typedef struct _GstTypeFindFactory GstTypeFindFactory;
43 typedef struct _GstTypeFindFactoryClass GstTypeFindFactoryClass;
45 typedef void (* GstTypeFindFunction) (GstTypeFind *find, gpointer data);
48 GST_TYPE_FIND_MINIMUM = 1,
49 GST_TYPE_FIND_POSSIBLE = 50,
50 GST_TYPE_FIND_LIKELY = 80,
51 GST_TYPE_FIND_NEARLY_CERTAIN = 99,
52 GST_TYPE_FIND_MAXIMUM = 100,
53 } GstTypeFindProbability;
56 /* private to the caller of the typefind function */
57 guint8 * (* peek) (gpointer data,
60 void (* suggest) (gpointer data,
62 const GstCaps * caps);
67 guint64 (* get_length) (gpointer data);
70 gpointer _gst_reserved[GST_PADDING];
73 struct _GstTypeFindFactory {
74 GstPluginFeature feature;
77 GstTypeFindFunction function;
79 GstCaps * caps; /* FIXME: not yet saved in registry */
83 gpointer _gst_reserved[GST_PADDING];
86 struct _GstTypeFindFactoryClass {
87 GstPluginFeatureClass parent;
90 gpointer _gst_reserved[GST_PADDING];
93 /* typefind function interface */
94 guint8 * gst_type_find_peek (GstTypeFind * find,
97 void gst_type_find_suggest (GstTypeFind * find,
99 const GstCaps * caps);
100 guint64 gst_type_find_get_length (GstTypeFind * find);
102 /* registration interface */
103 gboolean gst_type_find_register (GstPlugin * plugin,
106 GstTypeFindFunction func,
108 const GstCaps * possible_caps,
111 /* typefinding interface */
113 GType gst_type_find_factory_get_type (void);
115 GList * gst_type_find_factory_get_list (void);
117 gchar ** gst_type_find_factory_get_extensions (const GstTypeFindFactory *factory);
118 const GstCaps * gst_type_find_factory_get_caps (const GstTypeFindFactory *factory);
119 void gst_type_find_factory_call_function (const GstTypeFindFactory *factory,
125 #endif /* __GST_TYPE_FIND_H__ */