Package org.freedesktop.gstreamer.video
Class VideoOverlayComposition
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.freedesktop.gstreamer.video.VideoOverlayComposition
- All Implemented Interfaces:
Proxy
Functions to create and handle overlay compositions on video buffers.
An overlay composition describes one or more overlay rectangles to be blended on top of a video buffer.
This API serves two main purposes:
- it can be used to attach overlay information (subtitles or logos) to non-raw video buffers such as GL/VAAPI/VDPAU surfaces. The actual blending of the overlay can then be done by e.g. the video sink that processes these non-raw buffers.
- it can also be used to blend overlay rectangles on top of raw video buffers, thus consolidating blending functionality for raw video in one place.
Together, this allows existing overlay elements to easily handle raw
and non-raw video as input in without major changes (once the overlays
have been put into a GstVideoOverlayComposition
object anyway) - for raw
video the overlay can just use the blending function to blend the data
on top of the video, and for surface buffers it can just attach them to
the buffer and let the sink render the overlays.
-
Constructor Summary
ConstructorDescriptionCallsVideoOverlayComposition(org.freedesktop.gstreamer.video.VideoOverlayRectangle)
with rectangle =null
VideoOverlayComposition
(MemorySegment address) Create a VideoOverlayComposition proxy instance for the provided memory address.VideoOverlayComposition
(@Nullable VideoOverlayRectangle rectangle) Creates a new video overlay composition object to hold one or more overlay rectangles. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRectangle
(VideoOverlayRectangle rectangle) Adds an overlay rectangle to an existing overlay composition object.boolean
blend
(VideoFrame videoBuf) Blends the overlay rectangles in this VideoOverlayComposition on top of the raw video data contained invideoBuf
.copy()
Makes a copy of this VideoOverlayComposition and all contained rectangles, so that it is possible to modify the composition and contained rectangles (e.g.getRectangle
(int n) Returns then
-thGstVideoOverlayRectangle
contained in this VideoOverlayComposition.int
Returns the sequence number of this composition.static Type
getType()
Get the GType of the VideoOverlayComposition classTakes ownership of this VideoOverlayComposition and returns a version of this VideoOverlayComposition that is writable (i.e.int
Returns the number ofGstVideoOverlayRectangle
<!-- -->s contained in this VideoOverlayComposition.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
VideoOverlayComposition
Create a VideoOverlayComposition proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
VideoOverlayComposition
Creates a new video overlay composition object to hold one or more overlay rectangles.Note that since 1.20 this allows to pass
null
forrectangle
.- Parameters:
rectangle
- aGstVideoOverlayRectangle
to add to the composition
-
VideoOverlayComposition
public VideoOverlayComposition()CallsVideoOverlayComposition(org.freedesktop.gstreamer.video.VideoOverlayRectangle)
with rectangle =null
-
-
Method Details
-
getType
-
addRectangle
Adds an overlay rectangle to an existing overlay composition object. This must be done right after creating the overlay composition.- Parameters:
rectangle
- aGstVideoOverlayRectangle
to add to the composition
-
blend
Blends the overlay rectangles in this VideoOverlayComposition on top of the raw video data contained invideoBuf
. The data invideoBuf
must be writable and mapped appropriately.Since
videoBuf
data is read and will be modified, it ought be mapped with flag GST_MAP_READWRITE.- Parameters:
videoBuf
- aGstVideoFrame
containing raw video data in a supported format. It should be mapped using GST_MAP_READWRITE
-
copy
Makes a copy of this VideoOverlayComposition and all contained rectangles, so that it is possible to modify the composition and contained rectangles (e.g. add additional rectangles or change the render co-ordinates or render dimension). The actual overlay pixel data buffers contained in the rectangles are not copied.- Returns:
- a new
GstVideoOverlayComposition
equivalent to this VideoOverlayComposition.
-
getRectangle
Returns then
-thGstVideoOverlayRectangle
contained in this VideoOverlayComposition.- Parameters:
n
- number of the rectangle to get- Returns:
- the
n
-th rectangle, or NULL ifn
is out of bounds. Will not return a new reference, the caller will need to obtain her own reference using gst_video_overlay_rectangle_ref() if needed.
-
getSeqnum
public int getSeqnum()Returns the sequence number of this composition. Sequence numbers are monotonically increasing and unique for overlay compositions and rectangles (meaning there will never be a rectangle with the same sequence number as a composition).- Returns:
- the sequence number of this VideoOverlayComposition
-
makeWritable
Takes ownership of this VideoOverlayComposition and returns a version of this VideoOverlayComposition that is writable (i.e. can be modified). Will either return this VideoOverlayComposition right away, or create a new writable copy of this VideoOverlayComposition and unref this VideoOverlayComposition itself. All the contained rectangles will also be copied, but the actual overlay pixel data buffers contained in the rectangles are not copied.- Returns:
- a writable
GstVideoOverlayComposition
equivalent to this VideoOverlayComposition.
-
nRectangles
public int nRectangles()Returns the number ofGstVideoOverlayRectangle
<!-- -->s contained in this VideoOverlayComposition.- Returns:
- the number of rectangles
-