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.
64 <!-- ##### STRUCT GstTypeDefinition ##### -->
69 @name: The name of this factory
70 @mime: The mime type of the new type.
71 @exts: The extensions of this type.
72 @typefindfunc: An optional typefind function.
74 <!-- ##### USER_FUNCTION GstTypeFindFunc ##### -->
76 This is the function that will be called when a typefind has to be
77 performed by a plugin.
80 @buf: the buffer with media on which to perform the typefind
81 @priv: private; don't touch
82 @Returns: A #GstCaps structure describing the type or NULL if the
83 type was not recognized by this function;
86 <!-- ##### FUNCTION gst_typefactory_new ##### -->
95 <!-- ##### FUNCTION gst_typefactory_find ##### -->