diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2007-10-27 16:04:48 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2007-10-27 16:04:48 +0000 |
commit | 56560329df95a5429d1ded7e3d9ece1e19f16013 (patch) | |
tree | adf548637197b4553875ffd4bcdc94dc68a273cc | |
parent | adbe2a1b69af3050578701a5717cfe146c06775e (diff) | |
download | gst-plugins-bad-56560329df95a5429d1ded7e3d9ece1e19f16013.tar.gz gst-plugins-bad-56560329df95a5429d1ded7e3d9ece1e19f16013.tar.bz2 gst-plugins-bad-56560329df95a5429d1ded7e3d9ece1e19f16013.zip |
gst/interleave/interleave.c: Let's not call every request pad we create "sink%d", that'll create problems if there's ...
Original commit message from CVS:
* gst/interleave/interleave.c: (gst_interleave_request_new_pad):
Let's not call every request pad we create "sink%d", that'll
create problems if there's to be more than one pad. Fixes #490682.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/interleave.c:
Add unit test for the above.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | gst/interleave/interleave.c | 27 | ||||
-rw-r--r-- | tests/check/Makefile.am | 1 | ||||
-rw-r--r-- | tests/check/elements/.gitignore | 1 | ||||
-rw-r--r-- | tests/check/elements/interleave.c | 79 |
5 files changed, 108 insertions, 13 deletions
@@ -1,3 +1,14 @@ +2007-10-27 Tim-Philipp Müller <tim at centricular dot net> + + * gst/interleave/interleave.c: (gst_interleave_request_new_pad): + Let's not call every request pad we create "sink%d", that'll + create problems if there's to be more than one pad. Fixes #490682. + + * tests/check/Makefile.am: + * tests/check/elements/.cvsignore: + * tests/check/elements/interleave.c: + Add unit test for the above. + 2007-10-27 Julien MOUTTE <julien@moutte.net> * gst/mpeg4videoparse/mpeg4videoparse.c: (gst_mpeg4vparse_align), @@ -86,7 +97,7 @@ Patch by: Richard Hult <richard imendio com> * gst/dvdspu/Makefile.am: - Fix LIBS - we need to link against libgstreamer. + Fix LIBS - we need to link against libgstreamer (fixes #487496). 2007-10-17 Tim-Philipp Müller <tim at centricular dot net> diff --git a/gst/interleave/interleave.c b/gst/interleave/interleave.c index d8f4fb97..0ca2ea6c 100644 --- a/gst/interleave/interleave.c +++ b/gst/interleave/interleave.c @@ -195,27 +195,30 @@ static GstPad * gst_interleave_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name) { - GstPad *new; GstInterleave *self = GST_INTERLEAVE (element); + GstPad *new_pad; + gchar *pad_name; - new = g_object_new (GST_TYPE_INTERLEAVE_PAD, - "name", GST_OBJECT_NAME (templ), "direction", templ->direction, - "template", templ, NULL); - GST_INTERLEAVE_PAD (new)->channel = self->channels++; + pad_name = g_strdup_printf ("sink%d", self->channels); + new_pad = g_object_new (GST_TYPE_INTERLEAVE_PAD, "name", pad_name, + "direction", templ->direction, "template", templ, NULL); + g_free (pad_name); + GST_INTERLEAVE_PAD (new_pad)->channel = self->channels; + ++self->channels; - gst_pad_set_setcaps_function (new, + gst_pad_set_setcaps_function (new_pad, GST_DEBUG_FUNCPTR (gst_interleave_sink_setcaps)); - - gst_pad_set_chain_function (new, GST_DEBUG_FUNCPTR (gst_interleave_chain)); - gst_pad_set_activatepush_function (new, + gst_pad_set_chain_function (new_pad, + GST_DEBUG_FUNCPTR (gst_interleave_chain)); + gst_pad_set_activatepush_function (new_pad, GST_DEBUG_FUNCPTR (gst_interleave_sink_activate_push)); self->pending_in++; - GST_PAD_UNSET_FLUSHING (new); - gst_element_add_pad (element, new); + GST_PAD_UNSET_FLUSHING (new_pad); + gst_element_add_pad (element, new_pad); - return new; + return new_pad; } static void diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 8da66784..8d450738 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -59,6 +59,7 @@ check_PROGRAMS = \ $(check_neon) \ $(check_timidity) \ elements/bpwsinc \ + elements/interleave \ elements/lpwsinc \ elements/multifile \ elements/rganalysis \ diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore index 22d67f50..e8d40894 100644 --- a/tests/check/elements/.gitignore +++ b/tests/check/elements/.gitignore @@ -2,6 +2,7 @@ deinterleave gdpdepay gdppay +interleave mpeg2enc rglimiter rgvolume diff --git a/tests/check/elements/interleave.c b/tests/check/elements/interleave.c new file mode 100644 index 00000000..6d9fdd0c --- /dev/null +++ b/tests/check/elements/interleave.c @@ -0,0 +1,79 @@ +/* GStreamer unit tests for the interleave element + * Copyright (C) 2007 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/check/gstcheck.h> + +GST_START_TEST (test_create_and_unref) +{ + GstElement *interleave; + + interleave = gst_element_factory_make ("interleave", NULL); + fail_unless (interleave != NULL); + + gst_element_set_state (interleave, GST_STATE_NULL); + gst_object_unref (interleave); +} + +GST_END_TEST; + +GST_START_TEST (test_request_pads) +{ + GstElement *interleave; + GstPad *pad1, *pad2; + + interleave = gst_element_factory_make ("interleave", NULL); + fail_unless (interleave != NULL); + + pad1 = gst_element_get_request_pad (interleave, "sink%d"); + fail_unless (pad1 != NULL); + fail_unless_equals_string (GST_OBJECT_NAME (pad1), "sink0"); + + pad2 = gst_element_get_request_pad (interleave, "sink%d"); + fail_unless (pad2 != NULL); + fail_unless_equals_string (GST_OBJECT_NAME (pad2), "sink1"); + + gst_element_release_request_pad (interleave, pad2); + gst_object_unref (pad2); + gst_element_release_request_pad (interleave, pad1); + gst_object_unref (pad1); + + gst_element_set_state (interleave, GST_STATE_NULL); + gst_object_unref (interleave); +} + +GST_END_TEST; + +static Suite * +interleave_suite (void) +{ + Suite *s = suite_create ("interleave"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_create_and_unref); + tcase_add_test (tc_chain, test_request_pads); + + return s; +} + +GST_CHECK_MAIN (interleave); |