# GstTypefind

The following functions allow you to detect the media type of an unknown stream.

## GstTypeFind

Object that stores typefind callbacks. To use with GstTypeFindFactory.

### Members

`data` (gpointer) –

The data used by the caller of the typefinding function.

## Gst.TypeFind

Object that stores typefind callbacks. To use with Gst.TypeFindFactory.

### Members

`data` (Object) –

The data used by the caller of the typefinding function.

## Gst.TypeFind

Object that stores typefind callbacks. To use with Gst.TypeFindFactory.

### Members

`data` (object) –

The data used by the caller of the typefinding function.

### Methods

#### gst_type_find_get_length

    guint64
    gst_type_find_get_length (GstTypeFind * find)

Get the length of the data stream.

Parameters:

`find` –

The GstTypeFind the function was called with

Returns –

The length of the data stream, or 0 if it is not available.

#### Gst.TypeFind.prototype.get_length

    function Gst.TypeFind.prototype.get_length(): {
        // javascript wrapper for 'gst_type_find_get_length'
    }

Get the length of the data stream.

Parameters:

`find` (Gst.TypeFind) –

The Gst.TypeFind the function was called with

Returns (Number) –

The length of the data stream, or 0 if it is not available.

#### Gst.TypeFind.get_length

    def Gst.TypeFind.get_length (self):
        #python wrapper for 'gst_type_find_get_length'

Get the length of the data stream.

Parameters:

`find` (Gst.TypeFind) –

The Gst.TypeFind the function was called with

Returns (int) –

The length of the data stream, or 0 if it is not available.

#### gst_type_find_peek

    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.

Parameters:

`find` –

The GstTypeFind object the function was called with

`offset` –

The offset

`size` ( [in]) –

The number of bytes to return

Returns ( [transfer: none][nullable][array length=size]) –

the requested data, or NULL if that data is not available.

#### Gst.TypeFind.prototype.peek

    function Gst.TypeFind.prototype.peek(offset: Number): {
        // javascript wrapper for 'gst_type_find_peek'
    }

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.

Parameters:

`find` (Gst.TypeFind) –

The Gst.TypeFind object the function was called with

`offset` (Number) –

The offset

Returns a tuple made of:

([ Number ] ) –

the requested data, or null if that data is not available.

`size` (Number ) –

the requested data, or null if that data is not available.

#### Gst.TypeFind.peek

    def Gst.TypeFind.peek (self, offset):
        #python wrapper for 'gst_type_find_peek'

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.

Parameters:

`find` (Gst.TypeFind) –

The Gst.TypeFind object the function was called with

`offset` (int) –

The offset

Returns a tuple made of:

([ int ] ) –

the requested data, or None if that data is not available.

`size` (int ) –

the requested data, or None if that data is not available.

#### gst_type_find_suggest

    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.

Parameters:

`find` –

The GstTypeFind object the function was called with

`probability` –

The probability in percent that the suggestion is right

`caps` –

The fixed GstCaps to suggest

#### Gst.TypeFind.prototype.suggest

    function Gst.TypeFind.prototype.suggest(probability: Number, caps: Gst.Caps): {
        // javascript wrapper for 'gst_type_find_suggest'
    }

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

Parameters:

`find` (Gst.TypeFind) –

The Gst.TypeFind object the function was called with

`probability` (Number) –

The probability in percent that the suggestion is right

`caps` (Gst.Caps) –

The fixed Gst.Caps to suggest

#### Gst.TypeFind.suggest

    def Gst.TypeFind.suggest (self, probability, caps):
        #python wrapper for 'gst_type_find_suggest'

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

Parameters:

`find` (Gst.TypeFind) –

The Gst.TypeFind object the function was called with

`probability` (int) –

The probability in percent that the suggestion is right

`caps` (Gst.Caps) –

The fixed Gst.Caps to suggest

#### gst_type_find_suggest_empty_simple

    gst_type_find_suggest_empty_simple (GstTypeFind * find,
                                        guint probability,
                                        const char* media_type)

If a GstTypeFindFunction calls this function it suggests caps of the given media_type with the given probability.

This function is similar to gst_type_find_suggest_simple, but uses a GstCaps with no fields.

Parameters:

`find` –

The GstTypeFind object the function was called with

`probability` –

The probability in percent that the suggestion is right

`media_type` –

the media type of the suggested caps

Since : 1.20

#### Gst.TypeFind.prototype.suggest_empty_simple

    function Gst.TypeFind.prototype.suggest_empty_simple(probability: Number, media_type: String): {
        // javascript wrapper for 'gst_type_find_suggest_empty_simple'
    }

If a Gst.TypeFindFunction calls this function it suggests caps of the given media_type with the given probability.

This function is similar to gst_type_find_suggest_simple (not introspectable), but uses a Gst.Caps with no fields.

Parameters:

