Functions

type_find_helper(src: Pad, size: int) Caps | None

Tries to find what type of data is flowing from the given source Pad.

Free-function: gst_caps_unref

Parameters:
  • src – A source Pad

  • size – The length in bytes

Returns:

the Caps corresponding to the data stream. Returns None if no Caps matches the data stream.

type_find_helper_for_buffer(obj: Object | None, buf: Buffer) tuple[Caps | None, TypeFindProbability]

Tries to find what type of data is contained in the given Buffer, the assumption being that the buffer represents the beginning of the stream or file.

All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or None if the content of the buffer could not be identified.

Free-function: gst_caps_unref

Parameters:
  • obj – object doing the typefinding, or None (used for logging)

  • buf – a Buffer with data to typefind

Returns:

the Caps corresponding to the data, or None if no type could be found. The caller should free the caps returned with gst_caps_unref().

type_find_helper_for_buffer_with_caps(obj: Object | None, buf: Buffer, caps: Caps) tuple[Caps | None, TypeFindProbability]

Tries to find if type of media contained in the given Buffer, matches caps specified, assumption being that the buffer represents the beginning of the stream or file.

Tries to find what type of data is contained in the given data, the assumption being that the data represents the beginning of the stream or file.

Only the typefinder matching the given caps will be called, if found. The caps with the highest probability will be returned, or None if the content of the data could not be identified.

Free-function: gst_caps_unref

Added in version 1.22.

Parameters:
  • obj – object doing the typefinding, or None (used for logging)

  • buf – a Buffer with data to typefind

  • caps – caps of the media

Returns:

the Caps corresponding to the data, or None if no type could be found. The caller should free the caps returned with gst_caps_unref().

type_find_helper_for_buffer_with_extension(obj: Object | None, buf: Buffer, extension: str | None = None) tuple[Caps | None, TypeFindProbability]

Tries to find what type of data is contained in the given Buffer, the assumption being that the buffer represents the beginning of the stream or file.

All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or None if the content of the buffer could not be identified.

When extension is not None, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.

Free-function: gst_caps_unref

Added in version 1.16.

Parameters:
  • obj – object doing the typefinding, or None (used for logging)

  • buf – a Buffer with data to typefind

  • extension – extension of the media, or None

Returns:

the Caps corresponding to the data, or None if no type could be found. The caller should free the caps returned with gst_caps_unref().

type_find_helper_for_data(obj: Object | None, data: Sequence[int]) tuple[Caps | None, TypeFindProbability]

Tries to find what type of data is contained in the given data, the assumption being that the data represents the beginning of the stream or file.

All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or None if the content of data could not be identified.

Free-function: gst_caps_unref

Parameters:
  • obj – object doing the typefinding, or None (used for logging)

  • data

    • a pointer with data to typefind

Returns:

the Caps corresponding to the data, or None if no type could be found. The caller should free the caps returned with gst_caps_unref().

type_find_helper_for_data_with_caps(obj: Object | None, data: Sequence[int], caps: Caps) tuple[Caps | None, TypeFindProbability]

Tries to find if type of media contained in the given data, matches the caps specified, assumption being that the data represents the beginning of the stream or file.

Only the typefinder matching the given caps will be called, if found. The caps with the highest probability will be returned, or None if the content of the data could not be identified.

Free-function: gst_caps_unref

Added in version 1.22.

Parameters:
  • obj – object doing the typefinding, or None (used for logging)

  • data – a pointer with data to typefind

  • caps – caps of the media

Returns:

the Caps corresponding to the data, or None if no type could be found. The caller should free the caps returned with gst_caps_unref().

type_find_helper_for_data_with_extension(obj: Object | None, data: Sequence[int], extension: str | None = None) tuple[Caps | None, TypeFindProbability]

Tries to find what type of data is contained in the given data, the assumption being that the data represents the beginning of the stream or file.

All available typefinders will be called on the data in order of rank. If a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, typefinding is stopped immediately and the found caps will be returned right away. Otherwise, all available typefind functions will the tried, and the caps with the highest probability will be returned, or None if the content of data could not be identified.

When extension is not None, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.

Free-function: gst_caps_unref

Added in version 1.16.

Parameters:
  • obj – object doing the typefinding, or None (used for logging)

  • data

    • a pointer with data to typefind

  • extension – extension of the media, or None

Returns:

the Caps corresponding to the data, or None if no type could be found. The caller should free the caps returned with gst_caps_unref().

type_find_helper_for_extension(obj: Object | None, extension: str) Caps | None

Tries to find the best Caps associated with extension.

All available typefinders will be checked against the extension in order of rank. The caps of the first typefinder that can handle extension will be returned.

Free-function: gst_caps_unref

Parameters:
  • obj – object doing the typefinding, or None (used for logging)

  • extension – an extension

Returns:

the Caps corresponding to extension, or None if no type could be found. The caller should free the caps returned with gst_caps_unref().

type_find_helper_get_range(obj: Object, parent: Object | None, func: Callable[[Object, Object | None, int, int], tuple[FlowReturn, Buffer]], size: int, extension: str | None = None) tuple[Caps | None, TypeFindProbability]

Utility function to do pull-based typefinding. Unlike type_find_helper() however, this function will use the specified function func to obtain the data needed by the typefind functions, rather than operating on a given source pad. This is useful mostly for elements like tag demuxers which strip off data at the beginning and/or end of a file and want to typefind the stripped data stream before adding their own source pad (the specified callback can then call the upstream peer pad with offsets adjusted for the tag size, for example).

When extension is not None, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.

Free-function: gst_caps_unref

Parameters:
  • obj – A Object that will be passed as first argument to func

  • parent – the parent of obj or None

  • func – A generic TypeFindHelperGetRangeFunction that will be used to access data at random offsets when doing the typefinding

  • size – The length in bytes

  • extension – extension of the media, or None

Returns:

the Caps corresponding to the data stream. Returns None if no Caps matches the data stream.

type_find_helper_get_range_full(obj: Object, parent: Object | None, func: Callable[[Object, Object | None, int, int], tuple[FlowReturn, Buffer]], size: int, extension: str | None = None) tuple[FlowReturn, Caps, TypeFindProbability]

Utility function to do pull-based typefinding. Unlike type_find_helper() however, this function will use the specified function func to obtain the data needed by the typefind functions, rather than operating on a given source pad. This is useful mostly for elements like tag demuxers which strip off data at the beginning and/or end of a file and want to typefind the stripped data stream before adding their own source pad (the specified callback can then call the upstream peer pad with offsets adjusted for the tag size, for example).

When extension is not None, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases.

Added in version 1.14.3.

Parameters:
  • obj – A Object that will be passed as first argument to func

  • parent – the parent of obj or None

  • func – A generic TypeFindHelperGetRangeFunction that will be used to access data at random offsets when doing the typefinding

  • size – The length in bytes

  • extension – extension of the media, or None

Returns:

the last %GstFlowReturn from pulling a buffer or %GST_FLOW_OK if typefinding was successful.

type_find_list_factories_for_caps(obj: Object | None, caps: Caps) list[TypeFindFactory] | None

Tries to find the best TypeFindFactory associated with caps.

The typefinder that can handle caps will be returned.

Free-function: g_list_free

Added in version 1.22.

Parameters:
  • obj – object doing the typefinding, or None (used for logging)

  • caps – caps of the media

Returns:

the list of TypeFindFactory corresponding to caps, or None if no typefinder could be found. Caller should free the returned list with free() and list elements with unref().