Commit 8c5002db authored by Baptiste Coudurier's avatar Baptiste Coudurier

add codec detection based on essence container ul

Originally committed as revision 5904 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent cd035a60
...@@ -632,6 +632,20 @@ static const MXFCodecUL mxf_codec_uls[] = { ...@@ -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 }, { { 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) static enum CodecID mxf_get_codec_id(const MXFCodecUL *uls, UID *uid)
{ {
while (uls->id != CODEC_ID_NONE) { while (uls->id != CODEC_ID_NONE) {
...@@ -784,13 +798,18 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) ...@@ -784,13 +798,18 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
} }
#ifdef DEBUG #ifdef DEBUG
PRINT_KEY(descriptor->essence_codec_ul); PRINT_KEY(descriptor->essence_codec_ul);
PRINT_KEY(descriptor->essence_container_ul);
#endif #endif
st->codec->codec_id = mxf_get_codec_id(mxf_codec_uls, &descriptor->essence_codec_ul); 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_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->width = descriptor->width;
st->codec->height = descriptor->height; st->codec->height = descriptor->height;
st->codec->bits_per_sample = descriptor->bits_per_sample; /* Uncompressed */ st->codec->bits_per_sample = descriptor->bits_per_sample; /* Uncompressed */
} else if (st->codec->codec_type == CODEC_TYPE_AUDIO) { } 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->channels = descriptor->channels;
st->codec->bits_per_sample = descriptor->bits_per_sample; st->codec->bits_per_sample = descriptor->bits_per_sample;
st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den; st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment