gst-plugins-good: tests: enable more formats in videofilter unit test, check more resolutions
Tim Müller
tpm at kemper.freedesktop.org
Tue Mar 15 13:23:37 PDT 2011
Module: gst-plugins-good
Branch: master
Commit: 2a8103553d32644129b79293dbe7bd5d404d2691
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=2a8103553d32644129b79293dbe7bd5d404d2691
Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date: Tue Mar 15 20:19:48 2011 +0000
tests: enable more formats in videofilter unit test, check more resolutions
---
tests/check/elements/videofilter.c | 50 ++++++++++++++++++++----------------
1 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/tests/check/elements/videofilter.c b/tests/check/elements/videofilter.c
index 0bd148a..7389478 100644
--- a/tests/check/elements/videofilter.c
+++ b/tests/check/elements/videofilter.c
@@ -36,6 +36,9 @@ GstPad *mysrcpad, *mysinkpad;
#define VIDEO_CAPS_TEMPLATE_STRING \
GST_VIDEO_CAPS_YUV ("I420") ";" \
GST_VIDEO_CAPS_YUV ("AYUV") ";" \
+ GST_VIDEO_CAPS_YUV ("YUY2") ";" \
+ GST_VIDEO_CAPS_YUV ("UYVY") ";" \
+ GST_VIDEO_CAPS_YUV ("YVYU") ";" \
GST_VIDEO_CAPS_xRGB
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
@@ -129,7 +132,14 @@ check_filter_caps (const gchar * name, GstCaps * caps, gint size,
static void
check_filter (const gchar * name, gint num_buffers, const gchar * prop, ...)
{
- gint i, n;
+ static const struct
+ {
+ const int width, height;
+ } resolutions[] = { {
+ 384, 288}, {
+ 385, 289}, {
+ 385, 385}};
+ gint i, n, r;
GstVideoFormat format;
gint size;
GstCaps *templ = gst_caps_from_string (VIDEO_CAPS_TEMPLATE_STRING);
@@ -142,27 +152,23 @@ check_filter (const gchar * name, gint num_buffers, const gchar * prop, ...)
GstCaps *caps = gst_caps_new_empty ();
gst_caps_append_structure (caps, gst_structure_copy (s));
- gst_caps_set_simple (caps, "width", G_TYPE_INT, 384, "height", G_TYPE_INT,
- 288, "framerate", GST_TYPE_FRACTION, 25, 1, NULL);
-
- GST_DEBUG ("Testing with caps: %" GST_PTR_FORMAT, caps);
- gst_video_format_parse_caps (caps, &format, NULL, NULL);
- size = gst_video_format_get_size (format, 384, 288);
- va_start (varargs, prop);
- check_filter_caps (name, caps, size, num_buffers, prop, varargs);
- va_end (varargs);
-
- /* and again with 'odd' width/height */
- caps = gst_caps_make_writable (caps);
- gst_caps_set_simple (caps, "width", G_TYPE_INT, 385, "height", G_TYPE_INT,
- 289, "framerate", GST_TYPE_FRACTION, 25, 1, NULL);
-
- GST_DEBUG ("Testing with caps: %" GST_PTR_FORMAT, caps);
- gst_video_format_parse_caps (caps, &format, NULL, NULL);
- size = gst_video_format_get_size (format, 385, 289);
- va_start (varargs, prop);
- check_filter_caps (name, caps, size, num_buffers, prop, varargs);
- va_end (varargs);
+
+ /* try various resolutions */
+ for (r = 0; r < G_N_ELEMENTS (resolutions); ++r) {
+ caps = gst_caps_make_writable (caps);
+ gst_caps_set_simple (caps, "width", G_TYPE_INT, resolutions[r].width,
+ "height", G_TYPE_INT, resolutions[r].height,
+ "framerate", GST_TYPE_FRACTION, 25, 1, NULL);
+
+ GST_DEBUG ("Testing with caps: %" GST_PTR_FORMAT, caps);
+ gst_video_format_parse_caps (caps, &format, NULL, NULL);
+ size = gst_video_format_get_size (format, resolutions[r].width,
+ resolutions[r].height);
+
+ va_start (varargs, prop);
+ check_filter_caps (name, caps, size, num_buffers, prop, varargs);
+ va_end (varargs);
+ }
gst_caps_unref (caps);
}
More information about the gstreamer-commits
mailing list