*.h: Revert indentation changes.
[platform/upstream/gstreamer.git] / gst / gsttypefind.h
1 /* GStreamer
2  * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
3  *
4  * gsttypefind.h: typefinding subsystem
5  *
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.
10  *
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.
15  *
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.
20  */
21
22
23 #ifndef __GST_TYPE_FIND_H__
24 #define __GST_TYPE_FIND_H__
25
26 #include <gst/gstbuffer.h>
27 #include <gst/gstcaps.h>
28 #include <gst/gstplugin.h>
29 #include <gst/gstpluginfeature.h>
30 #include <gst/gsttypes.h>
31
32 G_BEGIN_DECLS
33 #define GST_TYPE_TYPE_FIND_FACTORY                 (gst_type_find_factory_get_type())
34 #define GST_TYPE_FIND_FACTORY(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactory))
35 #define GST_IS_TYPE_FIND_FACTORY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TYPE_FIND_FACTORY))
36 #define GST_TYPE_FIND_FACTORY_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass))
37 #define GST_IS_TYPE_FIND_FACTORY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TYPE_FIND_FACTORY))
38 #define GST_TYPE_FIND_FACTORY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass))
39 typedef struct _GstTypeFind GstTypeFind;
40 typedef struct _GstTypeFindFactory GstTypeFindFactory;
41 typedef struct _GstTypeFindFactoryClass GstTypeFindFactoryClass;
42
43 typedef void (*GstTypeFindFunction) (GstTypeFind * find, gpointer data);
44
45 typedef enum
46 {
47   GST_TYPE_FIND_MINIMUM = 1,
48   GST_TYPE_FIND_POSSIBLE = 50,
49   GST_TYPE_FIND_LIKELY = 80,
50   GST_TYPE_FIND_NEARLY_CERTAIN = 99,
51   GST_TYPE_FIND_MAXIMUM = 100,
52 }
53 GstTypeFindProbability;
54
55 struct _GstTypeFind
56 {
57   /* private to the caller of the typefind function */
58   guint8 *(*peek) (gpointer data, gint64 offset, guint size);
59   void (*suggest) (gpointer data, guint probability, const GstCaps * caps);
60
61   gpointer data;
62
63   /* optional */
64     guint64 (*get_length) (gpointer data);
65
66   /* <private> */
67   gpointer _gst_reserved[GST_PADDING];
68 };
69
70 struct _GstTypeFindFactory
71 {
72   GstPluginFeature feature;
73   /* <private> */
74
75   GstTypeFindFunction function;
76   gchar **extensions;
77   GstCaps *caps;                /* FIXME: not yet saved in registry */
78
79   gpointer user_data;
80
81   gpointer _gst_reserved[GST_PADDING];
82 };
83
84 struct _GstTypeFindFactoryClass
85 {
86   GstPluginFeatureClass parent;
87   /* <private> */
88
89   gpointer _gst_reserved[GST_PADDING];
90 };
91
92 /* typefind function interface */
93 guint8 *gst_type_find_peek (GstTypeFind * find, gint64 offset, guint size);
94 void gst_type_find_suggest (GstTypeFind * find,
95     guint probability, const GstCaps * caps);
96 guint64 gst_type_find_get_length (GstTypeFind * find);
97
98 /* registration interface */
99 gboolean gst_type_find_register (GstPlugin * plugin,
100     const gchar * name,
101     guint rank,
102     GstTypeFindFunction func,
103     gchar ** extensions, const GstCaps * possible_caps, gpointer data);
104
105 /* typefinding interface */
106
107 GType gst_type_find_factory_get_type (void);
108
109 GList *gst_type_find_factory_get_list (void);
110
111 gchar **gst_type_find_factory_get_extensions (const GstTypeFindFactory *
112     factory);
113 const GstCaps *gst_type_find_factory_get_caps (const GstTypeFindFactory *
114     factory);
115 void gst_type_find_factory_call_function (const GstTypeFindFactory * factory,
116     GstTypeFind * find);
117
118
119 G_END_DECLS
120 #endif /* __GST_TYPE_FIND_H__ */