On 13-01-01 4:36 PM, Tim W. wrote: > - 4 channels: left, right, back left, back right (FL FR BL BR) > - 5 channels: left, right, center, back/surround left, back/surround right > (FL FR FC BL BR or FL FR FC SL SR, same order so doesn't matter) > - 6 channels: left, right, center, LFE, back/surround left, back/surround > right > (FL FR FC LFE BL BR or FL FR FC LFE SL SR, same order so > doesn't matter)
I looked at the 'flac' command-line front-end code today, and it uses Back Left and Back Right for 4 channel but Side Left and Side Right for 5 and 6 channel files when writing out WAVE from FLAC files without a WAVFORMATEXTENSIBLE_CHANNEL_MASK metadata tag. As you say, the order is the same, and for less that 7 channels the physical speaker configurations are equivalent. The encoder accepts both Side and Back in the input channel mask, but passes them on in the tag, of course. If the input is AIFF the support is more limited, rejecting any multichannel file unless the undocumented --channel-map=none is passed, followed by some dead code saying only 1, 2, 3, and 5 channels can be unambiguously mapped. > - 6.1: FL FR FC LFE BC SL SR (L R C LFE Cs Ls Rs) > - 7.1: FL FR FC LFE BL BR SL SR (L R C LFE Rls Rrs Ls Rs) Again, I'm suggesting we update the spec to define these as the default channel maps for 7 and 8 channel FLAC files in the absence of the overriding WAVFORMATEXTENSIBLE_CHANNEL_MASK metadata tag, and modify the included 'flac' front-end to write out those masks when decoding such files. Likewise, we would modify 'flac' to accept files with those channel masks as input when encoding. Untested patch attached. -r
>From 2473146aac0b1c00863692b15ae0588373a00b04 Mon Sep 17 00:00:00 2001 From: Ralph Giles <gi...@mozilla.com> Date: Thu, 17 Jan 2013 16:21:45 -0800 Subject: [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)
_______________________________________________ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev