Commit 03ffaed3 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'd6b9ce99'

* commit 'd6b9ce99':
  flac demuxer: parse the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents ef13967e d6b9ce99
...@@ -136,9 +136,24 @@ static int flac_read_header(AVFormatContext *s) ...@@ -136,9 +136,24 @@ static int flac_read_header(AVFormatContext *s)
} }
/* process supported blocks other than STREAMINFO */ /* process supported blocks other than STREAMINFO */
if (metadata_type == FLAC_METADATA_TYPE_VORBIS_COMMENT) { if (metadata_type == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
AVDictionaryEntry *chmask;
if (ff_vorbis_comment(s, &s->metadata, buffer, metadata_size)) { if (ff_vorbis_comment(s, &s->metadata, buffer, metadata_size)) {
av_log(s, AV_LOG_WARNING, "error parsing VorbisComment metadata\n"); 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); av_freep(&buffer);
} }
......
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