![]() |
![]() |
![]() |
GStreamer Base Plugins 0.10 Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
gstvideooverlaycompositiongstvideooverlaycomposition — Video Buffer Overlay Compositions (Subtitles, Logos) |
#include <gst/video/video-overlay-composition.h> GstVideoOverlayComposition; GstVideoOverlayCompositionClass; GstVideoOverlayComposition * gst_video_overlay_composition_new (GstVideoOverlayRectangle *rectangle); void gst_video_overlay_composition_add_rectangle (GstVideoOverlayComposition *comp, GstVideoOverlayRectangle *rectangle); guint gst_video_overlay_composition_n_rectangles (GstVideoOverlayComposition *comp); GstVideoOverlayRectangle * gst_video_overlay_composition_get_rectangle (GstVideoOverlayComposition *comp, guint n); guint gst_video_overlay_composition_get_seqnum (GstVideoOverlayComposition *comp); GstVideoOverlayComposition * gst_video_overlay_composition_copy (GstVideoOverlayComposition *comp); GstVideoOverlayComposition * gst_video_overlay_composition_make_writable (GstVideoOverlayComposition *comp); gboolean gst_video_overlay_composition_blend (GstVideoOverlayComposition *comp, GstBuffer *video_buf); GstVideoOverlayComposition * gst_video_buffer_get_overlay_composition (GstBuffer *buf); void gst_video_buffer_set_overlay_composition (GstBuffer *buf, GstVideoOverlayComposition *comp); enum GstVideoOverlayFormatFlags; GstVideoOverlayRectangle; GstVideoOverlayRectangleClass; GstVideoOverlayRectangle * gst_video_overlay_rectangle_new_argb (GstBuffer *pixels, guint width, guint height, guint stride, gint render_x, gint render_y, guint render_width, guint render_height, GstVideoOverlayFormatFlags flags); GstBuffer * gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle *rectangle, guint *stride, GstVideoOverlayFormatFlags flags); GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle *rectangle, guint *width, guint *height, guint *stride, GstVideoOverlayFormatFlags flags); gboolean gst_video_overlay_rectangle_get_render_rectangle (GstVideoOverlayRectangle *rectangle, gint *render_x, gint *render_y, guint *render_width, guint *render_height); guint gst_video_overlay_rectangle_get_seqnum (GstVideoOverlayRectangle *rectangle); void gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle *rectangle, gint render_x, gint render_y, guint render_width, guint render_height); GstVideoOverlayRectangle * gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle *rectangle);
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:
typedef struct _GstVideoOverlayComposition GstVideoOverlayComposition;
An opaque video overlay composition object. A composition contains multiple overlay rectangles.
Since 0.10.36
typedef struct _GstVideoOverlayCompositionClass GstVideoOverlayCompositionClass;
GstVideoOverlayComposition * gst_video_overlay_composition_new (GstVideoOverlayRectangle *rectangle);
Creates a new video overlay composition object to hold one or more overlay rectangles.
Since 0.10.36
void gst_video_overlay_composition_add_rectangle (GstVideoOverlayComposition *comp, GstVideoOverlayRectangle *rectangle);
Adds an overlay rectangle to an existing overlay composition object. This must be done right after creating the overlay composition.
|
a GstVideoOverlayComposition |
|
transfer none. transfer none. |
Since 0.10.36
guint gst_video_overlay_composition_n_rectangles (GstVideoOverlayComposition *comp);
Returns the number of GstVideoOverlayRectangles contained in comp
.
|
a GstVideoOverlayComposition |
Returns : |
the number of rectangles |
Since 0.10.36
GstVideoOverlayRectangle * gst_video_overlay_composition_get_rectangle (GstVideoOverlayComposition *comp, guint n);
Returns the n
-th GstVideoOverlayRectangle contained in comp
.
|
a GstVideoOverlayComposition |
|
number of the rectangle to get |
Returns : |
transfer none. transfer none. |
Since 0.10.36
guint gst_video_overlay_composition_get_seqnum (GstVideoOverlayComposition *comp);
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).
|
a GstVideoOverlayComposition |
Returns : |
the sequence number of comp
|
Since 0.10.36
GstVideoOverlayComposition * gst_video_overlay_composition_copy (GstVideoOverlayComposition *comp);
Makes a copy of comp
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.
|
a GstVideoOverlayComposition to copy. transfer none. |
Returns : |
transfer full. transfer full. |
Since 0.10.36
GstVideoOverlayComposition * gst_video_overlay_composition_make_writable (GstVideoOverlayComposition *comp);
Takes ownership of comp
and returns a version of comp
that is writable
(i.e. can be modified). Will either return comp
right away, or create a
new writable copy of comp
and unref comp
itself. All the contained
rectangles will also be copied, but the actual overlay pixel data buffers
contained in the rectangles are not copied.
|
a GstVideoOverlayComposition to copy. transfer full. |
Returns : |
transfer full. transfer full. |
Since 0.10.36
gboolean gst_video_overlay_composition_blend (GstVideoOverlayComposition *comp, GstBuffer *video_buf);
Blends the overlay rectangles in comp
on top of the raw video data
contained in video_buf
. The data in video_buf
must be writable. If
needed, use gst_buffer_make_writable()
before calling this function to
ensure a buffer is writable. video_buf
must also have valid raw video
caps set on it.
|
a GstVideoOverlayComposition |
|
a GstBuffer containing raw video data in a supported format |
Since 0.10.36
GstVideoOverlayComposition * gst_video_buffer_get_overlay_composition (GstBuffer *buf);
Get the overlay composition that has previously been attached to a buffer
with gst_video_buffer_get_overlay_composition()
, usually by another element
upstream.
|
a GstBuffer |
Returns : |
transfer none. transfer none. |
Since 0.10.36
void gst_video_buffer_set_overlay_composition (GstBuffer *buf, GstVideoOverlayComposition *comp);
Sets an overlay composition on a buffer. The buffer will obtain its own
reference to the composition, meaning this function does not take ownership
of comp
.
|
a GstBuffer |
|
allow-none. allow-none. |
Since 0.10.36
typedef enum { GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE = 0 } GstVideoOverlayFormatFlags;
Overlay format flags.
Since 0.10.36
typedef struct _GstVideoOverlayRectangle GstVideoOverlayRectangle;
An opaque video overlay rectangle object. A rectangle contains a single overlay rectangle which can be added to a composition.
Since 0.10.36
typedef struct _GstVideoOverlayRectangleClass GstVideoOverlayRectangleClass;
GstVideoOverlayRectangle * gst_video_overlay_rectangle_new_argb (GstBuffer *pixels, guint width, guint height, guint stride, gint render_x, gint render_y, guint render_width, guint render_height, GstVideoOverlayFormatFlags flags);
Creates a new video overlay rectangle with ARGB pixel data. The layout of the components in memory is B-G-R-A on little-endian platforms (corresponding to GST_VIDEO_FORMAT_BGRA) and A-R-G-B on big-endian platforms (corresponding to GST_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. 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.
|
a GstBuffer pointing to the pixel memory. transfer none. |
|
the width of the rectangle in pixels
|
|
the height of the rectangle in pixels
|
|
the stride of the rectangle in pixels in bytes (>= 4*width)
|
|
the X co-ordinate on the video where the top-left corner of this overlay rectangle should be rendered to |
|
the Y co-ordinate on the video where the top-left corner of this overlay rectangle should be rendered to |
|
the render width of this rectangle on the video |
|
the render height of this rectangle on the video |
|
flags (currently unused) |
Returns : |
transfer full. transfer full. |
Since 0.10.36
GstBuffer * gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle *rectangle, guint *stride, GstVideoOverlayFormatFlags flags);
|
a GstVideoOverlayRectangle |
|
out) (allow-none. out. allow-none. |
|
flags (unused) |
Returns : |
transfer none. transfer none. |
Since 0.10.36
GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle *rectangle, guint *width, guint *height, guint *stride, GstVideoOverlayFormatFlags flags);
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()
.
|
a GstVideoOverlayRectangle |
|
out. out. |
|
out. out. |
|
out. out. |
|
flags for future use (unused) |
Returns : |
transfer none. transfer none. |
Since 0.10.36
gboolean gst_video_overlay_rectangle_get_render_rectangle (GstVideoOverlayRectangle *rectangle, gint *render_x, gint *render_y, guint *render_width, guint *render_height);
Retrieves the render position and render dimension of the overlay rectangle on the video.
|
a GstVideoOverlayRectangle |
|
address where to store the X render offset. out. allow-none. |
|
address where to store the Y render offset. out. allow-none. |
|
address where to store the render width. out. allow-none. |
|
address where to store the render height. out. allow-none. |
Returns : |
TRUE if valid render dimensions were retrieved. |
Since 0.10.36
guint gst_video_overlay_rectangle_get_seqnum (GstVideoOverlayRectangle *rectangle);
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).
|
a GstVideoOverlayRectangle |
Returns : |
the sequence number of rectangle
|
Since 0.10.36
void gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle *rectangle, gint render_x, gint render_y, guint render_width, guint render_height);
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.
rectangle
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()
.
|
a GstVideoOverlayRectangle |
|
render X position of rectangle on video |
|
render Y position of rectangle on video |
|
render width of rectangle |
|
render height of rectangle |
Since 0.10.36
GstVideoOverlayRectangle * gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle *rectangle);
Makes a copy of rectangle
, 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.
|
a GstVideoOverlayRectangle to copy. transfer none. |
Returns : |
transfer full. transfer full. |
Since 0.10.36