Make all request pads take _%u in the template.
Fix up unit tests.
}
static GstStaticPadTemplate funnel_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink%d",
+GST_STATIC_PAD_TEMPLATE ("sink_%u",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS_ANY);
#define GST_INPUT_SELECTOR_BROADCAST(sel) (g_cond_broadcast (GST_INPUT_SELECTOR_GET_COND(sel)))
static GstStaticPadTemplate gst_input_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);
GST_INPUT_SELECTOR_LOCK (sel);
GST_LOG_OBJECT (sel, "Creating new pad %d", sel->padcount);
- 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);
guint32 posid;
};
-static GstSingleQueue *gst_single_queue_new (GstMultiQueue * mqueue, gint id);
+static GstSingleQueue *gst_single_queue_new (GstMultiQueue * mqueue, guint id);
static void gst_single_queue_free (GstSingleQueue * squeue);
static void wake_up_next_non_linked (GstMultiQueue * mq);
static void single_queue_overrun_cb (GstDataQueue * dq, GstSingleQueue * sq);
static void single_queue_underrun_cb (GstDataQueue * dq, GstSingleQueue * sq);
-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);
-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);
{
GstMultiQueue *mqueue = GST_MULTI_QUEUE (element);
GstSingleQueue *squeue;
- gint temp_id = -1;
+ guint temp_id = -1;
if (name) {
- sscanf (name + 4, "%d", &temp_id);
+ sscanf (name + 4, "_%u", &temp_id);
GST_LOG_OBJECT (element, "name : %s (id %d)", GST_STR_NULL (name), temp_id);
}
}
static GstSingleQueue *
-gst_single_queue_new (GstMultiQueue * mqueue, gint id)
+gst_single_queue_new (GstMultiQueue * mqueue, guint id)
{
GstSingleQueue *sq;
gchar *name;
GList *tmp;
- gint temp_id = (id == -1) ? 0 : id;
+ guint temp_id = (id == -1) ? 0 : id;
GST_MULTI_QUEUE_MUTEX_LOCK (mqueue);
sq->sink_tainted = TRUE;
sq->src_tainted = TRUE;
- name = g_strdup_printf ("sink%d", sq->id);
+ name = g_strdup_printf ("sink_%u", sq->id);
sq->sinkpad = gst_pad_new_from_static_template (&sinktemplate, name);
g_free (name);
gst_pad_set_iterate_internal_links_function (sq->sinkpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_iterate_internal_links));
- name = g_strdup_printf ("src%d", sq->id);
+ name = g_strdup_printf ("src_%u", sq->id);
sq->srcpad = gst_pad_new_from_static_template (&srctemplate, name);
g_free (name);
GST_STATIC_CAPS_ANY);
static GstStaticPadTemplate gst_output_selector_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src%d",
+GST_STATIC_PAD_TEMPLATE ("src_%u",
GST_PAD_SRC,
GST_PAD_REQUEST,
GST_STATIC_CAPS_ANY);
GST_DEBUG_OBJECT (osel, "requesting pad");
GST_OBJECT_LOCK (osel);
- padname = g_strdup_printf ("src%d", osel->nb_srcpads++);
+ padname = g_strdup_printf ("src_%u", osel->nb_srcpads++);
srcpad = gst_pad_new_from_template (templ, padname);
GST_OBJECT_UNLOCK (osel);
PROP_ALLOC_PAD,
};
-static GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
+static GstStaticPadTemplate tee_src_template =
+GST_STATIC_PAD_TEMPLATE ("src_%u",
GST_PAD_SRC,
GST_PAD_REQUEST,
GST_STATIC_CAPS_ANY);
GST_DEBUG_OBJECT (tee, "requesting pad");
GST_OBJECT_LOCK (tee);
- name = g_strdup_printf ("src%d", tee->pad_counter++);
+ name = g_strdup_printf ("src_%u", tee->pad_counter++);
srcpad = gst_pad_new_from_template (templ, name);
g_free (name);
GstPad *sinkpad;
GstPad *allocpad;
- gint pad_counter;
+ guint pad_counter;
gboolean has_chain;
gboolean has_sink_loop;
td->funnelsrc = gst_element_get_static_pad (td->funnel, "src");
fail_unless (td->funnelsrc != NULL);
- td->funnelsink11 = gst_element_get_request_pad (td->funnel, "sink11");
+ td->funnelsink11 = gst_element_get_request_pad (td->funnel, "sink_11");
fail_unless (td->funnelsink11 != NULL);
- fail_unless (!strcmp (GST_OBJECT_NAME (td->funnelsink11), "sink11"));
+ fail_unless (!strcmp (GST_OBJECT_NAME (td->funnelsink11), "sink_11"));
- td->funnelsink22 = gst_element_get_request_pad (td->funnel, "sink22");
+ td->funnelsink22 = gst_element_get_request_pad (td->funnel, "sink_22");
fail_unless (td->funnelsink22 != NULL);
- fail_unless (!strcmp (GST_OBJECT_NAME (td->funnelsink22), "sink22"));
+ fail_unless (!strcmp (GST_OBJECT_NAME (td->funnelsink22), "sink_22"));
fail_unless (gst_element_set_state (td->funnel, GST_STATE_PLAYING) ==
GST_STATE_CHANGE_SUCCESS);
GstPad *srcpad = NULL;
/* create multiqueue sink (and source) pad */
- sinkpad = gst_element_get_request_pad (mq, "sink%d");
+ sinkpad = gst_element_get_request_pad (mq, "sink_%u");
fail_unless (sinkpad != NULL,
"failed to create multiqueue request pad #%u", i);
/* only the sink pads are by request, the source pads are sometimes pads,
* so this should return NULL */
- srcpad = gst_element_get_request_pad (mq, "src%d");
+ srcpad = gst_element_get_request_pad (mq, "src_%u");
fail_unless (srcpad == NULL);
- g_snprintf (padname, sizeof (padname), "src%d", i);
+ g_snprintf (padname, sizeof (padname), "src_%u", i);
srcpad = gst_element_get_static_pad (mq, padname);
fail_unless (srcpad != NULL, "failed to get multiqueue src pad #%u", i);
fail_unless (GST_PAD_IS_SRC (srcpad),
mq = gst_element_factory_make ("multiqueue", NULL);
- sink1 = gst_element_get_request_pad (mq, "foo%d");
+ sink1 = gst_element_get_request_pad (mq, "foo_%u");
fail_unless (sink1 == NULL,
- "Expected NULL pad, as there is no request pad template for 'foo%%d'");
+ "Expected NULL pad, as there is no request pad template for 'foo_%%u'");
- sink1 = gst_element_get_request_pad (mq, "src%d");
+ sink1 = gst_element_get_request_pad (mq, "src_%u");
fail_unless (sink1 == NULL,
- "Expected NULL pad, as there is no request pad template for 'src%%d'");
+ "Expected NULL pad, as there is no request pad template for 'src_%%u'");
- sink1 = gst_element_get_request_pad (mq, "sink%d");
+ sink1 = gst_element_get_request_pad (mq, "sink_%u");
fail_unless (sink1 != NULL);
fail_unless (GST_IS_PAD (sink1));
fail_unless (GST_PAD_IS_SINK (sink1));
GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink1));
- sink2 = gst_element_get_request_pad (mq, "sink%d");
+ sink2 = gst_element_get_request_pad (mq, "sink_%u");
fail_unless (sink2 != NULL);
fail_unless (GST_IS_PAD (sink2));
fail_unless (GST_PAD_IS_SINK (sink2));
mq_sinkpad_name = gst_pad_get_name (sink);
fail_unless (g_str_has_prefix (mq_sinkpad_name, "sink"));
- mq_srcpad_name = g_strdup_printf ("src%s", mq_sinkpad_name + 4);
+ mq_srcpad_name = g_strdup_printf ("src_%s", mq_sinkpad_name + 5);
srcpad = gst_element_get_static_pad (mq, mq_srcpad_name);
fail_unless (srcpad != NULL);
mq = gst_element_factory_make ("multiqueue", NULL);
- sink1 = gst_element_get_request_pad (mq, "sink1");
+ sink1 = gst_element_get_request_pad (mq, "sink_1");
fail_unless (sink1 != NULL);
fail_unless (GST_IS_PAD (sink1));
fail_unless (GST_PAD_IS_SINK (sink1));
- fail_unless_equals_string (GST_PAD_NAME (sink1), "sink1");
+ fail_unless_equals_string (GST_PAD_NAME (sink1), "sink_1");
GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink1));
- sink3 = gst_element_get_request_pad (mq, "sink3");
+ sink3 = gst_element_get_request_pad (mq, "sink_3");
fail_unless (sink3 != NULL);
fail_unless (GST_IS_PAD (sink3));
fail_unless (GST_PAD_IS_SINK (sink3));
- fail_unless_equals_string (GST_PAD_NAME (sink3), "sink3");
+ fail_unless_equals_string (GST_PAD_NAME (sink3), "sink_3");
GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink3));
- sink2 = gst_element_get_request_pad (mq, "sink2");
+ sink2 = gst_element_get_request_pad (mq, "sink_2");
fail_unless (sink2 != NULL);
fail_unless (GST_IS_PAD (sink2));
fail_unless (GST_PAD_IS_SINK (sink2));
- fail_unless_equals_string (GST_PAD_NAME (sink2), "sink2");
+ fail_unless_equals_string (GST_PAD_NAME (sink2), "sink_2");
GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink2));
/* This gets us the first unused id, sink0 */
- sink4 = gst_element_get_request_pad (mq, "sink%d");
+ sink4 = gst_element_get_request_pad (mq, "sink_%u");
fail_unless (sink4 != NULL);
fail_unless (GST_IS_PAD (sink4));
fail_unless (GST_PAD_IS_SINK (sink4));
- fail_unless_equals_string (GST_PAD_NAME (sink4), "sink0");
+ fail_unless_equals_string (GST_PAD_NAME (sink4), "sink_0");
GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink4));
GST_LOG ("Cleaning up");
g_free (name);
gst_pad_set_getcaps_function (inputpads[i], mq_dummypad_getcaps);
- mq_sinkpad = gst_element_get_request_pad (mq, "sink%d");
+ mq_sinkpad = gst_element_get_request_pad (mq, "sink_%u");
fail_unless (mq_sinkpad != NULL);
gst_pad_link (inputpads[i], mq_sinkpad);
g_free (name);
gst_pad_set_getcaps_function (inputpads[i], mq_dummypad_getcaps);
- mq_sinkpad = gst_element_get_request_pad (mq, "sink%d");
+ mq_sinkpad = gst_element_get_request_pad (mq, "sink_%u");
fail_unless (mq_sinkpad != NULL);
gst_pad_link (inputpads[i], mq_sinkpad);
GINT_TO_POINTER (probe_id));
/* request src pad */
- srcpad = gst_element_get_request_pad (element, "src%d");
+ srcpad = gst_element_get_request_pad (element, "src_%u");
fail_if (srcpad == NULL, "Could not get source pad from %s",
GST_ELEMENT_NAME (element));
fail_if (input_pad == NULL, "Could not create a input_pad");
/* request sink pad */
- sinkpad = gst_element_get_request_pad (element, "sink%d");
+ sinkpad = gst_element_get_request_pad (element, "sink_%u");
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
GST_ELEMENT_NAME (element));
g_object_set (sinks[i], "signal-handoffs", TRUE, NULL);
g_signal_connect (sinks[i], "handoff", (GCallback) handoff, &counts[i]);
- req_pads[i] = gst_element_get_request_pad (tee, "src%d");
+ req_pads[i] = gst_element_get_request_pad (tee, "src_%u");
fail_unless (req_pads[i] != NULL);
qpad = gst_element_get_static_pad (queues[i], "sink");
for (i = 0; i < 50000; i++) {
GstPad *pad;
- pad = gst_element_get_request_pad (tee, "src%d");
+ pad = gst_element_get_request_pad (tee, "src_%u");
gst_element_release_request_pad (tee, pad);
gst_object_unref (pad);
h->tee_sinkpad = gst_element_get_static_pad (h->tee, "sink");
fail_if (h->tee_sinkpad == NULL);
- h->tee_srcpad = gst_element_get_request_pad (h->tee, "src%d");
+ h->tee_srcpad = gst_element_get_request_pad (h->tee, "src_%u");
fail_if (h->tee_srcpad == NULL);
h->final_sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
fail_unless (res == GST_ITERATOR_DONE);
fail_unless (g_value_get_object (&val1) == NULL);
- srcpad1 = gst_element_get_request_pad (tee, "src%d");
+ srcpad1 = gst_element_get_request_pad (tee, "src_%u");
fail_unless (srcpad1 != NULL);
/* iterator should resync */
fail_unless (res == GST_ITERATOR_DONE);
fail_unless (g_value_get_object (&val1) == NULL);
- srcpad2 = gst_element_get_request_pad (tee, "src%d");
+ srcpad2 = gst_element_get_request_pad (tee, "src_%u");
fail_unless (srcpad2 != NULL);
/* iterator should resync */
fail_unless (tee != NULL);
teesink = gst_element_get_static_pad (tee, "sink");
fail_unless (teesink != NULL);
- teesrc1 = gst_element_get_request_pad (tee, "src%d");
+ teesrc1 = gst_element_get_request_pad (tee, "src_%u");
fail_unless (teesrc1 != NULL);
- teesrc2 = gst_element_get_request_pad (tee, "src%d");
+ teesrc2 = gst_element_get_request_pad (tee, "src_%u");
fail_unless (teesrc2 != NULL);
GST_DEBUG ("Creating mysink1");
tee = gst_element_factory_make ("tee", "tee");
sink1 = gst_element_factory_make ("fakesink", "sink1");
- tee_src1 = gst_element_get_request_pad (tee, "src%d");
+ tee_src1 = gst_element_get_request_pad (tee, "src_%u");
sink1_sink = gst_element_get_static_pad (sink1, "sink");
fail_unless_equals_int (gst_pad_link (tee_src1, sink1_sink), GST_PAD_LINK_OK);
sink2 = gst_element_factory_make ("fakesink", "sink2");
- tee_src2 = gst_element_get_request_pad (tee, "src%d");
+ tee_src2 = gst_element_get_request_pad (tee, "src_%u");
sink2_sink = gst_element_get_static_pad (sink2, "sink");
fail_unless_equals_int (gst_pad_link (tee_src2, sink2_sink), GST_PAD_LINK_OK);
#define PIPELINE4 "fakesrc num-buffers=4 .src ! identity silent=true !.sink identity silent=true .src ! .sink fakesink silent=true"
#define PIPELINE5 "fakesrc num-buffers=4 name=src identity silent=true name=id1 identity silent=true name = id2 fakesink silent=true name =sink src. ! id1. id1.! id2.sink id2.src!sink.sink"
#define PIPELINE6 "pipeline.(name=\"john\" fakesrc num-buffers=4 ( bin. ( ! queue ! identity silent=true !( queue ! fakesink silent=true )) ))"
-#define PIPELINE7 "fakesrc num-buffers=4 ! tee name=tee .src%d! queue ! fakesink silent=true tee.src%d ! queue ! fakesink silent=true queue name =\"foo\" ! fakesink silent=true tee.src%d ! foo."
+#define PIPELINE7 "fakesrc num-buffers=4 ! tee name=tee .src_%u! queue ! fakesink silent=true tee.src_%u ! queue ! fakesink silent=true queue name =\"foo\" ! fakesink silent=true tee.src_%u ! foo."
/* aggregator is borked
* #define PIPELINE8 "fakesrc num-buffers=4 ! tee name=tee1 .src0,src1 ! .sink0, sink1 aggregator ! fakesink silent=true"
* */