GStreamer Application Development Manual (0.8.7) | ||
---|---|---|
<<< Previous | More on factories | Next >>> |
GStreamer assigns a unique number to all registered MIME types. GStreamer also keeps a reference to a function that can be used to determine if a given buffer is of the given MIME type.
There is also an association between a MIME type and a file extension, but the use of typefind functions (similar to file(1)) is preferred.
The type information is maintained in a list of
GstType
. The definition of a
GstType
is like:
typedef GstCaps (*GstTypeFindFunc) (GstBuffer *buf,gpointer *priv); typedef struct _GstType GstType; struct _GstType { guint16 id; /* type id (assigned) */ gchar *mime; /* MIME type */ gchar *exts; /* space-delimited list of extensions */ GstTypeFindFunc typefindfunc; /* typefind function */ }; |
All operations on GstType
occur
via their guint16 id
numbers, with
the GstType
structure private to the GStreamer
library.
We can obtain the id for a given MIME type with the following piece of code:
guint16 id; id = gst_type_find_by_mime ("audio/mpeg"); |
This function will return 0 if the type was not known.
GstType
conversion
We can obtain the GstType
for a given id
with the following piece of code:
GstType *type; type = gst_type_find_by_id (id); |
This function will return NULL if the id was not associated with
any known GstType
We can obtain the id for a given file extension with the following piece of code:
guint16 id; id = gst_type_find_by_ext (".mp3"); |
This function will return 0 if the extension was not known.
For more information, see the chapter called Autoplugging.
<<< Previous | Home | Next >>> |
More on MIME Types | Up | Creating elements with the factory |