diff options
author | Doug Nazar <nazard@nazar.ca> | 2021-04-13 16:34:15 -0400 |
---|---|---|
committer | Doug Nazar <nazard@nazar.ca> | 2021-04-13 16:34:15 -0400 |
commit | 63b5ae0ffe20ed67dd4bebebb321779698d004ca (patch) | |
tree | 9fb1e7ffeaa58dc4e57a9a43b660195a03f3fbad /tests/check | |
parent | a1535a4dc363466357fcd1b4a61a4b7b22deb964 (diff) | |
download | gstreamer-plugins-bad-63b5ae0ffe20ed67dd4bebebb321779698d004ca.tar.gz |
line21enc: fix remove-caption-meta property test
It's possible for the same address to be allocated to the decoded
metadata. Switch test to actual detect if it was removed.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2159>
Diffstat (limited to 'tests/check')
-rw-r--r-- | tests/check/elements/line21.c | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/tests/check/elements/line21.c b/tests/check/elements/line21.c index fa9427b55..b4be999ab 100644 --- a/tests/check/elements/line21.c +++ b/tests/check/elements/line21.c @@ -31,7 +31,7 @@ GST_START_TEST (basic) GstHarness *h; GstBuffer *buf, *outbuf; GstVideoInfo info; - GstVideoCaptionMeta *in_cc_meta, *out_cc_meta; + GstVideoCaptionMeta *out_cc_meta; guint i; guint8 empty_data[] = { 0x8c, 0x80, 0x80, 0x0, 0x80, 0x80 }; guint8 full_data[] = { 0x8c, 0x42, 0x43, 0x0, 0x44, 0x45 }; @@ -58,7 +58,6 @@ GST_START_TEST (basic) GST_VIDEO_CAPTION_META_API_TYPE), 1); out_cc_meta = gst_buffer_get_video_caption_meta (outbuf); - fail_unless (out_cc_meta != NULL); fail_unless (out_cc_meta->size == 6); @@ -70,7 +69,7 @@ GST_START_TEST (basic) buf = gst_buffer_new_and_alloc (info.size); gst_buffer_add_video_caption_meta (buf, GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A, full_data, 6); - in_cc_meta = gst_buffer_get_video_caption_meta (buf); + outbuf = gst_harness_push_and_pull (h, buf); fail_unless (outbuf != NULL); @@ -78,7 +77,7 @@ GST_START_TEST (basic) GST_VIDEO_CAPTION_META_API_TYPE), 1); out_cc_meta = gst_buffer_get_video_caption_meta (outbuf); - fail_unless (in_cc_meta != out_cc_meta); + fail_unless (out_cc_meta != NULL); for (i = 0; i < out_cc_meta->size; i++) fail_unless (out_cc_meta->data[i] == full_data[i]); @@ -89,6 +88,45 @@ GST_START_TEST (basic) GST_END_TEST; +GST_START_TEST (remove_caption_meta) +{ + GstHarness *h; + GstBuffer *buf, *outbuf; + GstVideoInfo info; + GstVideoCaptionMeta *out_cc_meta; + guint8 full_data[] = { 0x8c, 0x42, 0x43, 0x0, 0x44, 0x45 }; + GstCaps *caps = gst_caps_new_simple ("video/x-raw", + "format", G_TYPE_STRING, "I420", + "width", G_TYPE_INT, 720, + "height", G_TYPE_INT, 525, + "interlace-mode", G_TYPE_STRING, "interleaved", + NULL); + + h = gst_harness_new_parse ("line21encoder remove-caption-meta=true"); + gst_harness_set_caps (h, gst_caps_ref (caps), gst_caps_ref (caps)); + + gst_video_info_from_caps (&info, caps); + + gst_caps_unref (caps); + + buf = gst_buffer_new_and_alloc (info.size); + gst_buffer_add_video_caption_meta (buf, GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A, + full_data, 6); + + outbuf = gst_harness_push_and_pull (h, buf); + fail_unless (outbuf != NULL); + fail_unless_equals_int (gst_buffer_get_n_meta (outbuf, + GST_VIDEO_CAPTION_META_API_TYPE), 0); + + out_cc_meta = gst_buffer_get_video_caption_meta (outbuf); + fail_unless (out_cc_meta == NULL); + + gst_buffer_unref (outbuf); + gst_harness_teardown (h); +} + +GST_END_TEST; + static Suite * line21_suite (void) { @@ -98,6 +136,7 @@ line21_suite (void) suite_add_tcase (s, tc); tcase_add_test (tc, basic); + tcase_add_test (tc, remove_caption_meta); return s; } |