:right-sidebar: True TypeFind =================================================================== .. currentmodule:: gi.repository.Gst .. class:: TypeFind(*args, **kwargs) :no-contents-entry: The following functions allow you to detect the media type of an unknown stream. Methods ------- .. rst-class:: interim-class .. class:: TypeFind :no-index: .. method:: get_length() -> int Get the length of the data stream. .. method:: peek(offset: int, size: int) -> int | None 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. :param offset: The offset :param size: The number of bytes to return .. classmethod:: register(name: str, rank: int, func: ~typing.Callable[[~gi.repository.Gst.TypeFind, ~typing.Any], None], extensions: str | None = None, possible_caps: ~gi.repository.Gst.Caps | None = None, data: ~typing.Any = None) -> bool 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. :param name: The name for registering :param rank: The rank (or importance) of this typefind function :param func: The :obj:`~gi.repository.Gst.TypeFindFunction` to use :param extensions: Optional comma-separated list of extensions that could belong to this type :param possible_caps: Optionally the caps that could be returned when typefinding succeeds :param data: Optional user data. This user data must be available until the plugin is unloaded. .. method:: suggest(probability: int, caps: ~gi.repository.Gst.Caps) -> None If a :obj:`~gi.repository.Gst.TypeFindFunction` calls this function it suggests the caps with the given probability. A :obj:`~gi.repository.Gst.TypeFindFunction` may supply different suggestions in one call. It is up to the caller of the :obj:`~gi.repository.Gst.TypeFindFunction` to interpret these values. :param probability: The probability in percent that the suggestion is right :param caps: The fixed :obj:`~gi.repository.Gst.Caps` to suggest .. method:: suggest_empty_simple(probability: int, media_type: str) -> None If a :obj:`~gi.repository.Gst.TypeFindFunction` calls this function it suggests caps of the given ``media_type`` with the given ``probability``\. This function is similar to :func:`~gi.repository.Gst.TypeFind.suggest_simple`, but uses a :obj:`~gi.repository.Gst.Caps` with no fields. .. versionadded:: 1.20 :param probability: The probability in percent that the suggestion is right :param media_type: the media type of the suggested caps Fields ------ .. rst-class:: interim-class .. class:: TypeFind :no-index: .. attribute:: data The data used by the caller of the typefinding function.