Package org.freedesktop.gstreamer.video
Class VideoMeta
java.lang.Object
io.github.jwharm.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
The padding fields have the same semantic as
GstVideoMeta
.alignment and so represent the paddings requested on produced video buffers.
Since 1.24 it can be serialized using gst_meta_serialize() and gst_meta_deserialize().
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theMapCallback
callback.static interface
Functional interface declaration of theUnmapCallback
callback. -
Constructor Summary
ConstructorDescriptionAllocate 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 MetaInfo
getInfo()
static MemoryLayout
The memory layout of the native struct.boolean
getPlaneHeight
(int[] planeHeight) Compute the padded height of each plane from this VideoMeta (padded size divided by stride).boolean
getPlaneSize
(long[] planeSize) Compute the size, in bytes, of each video plane described in this VideoMeta including any padding and alignment constraint defined in this VideoMeta->alignment.boolean
Map the video plane with indexplane
in this VideoMeta and return a pointer to the first byte of the plane and the stride of the plane.void
overrideMap
(VideoMeta.MapCallback map, Arena _arena) Write a value in the fieldmap
.void
overrideUnmap
(VideoMeta.UnmapCallback unmap, Arena _arena) Write a value in the fieldunmap
.Read the value of the fieldalignment
.Read the value of the fieldbuffer
.Read the value of the fieldflags
.Read the value of the fieldformat
.int
Read the value of the fieldheight
.int
readId()
Read the value of the fieldid
.readMeta()
Read the value of the fieldmeta
.int
Read the value of the fieldn_planes
.long[]
Read the value of the fieldoffset
.int[]
Read the value of the fieldstride
.int
Read the value of the fieldwidth
.boolean
setAlignment
(VideoAlignment alignment) Set the alignment of this VideoMeta toalignment
.boolean
Unmap a previously mapped plane with gst_video_meta_map().void
writeAlignment
(VideoAlignment alignment) Write a value in the fieldalignment
.void
writeBuffer
(Buffer buffer) Write a value in the fieldbuffer
.void
writeFlags
(Set<VideoFrameFlags> flags) Write a value in the fieldflags
.void
writeFormat
(VideoFormat format) Write a value in the fieldformat
.void
writeHeight
(int height) Write a value in the fieldheight
.void
writeId
(int id) Write a value in the fieldid
.void
Write a value in the fieldmeta
.void
writeNPlanes
(int nPlanes) Write a value in the fieldn_planes
.void
writeOffset
(long[] offset, Arena _arena) Write a value in the fieldoffset
.void
writeStride
(int[] stride, Arena _arena) Write a value in the fieldstride
.void
writeWidth
(int width) Write a value in the fieldwidth
.Methods inherited from class io.github.jwharm.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 fieldmeta
buffer
- value for the fieldbuffer
flags
- value for the fieldflags
format
- value for the fieldformat
id
- value for the fieldid
width
- value for the fieldwidth
height
- value for the fieldheight
nPlanes
- value for the fieldnPlanes
offset
- value for the fieldoffset
stride
- value for the fieldstride
map
- callback function for the fieldmap
unmap
- callback function for the fieldunmap
alignment
- value for the fieldalignment
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 withArena.ofAuto()
.- Parameters:
meta
- value for the fieldmeta
buffer
- value for the fieldbuffer
flags
- value for the fieldflags
format
- value for the fieldformat
id
- value for the fieldid
width
- value for the fieldwidth
height
- value for the fieldheight
nPlanes
- value for the fieldnPlanes
offset
- value for the fieldoffset
stride
- value for the fieldstride
map
- callback function for the fieldmap
unmap
- callback function for the fieldunmap
alignment
- value for the fieldalignment
-
-
Method Details
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readMeta
-
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 long[] 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
_arena
- to control the memory allocation scope
-
readStride
public int[] 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
_arena
- to control the memory allocation scope
-
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
public boolean getPlaneHeight(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 this VideoMeta's alignment is valid andplaneHeight
has been updated,false
otherwise
-
getPlaneSize
public boolean getPlaneSize(long[] planeSize) Compute the size, in bytes, of each video plane described in this VideoMeta including any padding and alignment constraint defined in this VideoMeta->alignment.- Parameters:
planeSize
- array used to store the plane sizes- Returns:
true
if this VideoMeta's alignment is valid andplaneSize
has been updated,false
otherwise
-
map
public boolean map(int plane, MapInfo info, @Nullable @Nullable Out<MemorySegment> data, Out<Integer> stride, int flags) Map the video plane with indexplane
in this VideoMeta and return a pointer to the first byte of the plane and the stride of the plane.- Parameters:
plane
- a planeinfo
- aGstMapInfo
data
- the data ofplane
stride
- the stride ofplane
flags
-GstMapFlags
- Returns:
- TRUE if the map operation was successful.
-
setAlignment
Set the alignment of this VideoMeta toalignment
. This function checks that the paddings defined inalignment
are compatible with the strides defined in this VideoMeta and will fail to update if they are not.- Parameters:
alignment
- aGstVideoAlignment
- Returns:
true
ifalignment
's meta has been updated,false
if not
-
unmap
Unmap a previously mapped plane with gst_video_meta_map().- Parameters:
plane
- a planeinfo
- aGstMapInfo
- Returns:
- TRUE if the memory was successfully unmapped.
-