From ee063478ffc98b1e2c122f0bfb8088da4fa51e70 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 11 May 2010 13:08:41 +0100 Subject: [PATCH] Remove capssetter element It has been moved to gst-plugins-good. See #617739. --- Makefile.am | 5 +- docs/plugins/Makefile.am | 1 - docs/plugins/gst-plugins-bad-plugins-docs.sgml | 1 - docs/plugins/gst-plugins-bad-plugins-sections.txt | 14 - docs/plugins/inspect/plugin-debugutilsbad.xml | 23 +- gst/debugutils/Makefile.am | 4 +- gst/debugutils/debugutilsbad.c | 5 +- gst/debugutils/gstcapssetter.c | 337 ---------------------- gst/debugutils/gstcapssetter.h | 63 ---- tests/check/Makefile.am | 1 - tests/check/elements/.gitignore | 1 - tests/check/elements/capssetter.c | 228 --------------- 12 files changed, 7 insertions(+), 676 deletions(-) delete mode 100644 gst/debugutils/gstcapssetter.c delete mode 100644 gst/debugutils/gstcapssetter.h delete mode 100644 tests/check/elements/capssetter.c diff --git a/Makefile.am b/Makefile.am index 454e773..3821d0c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,8 +44,9 @@ CRUFT_FILES = \ $(top_builddir)/gst/aacparse/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/amrparse/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/flacparse/.libs/*.{so,dll,DLL,dylib} \ - $(top_builddir)/gst/shapewipe/.libs/*.{so,dll,DLL,dylib} - $(top_builddir)/ext/ivorbis/.libs/*.{so,dll,DLL,dylib} + $(top_builddir)/gst/shapewipe/.libs/*.{so,dll,DLL,dylib} \ + $(top_builddir)/ext/ivorbis/.libs/*.{so,dll,DLL,dylib} \ + $(top_builddir)/tests/check/elements/capssetter CRUFT_DIRS = \ $(top_srcdir)/gst/aacparse \ diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am index d7fa122..b8460fe 100644 --- a/docs/plugins/Makefile.am +++ b/docs/plugins/Makefile.am @@ -136,7 +136,6 @@ EXTRA_HFILES = \ $(top_srcdir)/gst/dccp/gstdccpserversink.h \ $(top_srcdir)/gst/dccp/gstdccpserversrc.h \ $(top_srcdir)/gst/debugutils/fpsdisplaysink.h \ - $(top_srcdir)/gst/debugutils/gstcapssetter.h \ $(top_srcdir)/gst/dtmf/gstdtmfsrc.h \ $(top_srcdir)/gst/dtmf/gstdtmfdetect.h \ $(top_srcdir)/gst/dtmf/gstrtpdtmfsrc.h \ diff --git a/docs/plugins/gst-plugins-bad-plugins-docs.sgml b/docs/plugins/gst-plugins-bad-plugins-docs.sgml index 19285a3..167877f9 100644 --- a/docs/plugins/gst-plugins-bad-plugins-docs.sgml +++ b/docs/plugins/gst-plugins-bad-plugins-docs.sgml @@ -26,7 +26,6 @@ - diff --git a/docs/plugins/gst-plugins-bad-plugins-sections.txt b/docs/plugins/gst-plugins-bad-plugins-sections.txt index 09ca822..62264ff 100644 --- a/docs/plugins/gst-plugins-bad-plugins-sections.txt +++ b/docs/plugins/gst-plugins-bad-plugins-sections.txt @@ -141,20 +141,6 @@ gst_camerabin_get_type
-element-capssetter -capssetter -GstCapsSetter - -GstCapsSetterClass -GST_TYPE_CAPS_SETTER -GST_CAPS_SETTER -GST_IS_CAPS_SETTER -GST_CAPS_SETTER_CLASS -GST_IS_CAPS_SETTER_CLASS -gst_caps_setter_get_type -
- -
element-celtdec celtdec GstCeltDec diff --git a/docs/plugins/inspect/plugin-debugutilsbad.xml b/docs/plugins/inspect/plugin-debugutilsbad.xml index 454c066..a0ffc98 100644 --- a/docs/plugins/inspect/plugin-debugutilsbad.xml +++ b/docs/plugins/inspect/plugin-debugutilsbad.xml @@ -10,27 +10,6 @@ Unknown package origin - capssetter - CapsSetter - Generic - Set/merge caps on stream - Mark Nauwelaerts <mnauw@users.sourceforge.net> - - - src - source - always -
ANY
-
- - sink - sink - always -
ANY
-
-
-
- fpsdisplaysink Measure and show framerate on videosink Sink/Video @@ -46,4 +25,4 @@
- \ No newline at end of file + diff --git a/gst/debugutils/Makefile.am b/gst/debugutils/Makefile.am index 60fb794a..3b93fa9 100644 --- a/gst/debugutils/Makefile.am +++ b/gst/debugutils/Makefile.am @@ -1,10 +1,10 @@ plugin_LTLIBRARIES = libgstdebugutilsbad.la -libgstdebugutilsbad_la_SOURCES = fpsdisplaysink.c gstcapssetter.c debugutilsbad.c +libgstdebugutilsbad_la_SOURCES = fpsdisplaysink.c debugutilsbad.c libgstdebugutilsbad_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) libgstdebugutilsbad_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstinterfaces-$(GST_MAJORMINOR) libgstdebugutilsbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstdebugutilsbad_la_LIBTOOLFLAGS = --tag=disable-static -noinst_HEADERS = fpsdisplaysink.h gstcapssetter.h +noinst_HEADERS = fpsdisplaysink.h diff --git a/gst/debugutils/debugutilsbad.c b/gst/debugutils/debugutilsbad.c index d1b1026..b1fb6e0 100644 --- a/gst/debugutils/debugutilsbad.c +++ b/gst/debugutils/debugutilsbad.c @@ -24,15 +24,12 @@ #include GType fps_display_sink_get_type (void); -GType gst_caps_setter_get_type (void); static gboolean plugin_init (GstPlugin * plugin) { return gst_element_register (plugin, "fpsdisplaysink", GST_RANK_NONE, - fps_display_sink_get_type ()) && - gst_element_register (plugin, "capssetter", GST_RANK_NONE, - gst_caps_setter_get_type ()); + fps_display_sink_get_type ()); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/debugutils/gstcapssetter.c b/gst/debugutils/gstcapssetter.c deleted file mode 100644 index d01408e..0000000 --- a/gst/debugutils/gstcapssetter.c +++ /dev/null @@ -1,337 +0,0 @@ -/* GStreamer Element - * Copyright (C) 2006-2009 Mark Nauwelaerts - * - * 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1307, USA. - */ - -/** - * SECTION:element-capssetter - * - * - * - * Sets or merges caps on a stream's buffers. - * That is, a buffer's caps are updated using (fields of) - * caps. Note that this may - * contain multiple structures (though not likely recommended), but each - * of these must be fixed (or will otherwise be rejected). - * - * - * If join - * is TRUE, then the incoming caps' mime-type is compared to the mime-type(s) - * of provided caps and only matching structure(s) are considered for updating. - * - * - * If replace - * is TRUE, then any caps update is preceded by clearing existing fields, - * making provided fields (as a whole) replace incoming ones. - * Otherwise, no clearing is performed, in which case provided fields are - * added/merged onto incoming caps - * - * - * Although this element might mainly serve as debug helper, - * it can also practically be used to correct a faulty pixel-aspect-ratio, - * or to modify a yuv fourcc value to effectively swap chroma components or such - * alike. - * - * - * - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstcapssetter.h" - -#include - - -GST_DEBUG_CATEGORY_STATIC (caps_setter_debug); -#define GST_CAT_DEFAULT caps_setter_debug - - -/* signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - PROP_0, - PROP_CAPS, - PROP_JOIN, - PROP_REPLACE - /* FILL ME */ -}; - -#define DEFAULT_JOIN TRUE -#define DEFAULT_REPLACE FALSE - -static GstStaticPadTemplate gst_caps_setter_src_template = -GST_STATIC_PAD_TEMPLATE (GST_BASE_TRANSFORM_SRC_NAME, - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstStaticPadTemplate gst_caps_setter_sink_template = -GST_STATIC_PAD_TEMPLATE (GST_BASE_TRANSFORM_SINK_NAME, - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - - -static gboolean gst_caps_setter_transform_size (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, guint size, - GstCaps * othercaps, guint * othersize); -static GstCaps *gst_caps_setter_transform_caps (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps); -static GstFlowReturn gst_caps_setter_transform_ip (GstBaseTransform * btrans, - GstBuffer * in); - -static void gst_caps_setter_finalize (GObject * object); - -static void gst_caps_setter_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_caps_setter_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -GST_BOILERPLATE (GstCapsSetter, gst_caps_setter, GstBaseTransform, - GST_TYPE_BASE_TRANSFORM); - -static void -gst_caps_setter_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (element_class, "CapsSetter", - "Generic", - "Set/merge caps on stream", - "Mark Nauwelaerts "); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_caps_setter_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_caps_setter_src_template)); -} - -static void -gst_caps_setter_class_init (GstCapsSetterClass * g_class) -{ - GObjectClass *gobject_class = (GObjectClass *) g_class; - GstBaseTransformClass *trans_class = (GstBaseTransformClass *) g_class; - - GST_DEBUG_CATEGORY_INIT (caps_setter_debug, "capssetter", 0, "capssetter"); - - gobject_class->set_property = gst_caps_setter_set_property; - gobject_class->get_property = gst_caps_setter_get_property; - - gobject_class->finalize = gst_caps_setter_finalize; - - g_object_class_install_property (gobject_class, PROP_CAPS, - g_param_spec_boxed ("caps", "Merge caps", - "Merge these caps (thereby overwriting) in the stream", - GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_JOIN, - g_param_spec_boolean ("join", "Join", - "Match incoming caps' mime-type to mime-type of provided caps", - DEFAULT_JOIN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_REPLACE, - g_param_spec_boolean ("replace", "Replace", - "Drop fields of incoming caps", DEFAULT_REPLACE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - trans_class->transform_size = - GST_DEBUG_FUNCPTR (gst_caps_setter_transform_size); - trans_class->transform_caps = - GST_DEBUG_FUNCPTR (gst_caps_setter_transform_caps); - /* dummy seems needed */ - trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_caps_setter_transform_ip); -} - -static void -gst_caps_setter_init (GstCapsSetter * filter, GstCapsSetterClass * g_class) -{ - filter->caps = gst_caps_new_any (); - filter->join = DEFAULT_JOIN; - filter->replace = DEFAULT_REPLACE; -} - -static void -gst_caps_setter_finalize (GObject * object) -{ - GstCapsSetter *filter = GST_CAPS_SETTER (object); - - gst_caps_replace (&filter->caps, NULL); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static gboolean -gst_caps_setter_transform_size (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, guint size, - GstCaps * othercaps, guint * othersize) -{ - *othersize = size; - - return TRUE; -} - -static GstCaps * -gst_caps_setter_transform_caps (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps) -{ - GstCapsSetter *filter = GST_CAPS_SETTER (trans); - GstCaps *ret, *filter_caps; - GstStructure *structure, *merge; - const gchar *name; - gint i, j; - - GST_DEBUG_OBJECT (trans, "receiving caps: %" GST_PTR_FORMAT, caps); - - ret = gst_caps_copy (caps); - - /* this function is always called with a simple caps */ - if (!GST_CAPS_IS_SIMPLE (ret) || direction != GST_PAD_SINK) - return ret; - - structure = gst_caps_get_structure (ret, 0); - name = gst_structure_get_name (structure); - - GST_OBJECT_LOCK (filter); - filter_caps = gst_caps_ref (filter->caps); - GST_OBJECT_UNLOCK (filter); - - for (i = 0; i < gst_caps_get_size (filter_caps); ++i) { - merge = gst_caps_get_structure (filter_caps, i); - if (gst_structure_has_name (merge, name) || !filter->join) { - - if (!filter->join) - gst_structure_set_name (structure, gst_structure_get_name (merge)); - - if (filter->replace) - gst_structure_remove_all_fields (structure); - - for (j = 0; j < gst_structure_n_fields (merge); ++j) { - const gchar *fname; - - fname = gst_structure_nth_field_name (merge, j); - gst_structure_set_value (structure, fname, - gst_structure_get_value (merge, fname)); - } - } - } - - GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret); - - gst_caps_unref (filter_caps); - - return ret; -} - -static GstFlowReturn -gst_caps_setter_transform_ip (GstBaseTransform * btrans, GstBuffer * in) -{ - return GST_FLOW_OK; -} - -static gboolean -gst_caps_is_fixed_foreach (GQuark field_id, const GValue * value, - gpointer unused) -{ - return gst_value_is_fixed (value); -} - -static void -gst_caps_setter_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstCapsSetter *filter = GST_CAPS_SETTER (object); - - switch (prop_id) { - case PROP_CAPS:{ - GstCaps *new_caps; - const GstCaps *new_caps_val = gst_value_get_caps (value); - gint i; - - if (new_caps_val == NULL) { - new_caps = gst_caps_new_any (); - } else { - new_caps = gst_caps_copy (new_caps_val); - } - - for (i = 0; new_caps && (i < gst_caps_get_size (new_caps)); ++i) { - GstStructure *s; - - s = gst_caps_get_structure (new_caps, i); - if (!gst_structure_foreach (s, gst_caps_is_fixed_foreach, NULL)) { - GST_ERROR_OBJECT (filter, "rejected unfixed caps: %" GST_PTR_FORMAT, - new_caps); - gst_caps_unref (new_caps); - new_caps = NULL; - break; - } - } - - if (new_caps) { - GST_OBJECT_LOCK (filter); - gst_caps_replace (&filter->caps, new_caps); - /* drop extra ref */ - gst_caps_unref (new_caps); - GST_OBJECT_UNLOCK (filter); - - GST_DEBUG_OBJECT (filter, "set new caps %" GST_PTR_FORMAT, new_caps); - } - - /* try to activate these new caps next time around */ - gst_base_transform_reconfigure (GST_BASE_TRANSFORM (filter)); - break; - } - case PROP_JOIN: - filter->join = g_value_get_boolean (value); - break; - case PROP_REPLACE: - filter->replace = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_caps_setter_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstCapsSetter *filter = GST_CAPS_SETTER (object); - - switch (prop_id) { - case PROP_CAPS: - gst_value_set_caps (value, filter->caps); - break; - case PROP_JOIN: - g_value_set_boolean (value, filter->join); - break; - case PROP_REPLACE: - g_value_set_boolean (value, filter->replace); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} diff --git a/gst/debugutils/gstcapssetter.h b/gst/debugutils/gstcapssetter.h deleted file mode 100644 index 246bf19..0000000 --- a/gst/debugutils/gstcapssetter.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GStreamer Element - * Copyright (C) 2006-2009 Mark Nauwelaerts - * - * 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1307, USA. - */ - - -#ifndef __GST_CAPS_SETTER_H__ -#define __GST_CAPS_SETTER_H__ - -#include - -G_BEGIN_DECLS - -#define GST_TYPE_CAPS_SETTER \ - (gst_caps_setter_get_type()) -#define GST_CAPS_SETTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAPS_SETTER,GstCapsSetter)) -#define GST_CAPS_SETTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAPS_SETTER,GstCapsSetterClass)) -#define GST_IS_CAPS_SETTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAPS_SETTER)) -#define GST_IS_CAPS_SETTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAPS_SETTER)) - -GType gst_caps_setter_get_type (void); - -typedef struct _GstCapsSetter GstCapsSetter; -typedef struct _GstCapsSetterClass GstCapsSetterClass; - -struct _GstCapsSetter -{ - GstBaseTransform parent; - - /* < private > */ - /* properties */ - GstCaps *caps; - gboolean join; - gboolean replace; -}; - - -struct _GstCapsSetterClass -{ - GstBaseTransformClass parent_class; -}; - -G_END_DECLS - -#endif /* __GST_CAPS_SETTER_H__ */ diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 4404754..2f7e1e2 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -125,7 +125,6 @@ check_PROGRAMS = \ elements/autoconvert \ elements/asfmux \ elements/camerabin \ - elements/capssetter \ elements/dataurisrc \ elements/imagefreeze \ elements/legacyresample \ diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore index 88dc606..a140c98 100644 --- a/tests/check/elements/.gitignore +++ b/tests/check/elements/.gitignore @@ -5,7 +5,6 @@ asfmux assrender autoconvert camerabin -capssetter deinterleave dataurisrc faac diff --git a/tests/check/elements/capssetter.c b/tests/check/elements/capssetter.c deleted file mode 100644 index 0a6986b..0000000 --- a/tests/check/elements/capssetter.c +++ /dev/null @@ -1,228 +0,0 @@ -/* GStreamer - * - * unit test for capssetter - * - * Copyright (C) <2009> Mark Nauwelaerts - * - * 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. - */ - -#include - -#include - - -/* For ease of programming we use globals to keep refs for our floating - * src and sink pads we create; otherwise we always have to do get_pad, - * get_peer, and then remove references in every test function */ -static GstPad *mysrcpad, *mysinkpad; - - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstElement * -setup_capssetter (void) -{ - GstElement *capssetter; - - GST_DEBUG ("setup_capssetter"); - - capssetter = gst_check_setup_element ("capssetter"); - mysrcpad = gst_check_setup_src_pad (capssetter, &srctemplate, NULL); - mysinkpad = gst_check_setup_sink_pad (capssetter, &sinktemplate, NULL); - gst_pad_set_active (mysrcpad, TRUE); - gst_pad_set_active (mysinkpad, TRUE); - - return capssetter; -} - -static void -cleanup_capssetter (GstElement * capssetter) -{ - GST_DEBUG ("cleanup_capssetter"); - - gst_pad_set_active (mysrcpad, FALSE); - gst_pad_set_active (mysinkpad, FALSE); - gst_check_teardown_src_pad (capssetter); - gst_check_teardown_sink_pad (capssetter); - gst_check_teardown_element (capssetter); -} - -static void -push_and_test (GstCaps * prop_caps, gboolean join, gboolean replace, - GstCaps * in_caps, GstCaps * out_caps) -{ - GstElement *capssetter; - GstBuffer *buffer; - - capssetter = setup_capssetter (); - fail_unless (gst_element_set_state (capssetter, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - buffer = gst_buffer_new_and_alloc (4); - ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); - memcpy (GST_BUFFER_DATA (buffer), "data", 4); - - gst_buffer_set_caps (buffer, in_caps); - gst_caps_unref (in_caps); - - g_object_set (capssetter, "join", join, NULL); - g_object_set (capssetter, "replace", replace, NULL); - g_object_set (capssetter, "caps", prop_caps, NULL); - gst_caps_unref (prop_caps); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK, - "Failed pushing buffer to capssetter"); - - fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE); - - /* ... but it should end up being collected on the global buffer list */ - fail_unless (g_list_length (buffers) == 1); - buffer = g_list_first (buffers)->data; - ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); - - fail_unless (gst_caps_is_equal (out_caps, GST_BUFFER_CAPS (buffer))); - gst_caps_unref (out_caps); - - /* cleanup */ - cleanup_capssetter (capssetter); -} - -#define SRC_WIDTH 8 -#define SRC_HEIGHT 12 - -static GstCaps * -make_src_caps (void) -{ - return gst_caps_new_simple ("video/x-raw-yuv", "width", G_TYPE_INT, SRC_WIDTH, - "height", G_TYPE_INT, SRC_HEIGHT, NULL); -} - -/* don't try these caps mutations at home, folks */ - -GST_START_TEST (test_n_join_n_replace) -{ - GstCaps *in_caps, *prop_caps, *out_caps; - - in_caps = make_src_caps (); - prop_caps = gst_caps_new_simple ("video/x-raw-rgb", - "width", G_TYPE_INT, 2 * SRC_WIDTH, NULL); - out_caps = gst_caps_new_simple ("video/x-raw-rgb", - "width", G_TYPE_INT, 2 * SRC_WIDTH, - "height", G_TYPE_INT, SRC_HEIGHT, NULL); - push_and_test (prop_caps, FALSE, FALSE, in_caps, out_caps); -} - -GST_END_TEST; - -GST_START_TEST (test_n_join_replace) -{ - GstCaps *in_caps, *prop_caps, *out_caps; - - in_caps = make_src_caps (); - prop_caps = gst_caps_new_simple ("video/x-raw-rgb", - "width", G_TYPE_INT, 2 * SRC_WIDTH, NULL); - out_caps = gst_caps_copy (prop_caps); - push_and_test (prop_caps, FALSE, TRUE, in_caps, out_caps); -} - -GST_END_TEST; - -GST_START_TEST (test_join_n_replace_n_match) -{ - GstCaps *in_caps, *prop_caps, *out_caps; - - /* non joining caps */ - in_caps = make_src_caps (); - prop_caps = gst_caps_new_simple ("video/x-raw-rgb", - "width", G_TYPE_INT, 2 * SRC_WIDTH, NULL); - out_caps = gst_caps_copy (in_caps); - push_and_test (prop_caps, TRUE, FALSE, in_caps, out_caps); -} - -GST_END_TEST; - -GST_START_TEST (test_join_n_replace_match) -{ - GstCaps *in_caps, *prop_caps, *out_caps; - - /* joining caps */ - in_caps = make_src_caps (); - prop_caps = gst_caps_new_simple ("video/x-raw-yuv", - "width", G_TYPE_INT, 2 * SRC_WIDTH, NULL); - out_caps = gst_caps_new_simple ("video/x-raw-yuv", - "width", G_TYPE_INT, 2 * SRC_WIDTH, - "height", G_TYPE_INT, SRC_HEIGHT, NULL); - push_and_test (prop_caps, TRUE, FALSE, in_caps, out_caps); -} - -GST_END_TEST; - -GST_START_TEST (test_join_replace_n_match) -{ - GstCaps *in_caps, *prop_caps, *out_caps; - - /* non joining caps */ - in_caps = make_src_caps (); - prop_caps = gst_caps_new_simple ("video/x-raw-rgb", - "width", G_TYPE_INT, 2 * SRC_WIDTH, NULL); - out_caps = gst_caps_copy (in_caps); - push_and_test (prop_caps, TRUE, TRUE, in_caps, out_caps); -} - -GST_END_TEST; - -GST_START_TEST (test_join_replace_match) -{ - GstCaps *in_caps, *prop_caps, *out_caps; - - /* joining caps */ - in_caps = make_src_caps (); - prop_caps = gst_caps_new_simple ("video/x-raw-yuv", - "width", G_TYPE_INT, 2 * SRC_WIDTH, NULL); - out_caps = gst_caps_copy (prop_caps); - push_and_test (prop_caps, TRUE, TRUE, in_caps, out_caps); -} - -GST_END_TEST; - -static Suite * -capssetter_suite (void) -{ - Suite *s = suite_create ("capssetter"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_n_join_n_replace); - tcase_add_test (tc_chain, test_n_join_replace); - tcase_add_test (tc_chain, test_join_n_replace_n_match); - tcase_add_test (tc_chain, test_join_n_replace_match); - tcase_add_test (tc_chain, test_join_replace_n_match); - tcase_add_test (tc_chain, test_join_replace_match); - - return s; -} - -GST_CHECK_MAIN (capssetter); -- 2.7.4