Functions ========= .. currentmodule:: gi.repository.GstBase .. function:: type_find_helper(src: ~gi.repository.Gst.Pad, size: int) -> ~gi.repository.Gst.Caps | None Tries to find what type of data is flowing from the given source :obj:`~gi.repository.Gst.Pad`\. Free-function: gst_caps_unref :param src: A source :obj:`~gi.repository.Gst.Pad` :param size: The length in bytes :return: the :obj:`~gi.repository.Gst.Caps` corresponding to the data stream. Returns :const:`None` if no :obj:`~gi.repository.Gst.Caps` matches the data stream. .. function:: type_find_helper_for_buffer(obj: ~gi.repository.Gst.Object | None, buf: ~gi.repository.Gst.Buffer) -> ~typing.Tuple[~gi.repository.Gst.Caps | None, ~gi.repository.Gst.TypeFindProbability] Tries to find what type of data is contained in the given :obj:`~gi.repository.Gst.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 :const:`None` if the content of the buffer could not be identified. Free-function: gst_caps_unref :param obj: object doing the typefinding, or :const:`None` (used for logging) :param buf: a :obj:`~gi.repository.Gst.Buffer` with data to typefind :return: the :obj:`~gi.repository.Gst.Caps` corresponding to the data, or :const:`None` if no type could be found. The caller should free the caps returned with gst_caps_unref(). .. function:: type_find_helper_for_buffer_with_caps(obj: ~gi.repository.Gst.Object | None, buf: ~gi.repository.Gst.Buffer, caps: ~gi.repository.Gst.Caps) -> ~typing.Tuple[~gi.repository.Gst.Caps | None, ~gi.repository.Gst.TypeFindProbability] Tries to find if type of media contained in the given :obj:`~gi.repository.Gst.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 :const:`None` if the content of the ``data`` could not be identified. Free-function: gst_caps_unref .. versionadded:: 1.22 :param obj: object doing the typefinding, or :const:`None` (used for logging) :param buf: a :obj:`~gi.repository.Gst.Buffer` with data to typefind :param caps: caps of the media :return: the :obj:`~gi.repository.Gst.Caps` corresponding to the data, or :const:`None` if no type could be found. The caller should free the caps returned with gst_caps_unref(). .. function:: type_find_helper_for_buffer_with_extension(obj: ~gi.repository.Gst.Object | None, buf: ~gi.repository.Gst.Buffer, extension: str | None = None) -> ~typing.Tuple[~gi.repository.Gst.Caps | None, ~gi.repository.Gst.TypeFindProbability] Tries to find what type of data is contained in the given :obj:`~gi.repository.Gst.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 :const:`None` if the content of the buffer could not be identified. When ``extension`` is not :const:`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 .. versionadded:: 1.16 :param obj: object doing the typefinding, or :const:`None` (used for logging) :param buf: a :obj:`~gi.repository.Gst.Buffer` with data to typefind :param extension: extension of the media, or :const:`None` :return: the :obj:`~gi.repository.Gst.Caps` corresponding to the data, or :const:`None` if no type could be found. The caller should free the caps returned with gst_caps_unref(). .. function:: type_find_helper_for_data(obj: ~gi.repository.Gst.Object | None, data: list[int]) -> ~typing.Tuple[~gi.repository.Gst.Caps | None, ~gi.repository.Gst.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 :const:`None` if the content of ``data`` could not be identified. Free-function: gst_caps_unref :param obj: object doing the typefinding, or :const:`None` (used for logging) :param data: - a pointer with data to typefind :return: the :obj:`~gi.repository.Gst.Caps` corresponding to the data, or :const:`None` if no type could be found. The caller should free the caps returned with gst_caps_unref(). .. function:: type_find_helper_for_data_with_caps(obj: ~gi.repository.Gst.Object | None, data: list[int], caps: ~gi.repository.Gst.Caps) -> ~typing.Tuple[~gi.repository.Gst.Caps | None, ~gi.repository.Gst.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 :const:`None` if the content of the ``data`` could not be identified. Free-function: gst_caps_unref .. versionadded:: 1.22 :param obj: object doing the typefinding, or :const:`None` (used for logging) :param data: a pointer with data to typefind :param caps: caps of the media :return: the :obj:`~gi.repository.Gst.Caps` corresponding to the data, or :const:`None` if no type could be found. The caller should free the caps returned with gst_caps_unref(). .. function:: type_find_helper_for_data_with_extension(obj: ~gi.repository.Gst.Object | None, data: list[int], extension: str | None = None) -> ~typing.Tuple[~gi.repository.Gst.Caps | None, ~gi.repository.Gst.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 :const:`None` if the content of ``data`` could not be identified. When ``extension`` is not :const:`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 .. versionadded:: 1.16 :param obj: object doing the typefinding, or :const:`None` (used for logging) :param data: - a pointer with data to typefind :param extension: extension of the media, or :const:`None` :return: the :obj:`~gi.repository.Gst.Caps` corresponding to the data, or :const:`None` if no type could be found. The caller should free the caps returned with gst_caps_unref(). .. function:: type_find_helper_for_extension(obj: ~gi.repository.Gst.Object | None, extension: str) -> ~gi.repository.Gst.Caps | None Tries to find the best :obj:`~gi.repository.Gst.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 :param obj: object doing the typefinding, or :const:`None` (used for logging) :param extension: an extension :return: the :obj:`~gi.repository.Gst.Caps` corresponding to ``extension``\, or :const:`None` if no type could be found. The caller should free the caps returned with gst_caps_unref(). .. function:: type_find_helper_get_range(obj: ~gi.repository.Gst.Object, parent: ~gi.repository.Gst.Object | None, func: ~typing.Callable[[~gi.repository.Gst.Object, ~gi.repository.Gst.Object | None, int, int], ~typing.Tuple[~gi.repository.Gst.FlowReturn, ~gi.repository.Gst.Buffer]], size: int, extension: str | None = None) -> ~typing.Tuple[~gi.repository.Gst.Caps | None, ~gi.repository.Gst.TypeFindProbability] Utility function to do pull-based typefinding. Unlike :func:`~gi.repository.GstBase.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 :const:`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 :param obj: A :obj:`~gi.repository.Gst.Object` that will be passed as first argument to ``func`` :param parent: the parent of ``obj`` or :const:`None` :param func: A generic :obj:`~gi.repository.GstBase.TypeFindHelperGetRangeFunction` that will be used to access data at random offsets when doing the typefinding :param size: The length in bytes :param extension: extension of the media, or :const:`None` :return: the :obj:`~gi.repository.Gst.Caps` corresponding to the data stream. Returns :const:`None` if no :obj:`~gi.repository.Gst.Caps` matches the data stream. .. function:: type_find_helper_get_range_full(obj: ~gi.repository.Gst.Object, parent: ~gi.repository.Gst.Object | None, func: ~typing.Callable[[~gi.repository.Gst.Object, ~gi.repository.Gst.Object | None, int, int], ~typing.Tuple[~gi.repository.Gst.FlowReturn, ~gi.repository.Gst.Buffer]], size: int, extension: str | None = None) -> ~typing.Tuple[~gi.repository.Gst.FlowReturn, ~gi.repository.Gst.Caps, ~gi.repository.Gst.TypeFindProbability] Utility function to do pull-based typefinding. Unlike :func:`~gi.repository.GstBase.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 :const:`None`, this function will first try the typefind functions for the given extension, which might speed up the typefinding in many cases. .. versionadded:: 1.14.3 :param obj: A :obj:`~gi.repository.Gst.Object` that will be passed as first argument to ``func`` :param parent: the parent of ``obj`` or :const:`None` :param func: A generic :obj:`~gi.repository.GstBase.TypeFindHelperGetRangeFunction` that will be used to access data at random offsets when doing the typefinding :param size: The length in bytes :param extension: extension of the media, or :const:`None` :return: the last %GstFlowReturn from pulling a buffer or %GST_FLOW_OK if typefinding was successful. .. function:: type_find_list_factories_for_caps(obj: ~gi.repository.Gst.Object | None, caps: ~gi.repository.Gst.Caps) -> list[~gi.repository.Gst.TypeFindFactory] | None Tries to find the best :obj:`~gi.repository.Gst.TypeFindFactory` associated with ``caps``\. The typefinder that can handle ``caps`` will be returned. Free-function: g_list_free .. versionadded:: 1.22 :param obj: object doing the typefinding, or :const:`None` (used for logging) :param caps: caps of the media :return: the list of :obj:`~gi.repository.Gst.TypeFindFactory` corresponding to ``caps``\, or :const:`None` if no typefinder could be found. Caller should free the returned list with :func:`~gi.repository.GLib.List.free` and list elements with :func:`~gi.repository.Gst.Gst.Object.unref`.