summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/check/Makefile.am7
-rw-r--r--tests/check/elements/videocrop.c802
-rw-r--r--tests/icles/Makefile.am7
-rw-r--r--tests/icles/videocrop-test.c356
4 files changed, 1 insertions, 1171 deletions
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index 6db66850..3db85362 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -42,9 +42,7 @@ VALGRIND_TO_FIX = \
elements/mpeg2enc
# valgrind testing
-# videocrop disabled since it takes way too long in valgrind
VALGRIND_TESTS_DISABLE = \
- elements/videocrop \
$(VALGRIND_TO_FIX)
check_PROGRAMS = \
@@ -53,7 +51,6 @@ check_PROGRAMS = \
elements/rganalysis \
elements/rglimiter \
elements/rgvolume \
- elements/videocrop \
elements/y4menc
TESTS = $(check_PROGRAMS)
@@ -61,7 +58,3 @@ TESTS = $(check_PROGRAMS)
AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS)
LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS)
-
-elements_videocrop_LDADD = $(LDADD) $(GST_BASE_LIBS)
-elements_videocrop_CFLAGS = $(CFLAGS) $(AM_CFLAGS) $(GST_BASE_CFLAGS)
-
diff --git a/tests/check/elements/videocrop.c b/tests/check/elements/videocrop.c
deleted file mode 100644
index 25cc00a9..00000000
--- a/tests/check/elements/videocrop.c
+++ /dev/null
@@ -1,802 +0,0 @@
-/* GStreamer unit test for the videocrop element
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_VALGRIND
-# include <valgrind/valgrind.h>
-#endif
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-#include <gst/base/gstbasetransform.h>
-
-/* return a list of caps where we only need to set
- * width and height to get fixed caps */
-static GList *
-video_crop_get_test_caps (GstElement * videocrop)
-{
- const GstCaps *allowed_caps;
- GstPad *srcpad;
- GList *list = NULL;
- guint i;
-
- srcpad = gst_element_get_pad (videocrop, "src");
- fail_unless (srcpad != NULL);
- allowed_caps = gst_pad_get_pad_template_caps (srcpad);
- fail_unless (allowed_caps != NULL);
-
- for (i = 0; i < gst_caps_get_size (allowed_caps); ++i) {
- GstStructure *new_structure;
- GstCaps *single_caps;
-
- single_caps = gst_caps_new_empty ();
- new_structure =
- gst_structure_copy (gst_caps_get_structure (allowed_caps, i));
- gst_structure_set (new_structure, "framerate", GST_TYPE_FRACTION,
- 1, 1, NULL);
- gst_structure_remove_field (new_structure, "width");
- gst_structure_remove_field (new_structure, "height");
- gst_caps_append_structure (single_caps, new_structure);
-
- /* should be fixed without width/height */
- fail_unless (gst_caps_is_fixed (single_caps));
-
- list = g_list_prepend (list, single_caps);
- }
-
- gst_object_unref (srcpad);
-
- return list;
-}
-
-GST_START_TEST (test_unit_sizes)
-{
- GstBaseTransformClass *csp_klass, *vcrop_klass;
- GstElement *videocrop, *csp;
- GList *caps_list, *l;
- gint i;
-
- videocrop = gst_element_factory_make ("videocrop", "videocrop");
- fail_unless (videocrop != NULL, "Failed to create videocrop element");
- vcrop_klass = GST_BASE_TRANSFORM_GET_CLASS (videocrop);
-
- csp = gst_element_factory_make ("ffmpegcolorspace", "csp");
- fail_unless (csp != NULL, "Failed to create ffmpegcolorspace element");
- csp_klass = GST_BASE_TRANSFORM_GET_CLASS (csp);
-
- caps_list = video_crop_get_test_caps (videocrop);
-
- for (l = caps_list; l != NULL; l = l->next) {
- const struct
- {
- gint width, height;
- } sizes_to_try[] = {
- {
- 160, 120}, {
- 161, 120}, {
- 160, 121}, {
- 161, 121}, {
- 159, 120}, {
- 160, 119}, {
- 159, 119}, {
- 159, 121}
- };
- GstStructure *s;
- GstCaps *caps;
- gint i;
-
- caps = gst_caps_copy (GST_CAPS (l->data));
- s = gst_caps_get_structure (caps, 0);
- fail_unless (s != NULL);
-
- for (i = 0; i < G_N_ELEMENTS (sizes_to_try); ++i) {
- gchar *caps_str;
- guint32 format = 0;
- guint csp_size = 0;
- guint vc_size = 0;
-
- gst_structure_set (s, "width", G_TYPE_INT, sizes_to_try[i].width,
- "height", G_TYPE_INT, sizes_to_try[i].height, NULL);
-
- caps_str = gst_caps_to_string (caps);
- GST_INFO ("Testing unit size for %s", caps_str);
-
- /* skip if ffmpegcolorspace doesn't support these caps
- * (only works with gst-plugins-base 0.10.9.1 or later) */
- if (!csp_klass->get_unit_size ((GstBaseTransform *) csp, caps, &csp_size)) {
- GST_INFO ("ffmpegcolorspace does not support format %s", caps_str);
- g_free (caps_str);
- continue;
- }
-
- fail_unless (vcrop_klass->get_unit_size ((GstBaseTransform *) videocrop,
- caps, &vc_size));
-
- fail_unless (vc_size == csp_size,
- "videocrop and ffmpegcolorspace return different unit sizes for "
- "caps %s: vc_size=%d, csp_size=%d", caps_str, vc_size, csp_size);
-
- g_free (caps_str);
- }
-
- gst_caps_unref (caps);
- }
-
- g_list_foreach (caps_list, (GFunc) gst_caps_unref, NULL);
- g_list_free (caps_list);
-
- gst_object_unref (csp);
- gst_object_unref (videocrop);
-}
-
-GST_END_TEST;
-
-typedef struct
-{
- GstElement *pipeline;
- GstElement *src;
- GstElement *filter;
- GstElement *crop;
- GstElement *sink;
- GstBuffer *last_buf;
-} GstVideoCropTestContext;
-
-static void
-handoff_cb (GstElement * sink, GstBuffer * buf, GstPad * pad,
- GstBuffer ** p_buf)
-{
- gst_buffer_replace (p_buf, buf);
-}
-
-static void
-videocrop_test_cropping_init_context (GstVideoCropTestContext * ctx)
-{
- fail_unless (ctx != NULL);
-
- ctx->pipeline = gst_pipeline_new ("pipeline");
- fail_unless (ctx->pipeline != NULL);
- ctx->src = gst_element_factory_make ("videotestsrc", "src");
- fail_unless (ctx->src != NULL, "Failed to create videotestsrc element");
- ctx->filter = gst_element_factory_make ("capsfilter", "filter");
- fail_unless (ctx->filter != NULL, "Failed to create capsfilter element");
- ctx->crop = gst_element_factory_make ("videocrop", "crop");
- fail_unless (ctx->crop != NULL, "Failed to create videocrop element");
- ctx->sink = gst_element_factory_make ("fakesink", "sink");
- fail_unless (ctx->sink != NULL, "Failed to create fakesink element");
-
- gst_bin_add_many (GST_BIN (ctx->pipeline), ctx->src, ctx->filter,
- ctx->crop, ctx->sink, NULL);
- gst_element_link_many (ctx->src, ctx->filter, ctx->crop, ctx->sink, NULL);
-
- /* set pattern to 'red' - for our purposes it doesn't matter anyway */
- g_object_set (ctx->src, "pattern", 4, NULL);
-
- g_object_set (ctx->sink, "signal-handoffs", TRUE, NULL);
- g_signal_connect (ctx->sink, "preroll-handoff", G_CALLBACK (handoff_cb),
- &ctx->last_buf);
-
- ctx->last_buf = NULL;
-
- GST_LOG ("context inited");
-}
-
-static void
-videocrop_test_cropping_deinit_context (GstVideoCropTestContext * ctx)
-{
- GST_LOG ("deiniting context");
-
- gst_element_set_state (ctx->pipeline, GST_STATE_NULL);
- gst_object_unref (ctx->pipeline);
- gst_buffer_replace (&ctx->last_buf, NULL);
- memset (ctx, 0x00, sizeof (GstVideoCropTestContext));
-}
-typedef void (*GstVideoCropTestBufferFunc) (GstBuffer * buffer);
-
-static void
-videocrop_test_cropping (GstVideoCropTestContext * ctx, GstCaps * in_caps,
- gint left, gint right, gint top, gint bottom,
- GstVideoCropTestBufferFunc func)
-{
- GST_LOG ("lrtb = %03u %03u %03u %03u, caps = %" GST_PTR_FORMAT, left, right,
- top, bottom, in_caps);
-
- g_object_set (ctx->filter, "caps", in_caps, NULL);
-
- g_object_set (ctx->crop, "left", left, "right", right, "top", top,
- "bottom", bottom, NULL);
-
- /* this will fail if videotestsrc doesn't support our format; we need
- * videotestsrc from -base CVS 0.10.9.1 with RGBA and AYUV support */
- fail_unless (gst_element_set_state (ctx->pipeline,
- GST_STATE_PAUSED) != GST_STATE_CHANGE_FAILURE);
- fail_unless (gst_element_get_state (ctx->pipeline, NULL, NULL,
- -1) == GST_STATE_CHANGE_SUCCESS);
-
- if (func != NULL) {
- func (ctx->last_buf);
- }
-
- gst_element_set_state (ctx->pipeline, GST_STATE_NULL);
-}
-
-static void
-check_1x1_buffer (GstBuffer * buf)
-{
- GstStructure *s;
-
- fail_unless (buf != NULL);
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
-
- s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
- if (gst_structure_has_name (s, "video/x-raw-yuv")) {
- guint32 format = 0;
-
- fail_unless (gst_structure_get_fourcc (s, "format", &format));
-
- /* the exact values we check for come from videotestsrc */
- switch (format) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[0], 76);
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[8], 85);
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[12], 255);
- break;
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[0], 76);
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[8], 255);
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[12], 85);
- break;
- case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[0], 76);
- /* no chroma planes */
- break;
- case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[1], 76);
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[2], 85);
- fail_unless_equals_int (GST_BUFFER_DATA (buf)[3], 255);
- /* no chroma planes */
- break;
- default:
- GST_LOG ("not checking %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (format));
- break;
- }
- } else if (gst_structure_has_name (s, "video/x-raw-rgb")) {
- guint32 pixel;
- gint rmask = 0, bmask = 0, gmask = 0, endianness = 0, bpp = 0;
- gint rshift, gshift, bshift;
-
- fail_unless (gst_structure_get_int (s, "red_mask", &rmask));
- fail_unless (gst_structure_get_int (s, "blue_mask", &bmask));
- fail_unless (gst_structure_get_int (s, "green_mask", &gmask));
- fail_unless (gst_structure_get_int (s, "bpp", &bpp));
- fail_unless (gst_structure_get_int (s, "endianness", &endianness));
-
- fail_unless (rmask != 0);
- fail_unless (gmask != 0);
- fail_unless (bmask != 0);
- fail_unless (bpp != 0);
- fail_unless (endianness != 0);
-
- rshift = g_bit_nth_lsf (rmask, -1);
- gshift = g_bit_nth_lsf (gmask, -1);
- bshift = g_bit_nth_lsf (bmask, -1);
-
- switch (bpp) {
- case 32:{
- if (endianness == G_LITTLE_ENDIAN)
- pixel = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf));
- else
- pixel = GST_READ_UINT32_BE (GST_BUFFER_DATA (buf));
- break;
- }
- case 24:{
- if (endianness == G_BIG_ENDIAN) {
- pixel = (GST_READ_UINT8 (GST_BUFFER_DATA (buf)) << 16) |
- (GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 1) << 8) |
- (GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 2) << 0);
- } else {
- pixel = (GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 2) << 16) |
- (GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 1) << 8) |
- (GST_READ_UINT8 (GST_BUFFER_DATA (buf) + 0) << 0);
- }
- break;
- }
- default:{
- GST_LOG ("not checking RGB-format buffer with %ubpp", bpp);
- return;
- }
- }
-
- fail_unless_equals_int ((pixel & rmask) >> rshift, 0xff);
- fail_unless_equals_int ((pixel & gmask) >> gshift, 0x00);
- fail_unless_equals_int ((pixel & bmask) >> bshift, 0x00);
- }
-}
-
-GST_START_TEST (test_crop_to_1x1)
-{
- GstVideoCropTestContext ctx;
- GList *caps_list, *node;
-
- videocrop_test_cropping_init_context (&ctx);
-
- caps_list = video_crop_get_test_caps (ctx.crop);
-
- for (node = caps_list; node != NULL; node = node->next) {
- GstStructure *s;
- GstCaps *caps;
-
- caps = gst_caps_copy (GST_CAPS (node->data));
- s = gst_caps_get_structure (caps, 0);
- fail_unless (s != NULL);
-
- GST_INFO ("testing format: %" GST_PTR_FORMAT, caps);
-
- gst_structure_set (s, "width", G_TYPE_INT, 160,
- "height", G_TYPE_INT, 160, NULL);
-
- videocrop_test_cropping (&ctx, caps, 159, 0, 159, 0, check_1x1_buffer);
- /* commented out because they don't really add anything useful check-wise:
- videocrop_test_cropping (&ctx, caps, 0, 159, 0, 159, check_1x1_buffer);
- videocrop_test_cropping (&ctx, caps, 159, 0, 0, 159, check_1x1_buffer);
- videocrop_test_cropping (&ctx, caps, 0, 159, 159, 0, check_1x1_buffer);
- */
- gst_caps_unref (caps);
- }
- g_list_foreach (caps_list, (GFunc) gst_caps_unref, NULL);
- g_list_free (caps_list);
-
- videocrop_test_cropping_deinit_context (&ctx);
-}
-
-GST_END_TEST;
-
-
-
-GST_START_TEST (test_cropping)
-{
- GstVideoCropTestContext ctx;
- struct
- {
- gint width, height;
- } sizes_to_try[] = {
- {
- 160, 160}, {
- 161, 160}, {
- 160, 161}, {
- 161, 161}, {
- 159, 160}, {
- 160, 159}, {
- 159, 159}, {
- 159, 161}
- };
- GList *caps_list, *node;
- gint i;
-
- videocrop_test_cropping_init_context (&ctx);
-
- caps_list = video_crop_get_test_caps (ctx.crop);
-
- for (node = caps_list; node != NULL; node = node->next) {
- GstStructure *s;
- GstCaps *caps;
-
- caps = gst_caps_copy (GST_CAPS (node->data));
- s = gst_caps_get_structure (caps, 0);
- fail_unless (s != NULL);
-
- GST_INFO ("testing format: %" GST_PTR_FORMAT, caps);
-
- for (i = 0; i < G_N_ELEMENTS (sizes_to_try); ++i) {
- gst_structure_set (s, "width", G_TYPE_INT, sizes_to_try[i].width,
- "height", G_TYPE_INT, sizes_to_try[i].height, NULL);
-
- GST_INFO (" - %d x %d", sizes_to_try[i].width, sizes_to_try[i].height);
-
- videocrop_test_cropping (&ctx, caps, 0, 0, 0, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 1, 0, 0, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 1, 0, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 0, 1, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 0, 0, 1, NULL);
- videocrop_test_cropping (&ctx, caps, 63, 0, 0, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 63, 0, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 0, 63, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 0, 0, 63, NULL);
- videocrop_test_cropping (&ctx, caps, 63, 0, 0, 1, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 63, 1, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 1, 63, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 1, 0, 0, 63, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 0, 0, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 32, 0, 0, 128, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 32, 128, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 0, 128, 32, 0, NULL);
- videocrop_test_cropping (&ctx, caps, 128, 0, 0, 32, NULL);
- videocrop_test_cropping (&ctx, caps, 1, 1, 1, 1, NULL);
- videocrop_test_cropping (&ctx, caps, 63, 63, 63, 63, NULL);
- videocrop_test_cropping (&ctx, caps, 64, 64, 64, 64, NULL);
- }
-
- gst_caps_unref (caps);
- }
- g_list_foreach (caps_list, (GFunc) gst_caps_unref, NULL);
- g_list_free (caps_list);
-
- videocrop_test_cropping_deinit_context (&ctx);
-}
-
-GST_END_TEST;
-
-
-static gboolean
-buffer_probe_cb (GstPad * pad, GstBuffer * buf, GstBuffer ** p_buf)
-{
- gst_buffer_replace (p_buf, buf);
- return TRUE; /* keep data */
-}
-
-GST_START_TEST (test_passthrough)
-{
- GstStateChangeReturn state_ret;
- GstVideoCropTestContext ctx;
- GstPad *srcpad;
- GstBuffer *gen_buf = NULL; /* buffer generated by videotestsrc */
-
- videocrop_test_cropping_init_context (&ctx);
-
- g_object_set (ctx.src, "num-buffers", 1, NULL);
-
- srcpad = gst_element_get_pad (ctx.src, "src");
- fail_unless (srcpad != NULL);
- gst_pad_add_buffer_probe (srcpad, G_CALLBACK (buffer_probe_cb), &gen_buf);
- gst_object_unref (srcpad);
-
- g_object_set (ctx.crop, "left", 0, "right", 0, "top", 0, "bottom", 0, NULL);
-
- state_ret = gst_element_set_state (ctx.pipeline, GST_STATE_PAUSED);
- fail_unless (state_ret != GST_STATE_CHANGE_FAILURE,
- "couldn't set pipeline to PAUSED state");
-
- state_ret = gst_element_get_state (ctx.pipeline, NULL, NULL, -1);
- fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS,
- "pipeline failed to go to PAUSED state");
-
- fail_unless (gen_buf != NULL);
- fail_unless (ctx.last_buf != NULL);
-
- /* pass through should do nothing */
- fail_unless (gen_buf == ctx.last_buf);
-
- videocrop_test_cropping_deinit_context (&ctx);
-
- fail_unless_equals_int (GST_MINI_OBJECT_REFCOUNT_VALUE (gen_buf), 1);
- gst_buffer_unref (gen_buf);
-}
-
-GST_END_TEST;
-
-static gint
-notgst_value_list_get_nth_int (const GValue * list_val, guint n)
-{
- const GValue *v;
-
- fail_unless (GST_VALUE_HOLDS_LIST (list_val));
- fail_unless (n < gst_value_list_get_size (list_val));
-
- v = gst_value_list_get_value (list_val, n);
- fail_unless (G_VALUE_HOLDS_INT (v));
- return g_value_get_int (v);
-}
-
-GST_START_TEST (test_caps_transform)
-{
- GstVideoCropTestContext ctx;
- GstBaseTransformClass *klass;
- GstBaseTransform *crop;
- const GValue *w_val;
- const GValue *h_val;
- GstCaps *caps, *adj_caps;
-
- videocrop_test_cropping_init_context (&ctx);
-
- crop = GST_BASE_TRANSFORM (ctx.crop);
- klass = GST_BASE_TRANSFORM_GET_CLASS (ctx.crop);
- fail_unless (klass != NULL);
-
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
- "framerate", GST_TYPE_FRACTION, 1, 1,
- "width", G_TYPE_INT, 200, "height", G_TYPE_INT, 100, NULL);
-
- /* by default, it should be no cropping and hence passthrough */
- adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_is_equal (adj_caps, caps));
- gst_caps_unref (adj_caps);
-
- adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_is_equal (adj_caps, caps));
- gst_caps_unref (adj_caps);
-
- /* make sure that's still true after changing properties back and forth */
- g_object_set (ctx.crop, "left", 1, "right", 3, "top", 5, "bottom", 7, NULL);
- g_object_set (ctx.crop, "left", 0, "right", 0, "top", 0, "bottom", 0, NULL);
-
- adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_is_equal (adj_caps, caps));
- gst_caps_unref (adj_caps);
-
- adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_is_equal (adj_caps, caps));
- gst_caps_unref (adj_caps);
-
- /* now check adjustments made ... */
- g_object_set (ctx.crop, "left", 1, "right", 3, "top", 5, "bottom", 7, NULL);
-
- /* ========= (1) fixed value ============================================= */
-
- /* sink => source, source must be bigger if we crop stuff off */
- adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_get_size (adj_caps) == 1);
- w_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "width");
- fail_unless (w_val != NULL);
- fail_unless (G_VALUE_HOLDS_INT (w_val));
- fail_unless_equals_int (g_value_get_int (w_val), 200 + (1 + 3));
- h_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "height");
- fail_unless (h_val != NULL);
- fail_unless (G_VALUE_HOLDS_INT (h_val));
- fail_unless_equals_int (g_value_get_int (h_val), 100 + (5 + 7));
- gst_caps_unref (adj_caps);
-
- /* source => sink becomes smaller */
- adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_get_size (adj_caps) == 1);
- w_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "width");
- fail_unless (w_val != NULL);
- fail_unless (G_VALUE_HOLDS_INT (w_val));
- fail_unless_equals_int (g_value_get_int (w_val), 200 - (1 + 3));
- h_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "height");
- fail_unless (h_val != NULL);
- fail_unless (G_VALUE_HOLDS_INT (h_val));
- fail_unless_equals_int (g_value_get_int (h_val), 100 - (5 + 7));
- gst_caps_unref (adj_caps);
-
- /* ========= (2) range (simple adjustment) =============================== */
-
- gst_structure_set (gst_caps_get_structure (caps, 0),
- "width", GST_TYPE_INT_RANGE, 1000, 2000,
- "height", GST_TYPE_INT_RANGE, 3000, 4000, NULL);
-
- /* sink => source, source must be bigger if we crop stuff off */
- adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_get_size (adj_caps) == 1);
- w_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "width");
- fail_unless (w_val != NULL);
- fail_unless (GST_VALUE_HOLDS_INT_RANGE (w_val));
- fail_unless_equals_int (gst_value_get_int_range_min (w_val), 1000 + (1 + 3));
- fail_unless_equals_int (gst_value_get_int_range_max (w_val), 2000 + (1 + 3));
- h_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "height");
- fail_unless (h_val != NULL);
- fail_unless (GST_VALUE_HOLDS_INT_RANGE (h_val));
- fail_unless_equals_int (gst_value_get_int_range_min (h_val), 3000 + (5 + 7));
- fail_unless_equals_int (gst_value_get_int_range_max (h_val), 4000 + (5 + 7));
- gst_caps_unref (adj_caps);
-
- /* source => sink becomes smaller */
- adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_get_size (adj_caps) == 1);
- w_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "width");
- fail_unless (w_val != NULL);
- fail_unless (GST_VALUE_HOLDS_INT_RANGE (w_val));
- fail_unless_equals_int (gst_value_get_int_range_min (w_val), 1000 - (1 + 3));
- fail_unless_equals_int (gst_value_get_int_range_max (w_val), 2000 - (1 + 3));
- h_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "height");
- fail_unless (h_val != NULL);
- fail_unless (GST_VALUE_HOLDS_INT_RANGE (h_val));
- fail_unless_equals_int (gst_value_get_int_range_min (h_val), 3000 - (5 + 7));
- fail_unless_equals_int (gst_value_get_int_range_max (h_val), 4000 - (5 + 7));
- gst_caps_unref (adj_caps);
-
- /* ========= (3) range (adjustment at boundary) ========================== */
-
- gst_structure_set (gst_caps_get_structure (caps, 0),
- "width", GST_TYPE_INT_RANGE, 2, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 2, G_MAXINT, NULL);
-
- /* sink => source, source must be bigger if we crop stuff off */
- adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_get_size (adj_caps) == 1);
- w_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "width");
- fail_unless (w_val != NULL);
- fail_unless (GST_VALUE_HOLDS_INT_RANGE (w_val));
- fail_unless_equals_int (gst_value_get_int_range_min (w_val), 2 + (1 + 3));
- fail_unless_equals_int (gst_value_get_int_range_max (w_val), G_MAXINT);
- h_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "height");
- fail_unless (h_val != NULL);
- fail_unless (GST_VALUE_HOLDS_INT_RANGE (h_val));
- fail_unless_equals_int (gst_value_get_int_range_min (h_val), 2 + (5 + 7));
- fail_unless_equals_int (gst_value_get_int_range_max (h_val), G_MAXINT);
- gst_caps_unref (adj_caps);
-
- /* source => sink becomes smaller */
- adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_get_size (adj_caps) == 1);
- w_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "width");
- fail_unless (w_val != NULL);
- fail_unless (GST_VALUE_HOLDS_INT_RANGE (w_val));
- fail_unless_equals_int (gst_value_get_int_range_min (w_val), 1);
- fail_unless_equals_int (gst_value_get_int_range_max (w_val),
- G_MAXINT - (1 + 3));
- h_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "height");
- fail_unless (h_val != NULL);
- fail_unless (GST_VALUE_HOLDS_INT_RANGE (h_val));
- fail_unless_equals_int (gst_value_get_int_range_min (h_val), 1);
- fail_unless_equals_int (gst_value_get_int_range_max (h_val),
- G_MAXINT - (5 + 7));
- gst_caps_unref (adj_caps);
-
- /* ========= (4) list of values ========================================== */
-
- {
- GValue list = { 0, };
- GValue ival = { 0, };
-
- g_value_init (&ival, G_TYPE_INT);
- g_value_init (&list, GST_TYPE_LIST);
- g_value_set_int (&ival, 2);
- gst_value_list_append_value (&list, &ival);
- g_value_set_int (&ival, G_MAXINT);
- gst_value_list_append_value (&list, &ival);
- gst_structure_set_value (gst_caps_get_structure (caps, 0), "width", &list);
- g_value_unset (&list);
- g_value_unset (&ival);
-
- g_value_init (&ival, G_TYPE_INT);
- g_value_init (&list, GST_TYPE_LIST);
- g_value_set_int (&ival, 5);
- gst_value_list_append_value (&list, &ival);
- g_value_set_int (&ival, 1000);
- gst_value_list_append_value (&list, &ival);
- gst_structure_set_value (gst_caps_get_structure (caps, 0), "height", &list);
- g_value_unset (&list);
- g_value_unset (&ival);
- }
-
- /* sink => source, source must be bigger if we crop stuff off */
- adj_caps = klass->transform_caps (crop, GST_PAD_SRC, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_get_size (adj_caps) == 1);
- w_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "width");
- fail_unless (w_val != NULL);
- fail_unless (GST_VALUE_HOLDS_LIST (w_val));
- fail_unless_equals_int (notgst_value_list_get_nth_int (w_val, 0),
- 2 + (1 + 3));
- fail_unless_equals_int (notgst_value_list_get_nth_int (w_val, 1), G_MAXINT);
- h_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "height");
- fail_unless (h_val != NULL);
- fail_unless (GST_VALUE_HOLDS_LIST (h_val));
- fail_unless_equals_int (notgst_value_list_get_nth_int (h_val, 0),
- 5 + (5 + 7));
- fail_unless_equals_int (notgst_value_list_get_nth_int (h_val, 1),
- 1000 + (5 + 7));
- gst_caps_unref (adj_caps);
-
- /* source => sink becomes smaller */
- adj_caps = klass->transform_caps (crop, GST_PAD_SINK, caps);
- fail_unless (adj_caps != NULL);
- fail_unless (gst_caps_get_size (adj_caps) == 1);
- w_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "width");
- fail_unless (w_val != NULL);
- fail_unless (GST_VALUE_HOLDS_LIST (w_val));
- fail_unless_equals_int (notgst_value_list_get_nth_int (w_val, 0), 1);
- fail_unless_equals_int (notgst_value_list_get_nth_int (w_val, 1),
- G_MAXINT - (1 + 3));
- h_val =
- gst_structure_get_value (gst_caps_get_structure (adj_caps, 0), "height");
- fail_unless (h_val != NULL);
- fail_unless (GST_VALUE_HOLDS_LIST (h_val));
- fail_unless_equals_int (notgst_value_list_get_nth_int (h_val, 0), 1);
- fail_unless_equals_int (notgst_value_list_get_nth_int (h_val, 1),
- 1000 - (5 + 7));
- gst_caps_unref (adj_caps);
-
- gst_caps_unref (caps);
- videocrop_test_cropping_deinit_context (&ctx);
-}
-
-GST_END_TEST;
-
-static Suite *
-videocrop_suite (void)
-{
- Suite *s = suite_create ("videocrop");
- TCase *tc_chain = tcase_create ("general");
-
-#ifdef HAVE_VALGRIND
- if (RUNNING_ON_VALGRIND) {
- /* our tests take quite a long time, so increase
- * timeout (~25 minutes on my 1.6GHz AMD K7) */
- tcase_set_timeout (tc_chain, 30 * 60);
- } else
-#endif
- {
- /* increase timeout, these tests take a long time (60 secs here) */
- tcase_set_timeout (tc_chain, 2 * 60);
- }
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_crop_to_1x1);
- tcase_add_test (tc_chain, test_caps_transform);
- tcase_add_test (tc_chain, test_passthrough);
- tcase_add_test (tc_chain, test_unit_sizes);
- tcase_add_test (tc_chain, test_cropping);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = videocrop_suite ();
- SRunner *sr = srunner_create (s);
-
-#ifdef HAVE_VALGRIND
- if (RUNNING_ON_VALGRIND) {
- /* otherwise valgrind errors out when liboil probes CPU extensions
- * in oil_init() during which it causes SIGILLs etc. to be fired */
- g_setenv ("OIL_CPU_FLAGS", "0", 0);
- }
-#endif
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/icles/Makefile.am b/tests/icles/Makefile.am
index b57880e4..da44e312 100644
--- a/tests/icles/Makefile.am
+++ b/tests/icles/Makefile.am
@@ -11,14 +11,9 @@ else
GST_SOUNDTOUCH_TESTS =
endif
-videocrop_test_SOURCES = videocrop-test.c
-videocrop_test_CFLAGS = $(GST_CFLAGS)
-videocrop_test_LDADD = $(GST_LIBS)
-videocrop_test_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-
equalizer_test_SOURCES = equalizer-test.c
equalizer_test_CFLAGS = $(GST_CFLAGS)
equalizer_test_LDADD = $(GST_LIBS)
equalizer_test_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-noinst_PROGRAMS = $(GST_SOUNDTOUCH_TESTS) equalizer-test videocrop-test
+noinst_PROGRAMS = $(GST_SOUNDTOUCH_TESTS) equalizer-test
diff --git a/tests/icles/videocrop-test.c b/tests/icles/videocrop-test.c
deleted file mode 100644
index 1c7ae4ba..00000000
--- a/tests/icles/videocrop-test.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/* GStreamer interactive test for the videocrop element
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <stdlib.h>
-#include <math.h>
-
-GST_DEBUG_CATEGORY_STATIC (videocrop_test_debug);
-#define GST_CAT_DEFAULT videocrop_test_debug
-
-#define OUT_WIDTH 640
-#define OUT_HEIGHT 480
-#define TIME_PER_TEST 10 /* seconds each format is tested */
-#define FRAMERATE 15 /* frames per second */
-
-#define DEFAULT_VIDEOSINK "xvimagesink"
-
-static gboolean
-check_bus_for_errors (GstBus * bus, GstClockTime max_wait_time)
-{
- GstMessage *msg;
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, max_wait_time);
-
- if (msg) {
- GError *err = NULL;
- gchar *debug = NULL;
-
- g_assert (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
- gst_message_parse_error (msg, &err, &debug);
- GST_ERROR ("ERROR: %s [%s]", err->message, debug);
- g_print ("\n===========> ERROR: %s\n%s\n\n", err->message, debug);
- g_error_free (err);
- g_free (debug);
- gst_message_unref (msg);
- }
-
- return (msg != NULL);
-}
-
-static void
-test_with_caps (GstElement * src, GstElement * videocrop, GstCaps * caps)
-{
- GstClockTime time_run;
- GstElement *pipeline;
- GTimer *timer;
- GstBus *bus;
- GstPad *pad;
- guint hcrop;
- guint vcrop;
-
- /* caps must be writable, we can't check that here though */
- g_assert (GST_CAPS_REFCOUNT_VALUE (caps) == 1);
-
- timer = g_timer_new ();
- vcrop = 0;
- hcrop = 0;
-
- pipeline = GST_ELEMENT (gst_element_get_parent (videocrop));
- g_assert (GST_IS_PIPELINE (pipeline));
-
- /* at this point the pipeline is in PLAYING state; we only want to capture
- * errors resulting from our on-the-fly changing of the filtercaps */
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
-
- /* pad to block */
- pad = gst_element_get_pad (src, "src");
-
- time_run = 0;
- do {
- GstClockTime wait_time, waited_for_block;
-
- if (check_bus_for_errors (bus, 0))
- break;
-
- wait_time = GST_SECOND / FRAMERATE;
-
- GST_LOG ("hcrop = %3d, vcrop = %3d", vcrop, hcrop);
-
- g_timer_reset (timer);
-
- /* need to block the streaming thread while changing these properties,
- * otherwise we might get random not-negotiated errors (when caps are
- * changed in between upstream calling pad_alloc_buffer() and pushing
- * the processed buffer?) */
- gst_pad_set_blocked (pad, TRUE);
- g_object_set (videocrop, "left", hcrop, "top", vcrop, NULL);
- gst_pad_set_blocked (pad, FALSE);
-
- waited_for_block = g_timer_elapsed (timer, NULL) * (double) GST_SECOND;
- /* GST_LOG ("waited: %" GST_TIME_FORMAT ", frame len: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (waited_for_block), GST_TIME_ARGS (wait_time)); */
- ++vcrop;
- ++hcrop;
-
- if (wait_time > waited_for_block) {
- g_usleep ((wait_time - waited_for_block) / GST_MSECOND);
- }
-
- time_run += wait_time;
- }
- while (time_run < (TIME_PER_TEST * GST_SECOND));
-
- g_timer_destroy (timer);
- gst_object_unref (bus);
- gst_object_unref (pad);
-}
-
-/* return a list of caps where we only need to set
- * width and height to get fixed caps */
-static GList *
-video_crop_get_test_caps (GstElement * videocrop)
-{
- const GstCaps *allowed_caps;
- GstPad *srcpad;
- GList *list = NULL;
- guint i;
-
- srcpad = gst_element_get_pad (videocrop, "src");
- g_assert (srcpad != NULL);
- allowed_caps = gst_pad_get_pad_template_caps (srcpad);
- g_assert (allowed_caps != NULL);
-
- for (i = 0; i < gst_caps_get_size (allowed_caps); ++i) {
- GstStructure *new_structure;
- GstCaps *single_caps;
-
- single_caps = gst_caps_new_empty ();
- new_structure =
- gst_structure_copy (gst_caps_get_structure (allowed_caps, i));
- gst_structure_set (new_structure, "framerate", GST_TYPE_FRACTION,
- FRAMERATE, 1, NULL);
- gst_structure_remove_field (new_structure, "width");
- gst_structure_remove_field (new_structure, "height");
- gst_caps_append_structure (single_caps, new_structure);
-
- /* should be fixed without width/height */
- g_assert (gst_caps_is_fixed (single_caps));
-
- list = g_list_prepend (list, single_caps);
- }
-
- gst_object_unref (srcpad);
-
- return list;
-}
-
-static gchar *opt_videosink_str; /* NULL */
-static gchar *opt_filtercaps_str; /* NULL */
-static gboolean opt_with_ffmpegcolorspace; /* FALSE */
-
-int
-main (int argc, char **argv)
-{
- static const GOptionEntry test_goptions[] = {
- {"videosink", '\0', 0, G_OPTION_ARG_STRING, &opt_videosink_str,
- "videosink to use (default: " DEFAULT_VIDEOSINK ")", NULL},
- {"caps", '\0', 0, G_OPTION_ARG_STRING, &opt_filtercaps_str,
- "filter caps to narrow down formats to test", NULL},
- {"with-ffmpegcolorspace", '\0', 0, G_OPTION_ARG_NONE,
- &opt_with_ffmpegcolorspace,
- "whether to add an ffmpegcolorspace element in front of the sink",
- NULL},
- {NULL, '\0', 0, 0, NULL, NULL, NULL}
- };
- GOptionContext *ctx;
- GError *opt_err = NULL;
-
- GstElement *pipeline, *src, *filter1, *crop, *scale, *filter2, *csp, *sink;
- GMainLoop *loop;
- GstCaps *filter_caps = NULL;
- GList *caps_list, *l;
-
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- /* command line option parsing */
- ctx = g_option_context_new ("");
- g_option_context_add_group (ctx, gst_init_get_option_group ());
- g_option_context_add_main_entries (ctx, test_goptions, NULL);
-
- if (!g_option_context_parse (ctx, &argc, &argv, &opt_err)) {
- g_error ("Error parsing command line options: %s", opt_err->message);
- return -1;
- }
-
- GST_DEBUG_CATEGORY_INIT (videocrop_test_debug, "videocroptest", 0, "vctest");
-
- loop = g_main_loop_new (NULL, FALSE);
-
- pipeline = gst_pipeline_new ("pipeline");
- src = gst_element_factory_make ("videotestsrc", "videotestsrc");
- g_assert (src != NULL);
- filter1 = gst_element_factory_make ("capsfilter", "capsfilter1");
- g_assert (filter1 != NULL);
- crop = gst_element_factory_make ("videocrop", "videocrop");
- g_assert (crop != NULL);
- scale = gst_element_factory_make ("videoscale", "videoscale");
- g_assert (scale != NULL);
- filter2 = gst_element_factory_make ("capsfilter", "capsfilter2");
- g_assert (filter2 != NULL);
-
- if (opt_with_ffmpegcolorspace) {
- g_print ("Adding ffmpegcolorspace\n");
- csp = gst_element_factory_make ("ffmpegcolorspace", "colorspace");
- } else {
- csp = gst_element_factory_make ("identity", "colorspace");
- }
- g_assert (csp != NULL);
-
- if (opt_filtercaps_str) {
- filter_caps = gst_caps_from_string (opt_filtercaps_str);
- if (filter_caps == NULL) {
- g_error ("Invalid filter caps string '%s'", opt_filtercaps_str);
- } else {
- g_print ("Using filter caps '%s'\n", opt_filtercaps_str);
- }
- }
-
- if (opt_videosink_str) {
- g_print ("Trying videosink '%s' ...", opt_videosink_str);
- sink = gst_element_factory_make (opt_videosink_str, "sink");
- g_print ("%s\n", (sink) ? "ok" : "element couldn't be created");
- } else {
- sink = NULL;
- }
-
- if (sink == NULL) {
- g_print ("Trying videosink '%s' ...", DEFAULT_VIDEOSINK);
- sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "sink");
- g_print ("%s\n", (sink) ? "ok" : "element couldn't be created");
- }
- if (sink == NULL) {
- g_print ("Trying videosink '%s' ...", "xvimagesink");
- sink = gst_element_factory_make ("xvimagesink", "sink");
- g_print ("%s\n", (sink) ? "ok" : "element couldn't be created");
- }
- if (sink == NULL) {
- g_print ("Trying videosink '%s' ...", "ximagesink");
- sink = gst_element_factory_make ("ximagesink", "sink");
- g_print ("%s\n", (sink) ? "ok" : "element couldn't be created");
- }
-
- g_assert (sink != NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), src, filter1, crop, scale, filter2,
- csp, sink, NULL);
-
- if (!gst_element_link (src, filter1))
- g_error ("Failed to link videotestsrc to capsfilter1");
-
- if (!gst_element_link (filter1, crop))
- g_error ("Failed to link capsfilter1 to videocrop");
-
- if (!gst_element_link (crop, scale))
- g_error ("Failed to link videocrop to videoscale");
-
- if (!gst_element_link (scale, filter2))
- g_error ("Failed to link videoscale to capsfilter2");
-
- if (!gst_element_link (filter2, csp))
- g_error ("Failed to link capsfilter2 to ffmpegcolorspace");
-
- if (!gst_element_link (csp, sink))
- g_error ("Failed to link ffmpegcolorspace to video sink");
-
- caps_list = video_crop_get_test_caps (crop);
- for (l = caps_list; l != NULL; l = l->next) {
- GstStateChangeReturn ret;
- GstCaps *caps, *out_caps;
- gboolean skip = FALSE;
- gchar *s;
-
- if (filter_caps) {
- GstCaps *icaps;
-
- icaps = gst_caps_intersect (filter_caps, GST_CAPS (l->data));
- skip = gst_caps_is_empty (icaps);
- gst_caps_unref (icaps);
- }
-
- /* this is the size of our window (stays fixed) */
- out_caps = gst_caps_copy (GST_CAPS (l->data));
- gst_structure_set (gst_caps_get_structure (out_caps, 0), "width",
- G_TYPE_INT, OUT_WIDTH, "height", G_TYPE_INT, OUT_HEIGHT, NULL);
-
- g_object_set (filter2, "caps", out_caps, NULL);
-
- /* filter1 gets these too to prevent videotestsrc from renegotiating */
- g_object_set (filter1, "caps", out_caps, NULL);
- gst_caps_unref (out_caps);
-
- caps = gst_caps_copy (GST_CAPS (l->data));
- GST_INFO ("testing format: %" GST_PTR_FORMAT, caps);
-
- s = gst_caps_to_string (caps);
-
- if (skip) {
- g_print ("Skipping format: %s\n", s);
- g_free (s);
- continue;
- }
-
- g_print ("Format: %s\n", s);
-
- caps = gst_caps_make_writable (caps);
-
- /* FIXME: check return values */
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret != GST_STATE_CHANGE_FAILURE) {
- ret = gst_element_get_state (pipeline, NULL, NULL, -1);
-
- if (ret != GST_STATE_CHANGE_FAILURE) {
- test_with_caps (src, crop, caps);
- } else {
- g_print ("Format: %s not supported (failed to go to PLAYING)\n", s);
- }
- } else {
- g_print ("Format: %s not supported\n", s);
- }
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- gst_caps_unref (caps);
- g_free (s);
- }
-
- g_list_foreach (caps_list, (GFunc) gst_caps_unref, NULL);
- g_list_free (caps_list);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}