From c39ad574aa908a1f469b89746685ee4237bb242d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 28 Jul 2011 13:39:14 +0100 Subject: [PATCH] video: make GST_VIDEO_FORMATS_ALL define more readable We don't need all those quotes, strings will be parsed as strings regardless, and g-i doesn't seem to like all those escaped quotes. --- gst-libs/gst/video/video.h | 11 +++++------ tests/check/libs/video.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h index 8cc63b00d3..87c17c3c88 100644 --- a/gst-libs/gst/video/video.h +++ b/gst-libs/gst/video/video.h @@ -461,12 +461,11 @@ gboolean gst_video_frame_copy (GstVideoFrame *dest, const GstVideoFr #define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]" #define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]" -#define GST_VIDEO_FORMATS_ALL "{ \"I420\"," "\"YV12\"," "\"YUY2\"," "\"UYVY\"," "\"AYUV\"," "\"RGBx\"," \ - "\"BGRx\"," "\"xRGB\"," "\"xBGR\"," "\"RGBA\"," "\"BGRA\"," "\"ARGB\"," "\"ABGR\"," "\"RGB\"," \ - "\"BGR\"," "\"Y41B\"," "\"Y42B\"," "\"YVYU\"," "\"Y444\"," "\"v210\"," "\"v216\"," "\"NV12\"," \ - "\"NV21\"," "\"GRAY8\"," "\"GRAY16_BE\"," "\"GRAY16_LE\"," "\"v308\"," "\"Y800\"," "\"Y16\"," \ - "\"RGB16\"," "\"BGR16\"," "\"RGB15\"," "\"BGR15\"," "\"UYVP\"," "\"A420\"," "\"RGB8_PALETTED\"," \ - "\"YUV9\"," "\"YVU9\"," "\"IYU1\"," "\"ARGB64\"," "\"AYUV64\"," "\"r210\" } " +#define GST_VIDEO_FORMATS_ALL "{ I420, YV12, YUY2, UYVY, AYUV, RGBx, " \ + "BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, " \ + "YVYU, Y444, v210, v216, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, " \ + "v308, Y800, Y16, RGB16, BGR16, RGB15, BGR15, UYVP, A420, " \ + "RGB8_PALETTED, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210 }" /** * GST_VIDEO_CAPS_MAKE: diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c index e7616ecaf3..f3735d2550 100644 --- a/tests/check/libs/video.c +++ b/tests/check/libs/video.c @@ -358,6 +358,43 @@ video_format_is_packed (GstVideoFormat fmt) return FALSE; } +GST_START_TEST (test_video_formats_all) +{ + GstStructure *s; + const GValue *val, *list_val; + GstCaps *caps; + guint num, n, num_formats; + + num_formats = 100; + fail_unless (gst_video_format_to_string (num_formats) == NULL); + while (gst_video_format_to_string (num_formats) == NULL) + --num_formats; + GST_INFO ("number of known video formats: %d", num_formats); + + caps = gst_caps_from_string ("video/x-raw, format=" GST_VIDEO_FORMATS_ALL); + s = gst_caps_get_structure (caps, 0); + val = gst_structure_get_value (s, "format"); + fail_unless (val != NULL); + fail_unless (GST_VALUE_HOLDS_LIST (val)); + num = gst_value_list_get_size (val); + fail_unless (num > 0); + for (n = 0; n < num; ++n) { + const gchar *fmt_str; + + list_val = gst_value_list_get_value (val, n); + fail_unless (G_VALUE_HOLDS_STRING (list_val)); + fmt_str = g_value_get_string (list_val); + GST_INFO ("format: %s", fmt_str); + fail_if (gst_video_format_from_string (fmt_str) == + GST_VIDEO_FORMAT_UNKNOWN); + } + fail_unless_equals_int (num, num_formats); + + gst_caps_unref (caps); +} + +GST_END_TEST; + GST_START_TEST (test_video_formats) { guint i; @@ -806,6 +843,7 @@ video_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_video_formats); tcase_add_test (tc_chain, test_video_formats_rgb); + tcase_add_test (tc_chain, test_video_formats_all); tcase_add_test (tc_chain, test_dar_calc); tcase_add_test (tc_chain, test_parse_caps_rgb); tcase_add_test (tc_chain, test_events);