diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-05-28 12:20:44 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-05-28 12:21:50 +0200 |
commit | 03ffaed3f0199f82ae32c28923f41f22123aea95 (patch) | |
tree | bd8b84c228cf36acce71d0206d570cd4aab6c280 /libavformat/flacdec.c | |
parent | ef13967e601bb0851af04182ea2aeeea8a3025bd (diff) | |
parent | d6b9ce99ea384fb676561461768b8316725a4ccd (diff) | |
download | ffmpeg-03ffaed3f0199f82ae32c28923f41f22123aea95.tar.gz |
Merge commit 'd6b9ce99ea384fb676561461768b8316725a4ccd'
* commit 'd6b9ce99ea384fb676561461768b8316725a4ccd':
flac demuxer: parse the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/flacdec.c')
-rw-r--r-- | libavformat/flacdec.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index cd752e1a20..d17c3e6c19 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -136,9 +136,24 @@ static int flac_read_header(AVFormatContext *s) } /* process supported blocks other than STREAMINFO */ if (metadata_type == FLAC_METADATA_TYPE_VORBIS_COMMENT) { + AVDictionaryEntry *chmask; + if (ff_vorbis_comment(s, &s->metadata, buffer, metadata_size)) { av_log(s, AV_LOG_WARNING, "error parsing VorbisComment metadata\n"); } + + /* parse the channels mask if present */ + chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0); + if (chmask) { + uint64_t mask = strtol(chmask->value, NULL, 0); + if (!mask || mask & ~0x3ffffULL) { + av_log(s, AV_LOG_WARNING, + "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n"); + } else { + st->codec->channel_layout = mask; + av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0); + } + } } av_freep(&buffer); } |