Class VideoOverlayRectangle
- All Implemented Interfaces:
Proxy
-
Constructor Summary
ConstructorDescriptionVideoOverlayRectangle
(MemorySegment address) Create a VideoOverlayRectangle proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Makes a copy of this VideoOverlayRectangle, so that it is possible to modify it (e.g.getFlags()
Retrieves the flags associated with aGstVideoOverlayRectangle
.float
Retrieves the global-alpha value associated with aGstVideoOverlayRectangle
.getPixelsArgb
(Set<VideoOverlayFormatFlags> flags) getPixelsArgb
(VideoOverlayFormatFlags... flags) getPixelsAyuv
(Set<VideoOverlayFormatFlags> flags) getPixelsAyuv
(VideoOverlayFormatFlags... flags) getPixelsRaw
(Set<VideoOverlayFormatFlags> flags) getPixelsRaw
(VideoOverlayFormatFlags... flags) Retrieves the pixel data as it is.getPixelsUnscaledArgb
(VideoOverlayFormatFlags... flags) Retrieves the pixel data as it is.Retrieves the pixel data as it is.getPixelsUnscaledAyuv
(VideoOverlayFormatFlags... flags) Retrieves the pixel data as it is.Retrieves the pixel data as it is.getPixelsUnscaledRaw
(VideoOverlayFormatFlags... flags) Retrieves the pixel data as it is.boolean
getRenderRectangle
(@Nullable Out<Integer> renderX, @Nullable Out<Integer> renderY, @Nullable Out<Integer> renderWidth, @Nullable Out<Integer> renderHeight) Retrieves the render position and render dimension of the overlay rectangle on the video.int
Returns the sequence number of this rectangle.static Type
getType()
Get the GType of the VideoOverlayRectangle classstatic VideoOverlayRectangle
raw
(Buffer pixels, int renderX, int renderY, int renderWidth, int renderHeight, Set<VideoOverlayFormatFlags> flags) Creates a new video overlay rectangle with ARGB or AYUV pixel data.static VideoOverlayRectangle
raw
(Buffer pixels, int renderX, int renderY, int renderWidth, int renderHeight, VideoOverlayFormatFlags... flags) Creates a new video overlay rectangle with ARGB or AYUV pixel data.void
setGlobalAlpha
(float globalAlpha) Sets the global alpha value associated with aGstVideoOverlayRectangle
.void
setRenderRectangle
(int renderX, int renderY, int renderWidth, int renderHeight) Sets the render position and dimensions of the rectangle on the video.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
VideoOverlayRectangle
Create a VideoOverlayRectangle proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
raw
public static VideoOverlayRectangle raw(Buffer pixels, int renderX, int renderY, int renderWidth, int renderHeight, Set<VideoOverlayFormatFlags> flags) Creates a new video overlay rectangle with ARGB or AYUV pixel data. The layout in case of ARGB of the components in memory is B-G-R-A on little-endian platforms (corresponding toGST_VIDEO_FORMAT_BGRA
) and A-R-G-B on big-endian platforms (corresponding toGST_VIDEO_FORMAT_ARGB
). In other words, pixels are treated as 32-bit words and the lowest 8 bits then contain the blue component value and the highest 8 bits contain the alpha component value. Unless specified in the flags, the RGB values are non-premultiplied. This is the format that is used by most hardware, and also many rendering libraries such as Cairo, for example. The pixel data buffer must haveGstVideoMeta
set.- Parameters:
pixels
- aGstBuffer
pointing to the pixel memoryrenderX
- the X co-ordinate on the video where the top-left corner of this overlay rectangle should be rendered torenderY
- the Y co-ordinate on the video where the top-left corner of this overlay rectangle should be rendered torenderWidth
- the render width of this rectangle on the videorenderHeight
- the render height of this rectangle on the videoflags
- flags- Returns:
- a new
GstVideoOverlayRectangle
. Unref with gst_video_overlay_rectangle_unref() when no longer needed.
-
raw
public static VideoOverlayRectangle raw(Buffer pixels, int renderX, int renderY, int renderWidth, int renderHeight, VideoOverlayFormatFlags... flags) Creates a new video overlay rectangle with ARGB or AYUV pixel data. The layout in case of ARGB of the components in memory is B-G-R-A on little-endian platforms (corresponding toGST_VIDEO_FORMAT_BGRA
) and A-R-G-B on big-endian platforms (corresponding toGST_VIDEO_FORMAT_ARGB
). In other words, pixels are treated as 32-bit words and the lowest 8 bits then contain the blue component value and the highest 8 bits contain the alpha component value. Unless specified in the flags, the RGB values are non-premultiplied. This is the format that is used by most hardware, and also many rendering libraries such as Cairo, for example. The pixel data buffer must haveGstVideoMeta
set.- Parameters:
pixels
- aGstBuffer
pointing to the pixel memoryrenderX
- the X co-ordinate on the video where the top-left corner of this overlay rectangle should be rendered torenderY
- the Y co-ordinate on the video where the top-left corner of this overlay rectangle should be rendered torenderWidth
- the render width of this rectangle on the videorenderHeight
- the render height of this rectangle on the videoflags
- flags- Returns:
- a new
GstVideoOverlayRectangle
. Unref with gst_video_overlay_rectangle_unref() when no longer needed.
-
copy
Makes a copy of this VideoOverlayRectangle, so that it is possible to modify it (e.g. to change the render co-ordinates or render dimension). The actual overlay pixel data buffers contained in the rectangle are not copied.- Returns:
- a new
GstVideoOverlayRectangle
equivalent to this VideoOverlayRectangle.
-
getFlags
Retrieves the flags associated with aGstVideoOverlayRectangle
. This is useful if the caller can handle both premultiplied alpha and non premultiplied alpha, for example. By knowing whether the rectangle uses premultiplied or not, it can request the pixel data in the format it is stored in, to avoid unnecessary conversion.- Returns:
- the
GstVideoOverlayFormatFlags
associated with the rectangle.
-
getGlobalAlpha
public float getGlobalAlpha()Retrieves the global-alpha value associated with aGstVideoOverlayRectangle
.- Returns:
- the global-alpha value associated with the rectangle.
-
getPixelsArgb
-
getPixelsArgb
-
getPixelsAyuv
-
getPixelsAyuv
-
getPixelsRaw
-
getPixelsRaw
-
getPixelsUnscaledArgb
Retrieves the pixel data as it is. This is useful if the caller can do the scaling itself when handling the overlaying. The rectangle will need to be scaled to the render dimensions, which can be retrieved using gst_video_overlay_rectangle_get_render_rectangle().- Parameters:
flags
- flags. If a global_alpha value != 1 is set for the rectangle, the caller should set theGST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA
flag if he wants to apply global-alpha himself. If the flag is not set global_alpha is applied internally before returning the pixel-data.- Returns:
- a
GstBuffer
holding the ARGB pixel data withGstVideoMeta
set. This function does not return a reference, the caller should obtain a reference of her own with gst_buffer_ref() if needed.
-
getPixelsUnscaledArgb
Retrieves the pixel data as it is. This is useful if the caller can do the scaling itself when handling the overlaying. The rectangle will need to be scaled to the render dimensions, which can be retrieved using gst_video_overlay_rectangle_get_render_rectangle().- Parameters:
flags
- flags. If a global_alpha value != 1 is set for the rectangle, the caller should set theGST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA
flag if he wants to apply global-alpha himself. If the flag is not set global_alpha is applied internally before returning the pixel-data.- Returns:
- a
GstBuffer
holding the ARGB pixel data withGstVideoMeta
set. This function does not return a reference, the caller should obtain a reference of her own with gst_buffer_ref() if needed.
-
getPixelsUnscaledAyuv
Retrieves the pixel data as it is. This is useful if the caller can do the scaling itself when handling the overlaying. The rectangle will need to be scaled to the render dimensions, which can be retrieved using gst_video_overlay_rectangle_get_render_rectangle().- Parameters:
flags
- flags. If a global_alpha value != 1 is set for the rectangle, the caller should set theGST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA
flag if he wants to apply global-alpha himself. If the flag is not set global_alpha is applied internally before returning the pixel-data.- Returns:
- a
GstBuffer
holding the AYUV pixel data withGstVideoMeta
set. This function does not return a reference, the caller should obtain a reference of her own with gst_buffer_ref() if needed.
-
getPixelsUnscaledAyuv
Retrieves the pixel data as it is. This is useful if the caller can do the scaling itself when handling the overlaying. The rectangle will need to be scaled to the render dimensions, which can be retrieved using gst_video_overlay_rectangle_get_render_rectangle().- Parameters:
flags
- flags. If a global_alpha value != 1 is set for the rectangle, the caller should set theGST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA
flag if he wants to apply global-alpha himself. If the flag is not set global_alpha is applied internally before returning the pixel-data.- Returns:
- a
GstBuffer
holding the AYUV pixel data withGstVideoMeta
set. This function does not return a reference, the caller should obtain a reference of her own with gst_buffer_ref() if needed.
-
getPixelsUnscaledRaw
Retrieves the pixel data as it is. This is useful if the caller can do the scaling itself when handling the overlaying. The rectangle will need to be scaled to the render dimensions, which can be retrieved using gst_video_overlay_rectangle_get_render_rectangle().- Parameters:
flags
- flags. If a global_alpha value != 1 is set for the rectangle, the caller should set theGST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA
flag if he wants to apply global-alpha himself. If the flag is not set global_alpha is applied internally before returning the pixel-data.- Returns:
- a
GstBuffer
holding the pixel data withGstVideoMeta
set. This function does not return a reference, the caller should obtain a reference of her own with gst_buffer_ref() if needed.
-
getPixelsUnscaledRaw
Retrieves the pixel data as it is. This is useful if the caller can do the scaling itself when handling the overlaying. The rectangle will need to be scaled to the render dimensions, which can be retrieved using gst_video_overlay_rectangle_get_render_rectangle().- Parameters:
flags
- flags. If a global_alpha value != 1 is set for the rectangle, the caller should set theGST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA
flag if he wants to apply global-alpha himself. If the flag is not set global_alpha is applied internally before returning the pixel-data.- Returns:
- a
GstBuffer
holding the pixel data withGstVideoMeta
set. This function does not return a reference, the caller should obtain a reference of her own with gst_buffer_ref() if needed.
-
getRenderRectangle
public boolean getRenderRectangle(@Nullable @Nullable Out<Integer> renderX, @Nullable @Nullable Out<Integer> renderY, @Nullable @Nullable Out<Integer> renderWidth, @Nullable @Nullable Out<Integer> renderHeight) Retrieves the render position and render dimension of the overlay rectangle on the video.- Parameters:
renderX
- address where to store the X render offsetrenderY
- address where to store the Y render offsetrenderWidth
- address where to store the render widthrenderHeight
- address where to store the render height- Returns:
- TRUE if valid render dimensions were retrieved.
-
getSeqnum
public int getSeqnum()Returns the sequence number of this rectangle. 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).Using the sequence number of a rectangle as an indicator for changed pixel-data of a rectangle is dangereous. Some API calls, like e.g. gst_video_overlay_rectangle_set_global_alpha(), automatically update the per rectangle sequence number, which is misleading for renderers/ consumers, that handle global-alpha themselves. For them the pixel-data returned by gst_video_overlay_rectangle_get_pixels_*() won't be different for different global-alpha values. In this case a renderer could also use the GstBuffer pointers as a hint for changed pixel-data.
- Returns:
- the sequence number of this VideoOverlayRectangle
-
setGlobalAlpha
public void setGlobalAlpha(float globalAlpha) Sets the global alpha value associated with aGstVideoOverlayRectangle
. Per- pixel alpha values are multiplied with this value. Valid values: 0 <= global_alpha <= 1; 1 to deactivate.this VideoOverlayRectangle must be writable, meaning its refcount must be 1. You can make the rectangles inside a
GstVideoOverlayComposition
writable using gst_video_overlay_composition_make_writable() or gst_video_overlay_composition_copy().- Parameters:
globalAlpha
- Global alpha value (0 to 1.0)
-
setRenderRectangle
public void setRenderRectangle(int renderX, int renderY, int renderWidth, int renderHeight) Sets the render position and dimensions of the rectangle on the video. This function is mainly for elements that modify the size of the video in some way (e.g. through scaling or cropping) and need to adjust the details of any overlays to match the operation that changed the size.this VideoOverlayRectangle must be writable, meaning its refcount must be 1. You can make the rectangles inside a
GstVideoOverlayComposition
writable using gst_video_overlay_composition_make_writable() or gst_video_overlay_composition_copy().- Parameters:
renderX
- render X position of rectangle on videorenderY
- render Y position of rectangle on videorenderWidth
- render width of rectanglerenderHeight
- render height of rectangle
-