From cf8481b9904b437b42e982df9ff1fa955da45765 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 4 Nov 2011 10:48:50 +0100 Subject: [PATCH] fix pad template names for request pads --- ext/ogg/gstoggmux.c | 6 +++--- gst/adder/gstadder.c | 4 ++-- gst/encoding/gstencodebin.c | 16 ++++++++-------- gst/encoding/gststreamcombiner.c | 2 +- gst/encoding/gststreamsplitter.c | 2 +- gst/playback/gstdecodebin.c | 6 +++--- gst/playback/gstdecodebin2.c | 6 +++--- gst/playback/gstplaysink.c | 10 +++++----- gst/playback/gststreamselector.c | 4 ++-- gst/playback/gststreamsynchronizer.c | 8 ++++---- tests/check/elements/adder.c | 4 ++-- tests/check/pipelines/oggmux.c | 4 ++-- tests/examples/dynamic/sprinkle.c | 2 +- tests/examples/dynamic/sprinkle2.c | 2 +- tests/examples/dynamic/sprinkle3.c | 2 +- 15 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index dde10fb..2d6c461 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -101,7 +101,7 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS ("application/ogg") ); -static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d", +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("video/x-theora; " @@ -383,7 +383,7 @@ gst_ogg_mux_request_new_pad (GstElement * element, klass = GST_ELEMENT_GET_CLASS (element); - if (templ != gst_element_class_get_pad_template (klass, "sink_%d")) + if (templ != gst_element_class_get_pad_template (klass, "sink_%u")) goto wrong_template; { @@ -407,7 +407,7 @@ gst_ogg_mux_request_new_pad (GstElement * element, } /* create new pad with the name */ GST_DEBUG_OBJECT (ogg_mux, "Creating new pad for serial %d", serial); - name = g_strdup_printf ("sink_%d", serial); + name = g_strdup_printf ("sink_%u", serial); newpad = gst_pad_new_from_template (templ, name); g_free (name); diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index b51d9e3..c1b02ea 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -89,7 +89,7 @@ GST_STATIC_PAD_TEMPLATE ("src", ); static GstStaticPadTemplate gst_adder_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink%d", +GST_STATIC_PAD_TEMPLATE ("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS (CAPS) @@ -945,7 +945,7 @@ gst_adder_request_new_pad (GstElement * element, GstPadTemplate * templ, padcount = g_atomic_int_exchange_and_add (&adder->padcount, 1); #endif - name = g_strdup_printf ("sink%d", padcount); + name = g_strdup_printf ("sink_%u", padcount); newpad = gst_pad_new_from_template (templ, name); GST_DEBUG_OBJECT (adder, "request new pad %s", name); g_free (name); diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c index bc0ca09..b4d2c66 100644 --- a/gst/encoding/gstencodebin.c +++ b/gst/encoding/gstencodebin.c @@ -133,22 +133,22 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); static GstStaticPadTemplate video_sink_template = -GST_STATIC_PAD_TEMPLATE ("video_%d", +GST_STATIC_PAD_TEMPLATE ("video_%u", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS_ANY); static GstStaticPadTemplate audio_sink_template = -GST_STATIC_PAD_TEMPLATE ("audio_%d", +GST_STATIC_PAD_TEMPLATE ("audio_%u", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS_ANY); /* static GstStaticPadTemplate text_sink_template = */ -/* GST_STATIC_PAD_TEMPLATE ("text_%d", */ +/* GST_STATIC_PAD_TEMPLATE ("text_%u", */ /* GST_PAD_SINK, */ /* GST_PAD_REQUEST, */ /* GST_STATIC_CAPS_ANY); */ static GstStaticPadTemplate private_sink_template = -GST_STATIC_PAD_TEMPLATE ("private_%d", +GST_STATIC_PAD_TEMPLATE ("private_%u", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS_ANY); @@ -706,11 +706,11 @@ gst_encode_bin_request_new_pad (GstElement * element, if (res == NULL) { GType ptype = G_TYPE_NONE; - if (!strcmp (templ->name_template, "video_%d")) + if (!strcmp (templ->name_template, "video_%u")) ptype = GST_TYPE_ENCODING_VIDEO_PROFILE; - else if (!strcmp (templ->name_template, "audio_%d")) + else if (!strcmp (templ->name_template, "audio_%u")) ptype = GST_TYPE_ENCODING_AUDIO_PROFILE; - /* else if (!strcmp (templ->name_template, "text_%d")) */ + /* else if (!strcmp (templ->name_template, "text_%u")) */ /* ptype = GST_TYPE_ENCODING_TEXT_PROFILE; */ /* FIXME : Check uniqueness of pad */ @@ -1133,7 +1133,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof, sinkpad = gst_element_get_static_pad (sgroup->inqueue, "sink"); if (sinkpadname == NULL) { gchar *pname = - g_strdup_printf ("%s_%d", gst_encoding_profile_get_type_nick (sprof), + g_strdup_printf ("%s_%u", gst_encoding_profile_get_type_nick (sprof), ebin->last_pad_id++); GST_DEBUG ("Adding ghost pad %s", pname); sgroup->ghostpad = gst_ghost_pad_new (pname, sinkpad); diff --git a/gst/encoding/gststreamcombiner.c b/gst/encoding/gststreamcombiner.c index cc74ac5..93c2ca1 100644 --- a/gst/encoding/gststreamcombiner.c +++ b/gst/encoding/gststreamcombiner.c @@ -28,7 +28,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink_%d", +static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS_ANY); diff --git a/gst/encoding/gststreamsplitter.c b/gst/encoding/gststreamsplitter.c index f1323e2..93d7ac7 100644 --- a/gst/encoding/gststreamsplitter.c +++ b/gst/encoding/gststreamsplitter.c @@ -25,7 +25,7 @@ #include "gststreamsplitter.h" static GstStaticPadTemplate src_template = -GST_STATIC_PAD_TEMPLATE ("src_%d", GST_PAD_SRC, GST_PAD_REQUEST, +GST_STATIC_PAD_TEMPLATE ("src_%u", GST_PAD_SRC, GST_PAD_REQUEST, GST_STATIC_CAPS_ANY); static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index a3fe801..5104a4a 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -56,7 +56,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS_ANY); static GstStaticPadTemplate decoder_bin_src_template = -GST_STATIC_PAD_TEMPLATE ("src%d", +GST_STATIC_PAD_TEMPLATE ("src_%u", GST_PAD_SRC, GST_PAD_SOMETIMES, GST_STATIC_CAPS_ANY); @@ -92,7 +92,7 @@ struct _GstDecodeBin GList *probes; /* list of PadProbeData */ GList *factories; /* factories we can use for selecting elements */ - gint numpads; + guint numpads; gint numwaiting; gboolean have_type; @@ -917,7 +917,7 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps, } /* make a unique name for this new pad */ - padname = g_strdup_printf ("src%d", decode_bin->numpads); + padname = g_strdup_printf ("src_%u", decode_bin->numpads); decode_bin->numpads++; /* make it a ghostpad */ diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 761e63a..9e733c2 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -104,7 +104,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS_ANY); static GstStaticPadTemplate decoder_bin_src_template = -GST_STATIC_PAD_TEMPLATE ("src%d", +GST_STATIC_PAD_TEMPLATE ("src_%u", GST_PAD_SRC, GST_PAD_SOMETIMES, GST_STATIC_CAPS_ANY); @@ -152,7 +152,7 @@ struct _GstDecodeBin GMutex *expose_lock; /* Protects exposal and removal of groups */ GstDecodeChain *decode_chain; /* Top level decode chain */ - gint nbpads; /* unique identifier for source pads */ + guint nbpads; /* unique identifier for source pads */ GMutex *factories_lock; guint32 factories_cookie; /* Cookie from last time when factories was updated */ @@ -3578,7 +3578,7 @@ gst_decode_bin_expose (GstDecodeBin * dbin) gchar *padname; /* 1. rewrite name */ - padname = g_strdup_printf ("src%d", dbin->nbpads); + padname = g_strdup_printf ("src_%u", dbin->nbpads); dbin->nbpads++; GST_DEBUG_OBJECT (dbin, "About to expose dpad %s as %s", GST_OBJECT_NAME (dpad), padname); diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c index 5a3db67..c921687 100644 --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@ -198,7 +198,7 @@ struct _GstPlaySink gchar *font_desc; /* font description */ gchar *subtitle_encoding; /* subtitle encoding */ guint connection_speed; /* connection speed in bits/sec (0 = unknown) */ - gint count; + guint count; gboolean volume_changed; /* volume/mute changed while no audiochain */ gboolean mute_changed; /* ... has been created yet */ gint64 av_offset; @@ -2258,7 +2258,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink) playsink->video_sinkpad_stream_synchronizer = gst_element_get_request_pad (GST_ELEMENT_CAST - (playsink->stream_synchronizer), "sink_%d"); + (playsink->stream_synchronizer), "sink_%u"); it = gst_pad_iterate_internal_links (playsink->video_sinkpad_stream_synchronizer); g_assert (it); @@ -2420,7 +2420,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink) playsink->audio_sinkpad_stream_synchronizer = gst_element_get_request_pad (GST_ELEMENT_CAST - (playsink->stream_synchronizer), "sink_%d"); + (playsink->stream_synchronizer), "sink_%u"); it = gst_pad_iterate_internal_links (playsink->audio_sinkpad_stream_synchronizer); g_assert (it); @@ -2542,7 +2542,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink) playsink->text_sinkpad_stream_synchronizer = gst_element_get_request_pad (GST_ELEMENT_CAST - (playsink->stream_synchronizer), "sink_%d"); + (playsink->stream_synchronizer), "sink_%u"); it = gst_pad_iterate_internal_links (playsink->text_sinkpad_stream_synchronizer); g_assert (it); @@ -3181,7 +3181,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type) gchar *padname; /* we need a unique padname for the flushing pad. */ - padname = g_strdup_printf ("flushing_%d", playsink->count); + padname = g_strdup_printf ("flushing_%u", playsink->count); res = gst_ghost_pad_new_no_target (padname, GST_PAD_SINK); g_free (padname); playsink->count++; diff --git a/gst/playback/gststreamselector.c b/gst/playback/gststreamselector.c index 24f0031..4b309c4 100644 --- a/gst/playback/gststreamselector.c +++ b/gst/playback/gststreamselector.c @@ -32,7 +32,7 @@ GST_DEBUG_CATEGORY_STATIC (stream_selector_debug); #define GST_CAT_DEFAULT stream_selector_debug static GstStaticPadTemplate gst_stream_selector_sink_factory = -GST_STATIC_PAD_TEMPLATE ("sink%d", +GST_STATIC_PAD_TEMPLATE ("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS_ANY); @@ -647,7 +647,7 @@ gst_stream_selector_request_new_pad (GstElement * element, g_return_val_if_fail (templ->direction == GST_PAD_SINK, NULL); GST_LOG_OBJECT (sel, "Creating new pad %d", sel->padcount); GST_OBJECT_LOCK (sel); - name = g_strdup_printf ("sink%d", sel->padcount++); + name = g_strdup_printf ("sink_%u", sel->padcount++); sinkpad = g_object_new (GST_TYPE_SELECTOR_PAD, "name", name, "direction", templ->direction, "template", templ, NULL); g_free (name); diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c index 017a944..668318f 100644 --- a/gst/playback/gststreamsynchronizer.c +++ b/gst/playback/gststreamsynchronizer.c @@ -43,11 +43,11 @@ GST_DEBUG_CATEGORY_STATIC (stream_synchronizer_debug); g_mutex_unlock (GST_STREAM_SYNCHRONIZER_CAST(obj)->lock); \ } G_STMT_END -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%d", +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u", GST_PAD_SRC, GST_PAD_SOMETIMES, GST_STATIC_CAPS_ANY); -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink_%d", +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink_%u", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS_ANY); @@ -677,7 +677,7 @@ gst_stream_synchronizer_request_new_pad (GstElement * element, stream->transform = self; stream->stream_number = self->current_stream_number; - tmp = g_strdup_printf ("sink_%d", self->current_stream_number); + tmp = g_strdup_printf ("sink_%u", self->current_stream_number); stream->sinkpad = gst_pad_new_from_static_template (&sinktemplate, tmp); g_free (tmp); gst_pad_set_element_private (stream->sinkpad, stream); @@ -694,7 +694,7 @@ gst_stream_synchronizer_request_new_pad (GstElement * element, gst_pad_set_chain_function (stream->sinkpad, GST_DEBUG_FUNCPTR (gst_stream_synchronizer_sink_chain)); - tmp = g_strdup_printf ("src_%d", self->current_stream_number); + tmp = g_strdup_printf ("src_%u", self->current_stream_number); stream->srcpad = gst_pad_new_from_static_template (&srctemplate, tmp); g_free (tmp); gst_pad_set_element_private (stream->srcpad, stream); diff --git a/tests/check/elements/adder.c b/tests/check/elements/adder.c index 6daa6c7c..70863a1 100644 --- a/tests/check/elements/adder.c +++ b/tests/check/elements/adder.c @@ -675,7 +675,7 @@ GST_START_TEST (test_remove_pad) fail_unless (res == TRUE, NULL); /* create an unconnected sinkpad in adder */ - pad = gst_element_get_request_pad (adder, "sink%d"); + pad = gst_element_get_request_pad (adder, "sink_%u"); fail_if (pad == NULL, NULL); srcpad = gst_element_get_static_pad (adder, "src"); @@ -777,7 +777,7 @@ GST_START_TEST (test_clip) /* create an unconnected sinkpad in adder, should also automatically activate * the pad */ - sinkpad = gst_element_get_request_pad (adder, "sink%d"); + sinkpad = gst_element_get_request_pad (adder, "sink_%u"); fail_if (sinkpad == NULL, NULL); /* send segment to adder */ diff --git a/tests/check/pipelines/oggmux.c b/tests/check/pipelines/oggmux.c index d777cf9..5dc9071 100644 --- a/tests/check/pipelines/oggmux.c +++ b/tests/check/pipelines/oggmux.c @@ -392,10 +392,10 @@ GST_START_TEST (test_request_pad_cleanup) GstPad *pad; oggmux = gst_element_factory_make ("oggmux", NULL); - pad = gst_element_get_request_pad (oggmux, "sink_%d"); + pad = gst_element_get_request_pad (oggmux, "sink_%u"); fail_unless (pad != NULL); gst_object_unref (pad); - pad = gst_element_get_request_pad (oggmux, "sink_%d"); + pad = gst_element_get_request_pad (oggmux, "sink_%u"); fail_unless (pad != NULL); gst_object_unref (pad); gst_object_unref (oggmux); diff --git a/tests/examples/dynamic/sprinkle.c b/tests/examples/dynamic/sprinkle.c index 1b75840..722fe91 100644 --- a/tests/examples/dynamic/sprinkle.c +++ b/tests/examples/dynamic/sprinkle.c @@ -64,7 +64,7 @@ add_source (gdouble freq) info->srcpad = gst_element_get_static_pad (info->element, "src"); /* get new pad from adder, adder will now wait for data on this pad */ - info->sinkpad = gst_element_get_request_pad (adder, "sink%d"); + info->sinkpad = gst_element_get_request_pad (adder, "sink_%u"); /* link pad to adder */ gst_pad_link (info->srcpad, info->sinkpad); diff --git a/tests/examples/dynamic/sprinkle2.c b/tests/examples/dynamic/sprinkle2.c index abab47c..15ea812 100644 --- a/tests/examples/dynamic/sprinkle2.c +++ b/tests/examples/dynamic/sprinkle2.c @@ -74,7 +74,7 @@ add_source (gdouble freq, gfloat pos) info->fx_sinkpad = gst_element_get_static_pad (info->fx, "sink"); /* get new pad from adder, adder will now wait for data on this pad */ - info->adder_sinkpad = gst_element_get_request_pad (adder, "sink%d"); + info->adder_sinkpad = gst_element_get_request_pad (adder, "sink_%u"); /* link src to fx and fx to adder */ gst_pad_link (info->fx_srcpad, info->adder_sinkpad); diff --git a/tests/examples/dynamic/sprinkle3.c b/tests/examples/dynamic/sprinkle3.c index 5983c33..4b9d80b 100644 --- a/tests/examples/dynamic/sprinkle3.c +++ b/tests/examples/dynamic/sprinkle3.c @@ -80,7 +80,7 @@ add_source (gdouble freq, gfloat pos) gst_element_add_pad (info->bin, info->bin_srcpad); /* get new pad from adder, adder will now wait for data on this pad */ - info->adder_sinkpad = gst_element_get_request_pad (adder, "sink%d"); + info->adder_sinkpad = gst_element_get_request_pad (adder, "sink_%u"); /* link inside the bin */ gst_pad_link (info->src_srcpad, info->fx_sinkpad); -- 2.7.4