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/gstcaps.h>
27 #include <gst/gstplugin.h>
28 #include <gst/gstpluginfeature.h>
32 #define GST_TYPE_TYPE_FIND (gst_type_find_get_type())
34 typedef struct _GstTypeFind GstTypeFind;
37 * GstTypeFindFunction:
38 * @find: A #GstTypeFind structure
39 * @data: optionnal data to pass to the function
41 * A function that will be called by typefinding.
43 typedef void (* GstTypeFindFunction) (GstTypeFind *find, gpointer data);
46 * GstTypeFindProbability:
47 * @GST_TYPE_FIND_MINIMUM: unlikely typefind
48 * @GST_TYPE_FIND_POSSIBLE: possible type detected
49 * @GST_TYPE_FIND_LIKELY: likely a type was detected
50 * @GST_TYPE_FIND_NEARLY_CERTAIN: nearly certain that a type was detected
51 * @GST_TYPE_FIND_MAXIMUM: very certain a type was detected.
53 * The probability of the typefind function. Higher values have more certainty
54 * in doing a reliable typefind.
57 GST_TYPE_FIND_MINIMUM = 1,
58 GST_TYPE_FIND_POSSIBLE = 50,
59 GST_TYPE_FIND_LIKELY = 80,
60 GST_TYPE_FIND_NEARLY_CERTAIN = 99,
61 GST_TYPE_FIND_MAXIMUM = 100
62 } GstTypeFindProbability;
66 * @peek: Method to peek data.
67 * @suggest: Method to suggest #GstCaps with a given probability.
68 * @data: The data used by the caller of the typefinding function.
69 * @get_length: Returns the length of current data.
71 * Object that stores typefind callbacks. To use with #GstTypeFindFactory.
74 /* private to the caller of the typefind function */
75 const guint8 * (* peek) (gpointer data,
79 void (* suggest) (gpointer data,
81 const GstCaps * caps);
86 guint64 (* get_length) (gpointer data);
89 gpointer _gst_reserved[GST_PADDING];
92 GType gst_type_find_get_type (void);
94 /* typefind function interface */
95 const guint8 * gst_type_find_peek (GstTypeFind * find,
99 void gst_type_find_suggest (GstTypeFind * find,
101 const GstCaps * caps);
103 void gst_type_find_suggest_simple (GstTypeFind * find,
105 const char * media_type,
106 const char * fieldname, ...);
108 guint64 gst_type_find_get_length (GstTypeFind * find);
110 /* registration interface */
111 gboolean gst_type_find_register (GstPlugin * plugin,
114 GstTypeFindFunction func,
116 const GstCaps * possible_caps,
118 GDestroyNotify data_notify);
122 #endif /* __GST_TYPE_FIND_H__ */