1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
7 <!-- ##### SECTION Long_Description ##### -->
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().
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:
19 avi_typefind (GstBuffer *buf, gpointer private)
21 gchar *data = GST_BUFFER_DATA (buf);
23 if (strncmp (&data[0], "RIFF", 4)) return NULL;
24 if (strncmp (&data[8], "AVI ", 4)) return NULL;
26 return gst_caps_new ("avi_typefind","video/avi", NULL);
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 */
38 plugin_init (GModule *module, GstPlugin *plugin)
42 type = gst_typefactory_new (&avidefinition);
43 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
49 <!-- ##### SECTION See_Also ##### -->
51 #GstPluginFeature, #GstPlugin
54 <!-- ##### STRUCT GstTypeFactory ##### -->
56 The struct with the typefactory information.
60 <!-- ##### STRUCT GstTypeDefinition ##### -->
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.
70 <!-- ##### USER_FUNCTION GstTypeFindFunc ##### -->
72 This is the function that will be called when a typefind has to be
73 performed by a plugin.
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;
82 <!-- ##### FUNCTION gst_typefactory_new ##### -->
91 <!-- ##### FUNCTION gst_typefactory_find ##### -->
100 <!-- ##### FUNCTION gst_typefactory_get_list ##### -->