mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 16:48:11 +00:00
ffmpeg: fix template to %u
This commit is contained in:
parent
e98c1e2a95
commit
a70ce56cf8
2 changed files with 14 additions and 11 deletions
|
@ -213,9 +213,9 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass * klass)
|
||||||
sinkcaps = gst_ffmpeg_formatid_to_caps (name);
|
sinkcaps = gst_ffmpeg_formatid_to_caps (name);
|
||||||
sinktempl = gst_pad_template_new ("sink",
|
sinktempl = gst_pad_template_new ("sink",
|
||||||
GST_PAD_SINK, GST_PAD_ALWAYS, sinkcaps);
|
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);
|
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_PAD_SRC, GST_PAD_SOMETIMES, GST_CAPS_ANY);
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class, videosrctempl);
|
gst_element_class_add_pad_template (element_class, videosrctempl);
|
||||||
|
@ -921,9 +921,12 @@ gst_ffmpegdemux_create_padname (const gchar * templ, gint n)
|
||||||
{
|
{
|
||||||
GString *string;
|
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);
|
string = g_string_new (templ);
|
||||||
g_string_truncate (string, string->len - 4);
|
g_string_truncate (string, string->len - 2);
|
||||||
g_string_append_printf (string, "%02d", n);
|
g_string_append_printf (string, "%u", n);
|
||||||
|
|
||||||
return g_string_free (string, FALSE);
|
return g_string_free (string, FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct _GstFFMpegMux
|
||||||
AVFormatContext *context;
|
AVFormatContext *context;
|
||||||
gboolean opened;
|
gboolean opened;
|
||||||
|
|
||||||
gint videopads, audiopads;
|
guint videopads, audiopads;
|
||||||
|
|
||||||
/*< private > */
|
/*< private > */
|
||||||
/* event_function is the collectpads default eventfunction */
|
/* 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);
|
gst_element_class_add_pad_template (element_class, srctempl);
|
||||||
|
|
||||||
if (audiosinkcaps) {
|
if (audiosinkcaps) {
|
||||||
audiosinktempl = gst_pad_template_new ("audio_%d",
|
audiosinktempl = gst_pad_template_new ("audio_%u",
|
||||||
GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps);
|
GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps);
|
||||||
gst_element_class_add_pad_template (element_class, audiosinktempl);
|
gst_element_class_add_pad_template (element_class, audiosinktempl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videosinkcaps) {
|
if (videosinkcaps) {
|
||||||
videosinktempl = gst_pad_template_new ("video_%d",
|
videosinktempl = gst_pad_template_new ("video_%u",
|
||||||
GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps);
|
GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps);
|
||||||
gst_element_class_add_pad_template (element_class, videosinktempl);
|
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);
|
g_return_val_if_fail (ffmpegmux->opened == FALSE, NULL);
|
||||||
|
|
||||||
/* figure out a name that *we* like */
|
/* figure out a name that *we* like */
|
||||||
if (templ == gst_element_class_get_pad_template (klass, "video_%d")) {
|
if (templ == gst_element_class_get_pad_template (klass, "video_%u")) {
|
||||||
padname = g_strdup_printf ("video_%d", ffmpegmux->videopads++);
|
padname = g_strdup_printf ("video_%u", ffmpegmux->videopads++);
|
||||||
type = AVMEDIA_TYPE_VIDEO;
|
type = AVMEDIA_TYPE_VIDEO;
|
||||||
bitrate = 64 * 1024;
|
bitrate = 64 * 1024;
|
||||||
framesize = 1152;
|
framesize = 1152;
|
||||||
} else if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) {
|
} else if (templ == gst_element_class_get_pad_template (klass, "audio_%u")) {
|
||||||
padname = g_strdup_printf ("audio_%d", ffmpegmux->audiopads++);
|
padname = g_strdup_printf ("audio_%u", ffmpegmux->audiopads++);
|
||||||
type = AVMEDIA_TYPE_AUDIO;
|
type = AVMEDIA_TYPE_AUDIO;
|
||||||
bitrate = 285 * 1024;
|
bitrate = 285 * 1024;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue