Meta#

class Meta(*args, **kwargs)#

The Meta structure should be included as the first member of a 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 api_type_register() which takes a name for the metadata API and some tags associated with the metadata. With 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, 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 MetaInfo structure that contains the information for the implementation of the API.

A specific implementation can be retrieved by name with get_info().

See Buffer for how the metadata can be added, retrieved and removed from buffers.

Methods#

class Meta
classmethod api_type_get_tags() list[str]#

Added in version 1.2.

classmethod api_type_has_tag(tag: int) bool#

Check if api was registered with tag.

Parameters:

tag – the tag to check

classmethod api_type_register(tags: list[str]) GType#

Register and return a GType for the api and associate it with tags.

Parameters:

tags – tags for api

compare_seqnum(meta2: Meta) int#

Meta sequence number compare function. Can be used as CompareFunc or a CompareDataFunc.

Added in version 1.16.

Parameters:

meta2 – a Meta

classmethod deserialize(data: int, size: int) Tuple[Meta | None, int]#

Recreate a Meta from serialized data returned by 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.

Added in version 1.24.

Parameters:
  • data – serialization data obtained from serialize()

  • size – size of data

classmethod get_info() MetaInfo | None#

Lookup a previously registered meta info structure by its implementation name impl.

get_seqnum() int#

Gets seqnum for this meta.

Added in version 1.16.

classmethod register_custom(tags: list[str], transform_func: Callable[[Buffer, CustomMeta, Buffer, int, Any, Any], bool] | None = None, user_data: Any = None) MetaInfo#

Register a new custom Meta implementation, backed by an opaque structure holding a Structure.

The registered info can be retrieved later with get_info() by using name as the key.

The backing Structure can be retrieved with get_structure(), its mutability is conditioned by the writability of the buffer the meta is attached to.

When transform_func is None, the meta and its backing Structure will always be copied when the transform operation is copy, other operations are discarded, copy regions are ignored.

Added in version 1.20.

Parameters:
  • tags – tags for api

  • transform_func – a MetaTransformFunction

  • user_data – user data passed to transform_func

classmethod register_custom_simple() MetaInfo#

Simplified version of register_custom(), with no tags and no transform function.

Added in version 1.24.

serialize(data: ByteArrayInterface) bool#

Serialize meta into a format that can be stored or transmitted and later deserialized by deserialize().

This is only supported for meta that implements MetaInfo.serialize_func, 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.

Added in version 1.24.

Parameters:

dataByteArrayInterface to append serialization data

serialize_simple(data: list[int]) bool#

Same as serialize() but with a GByteArray instead of ByteArrayInterface.

Added in version 1.24.

Parameters:

dataGByteArray to append serialization data

Fields#

class Meta
flags#

Extra flags for the metadata

info#

Pointer to the MetaInfo