From 8c5002db1770abedb79c1929a4c441fe2ad5ae83 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Thu, 3 Aug 2006 09:14:56 +0000 Subject: add codec detection based on essence container ul Originally committed as revision 5904 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/mxf.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libavformat') diff --git a/libavformat/mxf.c b/libavformat/mxf.c index 026c808552..3779917274 100644 --- a/libavformat/mxf.c +++ b/libavformat/mxf.c @@ -632,6 +632,20 @@ static const MXFCodecUL mxf_codec_uls[] = { { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, CODEC_ID_NONE }, }; +static const MXFCodecUL mxf_picture_essence_container_uls[] = { + { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, CODEC_ID_MPEG2VIDEO }, /* MPEG-ES Frame wrapped */ + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, CODEC_ID_NONE }, +}; + +static const MXFCodecUL mxf_sound_essence_container_uls[] = { + { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, CODEC_ID_PCM_S16LE }, /* BWF Frame wrapped */ + { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x03,0x00 }, CODEC_ID_PCM_S16LE }, /* AES Frame wrapped */ + { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0x40 ??? stream id */ + { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0xc0,0x01 }, CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0xc0 MPA stream id */ + //{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x05,0x01 }, CODEC_ID_PCM_AES3 }, /* D-10 Mapping 30Mbps PAL Extended Template */ + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, CODEC_ID_NONE }, +}; + static enum CodecID mxf_get_codec_id(const MXFCodecUL *uls, UID *uid) { while (uls->id != CODEC_ID_NONE) { @@ -784,13 +798,18 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) } #ifdef DEBUG PRINT_KEY(descriptor->essence_codec_ul); + PRINT_KEY(descriptor->essence_container_ul); #endif st->codec->codec_id = mxf_get_codec_id(mxf_codec_uls, &descriptor->essence_codec_ul); if (st->codec->codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_id == CODEC_ID_NONE) + st->codec->codec_id = mxf_get_codec_id(mxf_picture_essence_container_uls, &descriptor->essence_container_ul); st->codec->width = descriptor->width; st->codec->height = descriptor->height; st->codec->bits_per_sample = descriptor->bits_per_sample; /* Uncompressed */ } else if (st->codec->codec_type == CODEC_TYPE_AUDIO) { + if (st->codec->codec_id == CODEC_ID_NONE) + st->codec->codec_id = mxf_get_codec_id(mxf_sound_essence_container_uls, &descriptor->essence_container_ul); st->codec->channels = descriptor->channels; st->codec->bits_per_sample = descriptor->bits_per_sample; st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den; -- cgit v1.2.3