[SCM] libav/experimental: flac demuxer: parse the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Aug 10 16:03:17 UTC 2014


The following commit has been merged in the experimental branch:
commit d6b9ce99ea384fb676561461768b8316725a4ccd
Author: Anton Khirnov <anton at khirnov.net>
Date:   Sun May 25 11:14:14 2014 +0200

    flac demuxer: parse the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag
    
    It is used to store the channel mask for non-standard layouts.

diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 11360a9..d02d8b5 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 || 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);
         }

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list