On 05/26/2014 07:56 AM, Anton Khirnov wrote:
> It is used to store the channel mask for non-standard layouts.
> ---
> libavformat/flacdec.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
> index 11360a9..479e5d3 100644
> --- a/libavformat/flacdec.c
> +++ b/libavformat/flacdec.c
> @@ -139,9 +139,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) {
> + 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);
> }
Might be a good idea to check that the value doesn't have bits set that
do not match up with Libav channel layout. IIRC that's anything past the
first 18 bits.
-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel