matroskamux: Only accept raw aac

makes matroskamux reject aac streams that are not
in raw format (stream-format=none)

Fixes #598350
This commit is contained in:
Thiago Santos 2010-01-11 12:07:29 -03:00
parent bacd350483
commit 1314853210

View file

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