mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
tests/check/gst/gstcaps.c: Add some tests for gst_caps_intersect().
Original commit message from CVS: * tests/check/gst/gstcaps.c: (GST_START_TEST), (gst_caps_suite): Add some tests for gst_caps_intersect(). * tools/gst-launch.c: (event_loop): Print all buffering percentages we get, even the 100% one.
This commit is contained in:
parent
2ab0b397bb
commit
b74d2e83a6
3 changed files with 123 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2006-09-27 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* tests/check/gst/gstcaps.c: (GST_START_TEST), (gst_caps_suite):
|
||||
Add some tests for gst_caps_intersect().
|
||||
|
||||
* tools/gst-launch.c: (event_loop):
|
||||
Print all buffering percentages we get, even the 100% one.
|
||||
|
||||
2006-09-26 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* tools/gst-inspect.c: (print_element_properties_info),
|
||||
|
|
|
@ -466,6 +466,119 @@ GST_START_TEST (test_merge_subset)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_intersect)
|
||||
{
|
||||
GstStructure *s;
|
||||
GstCaps *c1, *c2, *ci1, *ci2;
|
||||
|
||||
/* field not specified = any value possible, so the intersection
|
||||
* should keep fields which are only part of one set of caps */
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420");
|
||||
|
||||
ci1 = gst_caps_intersect (c2, c1);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
||||
fail_unless (gst_caps_get_size (ci1) == 1, NULL);
|
||||
s = gst_caps_get_structure (ci1, 0);
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv"));
|
||||
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
||||
|
||||
/* with changed order */
|
||||
ci2 = gst_caps_intersect (c1, c2);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
||||
fail_unless (gst_caps_get_size (ci2) == 1, NULL);
|
||||
s = gst_caps_get_structure (ci2, 0);
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv"));
|
||||
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
||||
|
||||
fail_unless (gst_caps_is_equal (ci1, ci2));
|
||||
|
||||
gst_caps_unref (ci1);
|
||||
gst_caps_unref (ci2);
|
||||
|
||||
gst_caps_unref (c1);
|
||||
gst_caps_unref (c2);
|
||||
|
||||
/* ========== */
|
||||
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=30");
|
||||
|
||||
ci1 = gst_caps_intersect (c2, c1);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
||||
fail_unless (gst_caps_is_empty (ci1), NULL);
|
||||
|
||||
/* with changed order */
|
||||
ci2 = gst_caps_intersect (c1, c2);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
||||
fail_unless (gst_caps_is_empty (ci2), NULL);
|
||||
|
||||
fail_unless (gst_caps_is_equal (ci1, ci2));
|
||||
|
||||
gst_caps_unref (ci1);
|
||||
gst_caps_unref (ci2);
|
||||
|
||||
gst_caps_unref (c1);
|
||||
gst_caps_unref (c2);
|
||||
|
||||
/* ========== */
|
||||
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw-rgb,format=(fourcc)I420,width=20");
|
||||
|
||||
ci1 = gst_caps_intersect (c2, c1);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
||||
fail_unless (gst_caps_is_empty (ci1), NULL);
|
||||
|
||||
/* with changed order */
|
||||
ci2 = gst_caps_intersect (c1, c2);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
||||
fail_unless (gst_caps_is_empty (ci2), NULL);
|
||||
|
||||
fail_unless (gst_caps_is_equal (ci1, ci2));
|
||||
|
||||
gst_caps_unref (ci1);
|
||||
gst_caps_unref (ci2);
|
||||
|
||||
gst_caps_unref (c1);
|
||||
gst_caps_unref (c2);
|
||||
|
||||
/* ========== */
|
||||
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,height=30");
|
||||
|
||||
ci1 = gst_caps_intersect (c2, c1);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
||||
fail_unless (gst_caps_get_size (ci1) == 1, NULL);
|
||||
s = gst_caps_get_structure (ci1, 0);
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv"));
|
||||
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "height") != NULL);
|
||||
|
||||
/* with changed order */
|
||||
ci2 = gst_caps_intersect (c1, c2);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
||||
fail_unless (gst_caps_get_size (ci2) == 1, NULL);
|
||||
s = gst_caps_get_structure (ci2, 0);
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv"));
|
||||
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "height") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
||||
|
||||
fail_unless (gst_caps_is_equal (ci1, ci2));
|
||||
|
||||
gst_caps_unref (ci1);
|
||||
gst_caps_unref (ci2);
|
||||
|
||||
gst_caps_unref (c1);
|
||||
gst_caps_unref (c2);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
Suite *
|
||||
gst_caps_suite (void)
|
||||
|
@ -484,6 +597,7 @@ gst_caps_suite (void)
|
|||
tcase_add_test (tc_chain, test_merge_fundamental);
|
||||
tcase_add_test (tc_chain, test_merge_same);
|
||||
tcase_add_test (tc_chain, test_merge_subset);
|
||||
tcase_add_test (tc_chain, test_intersect);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -483,6 +483,7 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
|
|||
gint percent;
|
||||
|
||||
gst_message_parse_buffering (message, &percent);
|
||||
fprintf (stderr, "buffering... %d\r", percent);
|
||||
|
||||
if (percent == 100) {
|
||||
/* a 100% message means buffering is done */
|
||||
|
@ -501,7 +502,6 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
|
|||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
||||
buffering = TRUE;
|
||||
}
|
||||
fprintf (stderr, "buffering... %d\r", percent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue