Package org.freedesktop.gstreamer.video
Class VideoMeta
java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.video.VideoMeta
- All Implemented Interfaces:
Proxy
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().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theMapCallbackcallback.static interfaceFunctional interface declaration of theUnmapCallbackcallback. -
Constructor Summary
ConstructorsConstructorDescriptionAllocate a new VideoMeta.Allocate a new VideoMeta.VideoMeta(MemorySegment address) Create a VideoMeta proxy instance for the provided memory address.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.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. -
Method Summary
Modifier and TypeMethodDescriptionstatic MetaInfogetInfo()static MemoryLayoutThe memory layout of the native struct.booleangetPlaneHeight(@Nullable Out<int[]> planeHeight) Compute the padded height of each plane from this VideoMeta (padded size divided by stride).booleangetPlaneSize(@Nullable Out<long[]> planeSize) Compute the size, in bytes, of each video plane described in this VideoMeta including any padding and alignment constraint defined inmeta>alignment.booleanMap the video plane with indexplanein this VideoMeta and return a pointer to the first byte of the plane and the stride of the plane.voidoverrideMap(VideoMeta.MapCallback map, Arena _arena) Write a value in the fieldmap.voidoverrideUnmap(VideoMeta.UnmapCallback unmap, Arena _arena) Write a value in the fieldunmap.@Nullable VideoAlignmentRead the value of the fieldalignment.Read the value of the fieldbuffer.Read the value of the fieldflags.Read the value of the fieldformat.intRead the value of the fieldheight.intreadId()Read the value of the fieldid.@Nullable MetareadMeta()Read the value of the fieldmeta.intRead the value of the fieldn_planes.@org.jspecify.annotations.Nullable long @Nullable []Read the value of the fieldoffset.@org.jspecify.annotations.Nullable int @Nullable []Read the value of the fieldstride.intRead the value of the fieldwidth.booleansetAlignment(@Nullable VideoAlignment alignment) Set the alignment of this VideoMeta toalignment.This function checks that the paddings defined inalignmentare compatible with the strides defined in this VideoMeta and will fail to update if they are not.booleanUnmap a previously mapped plane with gst_video_meta_map().voidwriteAlignment(@Nullable VideoAlignment alignment) Write a value in the fieldalignment.voidwriteBuffer(Buffer buffer) Write a value in the fieldbuffer.voidwriteFlags(Set<VideoFrameFlags> flags) Write a value in the fieldflags.voidwriteFormat(VideoFormat format) Write a value in the fieldformat.voidwriteHeight(int height) Write a value in the fieldheight.voidwriteId(int id) Write a value in the fieldid.voidWrite a value in the fieldmeta.voidwriteNPlanes(int nPlanes) Write a value in the fieldn_planes.voidwriteOffset(@org.jspecify.annotations.Nullable long @Nullable [] offset, Arena _arena) Write a value in the fieldoffset.voidwriteStride(@org.jspecify.annotations.Nullable int @Nullable [] stride, Arena _arena) Write a value in the fieldstride.voidwriteWidth(int width) Write a value in the fieldwidth.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
VideoMeta
Create a VideoMeta proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
VideoMeta
Allocate a new VideoMeta.- Parameters:
arena- to control the memory allocation scope
-
VideoMeta
public VideoMeta()Allocate a new VideoMeta. The memory is allocated withArena.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 fieldmetabuffer- value for the fieldbufferflags- value for the fieldflagsformat- value for the fieldformatid- value for the fieldidwidth- value for the fieldwidthheight- value for the fieldheightnPlanes- value for the fieldnPlanesoffset- value for the fieldoffsetstride- value for the fieldstridemap- callback function for the fieldmapunmap- callback function for the fieldunmapalignment- value for the fieldalignmentarena- 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 withArena.ofAuto().- Parameters:
meta- value for the fieldmetabuffer- value for the fieldbufferflags- value for the fieldflagsformat- value for the fieldformatid- value for the fieldidwidth- value for the fieldwidthheight- value for the fieldheightnPlanes- value for the fieldnPlanesoffset- value for the fieldoffsetstride- value for the fieldstridemap- callback function for the fieldmapunmap- callback function for the fieldunmapalignment- value for the fieldalignment
-
-
Method Details
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readMeta
Read the value of the fieldmeta.- Returns:
- The value of the field
meta
-
writeMeta
Write a value in the fieldmeta.- Parameters:
meta- The new value for the fieldmeta
-
readBuffer
Read the value of the fieldbuffer.- Returns:
- The value of the field
buffer
-
writeBuffer
Write a value in the fieldbuffer.- Parameters:
buffer- The new value for the fieldbuffer
-
readFlags
Read the value of the fieldflags.- Returns:
- The value of the field
flags
-
writeFlags
Write a value in the fieldflags.- Parameters:
flags- The new value for the fieldflags
-
readFormat
Read the value of the fieldformat.- Returns:
- The value of the field
format
-
writeFormat
Write a value in the fieldformat.- Parameters:
format- The new value for the fieldformat
-
readId
public int readId()Read the value of the fieldid.- Returns:
- The value of the field
id
-
writeId
public void writeId(int id) Write a value in the fieldid.- Parameters:
id- The new value for the fieldid
-
readWidth
public int readWidth()Read the value of the fieldwidth.- Returns:
- The value of the field
width
-
writeWidth
public void writeWidth(int width) Write a value in the fieldwidth.- Parameters:
width- The new value for the fieldwidth
-
readHeight
public int readHeight()Read the value of the fieldheight.- Returns:
- The value of the field
height
-
writeHeight
public void writeHeight(int height) Write a value in the fieldheight.- Parameters:
height- The new value for the fieldheight
-
readNPlanes
public int readNPlanes()Read the value of the fieldn_planes.- Returns:
- The value of the field
n_planes
-
writeNPlanes
public void writeNPlanes(int nPlanes) Write a value in the fieldn_planes.- Parameters:
nPlanes- The new value for the fieldn_planes
-
readOffset
public @org.jspecify.annotations.Nullable long @Nullable [] readOffset()Read the value of the fieldoffset.- Returns:
- The value of the field
offset
-
writeOffset
Write a value in the fieldoffset.- Parameters:
offset- The new value for the fieldoffset
-
readStride
public @org.jspecify.annotations.Nullable int @Nullable [] readStride()Read the value of the fieldstride.- Returns:
- The value of the field
stride
-
writeStride
Write a value in the fieldstride.- Parameters:
stride- The new value for the fieldstride
-
overrideMap
Write a value in the fieldmap.- Parameters:
map- The new value for the fieldmap_arena- to control the memory allocation scope
-
overrideUnmap
Write a value in the fieldunmap.- Parameters:
unmap- The new value for the fieldunmap_arena- to control the memory allocation scope
-
readAlignment
Read the value of the fieldalignment.- Returns:
- The value of the field
alignment
-
writeAlignment
Write a value in the fieldalignment.- Parameters:
alignment- The new value for the fieldalignment
-
getInfo
-
getPlaneHeight
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:
trueifmeta'salignment is valid andplaneHeighthas been updated,falseotherwise- Since:
- 1.18
-
getPlaneSize
Compute the size, in bytes, of each video plane described in this VideoMeta including any padding and alignment constraint defined inmeta>alignment.- Parameters:
planeSize- array used to store the plane sizes- Returns:
trueifmeta'salignment is valid andplaneSizehas been updated,falseotherwise- 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 indexplanein this VideoMeta and return a pointer to the first byte of the plane and the stride of the plane.- Parameters:
plane- a planeinfo- aGstMapInfodata- the data ofplanestride- the stride ofplaneflags-GstMapFlags- Returns:
- TRUE if the map operation was successful.
-
setAlignment
Set the alignment of this VideoMeta toalignment.This function checks that the paddings defined inalignmentare compatible with the strides defined in this VideoMeta and will fail to update if they are not.- Parameters:
alignment- aGstVideoAlignment- Returns:
trueifalignment'smeta has been updated,falseif not- Since:
- 1.18
-
unmap
Unmap a previously mapped plane with gst_video_meta_map().- Parameters:
plane- a planeinfo- aGstMapInfo- Returns:
- TRUE if the memory was successfully unmapped.
-