From 1314853210d66959f8c09447ec9278fe645d104c Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 11 Jan 2010 12:07:29 -0300 Subject: [PATCH] matroskamux: Only accept raw aac makes matroskamux reject aac streams that are not in raw format (stream-format=none) Fixes #598350 --- gst/matroska/matroska-mux.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index e59faab475..fa456370c0 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -136,6 +136,7 @@ static GstStaticPadTemplate audiosink_templ = GST_STATIC_CAPS ("audio/mpeg, " "mpegversion = (int) 1, " "layer = (int) [ 1, 3 ], " + "stream-format = (string) { none }, " COMMON_AUDIO_CAPS "; " "audio/mpeg, " "mpegversion = (int) { 2, 4 }, " @@ -1426,6 +1427,7 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps) GstStructure *structure; const GValue *codec_data = NULL; const GstBuffer *buf = NULL; + const gchar *stream_format = NULL; mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad)); @@ -1504,20 +1506,30 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps) break; } case 2: - if (buf) { - context->codec_id = - g_strdup_printf (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG2 "%s", - aac_codec_data_to_codec_id (buf)); - } else { - GST_DEBUG_OBJECT (mux, "no AAC codec_data; not packetized"); - return FALSE; - } - break; case 4: + stream_format = gst_structure_get_string (structure, "stream-format"); + /* check this is raw aac */ + if (stream_format) { + if (strcmp (stream_format, "none") != 0) { + GST_WARNING_OBJECT (mux, "AAC stream-format must be 'none', not %s", + stream_format); + } + } else { + GST_WARNING_OBJECT (mux, "AAC stream-format not specified, " + "assuming 'none'"); + } + if (buf) { - context->codec_id = - g_strdup_printf (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4 "%s", - aac_codec_data_to_codec_id (buf)); + if (mpegversion == 2) + context->codec_id = + g_strdup_printf (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG2 "%s", + aac_codec_data_to_codec_id (buf)); + else if (mpegversion == 4) + context->codec_id = + g_strdup_printf (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4 "%s", + aac_codec_data_to_codec_id (buf)); + else + g_assert_not_reached (); } else { GST_DEBUG_OBJECT (mux, "no AAC codec_data; not packetized"); return FALSE;