diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2019-02-20 09:46:30 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-02-20 09:49:26 +0000 |
commit | a1d757b1ee9ea06593db0df31f0127f12699060c (patch) | |
tree | ee5861c1fd0ae37865b499c34a45b404d2bb1cce | |
parent | 8f51fba8b533b79706d921278e80ccaa86305fb4 (diff) | |
download | gstreamer-plugins-base-a1d757b1ee9ea06593db0df31f0127f12699060c.tar.gz |
tests: video: add basic sanity check of pstrides for formats
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/117
-rw-r--r-- | tests/check/libs/video.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c index 2fdb54c96..eca5f30db 100644 --- a/tests/check/libs/video.c +++ b/tests/check/libs/video.c @@ -2953,6 +2953,51 @@ GST_START_TEST (test_video_format_enum_stability) GST_END_TEST; +GST_START_TEST (test_video_formats_pstrides) +{ + GstVideoFormat fmt = GST_VIDEO_FORMAT_I420; + + + while ((gst_video_format_to_string (fmt) != NULL)) { + const GstVideoFormatInfo *vf_info = gst_video_format_get_info (fmt); + guint n_comps = GST_VIDEO_FORMAT_INFO_N_COMPONENTS (vf_info); + + GST_LOG ("format: %s (%d), n_comps = %u", vf_info->name, fmt, n_comps); + + if (fmt == GST_VIDEO_FORMAT_v210 + || fmt == GST_VIDEO_FORMAT_UYVP + || fmt == GST_VIDEO_FORMAT_IYU1 + || fmt == GST_VIDEO_FORMAT_GRAY10_LE32 + || fmt == GST_VIDEO_FORMAT_NV12_64Z32 + || fmt == GST_VIDEO_FORMAT_NV12_10LE32 + || fmt == GST_VIDEO_FORMAT_NV16_10LE32 + || fmt == GST_VIDEO_FORMAT_NV12_10LE40 + || fmt == GST_VIDEO_FORMAT_Y410) { + fmt++; + continue; + } + + switch (n_comps) { + case 4: + fail_unless (GST_VIDEO_FORMAT_INFO_PSTRIDE (vf_info, 3) > 0); + /* fall through */ + case 3: + fail_unless (GST_VIDEO_FORMAT_INFO_PSTRIDE (vf_info, 2) > 0); + /* fall through */ + case 2: + fail_unless (GST_VIDEO_FORMAT_INFO_PSTRIDE (vf_info, 1) > 0); + /* fall through */ + case 1: + fail_unless (GST_VIDEO_FORMAT_INFO_PSTRIDE (vf_info, 0) > 0); + break; + } + + fmt++; + } +} + +GST_END_TEST; + static Suite * video_suite (void) { @@ -2993,6 +3038,7 @@ video_suite (void) tcase_add_test (tc_chain, test_video_center_rect); tcase_add_test (tc_chain, test_overlay_composition_over_transparency); tcase_add_test (tc_chain, test_video_format_enum_stability); + tcase_add_test (tc_chain, test_video_formats_pstrides); return s; } |