Merge commit '54ed488b1af583df6c9d2a73b4a44f16b7e4f82c'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 28 May 2014 10:28:23 +0000 (12:28 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 28 May 2014 10:28:23 +0000 (12:28 +0200)
* commit '54ed488b1af583df6c9d2a73b4a44f16b7e4f82c':
  flac muxer: write WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag for multichannel files

Conflicts:
libavformat/flacenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/flacenc.c
libavformat/flacenc.h
libavformat/flacenc_header.c

@@@ -97,7 -84,24 +98,24 @@@ static int flac_write_header(struct AVF
      if (ret)
          return ret;
  
 -    ret = flac_write_block_comment(s->pb, &s->metadata, 0,
+     /* add the channel layout tag */
+     if (codec->channel_layout &&
+         !(codec->channel_layout & ~0x3ffffULL) &&
+         !ff_flac_is_native_layout(codec->channel_layout)) {
+         AVDictionaryEntry *chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
+                                                 NULL, 0);
+         if (chmask) {
+             av_log(s, AV_LOG_WARNING, "A WAVEFORMATEXTENSIBLE_CHANNEL_MASK is "
+                    "already present, this muxer will not overwrite it.\n");
+         } else {
+             uint8_t buf[32];
+             snprintf(buf, sizeof(buf), "0x%"PRIx64, codec->channel_layout);
+             av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
+         }
+     }
 +    ret = flac_write_block_comment(s->pb, &s->metadata, !padding,
                                     s->flags & AVFMT_FLAG_BITEXACT);
      if (ret)
          return ret;
Simple merge
Simple merge