Class VideoMeta

java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.video.VideoMeta
All Implemented Interfaces:
Proxy

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

Extra buffer metadata describing image properties

This meta can also be used by downstream elements to specifiy their buffer layout requirements for upstream. Upstream should try to fit those requirements, if possible, in order to prevent buffer copies.

This is done by passing a custom GstStructure to gst_query_add_allocation_meta() when handling the ALLOCATION query. This structure should be named 'video-meta' and can have the following fields:

  • padding-top (uint): extra pixels on the top
  • padding-bottom (uint): extra pixels on the bottom
  • padding-left (uint): extra pixels on the left side
  • padding-right (uint): extra pixels on the right side
  • stride-align0 (uint): stride align requirements for plane 0
  • stride-align1 (uint): stride align requirements for plane 1
  • stride-align2 (uint): stride align requirements for plane 2
  • stride-align3 (uint): stride align requirements for plane 3 The padding and stride-align fields have the same semantic as GstVideoMeta.alignment and so represent the paddings and stride-align requested on produced video buffers.

Since 1.24 it can be serialized using gst_meta_serialize() and gst_meta_deserialize().

  • Constructor Details

    • VideoMeta

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

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

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

      public VideoMeta(Meta meta, Buffer buffer, Set<VideoFrameFlags> flags, VideoFormat format, int id, int width, int height, int nPlanes, long[] offset, int[] stride, VideoMeta.MapCallback map, VideoMeta.UnmapCallback unmap, VideoAlignment alignment, Arena arena)
      Allocate a new VideoMeta with the fields set to the provided values.
      Parameters:
      meta - value for the field meta
      buffer - value for the field buffer
      flags - value for the field flags
      format - value for the field format
      id - value for the field id
      width - value for the field width
      height - value for the field height
      nPlanes - value for the field nPlanes
      offset - value for the field offset
      stride - value for the field stride
      map - callback function for the field map
      unmap - callback function for the field unmap
      alignment - value for the field alignment
      arena - to control the memory allocation scope
    • VideoMeta

      public VideoMeta(Meta meta, Buffer buffer, Set<VideoFrameFlags> flags, VideoFormat format, int id, int width, int height, int nPlanes, long[] offset, int[] stride, VideoMeta.MapCallback map, VideoMeta.UnmapCallback unmap, VideoAlignment alignment)
      Allocate a new VideoMeta with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      meta - value for the field meta
      buffer - value for the field buffer
      flags - value for the field flags
      format - value for the field format
      id - value for the field id
      width - value for the field width
      height - value for the field height
      nPlanes - value for the field nPlanes
      offset - value for the field offset
      stride - value for the field stride
      map - callback function for the field map
      unmap - callback function for the field unmap
      alignment - value for the field alignment
  • Method Details

    • getMemoryLayout

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

      public @Nullable Meta readMeta()
      Read the value of the field meta.
      Returns:
      The value of the field meta
    • writeMeta

      public void writeMeta(@Nullable Meta meta)
      Write a value in the field meta.
      Parameters:
      meta - The new value for the field meta
    • readBuffer

      public Buffer readBuffer()
      Read the value of the field buffer.
      Returns:
      The value of the field buffer
    • writeBuffer

      public void writeBuffer(Buffer buffer)
      Write a value in the field buffer.
      Parameters:
      buffer - The new value for the field buffer
    • readFlags

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

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

      public VideoFormat readFormat()
      Read the value of the field format.
      Returns:
      The value of the field format
    • writeFormat

      public void writeFormat(VideoFormat format)
      Write a value in the field format.
      Parameters:
      format - The new value for the field format
    • readId

      public int readId()
      Read the value of the field id.
      Returns:
      The value of the field id
    • writeId

      public void writeId(int id)
      Write a value in the field id.
      Parameters:
      id - The new value for the field id
    • readWidth

      public int readWidth()
      Read the value of the field width.
      Returns:
      The value of the field width
    • writeWidth

      public void writeWidth(int width)
      Write a value in the field width.
      Parameters:
      width - The new value for the field width
    • readHeight

      public int readHeight()
      Read the value of the field height.
      Returns:
      The value of the field height
    • writeHeight

      public void writeHeight(int height)
      Write a value in the field height.
      Parameters:
      height - The new value for the field height
    • readNPlanes

      public int readNPlanes()
      Read the value of the field n_planes.
      Returns:
      The value of the field n_planes
    • writeNPlanes

      public void writeNPlanes(int nPlanes)
      Write a value in the field n_planes.
      Parameters:
      nPlanes - The new value for the field n_planes
    • readOffset

      public @Nullable long @Nullable [] readOffset()
      Read the value of the field offset.
      Returns:
      The value of the field offset
    • writeOffset

      public void writeOffset(@Nullable long @Nullable [] offset, Arena _arena)
      Write a value in the field offset.
      Parameters:
      offset - The new value for the field offset
    • readStride

      public @Nullable int @Nullable [] readStride()
      Read the value of the field stride.
      Returns:
      The value of the field stride
    • writeStride

      public void writeStride(@Nullable int @Nullable [] stride, Arena _arena)
      Write a value in the field stride.
      Parameters:
      stride - The new value for the field stride
    • overrideMap

      public void overrideMap(VideoMeta.MapCallback map, Arena _arena)
      Write a value in the field map.
      Parameters:
      map - The new value for the field map
      _arena - to control the memory allocation scope
    • overrideUnmap

      public void overrideUnmap(VideoMeta.UnmapCallback unmap, Arena _arena)
      Write a value in the field unmap.
      Parameters:
      unmap - The new value for the field unmap
      _arena - to control the memory allocation scope
    • readAlignment

      public @Nullable VideoAlignment readAlignment()
      Read the value of the field alignment.
      Returns:
      The value of the field alignment
    • writeAlignment

      public void writeAlignment(@Nullable VideoAlignment alignment)
      Write a value in the field alignment.
      Parameters:
      alignment - The new value for the field alignment
    • getInfo

      public static MetaInfo getInfo()
    • getPlaneHeight

      public boolean getPlaneHeight(@Nullable Out<int[]> planeHeight)

      Compute the padded height of each plane from this VideoMeta (padded size divided by stride).

      It is not valid to call this function with a meta associated to a TILED video format.

      Parameters:
      planeHeight - array used to store the plane height
      Returns:
      true if meta's alignment is valid and planeHeight has been updated, false otherwise
      Since:
      1.18
    • getPlaneSize

      public boolean getPlaneSize(@Nullable Out<long[]> planeSize)
      Compute the size, in bytes, of each video plane described in this VideoMeta including any padding and alignment constraint defined in meta>alignment.
      Parameters:
      planeSize - array used to store the plane sizes
      Returns:
      true if meta's alignment is valid and planeSize has been updated, false otherwise
      Since:
      1.18
    • map

      public boolean map(int plane, MapInfo info, @Nullable Out<MemorySegment> data, Out<Integer> stride, int flags)
      Map the video plane with index plane in this VideoMeta and return a pointer to the first byte of the plane and the stride of the plane.
      Parameters:
      plane - a plane
      info - a GstMapInfo
      data - the data of plane
      stride - the stride of plane
      flags - GstMapFlags
      Returns:
      TRUE if the map operation was successful.
    • setAlignment

      public boolean setAlignment(@Nullable VideoAlignment alignment)
      Set the alignment of this VideoMeta to alignment. This function checks that the paddings defined in alignment are compatible with the strides defined in this VideoMeta and will fail to update if they are not.
      Parameters:
      alignment - a GstVideoAlignment
      Returns:
      true if alignment's meta has been updated, false if not
      Since:
      1.18
    • unmap

      public boolean unmap(int plane, MapInfo info)
      Unmap a previously mapped plane with gst_video_meta_map().
      Parameters:
      plane - a plane
      info - a GstMapInfo
      Returns:
      TRUE if the memory was successfully unmapped.