GstTypeFindElement

GstTypeFindElement —

Synopsis




struct      GstTypeFind;
void        (*GstTypeFindFunction)          (GstTypeFind *find,
                                             gpointer data);
enum        GstTypeFindProbability;
struct      GstTypeFindFactory;
guint8*     gst_type_find_peek              (GstTypeFind *find,
                                             gint64 offset,
                                             guint size);
void        gst_type_find_suggest           (GstTypeFind *find,
                                             guint probability,
                                             const GstCaps *caps);
guint64     gst_type_find_get_length        (GstTypeFind *find);
gboolean    gst_type_find_register          (GstPlugin *plugin,
                                             const gchar *name,
                                             guint rank,
                                             GstTypeFindFunction func,
                                             gchar **extensions,
                                             const GstCaps *possible_caps,
                                             gpointer data);
GList*      gst_type_find_factory_get_list  (void);
gchar**     gst_type_find_factory_get_extensions
                                            (const GstTypeFindFactory *factory);
const GstCaps* gst_type_find_factory_get_caps
                                            (const GstTypeFindFactory *factory);
void        gst_type_find_factory_call_function
                                            (const GstTypeFindFactory *factory,
                                             GstTypeFind *find);

Object Hierarchy


  GObject
   +----GstPluginFeature
         +----GstTypeFindFactory

Description

Details

struct GstTypeFind

struct GstTypeFind {

  /* private to the caller of the typefind function */
  guint8 *		(* peek)			(gpointer		data,
							 gint64	         	offset,
							 guint			size);
  void			(* suggest)			(gpointer		data,
							 guint			probability,
							 const GstCaps *		caps);
  
  gpointer			data;
  
  /* optional */
  guint64		(* get_length)			(gpointer		data);

};


GstTypeFindFunction ()

void        (*GstTypeFindFunction)          (GstTypeFind *find,
                                             gpointer data);

find :
data :

enum GstTypeFindProbability

typedef enum {
  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;


struct GstTypeFindFactory

struct GstTypeFindFactory;

Object that stores information about a typefind function


gst_type_find_peek ()

guint8*     gst_type_find_peek              (GstTypeFind *find,
                                             gint64 offset,
                                             guint size);

Returns 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. If NULL is returned, that data is not available.

find : the find object the function was called with
offset : the offset
size : the number of bytes to return
Returns : the requested data or NULL if that data is not available.

gst_type_find_suggest ()

void        gst_type_find_suggest           (GstTypeFind *find,
                                             guint probability,
                                             const GstCaps *caps);

If a typefind function calls this function it suggests the caps with the given probability. A typefind function may supply different suggestions in one call. It is up to the caller of the typefind function to interpret these values.

find : the find object the function was called with
probability : the probability in percent that the suggestion is right
caps : the fixed caps to suggest

gst_type_find_get_length ()

guint64     gst_type_find_get_length        (GstTypeFind *find);

Get the length of the data stream.

find : the find object the function was called with
Returns : the length of the data stream or 0 if it is not available.

gst_type_find_register ()

gboolean    gst_type_find_register          (GstPlugin *plugin,
                                             const gchar *name,
                                             guint rank,
                                             GstTypeFindFunction func,
                                             gchar **extensions,
                                             const GstCaps *possible_caps,
                                             gpointer data);

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.

plugin : the GstPlugin to register with
name : the name for registering
rank : rank (or importance) of this typefind function
func : the function to use for typefinding
extensions : optional extensions that could belong to this type
possible_caps : optionally the caps that could be returned when typefinding succeeds
data : optional user data. This user data must be available until the plugin is unloaded.
Returns : TRUE on success, FALSE otherwise

gst_type_find_factory_get_list ()

GList*      gst_type_find_factory_get_list  (void);

Gets the list of all registered typefind factories. You must free the list using g_list_free.

Returns : the list of all registered typefind factories

gst_type_find_factory_get_extensions ()

gchar**     gst_type_find_factory_get_extensions
                                            (const GstTypeFindFactory *factory);

Gets the extensions associated with a typefind factory. The returned array should not be changed. If you need to change stuff in it, you should copy it using g_stdupv(). This function may return NULL to indicate a 0-length list.

factory : a factory
Returns : a NULL-terminated array of extensions associated with this factory

gst_type_find_factory_get_caps ()

const GstCaps* gst_type_find_factory_get_caps
                                            (const GstTypeFindFactory *factory);

Gets the caps associated with a typefind factory.

factory : a factory
Returns : the GstCaps associated with this factory

gst_type_find_factory_call_function ()

void        gst_type_find_factory_call_function
                                            (const GstTypeFindFactory *factory,
                                             GstTypeFind *find);

Calls the typefinding function associated with this factory.

factory : a factory
find : a properly setup GstTypeFind entry. The get_data and suggest_type members must be set.