Ralph Giles
2013-Jan-18 00:21 UTC
[PATCH] 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. --- src/flac/decode.c | 7 +++++++ src/flac/encode.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/flac/decode.c b/src/flac/decode.c index fa82c04..733b6e2 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -360,6 +360,13 @@ FLAC__bool DecoderSession_process(DecoderSession *d) if(d->channel_mask == 0) d->channel_mask = 0x060f; } + else if(d->channels == 7) { + if(d->channel_mask == 0) + d->channel_mask = 0x070f; + } + else if(d->channels == 8) { + if(d->channel_mask == 0) + 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.10.2 (Apple Git-33) --------------090206050809070202060309--