From a70ce56cf805d4489c9c5e40f584fc23db6ea7b6 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 4 Nov 2011 12:43:17 +0100 Subject: [PATCH] ffmpeg: fix template to %u --- ext/ffmpeg/gstffmpegdemux.c | 11 +++++++---- ext/ffmpeg/gstffmpegmux.c | 14 +++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ext/ffmpeg/gstffmpegdemux.c b/ext/ffmpeg/gstffmpegdemux.c index d86ba76827..983596d729 100644 --- a/ext/ffmpeg/gstffmpegdemux.c +++ b/ext/ffmpeg/gstffmpegdemux.c @@ -213,9 +213,9 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass * klass) sinkcaps = gst_ffmpeg_formatid_to_caps (name); sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, sinkcaps); - videosrctempl = gst_pad_template_new ("video_%02d", + videosrctempl = gst_pad_template_new ("video_%u", GST_PAD_SRC, GST_PAD_SOMETIMES, GST_CAPS_ANY); - audiosrctempl = gst_pad_template_new ("audio_%02d", + audiosrctempl = gst_pad_template_new ("audio_%u", GST_PAD_SRC, GST_PAD_SOMETIMES, GST_CAPS_ANY); gst_element_class_add_pad_template (element_class, videosrctempl); @@ -921,9 +921,12 @@ gst_ffmpegdemux_create_padname (const gchar * templ, gint n) { GString *string; + /* FIXME, we just want to printf the number according to the template but + * then the format string is not a literal and we can't check arguments and + * this generates a compiler error */ string = g_string_new (templ); - g_string_truncate (string, string->len - 4); - g_string_append_printf (string, "%02d", n); + g_string_truncate (string, string->len - 2); + g_string_append_printf (string, "%u", n); return g_string_free (string, FALSE); } diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c index 36227f4f33..8b2d159cc1 100644 --- a/ext/ffmpeg/gstffmpegmux.c +++ b/ext/ffmpeg/gstffmpegmux.c @@ -56,7 +56,7 @@ struct _GstFFMpegMux AVFormatContext *context; gboolean opened; - gint videopads, audiopads; + guint videopads, audiopads; /*< private > */ /* event_function is the collectpads default eventfunction */ @@ -273,13 +273,13 @@ gst_ffmpegmux_base_init (gpointer g_class) gst_element_class_add_pad_template (element_class, srctempl); if (audiosinkcaps) { - audiosinktempl = gst_pad_template_new ("audio_%d", + audiosinktempl = gst_pad_template_new ("audio_%u", GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps); gst_element_class_add_pad_template (element_class, audiosinktempl); } if (videosinkcaps) { - videosinktempl = gst_pad_template_new ("video_%d", + videosinktempl = gst_pad_template_new ("video_%u", GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps); gst_element_class_add_pad_template (element_class, videosinktempl); } @@ -419,13 +419,13 @@ gst_ffmpegmux_request_new_pad (GstElement * element, g_return_val_if_fail (ffmpegmux->opened == FALSE, NULL); /* figure out a name that *we* like */ - if (templ == gst_element_class_get_pad_template (klass, "video_%d")) { - padname = g_strdup_printf ("video_%d", ffmpegmux->videopads++); + if (templ == gst_element_class_get_pad_template (klass, "video_%u")) { + padname = g_strdup_printf ("video_%u", ffmpegmux->videopads++); type = AVMEDIA_TYPE_VIDEO; bitrate = 64 * 1024; framesize = 1152; - } else if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) { - padname = g_strdup_printf ("audio_%d", ffmpegmux->audiopads++); + } else if (templ == gst_element_class_get_pad_template (klass, "audio_%u")) { + padname = g_strdup_printf ("audio_%u", ffmpegmux->audiopads++); type = AVMEDIA_TYPE_AUDIO; bitrate = 285 * 1024; } else {