![]() |
![]() |
![]() |
GStreamer 1.0 Core Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <gst/gst.h> struct GstTypeFind; void (*GstTypeFindFunction) (GstTypeFind *find
,gpointer user_data
); enum GstTypeFindProbability; const guint8 * gst_type_find_peek (GstTypeFind *find
,gint64 offset
,guint size
); void gst_type_find_suggest (GstTypeFind *find
,guint probability
,GstCaps *caps
); void gst_type_find_suggest_simple (GstTypeFind *find
,guint probability
,const char *media_type
,const char *fieldname
,...
); guint64 gst_type_find_get_length (GstTypeFind *find
); gboolean gst_type_find_register (GstPlugin *plugin
,const gchar *name
,guint rank
,GstTypeFindFunction func
,const gchar *extensions
,GstCaps *possible_caps
,gpointer data
,GDestroyNotify data_notify
);
The following functions allow you to detect the media type of an unknown stream.
Last reviewed on 2005-11-09 (0.9.4)
struct GstTypeFind { /* private to the caller of the typefind function */ const guint8 * (* peek) (gpointer data, gint64 offset, guint size); void (* suggest) (gpointer data, guint probability, GstCaps *caps); gpointer data; /* optional */ guint64 (* get_length) (gpointer data); };
Object that stores typefind callbacks. To use with GstTypeFindFactory.
void (*GstTypeFindFunction) (GstTypeFind *find
,gpointer user_data
);
A function that will be called by typefinding.
|
A GstTypeFind structure |
|
optionnal data to pass to the function |
typedef enum { GST_TYPE_FIND_NONE = 0, GST_TYPE_FIND_MINIMUM = 1, GST_TYPE_FIND_POSSIBLE = 50, GST_TYPE_FIND_LIKELY = 80, GST_TYPE_FIND_NEARLY_CERTAIN = 99, GST_TYPE_FIND_MAXIMUM = 100 } GstTypeFindProbability;
The probability of the typefind function. Higher values have more certainty in doing a reliable typefind.
const guint8 * gst_type_find_peek (GstTypeFind *find
,gint64 offset
,guint size
);
Returns the size
bytes of the stream to identify beginning at offset. If
offset is a positive number, the offset is relative to the beginning of the
stream, if offset is a negative number the offset is relative to the end of
the stream. The returned memory is valid until the typefinding function
returns and must not be freed.
|
The GstTypeFind object the function was called with |
|
The offset |
|
The number of bytes to return |
Returns : |
the requested data, or NULL if that data is not available. [transfer none][array length=size] |
void gst_type_find_suggest (GstTypeFind *find
,guint probability
,GstCaps *caps
);
If a GstTypeFindFunction calls this function it suggests the caps with the given probability. A GstTypeFindFunction may supply different suggestions in one call. It is up to the caller of the GstTypeFindFunction to interpret these values.
|
The GstTypeFind object the function was called with |
|
The probability in percent that the suggestion is right |
|
The fixed GstCaps to suggest |
void gst_type_find_suggest_simple (GstTypeFind *find
,guint probability
,const char *media_type
,const char *fieldname
,...
);
If a GstTypeFindFunction calls this function it suggests the caps with the given probability. A GstTypeFindFunction may supply different suggestions in one call. It is up to the caller of the GstTypeFindFunction to interpret these values.
This function is similar to gst_type_find_suggest()
, only that instead of
passing a GstCaps argument you can create the caps on the fly in the same
way as you can with gst_caps_new_simple()
.
Make sure you terminate the list of arguments with a NULL argument and that the values passed have the correct type (in terms of width in bytes when passed to the vararg function - this applies particularly to gdouble and guint64 arguments).
|
The GstTypeFind object the function was called with |
|
The probability in percent that the suggestion is right |
|
the media type of the suggested caps |
|
first field of the suggested caps, or NULL |
|
additional arguments to the suggested caps in the same format as the
arguments passed to gst_structure_new() (ie. triplets of field name,
field GType and field value) |
guint64 gst_type_find_get_length (GstTypeFind *find
);
Get the length of the data stream.
|
The GstTypeFind the function was called with |
Returns : |
The length of the data stream, or 0 if it is not available. |
gboolean gst_type_find_register (GstPlugin *plugin
,const gchar *name
,guint rank
,GstTypeFindFunction func
,const gchar *extensions
,GstCaps *possible_caps
,gpointer data
,GDestroyNotify data_notify
);
Registers a new typefind function to be used for typefinding. After registering this function will be available for typefinding. This function is typically called during an element's plugin initialization.
|
A GstPlugin, or NULL for a static typefind function |
|
The name for registering |
|
The rank (or importance) of this typefind function |
|
The GstTypeFindFunction to use |
|
Optional comma-separated list of extensions that could belong to this type. [allow-none] |
|
Optionally the caps that could be returned when typefinding succeeds |
|
Optional user data. This user data must be available until the plugin is unloaded. |
|
a GDestroyNotify that will be called on data when the plugin
is unloaded. |
Returns : |
TRUE on success, FALSE otherwise |