ffmpeg: fix template to %u

This commit is contained in:
Wim Taymans 2011-11-04 12:43:17 +01:00
parent e98c1e2a95
commit a70ce56cf8
2 changed files with 14 additions and 11 deletions

View file

@ -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);
}

View file

@ -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 {