`find` (Gst.TypeFind) –

The Gst.TypeFind object the function was called with

`probability` (Number) –

The probability in percent that the suggestion is right

`media_type` (String) –

the media type of the suggested caps

Since : 1.20

#### Gst.TypeFind.suggest_empty_simple

    def Gst.TypeFind.suggest_empty_simple (self, probability, media_type):
        #python wrapper for 'gst_type_find_suggest_empty_simple'

If a Gst.TypeFindFunction calls this function it suggests caps of the given media_type with the given probability.

This function is similar to gst_type_find_suggest_simple (not introspectable), but uses a Gst.Caps with no fields.

Parameters:

`find` (Gst.TypeFind) –

The Gst.TypeFind object the function was called with

`probability` (int) –

The probability in percent that the suggestion is right

`media_type` (str) –

the media type of the suggested caps

Since : 1.20

#### gst_type_find_suggest_simple

    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).

Parameters:

`find` –

The GstTypeFind object the function was called with

`probability` –

The probability in percent that the suggestion is right

`media_type` –

the media type of the suggested caps

`fieldname` ( [allow-none]) –

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). If fieldname is NULL, this list must be exactly one NULL.

### Functions

#### gst_type_find_register

    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.

Parameters:

`plugin` ( [nullable]) –

A GstPlugin, or NULL for a static typefind function

`name` –

The name for registering

`rank` –

The rank (or importance) of this typefind function

`func` –

The GstTypeFindFunction to use

`extensions` ( [nullable]) –

Optional comma-separated list of extensions that could belong to this type

`possible_caps` ( [nullable]) –

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.

`data_notify` –

a GDestroyNotify that will be called on data when the plugin is unloaded.

Returns –

TRUE on success, FALSE otherwise

#### Gst.prototype.type_find_register

    function Gst.prototype.type_find_register(plugin: Gst.Plugin, name: String, rank: Number, func: Gst.TypeFindFunction, extensions: String, possible_caps: Gst.Caps, data: Object): {
        // javascript wrapper for 'gst_type_find_register'
    }

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.

Parameters:

`plugin` (Gst.Plugin) –

A Gst.Plugin, or null for a static typefind function

`name` (String) –

The name for registering

`rank` (Number) –

The rank (or importance) of this typefind function

`func` (Gst.TypeFindFunction) –

The Gst.TypeFindFunction to use

`extensions` (String) –

Optional comma-separated list of extensions that could belong to this type

`possible_caps` (Gst.Caps) –

Optionally the caps that could be returned when typefinding succeeds

`data` (Object) –

Optional user data. This user data must be available until the plugin is unloaded.

Returns (Number) –

true on success, false otherwise

#### Gst.type_find_register

    def Gst.type_find_register (plugin, name, rank, func, extensions, possible_caps, *data):
        #python wrapper for 'gst_type_find_register'

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.

Parameters:

`plugin` (Gst.Plugin) –

A Gst.Plugin, or None for a static typefind function

`name` (str) –

The name for registering

`rank` (int) –

The rank (or importance) of this typefind function

`func` (Gst.TypeFindFunction) –

The Gst.TypeFindFunction to use

`extensions` (str) –

Optional comma-separated list of extensions that could belong to this type

`possible_caps` (Gst.Caps) –

Optionally the caps that could be returned when typefinding succeeds

`data` (variadic) –

Optional user data. This user data must be available until the plugin is unloaded.

Returns (bool) –

True on success, False otherwise

## Function Macros

### GST_TYPE_FIND_REGISTER

    #define GST_TYPE_FIND_REGISTER(t_f, plugin) G_PASTE(gst_type_find_register_, t_f) (plugin)

This macro can be used to register a type find into a GstPlugin. This method will be usually called in the plugin init function but can also be called with a NULL plugin.

Parameters:

`t_f` –

The type find name in lower case, with words separated by '_'.

`plugin` –

The GstPlugin where to register the type find.

Since : 1.20

### GST_TYPE_FIND_REGISTER_DECLARE

    #define GST_TYPE_FIND_REGISTER_DECLARE(t_f) \
    G_BEGIN_DECLS \
    gboolean G_PASTE(gst_type_find_register_, t_f) (GstPlugin * plugin); \
    G_END_DECLS

This macro can be used to declare a new type find. It has to be used in combination with GST_TYPE_FIND_REGISTER_DEFINE macro and must be placed outside any block to declare the type find registration function.

Parameters:

`t_f` –

The type find name in lower case, with words separated by '_'.

Since : 1.20

### GST_TYPE_FIND_REGISTER_DEFINE

    #define GST_TYPE_FIND_REGISTER_DEFINE(t_f, t_f_n, r, func, extensions, possible_caps, data, data_notify) \
    G_BEGIN_DECLS \
    gboolean G_PASTE (gst_type_find_register_, t_f) (GstPlugin * plugin) \
    { \
      return gst_type_find_register (plugin, t_f_n, r, func, extensions, possible_caps, data, data_notify); \
    } \
    G_END_DECLS

