summaryrefslogtreecommitdiff
path: root/libavformat/mxfdec.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2012-09-27 00:24:46 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-27 21:28:35 +0200
commit13f0cd681e9308efe68802ab03e7443863b4c54f (patch)
treedd3a0eeb73bd6c18a33ae47f63ce707077a1258c /libavformat/mxfdec.c
parent6226d104a327733ef8591148ba84ac8a6820bd04 (diff)
mxfdec: allow container_ul to override codec_ul if codec is A-law
Fixes some DNXHD files generated by AVID TM, where codec UL was set to A-law meanwhile the real audio codec was PCM S16. According to SMPTE RP 224, A-law is the default value for sound essence parameters therefore we should handle it specially. Signed-off-by: Marton Balint <cus@passwd.hu> Reviewed-by: Tomas Härdin <tomas.hardin@codemill.se> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mxfdec.c')
-rw-r--r--libavformat/mxfdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 16b8c12070..a503289582 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1536,7 +1536,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
st->need_parsing = AVSTREAM_PARSE_HEADERS;
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);
- if (st->codec->codec_id == AV_CODEC_ID_NONE)
+ /* Only overwrite existing codec ID if it is unset or A-law, which is the default according to SMPTE RP 224. */
+ if (st->codec->codec_id == AV_CODEC_ID_NONE || (st->codec->codec_id == AV_CODEC_ID_PCM_ALAW && container_ul->id != AV_CODEC_ID_NONE))
st->codec->codec_id = container_ul->id;
st->codec->channels = descriptor->channels;
st->codec->bits_per_coded_sample = descriptor->bits_per_sample;