From 56560329df95a5429d1ded7e3d9ece1e19f16013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 27 Oct 2007 16:04:48 +0000 Subject: 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. --- gst/interleave/interleave.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'gst') 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 -- cgit v1.2.1