mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
videoscale: Add test for transform_meta function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1630>
This commit is contained in:
parent
c8a24146c4
commit
2290af332b
1 changed files with 41 additions and 0 deletions
|
@ -966,6 +966,46 @@ GST_START_TEST (test_basetransform_negotiation)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_transform_meta)
|
||||
{
|
||||
GstHarness *h;
|
||||
GstBuffer *buffer;
|
||||
const guint8 data[16] = { 0 };
|
||||
GstCaps *caps;
|
||||
GstVideoRegionOfInterestMeta *roi_meta;
|
||||
|
||||
h = gst_harness_new ("videoscale");
|
||||
|
||||
buffer = gst_buffer_new_allocate (NULL, sizeof (data), NULL);
|
||||
gst_buffer_fill (buffer, 0, data, sizeof (data));
|
||||
|
||||
caps = gst_caps_new_empty_simple ("timestamp/test");
|
||||
gst_buffer_add_video_region_of_interest_meta (buffer, "face", 0, 1, 2, 3);
|
||||
|
||||
gst_harness_set_sink_caps_str (h,
|
||||
"video/x-raw,width=8,height=8,format=GRAY8");
|
||||
gst_harness_set_src_caps_str (h, "video/x-raw,width=4,height=4,format=GRAY8");
|
||||
fail_unless_equals_int (gst_harness_push (h, buffer), GST_FLOW_OK);
|
||||
|
||||
buffer = gst_harness_pull (h);
|
||||
fail_unless_equals_int (gst_buffer_get_n_meta (buffer,
|
||||
GST_VIDEO_REGION_OF_INTEREST_META_API_TYPE), 1);
|
||||
|
||||
roi_meta = gst_buffer_get_video_region_of_interest_meta_id (buffer, 0);
|
||||
fail_unless (roi_meta != NULL);
|
||||
fail_unless_equals_int (roi_meta->roi_type, g_quark_from_string ("face"));
|
||||
fail_unless_equals_int (roi_meta->x, 0);
|
||||
fail_unless_equals_int (roi_meta->y, 2);
|
||||
fail_unless_equals_int (roi_meta->w, 4);
|
||||
fail_unless_equals_int (roi_meta->h, 6);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
gst_caps_unref (caps);
|
||||
gst_harness_teardown (h);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
#endif /* !defined(VSCALE_TEST_GROUP) */
|
||||
|
||||
static Suite *
|
||||
|
@ -988,6 +1028,7 @@ videoscale_suite (void)
|
|||
tcase_add_test (tc_chain, test_reverse_negotiation);
|
||||
#endif
|
||||
tcase_add_test (tc_chain, test_basetransform_negotiation);
|
||||
tcase_add_test (tc_chain, test_transform_meta);
|
||||
#else
|
||||
#if VSCALE_TEST_GROUP == 1
|
||||
tcase_add_test (tc_chain, test_downscale_640x480_320x240_method_0);
|
||||
|
|
Loading…
Reference in a new issue