check/Makefile.am: Use CHECK_CFLAGS and CHECK_LIBS
[platform/upstream/gstreamer.git] / docs / gst / tmpl / gsttypefindfactory.sgml
1 <!-- ##### SECTION Title ##### -->
2 GstTypeFindFactory
3
4 <!-- ##### SECTION Short_Description ##### -->
5 information about registered typefind functions
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 These functions allow querying informations about registered typefind 
10 functions. How to create and register these functions is described in
11 the section <link linkend="gstreamer-Writing-typefind-functions">
12 "Writing typefind functions"</link>.
13 </para>
14 <example>
15   <title>how to write a simple typefinder</title>
16   <programlisting>
17   /* FIXME: compile this? ;) */
18   typedef struct {
19     guint8 *data;
20     guint size;
21     guint probability;
22     GstCaps *data;
23   } MyTypeFind;
24   static void
25   my_peek (gpointer data, gint64 offset, guint size)
26   {
27     MyTypeFind *find = (MyTypeFind *) data;
28     if (offset &gt;= 0 &amp;&amp; offset + size &lt;= find->size) {
29       return find->data + offset;
30     }
31     return NULL;
32   }
33   static void
34   my_suggest (gpointer data, guint probability, GstCaps *caps)
35   {
36     MyTypeFind *find = (MyTypeFind *) data;
37     if (probability &gt; find->probability) {
38       find->probability = probability;
39       gst_caps_replace (&amp;find->caps, caps);
40     }
41   }
42   static GstCaps *
43   find_type (guint8 *data, guint size)
44   {
45     GList *walk, *type_list;
46     MyTypeFind find = {data, size, 0, NULL};
47     GstTypeFind gst_find = {my_peek, my_suggest, &amp;find, };
48     
49     walk = type_list = gst_type_find_factory_get_list ();
50     while (walk) {
51       GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
52       walk = g_list_next (walk)
53       gst_type_find_factory_call_function (factory, &amp;gst_find);
54     }
55     g_list_free (type_list);
56     return find.caps;
57   };
58   </programlisting>
59 </example>
60 <para>
61 The above example shows how to write a very simple typefinder that identifies
62 the given data. You can get quite a bit more complicated than that though.
63 </para>
64
65 <!-- ##### SECTION See_Also ##### -->
66 <para>
67 <link linkend="gstreamer-Writing-typefind-functions">Writing typefind functions</link>
68 </para>
69
70 <!-- ##### SECTION Stability_Level ##### -->
71
72
73 <!-- ##### STRUCT GstTypeFindFactory ##### -->
74 <para>
75 Object that stores information about a typefind function
76 </para>
77
78
79 <!-- ##### FUNCTION gst_type_find_factory_get_list ##### -->
80 <para>
81
82 </para>
83
84 @Returns: 
85
86
87 <!-- ##### FUNCTION gst_type_find_factory_get_extensions ##### -->
88 <para>
89
90 </para>
91
92 @factory: 
93 @Returns: 
94
95
96 <!-- ##### FUNCTION gst_type_find_factory_get_caps ##### -->
97 <para>
98
99 </para>
100
101 @factory: 
102 @Returns: 
103
104
105 <!-- ##### FUNCTION gst_type_find_factory_call_function ##### -->
106 <para>
107
108 </para>
109
110 @factory: 
111 @find: 
112
113