A convenience macro to define the entry point of a type find `gst_type_find_register_*(GstPlugin* plugin)`.

Parameters:

`t_f` –

The type find name in lower case, with words separated by '_'. Used to generate `gst_type_find_register_*(GstPlugin* plugin)`.

`t_f_n` –

The public name of the type find

`r` –

The GstRank of the type find (higher rank means more importance when autoplugging, see GstRank)

`func` –

The GstTypeFindFunction to use

`extensions` ( [nullable]) –

Optional comma-separated list of extensions that could belong to this type

`possible_caps` ( [nullable]) –

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.

`data_notify` –

a GDestroyNotify that will be called on data when the plugin is unloaded.

Since : 1.20

### GST_TYPE_FIND_REGISTER_DEFINE_CUSTOM

    #define GST_TYPE_FIND_REGISTER_DEFINE_CUSTOM(type_find, register_func) \
    G_BEGIN_DECLS \
    gboolean G_PASTE (gst_type_find_register_, type_find) (GstPlugin * plugin) \
    { \
      return register_func (plugin); \
    } \
    G_END_DECLS

A convenience macro to define the entry point of a type find `gst_type_find_register_*(GstPlugin* plugin)` which uses register_func as the main registration method for the type find. As an example, you may define the type find named "custom-typefind" as following using `type_find_register_custom`:

    GST_TYPE_FIND_REGISTER_DEFINE_CUSTOM (plugin, type_find_register_custom)

Parameters:

`type_find` –

The type find name in lower case, with words separated by '_'. Used to generate `gst_type_find_register_*(GstPlugin* plugin)`.

`register_func` –

pointer to a method with the format: `gboolean register_func (GstPlugin* plugin);`

Since : 1.20

## Enumerations

### GstTypeFindProbability

The probability of the typefind function. Higher values have more certainty in doing a reliable typefind.

##### Members

`GST_TYPE_FIND_NONE` (0) –

type undetected.

`GST_TYPE_FIND_MINIMUM` (1) –

unlikely typefind.

`GST_TYPE_FIND_POSSIBLE` (50) –

possible type detected.

`GST_TYPE_FIND_LIKELY` (80) –

likely a type was detected.

`GST_TYPE_FIND_NEARLY_CERTAIN` (99) –

nearly certain that a type was detected.

`GST_TYPE_FIND_MAXIMUM` (100) –

very certain a type was detected.

### Gst.TypeFindProbability

The probability of the typefind function. Higher values have more certainty in doing a reliable typefind.

##### Members

`Gst.TypeFindProbability.NONE` (0) –

type undetected.

`Gst.TypeFindProbability.MINIMUM` (1) –

unlikely typefind.

`Gst.TypeFindProbability.POSSIBLE` (50) –

possible type detected.

`Gst.TypeFindProbability.LIKELY` (80) –

likely a type was detected.

`Gst.TypeFindProbability.NEARLY_CERTAIN` (99) –

nearly certain that a type was detected.

`Gst.TypeFindProbability.MAXIMUM` (100) –

very certain a type was detected.

### Gst.TypeFindProbability

The probability of the typefind function. Higher values have more certainty in doing a reliable typefind.

##### Members

`Gst.TypeFindProbability.NONE` (0) –

type undetected.

`Gst.TypeFindProbability.MINIMUM` (1) –

unlikely typefind.

`Gst.TypeFindProbability.POSSIBLE` (50) –

possible type detected.

`Gst.TypeFindProbability.LIKELY` (80) –

likely a type was detected.

`Gst.TypeFindProbability.NEARLY_CERTAIN` (99) –

nearly certain that a type was detected.

`Gst.TypeFindProbability.MAXIMUM` (100) –

very certain a type was detected.

## Callbacks

### GstTypeFindFunction

    (*GstTypeFindFunction) (GstTypeFind * find,
                            gpointer user_data)

A function that will be called by typefinding.

Parameters:

`find` –

A GstTypeFind structure

`user_data` –

optional data to pass to the function

### Gst.TypeFindFunction

    function Gst.TypeFindFunction(find: Gst.TypeFind, user_data: Object): {
        // javascript wrapper for 'GstTypeFindFunction'
    }

A function that will be called by typefinding.

Parameters:

`find` (Gst.TypeFind) –

A Gst.TypeFind structure

`user_data` (Object) –

optional data to pass to the function

### Gst.TypeFindFunction

    def Gst.TypeFindFunction (find, *user_data):
        #python wrapper for 'GstTypeFindFunction'

A function that will be called by typefinding.

Parameters:

`find` (Gst.TypeFind) –

A Gst.TypeFind structure

`user_data` (variadic) –

optional data to pass to the function

The results of the search are