/* Info on overlay pixels (format, width, height) */
GstVideoInfo info;
- /* cached stride */
- guint stride;
-
/* The flags associated to this rectangle */
GstVideoOverlayFormatFlags flags;
/**
* gst_video_overlay_rectangle_new_argb:
* @pixels: (transfer none): a #GstBuffer pointing to the pixel memory
- * @width: the width of the rectangle in @pixels
- * @height: the height of the rectangle in @pixels
- * @stride: the stride of the rectangle in @pixels in bytes (>= 4*width)
* @render_x: the X co-ordinate on the video where the top-left corner of this
* overlay rectangle should be rendered to
* @render_y: the Y co-ordinate on the video where the top-left corner of this
* 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 have #GstVideoMeta set.
*
* Returns: (transfer full): a new #GstVideoOverlayRectangle. Unref with
* gst_video_overlay_rectangle_unref() when no longer needed.
*/
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)
+ gint render_x, gint render_y, guint render_width, guint render_height,
+ GstVideoOverlayFormatFlags flags)
{
GstVideoOverlayRectangle *rect;
GstVideoFormat format;
- gint strides[GST_VIDEO_MAX_PLANES];
- gsize offsets[GST_VIDEO_MAX_PLANES];
+ GstVideoMeta *vmeta;
+ guint width, height;
g_return_val_if_fail (GST_IS_BUFFER (pixels), NULL);
- /* technically ((height-1)*stride)+width might be okay too */
- g_return_val_if_fail (gst_buffer_get_size (pixels) >= height * stride, NULL);
- g_return_val_if_fail (gst_buffer_is_writable (pixels), NULL);
- g_return_val_if_fail (stride >= (4 * width), NULL);
- g_return_val_if_fail (height > 0 && width > 0, NULL);
g_return_val_if_fail (render_height > 0 && render_width > 0, NULL);
g_return_val_if_fail (gst_video_overlay_rectangle_check_flags (flags), NULL);
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ format = GST_VIDEO_FORMAT_BGRA;
+#else
+ format = GST_VIDEO_FORMAT_ARGB;
+#endif
+
+ /* buffer must have video meta with some expected settings */
+ vmeta = gst_buffer_get_video_meta (pixels);
+ g_return_val_if_fail (vmeta, NULL);
+ g_return_val_if_fail (vmeta->format == format, NULL);
+ g_return_val_if_fail (vmeta->flags == GST_VIDEO_FRAME_FLAG_NONE, NULL);
+
+ width = vmeta->width;
+ height = vmeta->height;
+
+ /* technically ((height-1)*stride)+width might be okay too */
+ g_return_val_if_fail (gst_buffer_get_size (pixels) >= height * width, NULL);
+ g_return_val_if_fail (height > 0 && width > 0, NULL);
+
rect = (GstVideoOverlayRectangle *) g_slice_new0 (GstVideoOverlayRectangle);
gst_mini_object_init (GST_MINI_OBJECT_CAST (rect), 0,
g_mutex_init (&rect->lock);
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- format = GST_VIDEO_FORMAT_BGRA;
-#else
- format = GST_VIDEO_FORMAT_ARGB;
-#endif
-
- strides[0] = stride;
- offsets[0] = 0;
- gst_buffer_add_video_meta_full (pixels, GST_VIDEO_FRAME_FLAG_NONE,
- format, width, height, 1, offsets, strides);
rect->pixels = gst_buffer_ref (pixels);
rect->scaled_rectangles = NULL;
rect->y = render_y;
rect->render_width = render_width;
rect->render_height = render_height;
- rect->stride = stride;
rect->global_alpha = 1.0;
rect->applied_global_alpha = 1.0;
static GstBuffer *
gst_video_overlay_rectangle_get_pixels_argb_internal (GstVideoOverlayRectangle *
- rectangle, guint * stride, GstVideoOverlayFormatFlags flags,
- gboolean unscaled)
+ rectangle, GstVideoOverlayFormatFlags flags, gboolean unscaled)
{
GstVideoOverlayFormatFlags new_flags;
GstVideoOverlayRectangle *scaled_rect = NULL;
gboolean revert_global_alpha;
g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL);
- g_return_val_if_fail (stride != NULL, NULL);
g_return_val_if_fail (gst_video_overlay_rectangle_check_flags (flags), NULL);
width = GST_VIDEO_INFO_WIDTH (&rectangle->info);
if ((!apply_global_alpha
|| rectangle->applied_global_alpha == rectangle->global_alpha)
&& (!revert_global_alpha || rectangle->applied_global_alpha == 1.0)) {
- *stride = rectangle->stride;
return rectangle->pixels;
} else {
/* only apply/revert global-alpha */
gst_video_blend_scale_linear_RGBA (&rectangle->info, rectangle->pixels,
wanted_height, wanted_width, &scaled_info, &buf);
info = scaled_info;
+ gst_buffer_add_video_meta (buf, GST_VIDEO_FRAME_FLAG_NONE,
+ GST_VIDEO_INFO_FORMAT (&rectangle->info), wanted_width, wanted_height);
} else {
/* if we don't have to scale, we have to modify the alpha values, so we
* need to make a copy of the pixel memory (and we take ownership below) */
gst_video_frame_unmap (&frame);
scaled_rect = gst_video_overlay_rectangle_new_argb (buf,
- wanted_width, wanted_height, info.stride[0],
0, 0, wanted_width, wanted_height, new_flags);
if (rectangle->global_alpha != 1.0)
gst_video_overlay_rectangle_set_global_alpha (scaled_rect,
}
GST_RECTANGLE_UNLOCK (rectangle);
- *stride = scaled_rect->stride;
return scaled_rect->pixels;
}
/**
* gst_video_overlay_rectangle_get_pixels_argb:
* @rectangle: a #GstVideoOverlayRectangle
- * @stride: (out) (allow-none): address of guint variable where to store the
- * row stride of the ARGB pixel data in the buffer
* @flags: flags
* If a global_alpha value != 1 is set for the rectangle, the caller
* should set the #GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA flag
* global_alpha is applied internally before returning the pixel-data.
*
* Returns: (transfer none): a #GstBuffer holding the ARGB pixel data with
- * row stride @stride and width and height of the render dimensions as per
+ * width and height of the render dimensions as per
* gst_video_overlay_rectangle_get_render_rectangle(). This function does
* not return a reference, the caller should obtain a reference of her own
* with gst_buffer_ref() if needed.
*/
GstBuffer *
gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle *
- rectangle, guint * stride, GstVideoOverlayFormatFlags flags)
+ rectangle, GstVideoOverlayFormatFlags flags)
{
return gst_video_overlay_rectangle_get_pixels_argb_internal (rectangle,
- stride, flags, FALSE);
+ flags, FALSE);
}
/**
* gst_video_overlay_rectangle_get_pixels_unscaled_argb:
* @rectangle: a #GstVideoOverlayRectangle
- * @width: (out): address where to store the width of the unscaled
- * rectangle in pixels
- * @height: (out): address where to store the height of the unscaled
- * rectangle in pixels
- * @stride: (out): address of guint variable where to store the row
- * stride of the ARGB pixel data in the buffer
* @flags: flags.
* If a global_alpha value != 1 is set for the rectangle, the caller
* should set the #GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA flag
* gst_video_overlay_rectangle_get_render_rectangle().
*
* Returns: (transfer none): a #GstBuffer holding the ARGB pixel data with
- * row stride @stride. This function does not return a reference, the caller
+ * #GstVideoMeta set. This function does not return a reference, the caller
* should obtain a reference of her own with gst_buffer_ref() if needed.
*/
GstBuffer *
gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle *
- rectangle, guint * width, guint * height, guint * stride,
- GstVideoOverlayFormatFlags flags)
+ rectangle, GstVideoOverlayFormatFlags flags)
{
g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL);
- g_return_val_if_fail (width != NULL, NULL);
- g_return_val_if_fail (height != NULL, NULL);
- g_return_val_if_fail (stride != NULL, NULL);
- *width = GST_VIDEO_INFO_WIDTH (&rectangle->info);
- *height = GST_VIDEO_INFO_HEIGHT (&rectangle->info);
return gst_video_overlay_rectangle_get_pixels_argb_internal (rectangle,
- stride, flags, TRUE);
+ flags, TRUE);
}
/**
g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL);
copy = gst_video_overlay_rectangle_new_argb (rectangle->pixels,
- GST_VIDEO_INFO_WIDTH (&rectangle->info),
- GST_VIDEO_INFO_HEIGHT (&rectangle->info), rectangle->stride,
rectangle->x, rectangle->y,
rectangle->render_width, rectangle->render_height, rectangle->flags);
if (rectangle->global_alpha != 1)
#include <gst/check/gstcheck.h>
#include <gst/video/video.h>
+#include <gst/video/gstvideometa.h>
#include <gst/video/video-overlay-composition.h>
#include <string.h>
GstVideoOverlayRectangle *rect1, *rect2;
GstVideoOverlayCompositionMeta *ometa;
GstBuffer *pix1, *pix2, *buf;
+ GstVideoMeta *vmeta;
guint seq1, seq2;
guint w, h, stride;
gint x, y;
pix1 = gst_buffer_new_and_alloc (200 * sizeof (guint32) * 50);
gst_buffer_memset (pix1, 0, 0, gst_buffer_get_size (pix1));
- rect1 = gst_video_overlay_rectangle_new_argb (pix1, 200, 50, 200 * 4,
+ gst_buffer_add_video_meta (pix1, GST_VIDEO_FRAME_FLAG_NONE,
+ GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, 200, 50);
+ rect1 = gst_video_overlay_rectangle_new_argb (pix1,
600, 50, 300, 50, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
gst_buffer_unref (pix1);
fail_unless_equals_int (h, 51);
/* get scaled pixbuf and touch last byte */
- pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ stride = 4 * w;
fail_unless (gst_buffer_get_size (pix1) > ((h - 1) * stride + (w * 4) - 1),
"size %u vs. last pixel offset %u", gst_buffer_get_size (pix1),
((h - 1) * stride + (w * 4) - 1));
fail_unless_equals_int (h, 50);
/* get scaled pixbuf and touch last byte */
- pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect2, &stride,
+ pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect2,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ stride = 4 * w;
fail_unless (gst_buffer_get_size (pix2) > ((h - 1) * stride + (w * 4) - 1),
"size %u vs. last pixel offset %u", gst_buffer_get_size (pix1),
((h - 1) * stride + (w * 4) - 1));
fail_unless_equals_int (val, 0);
/* get scaled pixbuf again, should be the same buffer as before (caching) */
- pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect2, &stride,
+ pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect2,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (pix1 == pix2);
/* now compare the original unscaled ones */
- pix1 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect2, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ pix1 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect2,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+
+ vmeta = gst_buffer_get_video_meta (pix2);
+ fail_unless (vmeta != NULL);
+ w = vmeta->width;
+ h = vmeta->height;
/* the original pixel buffers should be identical */
fail_unless (pix1 == pix2);
fail_unless_equals_int (w, 200);
fail_unless_equals_int (h, 50);
+ stride = 4 * w;
/* touch last byte */
fail_unless (gst_buffer_get_size (pix1) > ((h - 1) * stride + (w * 4) - 1),
GST_START_TEST (test_overlay_composition_premultiplied_alpha)
{
GstVideoOverlayRectangle *rect1;
+ GstVideoMeta *vmeta;
GstBuffer *pix1, *pix2, *pix3, *pix4, *pix5;
GstBuffer *pix6, *pix7, *pix8, *pix9, *pix10;
guint8 *data5, *data7;
- guint w, h, stride, w2, h2, stride2;
+ guint w, h, w2, h2;
GstMapInfo map;
pix1 = gst_buffer_new_and_alloc (200 * sizeof (guint32) * 50);
gst_buffer_memset (pix1, 0, 0x80, gst_buffer_get_size (pix1));
- rect1 = gst_video_overlay_rectangle_new_argb (pix1, 200, 50, 200 * 4,
+ gst_buffer_add_video_meta (pix1, GST_VIDEO_FRAME_FLAG_NONE,
+ GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, 200, 50);
+ rect1 = gst_video_overlay_rectangle_new_argb (pix1,
600, 50, 300, 50, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
gst_buffer_unref (pix1);
/* same flags, unscaled, should be the same buffer */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (pix1 == pix2);
/* same flags, but scaled */
- pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_if (pix3 == pix1 || pix3 == pix2);
/* same again, should hopefully get the same (cached) buffer as before */
- pix4 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix4 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (pix4 == pix3);
/* just to update the vars */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+
+ vmeta = gst_buffer_get_video_meta (pix2);
+ fail_unless (vmeta != NULL);
+ w = vmeta->width;
+ h = vmeta->height;
/* now, let's try to get premultiplied alpha from the unpremultiplied input */
- pix5 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w2, &h2,
- &stride2, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
+ pix5 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
fail_if (pix5 == pix1 || pix5 == pix2 || pix5 == pix3);
- fail_unless_equals_int (stride, stride2);
+ vmeta = gst_buffer_get_video_meta (pix5);
+ fail_unless (vmeta != NULL);
+ w2 = vmeta->width;
+ h2 = vmeta->height;
fail_unless_equals_int (w, w2);
fail_unless_equals_int (h, h2);
fail_unless_equals_int (gst_buffer_get_size (pix2),
/* same again, now we should be getting back the same buffer as before,
* as it should have been cached */
- pix6 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w2, &h2,
- &stride2, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
+ pix6 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
fail_unless (pix6 == pix5);
/* just to update the stride var */
- pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (pix3 == pix4);
/* now try to get scaled premultiplied alpha from unpremultiplied input */
- pix7 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride2,
+ pix7 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
fail_if (pix7 == pix1 || pix7 == pix2 || pix7 == pix3 || pix7 == pix5);
- fail_unless_equals_int (stride, stride2);
gst_buffer_map (pix7, &map, GST_MAP_READ);
data7 = map.data;
gst_buffer_unmap (pix7, &map);
/* and the same again, it should be cached now */
- pix8 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride2,
+ pix8 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
fail_unless (pix8 == pix7);
/* make sure other cached stuff is still there */
- pix9 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix9 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (pix9 == pix3);
- pix10 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w2, &h2,
- &stride2, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
+ pix10 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
fail_unless (pix10 == pix5);
gst_video_overlay_rectangle_unref (rect1);
{
GstVideoOverlayRectangle *rect1;
GstBuffer *pix1, *pix2, *pix3, *pix4, *pix5;
+ GstVideoMeta *vmeta;
guint8 *data2, *data4, *data5;
- guint w, h, stride, stride3, w4, h4, stride4, stride5;
+ guint w, h, w4, h4;
guint seq1, seq2;
gfloat ga1, ga2;
GstVideoOverlayFormatFlags flags1;
pix1 = gst_buffer_new_and_alloc (200 * sizeof (guint32) * 50);
gst_buffer_memset (pix1, 0, 0x80, gst_buffer_get_size (pix1));
- rect1 = gst_video_overlay_rectangle_new_argb (pix1, 200, 50, 200 * 4,
+ gst_buffer_add_video_meta (pix1, GST_VIDEO_FRAME_FLAG_NONE,
+ GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, 200, 50);
+ rect1 = gst_video_overlay_rectangle_new_argb (pix1,
600, 50, 300, 50, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
gst_buffer_unref (pix1);
/* same flags, unscaled, should be the same buffer */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (pix1 == pix2);
+ vmeta = gst_buffer_get_video_meta (pix2);
+ fail_unless (vmeta != NULL);
+ w = vmeta->width;
+ h = vmeta->height;
+
/* same flags, but scaled */
- pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride3,
+ pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_if (pix3 == pix1 || pix3 == pix2);
/* get unscaled premultiplied data, new cached rectangle should be created */
- pix4 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w4, &h4,
- &stride4, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
+ pix4 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
fail_if (pix4 == pix2 || pix4 == pix3);
- fail_unless_equals_int (stride, stride4);
+ vmeta = gst_buffer_get_video_meta (pix4);
+ fail_unless (vmeta != NULL);
+ w4 = vmeta->width;
+ h4 = vmeta->height;
fail_unless_equals_int (w, w4);
fail_unless_equals_int (h, h4);
fail_unless_equals_int (gst_buffer_get_size (pix2),
gst_buffer_unmap (pix4, &map);
/* now premultiplied and scaled, again a new cached rectangle should be cached */
- pix5 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride5,
+ pix5 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
fail_if (pix5 == pix2 || pix5 == pix3 || pix5 == pix4);
/* stride and size should be equal to the first scaled rect */
- fail_unless_equals_int (stride5, stride3);
fail_unless_equals_int (gst_buffer_get_size (pix5),
gst_buffer_get_size (pix3));
/* data should be different (premutliplied) though */
fail_unless_equals_int (flags1, GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA);
/* request unscaled pixel-data, global-alpha not applied */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA);
/* this should just return the same buffer */
fail_unless (pix2 == pix1);
/* make sure we got the initial data (input=0x80808080) */
gst_buffer_unmap (pix2, &map);
/* unscaled pixel-data, global-alpha applied */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
/* this should be the same buffer with on-the-fly modified alpha-channel */
fail_unless (pix2 == pix1);
gst_buffer_map (pix2, &map, GST_MAP_READ);
ga2 = gst_video_overlay_rectangle_get_global_alpha (rect1);
fail_unless_equals_float (ga2, 0.25);
/* and again request unscaled pixel-data, global-alpha applied */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (pix2 == pix1);
/* make sure we got the initial data with adjusted alpha-channel */
gst_buffer_map (pix2, &map, GST_MAP_READ);
/* again: unscaled pixel-data, global-alpha not applied,
* this should revert alpha-channel to initial values */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA);
fail_unless (pix2 == pix1);
/* make sure we got the initial data (input=0x80808080) */
gst_buffer_map (pix2, &map, GST_MAP_READ);
gst_buffer_unmap (pix2, &map);
/* now scaled, global-alpha not applied */
- pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA);
/* this should just return the rect/buffer, that was cached for these
* scaling dimensions */
gst_buffer_unmap (pix2, &map);
/* scaled, global-alpha (0.25) applied */
- pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
/* this should just return the rect/buffer, that was cached for these
* scaling dimensions with modified alpha channel */
/* now unscaled premultiplied data, global-alpha not applied,
* is this really a valid use case?*/
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA |
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA |
GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA);
/* this should just return the rect/buffer, that was cached for the
* premultiplied data */
gst_buffer_unmap (pix2, &map);
/* unscaled premultiplied data, global-alpha (0.25) applied */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
/* this should just return the rect/buffer, that was cached for the
* premultiplied data */
fail_unless (pix2 == pix4);
gst_video_overlay_rectangle_set_global_alpha (rect1, 0.75);
/* and verify that also premultiplied data is adjusted
* correspondingly (though with increasing rounding errors) */
- pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
- &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
/* this should just return the rect/buffer, that was cached for the
* premultiplied data */
fail_unless (pix2 == pix4);
/* now scaled and premultiplied data, global-alpha not applied,
* is this really a valid use case?*/
- pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA |
GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA);
/* this should just return the rect/buffer, that was cached for the
* first premultiplied+scaled rect*/
fail_unless (pix2 == pix5);
- fail_unless (stride == stride5);
/* make sure we got what we expected */
gst_buffer_map (pix2, &map, GST_MAP_READ);
data2 = map.data;
gst_buffer_unmap (pix2, &map);
/* scaled and premultiplied data, global-alpha applied */
- pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1,
GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
/* this should just return the rect/buffer, that was cached for the
* first premultiplied+scaled rect*/
fail_unless (pix2 == pix5);
- fail_unless (stride == stride5);
/* make sure we got what we expected; see above note about rounding errors! */
gst_buffer_map (pix2, &map, GST_MAP_READ);
data2 = map.data;