pub struct ChannelLayout {
pub mapping_family: u8,
pub nb_channels: usize,
pub nb_streams: usize,
pub nb_coupled_streams: usize,
pub mapping: Vec<u8>,
}Expand description
How a set of Opus streams becomes a set of output channels.
A multistream packet is several ordinary Opus streams concatenated. Some are coded as coupled stereo pairs and carry two channels each, the rest carry one, and the mapping says which of the resulting channels goes where in the output. Coupled streams always come first, so the channels a decoder produces are the coupled pairs in order, then the mono streams in order.
surround builds the standard layout for a channel count
and mapping family, which is how OpusMSEncoder and OpusMSDecoder
obtain theirs. The fields are public so a caller can read what a given
channel count works out to, which is what the
OpusHead for such a stream has to declare.
Fields§
§mapping_family: u8The mapping family this layout came from: 0 for mono/stereo, 1 for the
Vorbis surround orders. Kept so the layout can describe itself to an
OpusHead without being asked twice.
nb_channels: usizeOutput channels this layout produces, which is what a caller interleaves.
nb_streams: usizeOpus streams in the packet, coupled and uncoupled together.
nb_coupled_streams: usizeHow many of those streams are coupled stereo pairs. They are the first
nb_coupled_streams of them, and each carries two channels, so the
streams carry nb_coupled_streams + nb_streams channels in total.
mapping: Vec<u8>For each output channel, which of the streams’ channels feeds it.
Indices 0..2 * nb_coupled_streams are the coupled pairs, left then
right; the rest are the mono streams in order. The value 255 marks a
channel that is left silent. Length is nb_channels.