Class Meta

java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.Meta
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Meta extends ProxyInstance

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

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

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

  • Constructor Details

    • Meta

      public Meta(MemorySegment address)
      Create a Meta proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Meta

      public Meta(Arena arena)
      Allocate a new Meta.
      Parameters:
      arena - to control the memory allocation scope
    • Meta

      public Meta()
      Allocate a new Meta. The memory is allocated with Arena.ofAuto().
    • Meta

      public Meta(Set<MetaFlags> flags, MetaInfo info, Arena arena)
      Allocate a new Meta with the fields set to the provided values.
      Parameters:
      flags - value for the field flags
      info - value for the field info
      arena - to control the memory allocation scope
    • Meta

      public Meta(Set<MetaFlags> flags, MetaInfo info)
      Allocate a new Meta with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      flags - value for the field flags
      info - value for the field info
  • Method Details

    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readFlags

      public Set<MetaFlags> readFlags()
      Read the value of the field flags.
      Returns:
      The value of the field flags
    • writeFlags

      public void writeFlags(Set<MetaFlags> flags)
      Write a value in the field flags.
      Parameters:
      flags - The new value for the field flags
    • readInfo

      public MetaInfo readInfo()
      Read the value of the field info.
      Returns:
      The value of the field info
    • writeInfo

      public void writeInfo(MetaInfo info)
      Write a value in the field info.
      Parameters:
      info - The new value for the field info
    • apiTypeAggregateParams

      public static boolean apiTypeAggregateParams(Type api, Structure[] aggregatedParams, Structure params0, Structure params1)
      When a element like tee decides the allocation, each downstream element may fill different parameters and pass them to 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 aggregatedParams.
      Parameters:
      api - the GType of the API for which the parameters are being aggregated.
      aggregatedParams - This structure will be updated with the combined parameters from both params0 and params1.
      params0 - a GstStructure containing the new parameters to be aggregated.
      params1 - a GstStructure containing the new parameters to be aggregated.
      Returns:
      true if the parameters were successfully aggregated, false otherwise.
      Since:
      1.26
    • apiTypeGetTags

      public static String[] apiTypeGetTags(Type api)
    • apiTypeHasTag

      public static boolean apiTypeHasTag(Type api, Quark tag)
      Check if api was registered with tag.
      Parameters:
      api - an API
      tag - the tag to check
      Returns:
      true if api was registered with tag.
    • apiTypeRegister

      public static Type apiTypeRegister(String api, @Nullable String @Nullable [] tags)
      Register and return a GType for the api and associate it with tags.
      Parameters:
      api - an API to register
      tags - tags for api
      Returns:
      a unique GType for api.
    • apiTypeSetParamsAggregator

      public static void apiTypeSetParamsAggregator(Type api, @Nullable AllocationMetaParamsAggregator aggregator)
      This function sets the aggregator function for a specific API type.
      Parameters:
      api - the GType of the API for which the aggregator function is being set.
      aggregator - the aggregator function to be associated with the given API type.
      Since:
      1.26
    • deserialize

      public static @Nullable Meta deserialize(Buffer buffer, MemorySegment data, long size, Out<Integer> consumed)

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

      Parameters:
      buffer - a GstBuffer
      data - serialization data obtained from gst_meta_serialize()
      size - size of data
      consumed - total size used by this meta, could be less than size
      Returns:
      the metadata owned by buffer, or null.
      Since:
      1.24
    • getInfo

      public static @Nullable MetaInfo getInfo(String impl)
      Lookup a previously registered meta info structure by its implementation name impl.
      Parameters:
      impl - the name
      Returns:
      a GstMetaInfo with impl, or null when no such metainfo exists.
    • register

      public static MetaInfo register(Type api, String impl, long size, @Nullable MetaInitFunction initFunc, @Nullable MetaFreeFunction freeFunc, @Nullable MetaTransformFunction transformFunc)

      Register a new GstMeta implementation.

      The same info can be retrieved later with gst_meta_get_info() by using impl as the key.

      Parameters:
      api - the type of the GstMeta API
      impl - the name of the GstMeta implementation
      size - the size of the GstMeta structure
      initFunc - a GstMetaInitFunction
      freeFunc - a GstMetaFreeFunction
      transformFunc - a GstMetaTransformFunction
      Returns:
      a GstMetaInfo that can be used to access metadata.
    • registerCustom

      public static MetaInfo registerCustom(String name, @Nullable String @Nullable [] tags, @Nullable CustomMetaTransformFunction transformFunc)

      Register a new custom GstMeta implementation, backed by an opaque structure holding a GstStructure.

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

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

      When transformFunc is null, the meta and its backing GstStructure will always be copied when the transform operation is copy, other operations are discarded, copy regions are ignored.

      Parameters:
      name - the name of the GstMeta implementation
      tags - tags for api
      transformFunc - a GstMetaTransformFunction
      Returns:
      a GstMetaInfo that can be used to access metadata.
      Since:
      1.20
    • registerCustomSimple

      public static MetaInfo registerCustomSimple(String name)
      Simplified version of gst_meta_register_custom(), with no tags and no transform function.
      Parameters:
      name - the name of the GstMeta implementation
      Returns:
      a GstMetaInfo that can be used to access metadata.
      Since:
      1.24
    • compareSeqnum

      public int compareSeqnum(Meta meta2)
      Meta sequence number compare function. Can be used as GCompareFunc or a GCompareDataFunc.
      Parameters:
      meta2 - a GstMeta
      Returns:
      a negative number if this Meta comes before meta2, 0 if both metas have an equal sequence number, or a positive integer if this Meta comes after meta2.
      Since:
      1.16
    • getSeqnum

      public long getSeqnum()
      Gets seqnum for this meta.
      Since:
      1.16
    • serialize

      public boolean serialize(ByteArrayInterface data)

      Serialize this Meta into a format that can be stored or transmitted and later deserialized by gst_meta_deserialize().

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

      Parameters:
      data - GstByteArrayInterface to append serialization data
      Returns:
      true on success, false otherwise.
      Since:
      1.24
    • serializeSimple

      public boolean serializeSimple(@Nullable byte @Nullable [] data)
      Same as gst_meta_serialize() but with a GByteArray instead of GstByteArrayInterface.
      Parameters:
      data - GByteArray to append serialization data
      Returns:
      true on success, false otherwise.
      Since:
      1.24