the 'brown paper bag' commit. sorry for the email spam on this one, but it will be...
[platform/upstream/gstreamer.git] / docs / gst / tmpl / gsttypefactory.sgml
1 <!-- ##### SECTION Title ##### -->
2 GstTypeFactory
3
4 <!-- ##### SECTION Short_Description ##### -->
5 Add types to plugins.
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 A GstTypeFactory is used to add a new type and a typedetection function 
10 to a plugin. Typefactories are named so they can be found with
11 gst_typefactory_find().
12 </para>
13 <para>
14 gst_typefactory_new() is used to create a new typefactory from the given
15 #GstTypeDefinition. A typefactory is added to a #GstPlugin with 
16 gst_plugin_add_feature() as shown in the example:
17 <programlisting>
18   static GstCaps*
19   avi_typefind (GstBuffer *buf, gpointer private)
20   {
21     gchar *data = GST_BUFFER_DATA (buf);
22                       
23     if (strncmp (&amp;data[0], "RIFF", 4)) return NULL;
24     if (strncmp (&amp;data[8], "AVI ", 4)) return NULL;
25                               
26     return gst_caps_new ("avi_typefind","video/avi", NULL);
27   }
28
29   /* typedefinition for 'avi' */
30   static GstTypeDefinition avidefinition = {
31     "avidecoder_video/avi",   /* the name of this definition */
32     "video/avi",              /* the mime type */
33     ".avi",                   /* the file extensions */
34     avi_typefind,             /* a pointer to a GstTypeFindFunc function */
35   };
36
37   static gboolean
38   plugin_init (GModule *module, GstPlugin *plugin)
39   {
40     GstTypeFactory *type;
41     ...
42     type = gst_typefactory_new (&amp;avidefinition);
43     gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
44     ...
45   }
46 </programlisting>
47 </para>
48
49 <!-- ##### SECTION See_Also ##### -->
50 <para>
51 #GstPluginFeature, #GstPlugin
52 </para>
53
54 <!-- ##### STRUCT GstTypeFactory ##### -->
55 <para>
56 The struct with the typefactory information.
57 </para>
58
59
60 <!-- ##### STRUCT GstTypeDefinition ##### -->
61 <para>
62
63 </para>
64
65 @name: The name of this factory
66 @mime: The mime type of the new type.
67 @exts: The extensions of this type.
68 @typefindfunc: An optional typefind function.
69
70 <!-- ##### USER_FUNCTION GstTypeFindFunc ##### -->
71 <para>
72 This is the function that will be called when a typefind has to be
73 performed by a plugin.
74 </para>
75
76 @buf: the buffer with media on which to perform the typefind
77 @priv: private; don't touch
78 @Returns: A #GstCaps structure describing the type or NULL if the
79           type was not recognized by this function;
80
81
82 <!-- ##### FUNCTION gst_typefactory_new ##### -->
83 <para>
84
85 </para>
86
87 @definition: 
88 @Returns: 
89
90
91 <!-- ##### FUNCTION gst_typefactory_find ##### -->
92 <para>
93
94 </para>
95
96 @name: 
97 @Returns: 
98
99
100 <!-- ##### FUNCTION gst_typefactory_get_list ##### -->
101 <para>
102
103 </para>
104
105 @Returns: 
106
107