From: Marton Balint <[email protected]> Fix 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: Luca Barbato <[email protected]> --- libavformat/mxfdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 9e916bc..45fb465 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1562,7 +1562,10 @@ 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; -- 1.8.5.1 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
