mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
video: add seqnum getters for overlay compositions and rectangles
API: gst_video_overlay_composition_get_seqnum() API: gst_video_overlay_rectangle_get_seqnum()
This commit is contained in:
parent
39c5015ed0
commit
5037b39883
4 changed files with 57 additions and 0 deletions
|
@ -602,6 +602,27 @@ copy:
|
||||||
return writable_comp;
|
return writable_comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_video_overlay_composition_get_seqnum:
|
||||||
|
* @comp: a #GstVideoOverlayComposition
|
||||||
|
*
|
||||||
|
* 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 @comp
|
||||||
|
*
|
||||||
|
* Since: 0.10.36
|
||||||
|
*/
|
||||||
|
guint
|
||||||
|
gst_video_overlay_composition_get_seqnum (GstVideoOverlayComposition * comp)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp), 0);
|
||||||
|
|
||||||
|
return comp->seq_num;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------ rectangles ------------------------------ -*/
|
/* ------------------------------ rectangles ------------------------------ -*/
|
||||||
|
|
||||||
static void gst_video_overlay_rectangle_instance_init (GstMiniObject * miniobj);
|
static void gst_video_overlay_rectangle_instance_init (GstMiniObject * miniobj);
|
||||||
|
@ -958,3 +979,24 @@ gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle * rectangle)
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_video_overlay_rectangle_get_seqnum:
|
||||||
|
* @rectangle: a #GstVideoOverlayRectangle
|
||||||
|
*
|
||||||
|
* 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).
|
||||||
|
*
|
||||||
|
* Returns: the sequence number of @rectangle
|
||||||
|
*
|
||||||
|
* Since: 0.10.36
|
||||||
|
*/
|
||||||
|
guint
|
||||||
|
gst_video_overlay_rectangle_get_seqnum (GstVideoOverlayRectangle * rectangle)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), 0);
|
||||||
|
|
||||||
|
return rectangle->seq_num;
|
||||||
|
}
|
||||||
|
|
|
@ -114,6 +114,8 @@ GstVideoOverlayRectangle * gst_video_overlay_rectangle_new_argb (GstBuffer * p
|
||||||
|
|
||||||
GstVideoOverlayRectangle * gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle * rectangle);
|
GstVideoOverlayRectangle * gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle * rectangle);
|
||||||
|
|
||||||
|
guint gst_video_overlay_rectangle_get_seqnum (GstVideoOverlayRectangle * rectangle);
|
||||||
|
|
||||||
void gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle * rectangle,
|
void gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle * rectangle,
|
||||||
gint render_x,
|
gint render_x,
|
||||||
gint render_y,
|
gint render_y,
|
||||||
|
@ -214,6 +216,8 @@ guint gst_video_overlay_composition_n_rectangles (GstVid
|
||||||
|
|
||||||
GstVideoOverlayRectangle * gst_video_overlay_composition_get_rectangle (GstVideoOverlayComposition * comp, guint n);
|
GstVideoOverlayRectangle * gst_video_overlay_composition_get_rectangle (GstVideoOverlayComposition * comp, guint n);
|
||||||
|
|
||||||
|
guint gst_video_overlay_composition_get_seqnum (GstVideoOverlayComposition * comp);
|
||||||
|
|
||||||
/* blend composition onto raw video buffer */
|
/* blend composition onto raw video buffer */
|
||||||
|
|
||||||
void gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
|
void gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
|
||||||
|
|
|
@ -783,6 +783,7 @@ GST_START_TEST (test_overlay_composition)
|
||||||
GstVideoOverlayComposition *comp1, *comp2;
|
GstVideoOverlayComposition *comp1, *comp2;
|
||||||
GstVideoOverlayRectangle *rect1, *rect2;
|
GstVideoOverlayRectangle *rect1, *rect2;
|
||||||
GstBuffer *pix1, *pix2, *buf;
|
GstBuffer *pix1, *pix2, *buf;
|
||||||
|
guint seq1, seq2;
|
||||||
guint w, h, stride;
|
guint w, h, stride;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
|
||||||
|
@ -800,6 +801,11 @@ GST_START_TEST (test_overlay_composition)
|
||||||
fail_unless (gst_video_overlay_composition_get_rectangle (comp1, 0) == rect1);
|
fail_unless (gst_video_overlay_composition_get_rectangle (comp1, 0) == rect1);
|
||||||
fail_unless (gst_video_overlay_composition_get_rectangle (comp1, 1) == NULL);
|
fail_unless (gst_video_overlay_composition_get_rectangle (comp1, 1) == NULL);
|
||||||
|
|
||||||
|
/* rectangle was created first, sequence number should be smaller */
|
||||||
|
seq1 = gst_video_overlay_rectangle_get_seqnum (rect1);
|
||||||
|
seq2 = gst_video_overlay_composition_get_seqnum (comp1);
|
||||||
|
fail_unless (seq1 < seq2);
|
||||||
|
|
||||||
/* composition took own ref, so refcount is 2 now, so this should fail */
|
/* composition took own ref, so refcount is 2 now, so this should fail */
|
||||||
ASSERT_CRITICAL (gst_video_overlay_rectangle_set_render_rectangle (rect1, 50,
|
ASSERT_CRITICAL (gst_video_overlay_rectangle_set_render_rectangle (rect1, 50,
|
||||||
600, 300, 50));
|
600, 300, 50));
|
||||||
|
@ -813,6 +819,9 @@ GST_START_TEST (test_overlay_composition)
|
||||||
fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 0) == rect1);
|
fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 0) == rect1);
|
||||||
fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 1) == NULL);
|
fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 1) == NULL);
|
||||||
|
|
||||||
|
fail_unless (seq1 < gst_video_overlay_composition_get_seqnum (comp2));
|
||||||
|
fail_unless (seq2 < gst_video_overlay_composition_get_seqnum (comp2));
|
||||||
|
|
||||||
/* now refcount is 2 again because comp2 has also taken a ref, so must fail */
|
/* now refcount is 2 again because comp2 has also taken a ref, so must fail */
|
||||||
ASSERT_CRITICAL (gst_video_overlay_rectangle_set_render_rectangle (rect1, 0,
|
ASSERT_CRITICAL (gst_video_overlay_rectangle_set_render_rectangle (rect1, 0,
|
||||||
0, 1, 1));
|
0, 1, 1));
|
||||||
|
|
|
@ -39,6 +39,7 @@ EXPORTS
|
||||||
gst_video_overlay_composition_blend
|
gst_video_overlay_composition_blend
|
||||||
gst_video_overlay_composition_copy
|
gst_video_overlay_composition_copy
|
||||||
gst_video_overlay_composition_get_rectangle
|
gst_video_overlay_composition_get_rectangle
|
||||||
|
gst_video_overlay_composition_get_seqnum
|
||||||
gst_video_overlay_composition_get_type
|
gst_video_overlay_composition_get_type
|
||||||
gst_video_overlay_composition_make_writable
|
gst_video_overlay_composition_make_writable
|
||||||
gst_video_overlay_composition_n_rectangles
|
gst_video_overlay_composition_n_rectangles
|
||||||
|
@ -47,6 +48,7 @@ EXPORTS
|
||||||
gst_video_overlay_rectangle_get_pixels_argb
|
gst_video_overlay_rectangle_get_pixels_argb
|
||||||
gst_video_overlay_rectangle_get_pixels_unscaled_argb
|
gst_video_overlay_rectangle_get_pixels_unscaled_argb
|
||||||
gst_video_overlay_rectangle_get_render_rectangle
|
gst_video_overlay_rectangle_get_render_rectangle
|
||||||
|
gst_video_overlay_rectangle_get_seqnum
|
||||||
gst_video_overlay_rectangle_get_type
|
gst_video_overlay_rectangle_get_type
|
||||||
gst_video_overlay_rectangle_new_argb
|
gst_video_overlay_rectangle_new_argb
|
||||||
gst_video_overlay_rectangle_set_render_rectangle
|
gst_video_overlay_rectangle_set_render_rectangle
|
||||||
|
|
Loading…
Reference in a new issue