Writing typefind functions Using the type finding subsystem from plugins The typefinding subsystem in GStreamer is used to find the matching #GstCaps for an unidentified stream. This works similar to the unix file command. There are a number of elements which output unidentified data streams, such as a file source. Some other elements such as an autoplugger require a proper identification of the data, so they can create the right pipeline. To find the right type, they use typefinding elements, the most notable being the typefind element. These elements take a list of all registered typefind functions and try them on the data to see if any of these functions can identify the data. The functions in this section provide the simple framework for writing these typefind functions. The job of a typefind function is to identify the type of the data good enough so that plugins using this type can understand them while make sure no other type is misidentified. a typefind function for Ogg data static void ogg_type_find (GstTypeFind *tf, gpointer unused) { guint8 *data = gst_type_find_peek (tf, 0, 4); if (data && memcmp (data, "OggS", 4) == 0) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, gst_caps_new ("ogg_type_find", "application/ogg", NULL)); } }; GstTypeFactory - querying registered typefind functions This structure is filled by the caller of the typefind function. Typefind functions must treat this as an opaque structure. @peek: function called to get data. See gst_type_find_peek() @suggest: function called to suggest a caps. See gst_type_find_suggest() @data: caller defined data, that is passed when calling the functions @get_length: function called to query the length of the stream. See gst_type_find_get_length(). Providing this function is optional. This is the prototype for a typefind function. @find: The #GstTypeFind data @data: the user defined data that was provided on gst_type_find_factory_register() @find: @offset: @size: @Returns: @find: @probability: @caps: @find: @Returns: