:right-sidebar: True Meta =================================================================== .. currentmodule:: gi.repository.Gst .. class:: Meta(*args, **kwargs) :no-contents-entry: The :obj:`~gi.repository.Gst.Meta` structure should be included as the first member of a :obj:`~gi.repository.Gst.Buffer` metadata structure. The structure defines the API of the metadata and should be accessible to all elements using the metadata. A metadata API is registered with :func:`~gi.repository.Gst.Meta.api_type_register` which takes a name for the metadata API and some tags associated with the metadata. With :func:`~gi.repository.Gst.Meta.api_type_has_tag` one can check if a certain metadata API contains a given tag. Multiple implementations of a metadata API can be registered. To implement a metadata API, :func:`~gi.repository.Gst.Meta.register` should be used. This function takes all parameters needed to create, free and transform metadata along with the size of the metadata. The function returns a :obj:`~gi.repository.Gst.MetaInfo` structure that contains the information for the implementation of the API. A specific implementation can be retrieved by name with :func:`~gi.repository.Gst.Meta.get_info`. See :obj:`~gi.repository.Gst.Buffer` for how the metadata can be added, retrieved and removed from buffers. Methods ------- .. rst-class:: interim-class .. class:: Meta :no-index: .. classmethod:: api_type_get_tags() -> list[str] .. versionadded:: 1.2 .. classmethod:: api_type_has_tag(tag: int) -> bool Check if ``api`` was registered with ``tag``\. :param tag: the tag to check .. classmethod:: api_type_register(tags: list[str]) -> ~gobject.GType Register and return a GType for the ``api`` and associate it with ``tags``\. :param tags: tags for ``api`` .. method:: compare_seqnum(meta2: ~gi.repository.Gst.Meta) -> int Meta sequence number compare function. Can be used as :obj:`~gi.repository.GLib.CompareFunc` or a :obj:`~gi.repository.GLib.CompareDataFunc`\. .. versionadded:: 1.16 :param meta2: a :obj:`~gi.repository.Gst.Meta` .. classmethod:: deserialize(data: int, size: int) -> ~typing.Tuple[~gi.repository.Gst.Meta | None, int] Recreate a :obj:`~gi.repository.Gst.Meta` from serialized data returned by :func:`~gi.repository.Gst.Meta.serialize` and add it to ``buffer``\. Note that the meta must have been previously registered by calling one of ``gst_*_meta_get_info ()`` functions. ``consumed`` is set to the number of bytes that can be skipped from ``data`` to find the next meta serialization, if any. In case of parsing error that does not allow to determine that size, ``consumed`` is set to 0. .. versionadded:: 1.24 :param data: serialization data obtained from :func:`~gi.repository.Gst.Meta.serialize` :param size: size of ``data`` .. classmethod:: get_info() -> ~gi.repository.Gst.MetaInfo | None Lookup a previously registered meta info structure by its implementation name ``impl``\. .. method:: get_seqnum() -> int Gets seqnum for this meta. .. versionadded:: 1.16 .. classmethod:: register_custom(tags: list[str], transform_func: ~typing.Callable[[~gi.repository.Gst.Buffer, ~gi.repository.Gst.CustomMeta, ~gi.repository.Gst.Buffer, int, ~typing.Any, ~typing.Any], bool] | None = None, user_data: ~typing.Any = None) -> ~gi.repository.Gst.MetaInfo Register a new custom :obj:`~gi.repository.Gst.Meta` implementation, backed by an opaque structure holding a :obj:`~gi.repository.Gst.Structure`\. The registered info can be retrieved later with :func:`~gi.repository.Gst.Meta.get_info` by using ``name`` as the key. The backing :obj:`~gi.repository.Gst.Structure` can be retrieved with :func:`~gi.repository.Gst.CustomMeta.get_structure`, its mutability is conditioned by the writability of the buffer the meta is attached to. When ``transform_func`` is :const:`None`, the meta and its backing :obj:`~gi.repository.Gst.Structure` will always be copied when the transform operation is copy, other operations are discarded, copy regions are ignored. .. versionadded:: 1.20 :param tags: tags for ``api`` :param transform_func: a :obj:`~gi.repository.Gst.MetaTransformFunction` :param user_data: user data passed to ``transform_func`` .. classmethod:: register_custom_simple() -> ~gi.repository.Gst.MetaInfo Simplified version of :func:`~gi.repository.Gst.Meta.register_custom`, with no tags and no transform function. .. versionadded:: 1.24 .. method:: serialize(data: ~gi.repository.Gst.ByteArrayInterface) -> bool Serialize ``meta`` into a format that can be stored or transmitted and later deserialized by :func:`~gi.repository.Gst.Meta.deserialize`. This is only supported for meta that implements :obj:`~gi.repository.Gst.MetaInfo`\.serialize_func, :const:`False` is returned otherwise. Upon failure, ``data``\->data pointer could have been reallocated, but ``data``\->len won't be modified. This is intended to be able to append multiple metas into the same ``GByteArray``. Since serialization size is often the same for every buffer, caller may want to remember the size of previous data to preallocate the next. .. versionadded:: 1.24 :param data: :obj:`~gi.repository.Gst.ByteArrayInterface` to append serialization data .. method:: serialize_simple(data: list[int]) -> bool Same as :func:`~gi.repository.Gst.Meta.serialize` but with a ``GByteArray`` instead of :obj:`~gi.repository.Gst.ByteArrayInterface`\. .. versionadded:: 1.24 :param data: ``GByteArray`` to append serialization data Fields ------ .. rst-class:: interim-class .. class:: Meta :no-index: .. attribute:: flags Extra flags for the metadata .. attribute:: info Pointer to the :obj:`~gi.repository.Gst.MetaInfo`