summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2013-03-02 14:09:46 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2013-03-02 14:09:46 +1100
commitc8adb080b06a98ee65676f8d5149cc58e3e2cb65 (patch)
tree8177b876abbf65df63ce2347b6434a0176f5211f
parentd75cb67d7ff40d9e7379791558f804434c06826c (diff)
downloadflac-c8adb080b06a98ee65676f8d5149cc58e3e2cb65.tar.gz
Add appropriate WAV channel masks for 7 and 8 channel files.
This commit accepts the new default channel masks for 6.1 and 7.1 surround input WAV files, and writes the corresponding masks when decoding to WAV without a channel mask from the metadata block. The local copy of the format spec is also updated with the new text from the flac-website repository. Patch from Ralph Giles <giles@mozilla.com>
-rw-r--r--doc/html/format.html10
-rw-r--r--src/flac/decode.c12
-rw-r--r--src/flac/encode.c8
3 files changed, 23 insertions, 7 deletions
diff --git a/doc/html/format.html b/doc/html/format.html
index a8a539e0..87f6413d 100644
--- a/doc/html/format.html
+++ b/doc/html/format.html
@@ -1247,11 +1247,11 @@
<li>1 channel: mono</li>
<li>2 channels: left, right</li>
<li>3 channels: left, right, center</li>
- <li>4 channels: left, right, back left, back right</li>
- <li>5 channels: left, right, center, back/surround left, back/surround right</li>
- <li>6 channels: left, right, center, LFE, back/surround left, back/surround right</li>
- <li>7 channels: not defined</li>
- <li>8 channels: not defined</li>
+ <li>4 channels: front left, front right, back left, back right</li>
+ <li>5 channels: front left, front right, front center, back/surround left, back/surround right</li>
+ <li>6 channels: front left, front right, front center, LFE, back/surround left, back/surround right</li>
+ <li>7 channels: front left, front right, front center, LFE, back center, side left, side right</li>
+ <li>8 channels: front left, front right, front center, LFE, back left, back right, side left, side right</li>
</ul>
</li>
<li>
diff --git a/src/flac/decode.c b/src/flac/decode.c
index 98fc430f..e07b5aef 100644
--- a/src/flac/decode.c
+++ b/src/flac/decode.c
@@ -354,6 +354,18 @@ FLAC__bool DecoderSession_process(DecoderSession *d)
else if(d->channels == 6) {
d->channel_mask = 0x060f;
}
+ else if(d->channels == 7) {
+ d->channel_mask = 0x070f;
+ }
+ else if(d->channels == 8) {
+ d->channel_mask = 0x063f;
+ }
+ else if(d->channels == 7) {
+ d->channel_mask = 0x070f;
+ }
+ else if(d->channels == 8) {
+ d->channel_mask = 0x063f;
+ }
}
/* write the WAVE/AIFF headers if necessary */
diff --git a/src/flac/encode.c b/src/flac/encode.c
index eeea08aa..04539fc7 100644
--- a/src/flac/encode.c
+++ b/src/flac/encode.c
@@ -461,7 +461,9 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
}
else if(
channel_mask == 0x003f || /* 6 channels: front left, front right, front center, LFE, back left, back right */
- channel_mask == 0x060f /* 6 channels: front left, front right, front center, LFE, side left, side right */
+ channel_mask == 0x060f || /* 6 channels: front left, front right, front center, LFE, side left, side right */
+ channel_mask == 0x070f || /* 7 channels: front left, front right, front center, LFE, back center, side left, side right */
+ channel_mask == 0x063f /* 8 channels: front left, front right, front center, LFE, back left, back right, side left, side right */
) {
/* to dolby order: front left, center, front right, surround left, surround right, LFE */
channel_map[1] = 2;
@@ -481,7 +483,9 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
channel_mask == 0x0037 || /* 5 channels: front left, front right, front center, back left, back right */
channel_mask == 0x0607 || /* 5 channels: front left, front right, front center, side left, side right */
channel_mask == 0x003f || /* 6 channels: front left, front right, front center, LFE, back left, back right */
- channel_mask == 0x060f /* 6 channels: front left, front right, front center, LFE, side left, side right */
+ channel_mask == 0x060f || /* 6 channels: front left, front right, front center, LFE, side left, side right */
+ channel_mask == 0x070f || /* 7 channels: front left, front right, front center, LFE, back center, side left, side right */
+ channel_mask == 0x063f /* 8 channels: front left, front right, front center, LFE, back left, back right, side left, side right */
) {
/* keep default channel order */
}