[PATCH] Add appropriate WAV channel masks for 7 and 8 channel files.

Ralph Giles giles at mozilla.com
Thu Jan 17 16:21:45 PST 2013


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.
---
 src/flac/decode.c | 5 +++++
 src/flac/encode.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/flac/decode.c b/src/flac/decode.c
index 98fc430..2d1bdd6 100644
--- a/src/flac/decode.c
+++ b/src/flac/decode.c
@@ -354,6 +354,11 @@ 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;
 	}
 
 	/* write the WAVE/AIFF headers if necessary */
diff --git a/src/flac/encode.c b/src/flac/encode.c
index eeea08a..58cdc77 100644
--- a/src/flac/encode.c
+++ b/src/flac/encode.c
@@ -481,7 +481,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 */
 				}
-- 
1.7.12.4 (Apple Git-37)


--------------060809010801040601060705--


More information about the flac-dev mailing list