From cbc0b053ee43d8bfbd3381450c80c833ce387a68 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 11 Jan 2010 10:34:32 -0300 Subject: [PATCH] qtmux: Only accept stream-format='none' aac Only accept raw aac streams (stream-format=none) to avoid generating invalid files. Fixes #604925 --- gst/quicktime/gstqtmux.c | 21 +++++++++++++++++++-- gst/quicktime/gstqtmuxmap.c | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gst/quicktime/gstqtmux.c b/gst/quicktime/gstqtmux.c index 1773092..ba0978e 100644 --- a/gst/quicktime/gstqtmux.c +++ b/gst/quicktime/gstqtmux.c @@ -1717,6 +1717,7 @@ gst_qt_mux_audio_sink_set_caps (GstPad * pad, GstCaps * caps) AudioSampleEntry entry = { 0, }; AtomInfo *ext_atom = NULL; gint constant_size = 0; + const gchar *stream_format; /* find stream data */ qtpad = (GstQTPad *) gst_pad_get_element_private (pad); @@ -1787,8 +1788,20 @@ gst_qt_mux_audio_sink_set_caps (GstPad * pad, GstCaps * caps) } break; case 4: - /* AAC */ - entry.fourcc = FOURCC_mp4a; + + /* check stream-format */ + stream_format = gst_structure_get_string (structure, "stream-format"); + if (stream_format) { + if (strcmp (stream_format, "none") != 0) { + GST_WARNING_OBJECT (qtmux, "Unsupported AAC stream-format %s, " + "please use 'none'", stream_format); + goto refuse_caps; + } + } else { + GST_WARNING_OBJECT (qtmux, "No stream-format present in caps, " + "assuming 'none'"); + } + if (!codec_data || GST_BUFFER_SIZE (codec_data) < 2) GST_WARNING_OBJECT (qtmux, "no (valid) codec_data for AAC audio"); else { @@ -1800,6 +1813,10 @@ gst_qt_mux_audio_sink_set_caps (GstPad * pad, GstCaps * caps) GST_WARNING_OBJECT (qtmux, "non-LC AAC may not run well on (Apple) QuickTime/iTunes"); } + + /* AAC */ + entry.fourcc = FOURCC_mp4a; + if (format == GST_QT_MUX_FORMAT_QT) ext_atom = build_mov_aac_extension (qtpad->trak, codec_data); else diff --git a/gst/quicktime/gstqtmuxmap.c b/gst/quicktime/gstqtmuxmap.c index 4c225a3..c402198 100644 --- a/gst/quicktime/gstqtmuxmap.c +++ b/gst/quicktime/gstqtmuxmap.c @@ -119,6 +119,7 @@ #define AAC_CAPS \ "audio/mpeg, " \ "mpegversion = (int) 4, " \ + "stream-format = (string) none, " \ COMMON_AUDIO_CAPS (8, MAX) #define AMR_CAPS \ -- 2.7.4