: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_aggregate_params(api: ~gobject.GType, aggregated_params: ~gi.repository.Gst.Structure, params0: ~gi.repository.Gst.Structure, params1: ~gi.repository.Gst.Structure) -> bool When a element like ``tee`` decides the allocation, each downstream element may fill different parameters and pass them to :func:`~gi.repository.Gst.Query.add_allocation_meta`. In order to keep these parameters, a merge operation is needed. This aggregate function can combine the parameters from ``params0`` and ``param1``\, and write the result back into ``aggregated_params``\. .. versionadded:: 1.26 :param api: the GType of the API for which the parameters are being aggregated. :param aggregated_params: This structure will be updated with the combined parameters from both ``params0`` and ``params1``\. :param params0: a :obj:`~gi.repository.Gst.Structure` containing the new parameters to be aggregated. :param params1: a :obj:`~gi.repository.Gst.Structure` containing the new parameters to be aggregated. .. classmethod:: api_type_get_tags(api: ~gobject.GType) -> list[str] .. versionadded:: 1.2 :param api: an API .. classmethod:: api_type_has_tag(api: ~gobject.GType, tag: int) -> bool Check if ``api`` was registered with ``tag``\. :param api: an API :param tag: the tag to check .. classmethod:: api_type_register(api: str, tags: list[str]) -> ~gobject.GType Register and return a GType for the ``api`` and associate it with ``tags``\. :param api: an API to register :param tags: tags for ``api`` .. classmethod:: api_type_set_params_aggregator(api: ~gobject.GType, aggregator: ~collections.abc.Callable[[~gi.repository.Gst.Structure, ~gi.repository.Gst.Structure, ~gi.repository.Gst.Structure], bool]) -> None This function sets the aggregator function for a specific API type. .. versionadded:: 1.26 :param api: the :obj:`~gi.repository.GObject.Type` of the API for which the aggregator function is being set. :param aggregator: the aggregator function to be associated with the given API type. .. classmethod:: api_type_tags_contain_only(api: ~gobject.GType, valid_tags: list[str]) -> bool .. versionadded:: 1.28 :param api: an API :param valid_tags: a list of valid tags .. 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(buffer: ~gi.repository.Gst.Buffer, data: list[int]) -> 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 buffer: a :obj:`~gi.repository.Gst.Buffer` :param data: serialization data obtained from :func:`~gi.repository.Gst.Meta.serialize` .. classmethod:: get_info(impl: str) -> ~gi.repository.Gst.MetaInfo | None Lookup a previously registered meta info structure by its implementation name ``impl``\. :param impl: the name .. method:: get_seqnum() -> int Gets seqnum for this meta. .. versionadded:: 1.16 .. classmethod:: register_custom(name: str, tags: list[str], transform_func: ~collections.abc.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 name: the name of the :obj:`~gi.repository.Gst.Meta` implementation :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(name: str) -> ~gi.repository.Gst.MetaInfo Simplified version of :func:`~gi.repository.Gst.Meta.register_custom`, with no tags and no transform function. .. versionadded:: 1.24 :param name: the name of the :obj:`~gi.repository.Gst.Meta` implementation .. 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`