From 44deb9f68de2ba3fef0d39eeab0531cc842e1624 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 10 Dec 2011 14:58:57 +0100 Subject: [PATCH] mfxdec: Separate mxf_essence_container_uls for audio and video. It is a really bad idea to assign a video codec id when we have set codec_type to audio and vice versa. Prevents detection of mp2 in mxf as mpeg2video. Signed-off-by: Janne Grunau --- libavformat/mxfdec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index c45e225d8f..9de89abe2c 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -949,10 +949,13 @@ static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMe return NULL; } -static const MXFCodecUL mxf_essence_container_uls[] = { +static const MXFCodecUL mxf_picture_essence_container_uls[] = { // video essence container uls { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, /* MPEG-ES Frame wrapped */ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, 14, CODEC_ID_DVVIDEO }, /* DV 625 25mbps */ + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, CODEC_ID_NONE }, +}; +static const MXFCodecUL mxf_sound_essence_container_uls[] = { // sound essence container uls { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 14, CODEC_ID_PCM_S16LE }, /* BWF Frame wrapped */ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, 14, CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0x40 ??? stream id */ @@ -1304,7 +1307,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) st->codec->extradata_size = descriptor->extradata_size; } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul); + container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul); if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = container_ul->id; st->codec->width = descriptor->width; @@ -1313,7 +1316,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) st->codec->pix_fmt = descriptor->pix_fmt; st->need_parsing = AVSTREAM_PARSE_HEADERS; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul); + container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul); if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = container_ul->id; st->codec->channels = descriptor->channels;