STRUCT SND_DEC_OPUS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🎧 struct snd_dec_opus(9) β€” the kernel API manual, bestie edition 🎧

okay so welcome to the struct snd_dec_opus page, it's literally all about Opus decoder parameters for raw opus packets and honestly? it's giving "header file that knows exactly what it wants." πŸ’…


✨ NAME ✨

struct snd_dec_opus β€” Opus decoder parameters (raw opus packets). yes that's it, that's the whole name, and she ate. πŸŽ€


🌸 SYNOPSIS 🌸

here's the whole struct, bestie, copied exactly so don't come for me:

struct snd_dec_opus {
    __u8 version;
    __u8 num_channels;
    __u16 pre_skip;
    __u32 sample_rate;
    __u16 output_gain;
    __u8 mapping_family;
    struct snd_dec_opus_ch_map {
      __u8 stream_count;
      __u8 coupled_count;
      __u8 channel_map[8];
    } chan_map;
 };

look at her. gorgeous. no notes. πŸ¦‹


πŸ‘‘ Members πŸ‘‘

πŸ’– version

usually should be '1' but ngl it can be split into major (the 4 upper bits) and minor (the 4 lower bits) sub-fields. so like, she's got layers. iykyk.

πŸ’– num_channels

the number of output channels. how many voices are we talking about here. 🎀

πŸ’– pre_skip

number of samples to discard at 48 kHz. like a little trim off the top, cute.

πŸ’– sample_rate

sample rate of the original input. the og vibes, preserved. ⭐

πŸ’– output_gain

gain to apply when decoding, and it's in Q7.8 format. okay fancy math girl. πŸ”₯

πŸ’– mapping_family

this is the order and meaning of the output channels. only values 0 and 1 are expected; values 2..255 are not recommended for playback β€” so like, don't. πŸ™ˆ

πŸ’– chan_map

optional channel mapping table, and it describes the mapping of opus streams to decoded channels. fields go like this:

πŸŽ€ chan_map.stream_count

the number of streams encoded in each Ogg packet.

πŸŽ€ chan_map.coupled_count

the number of streams whose decoders are used for two channels. two-for-one, iconic.

πŸŽ€ chan_map.channel_map

which decoded channel to be used for each one. supports only mapping families 0 and 1, and the max number of channels is 8. that's the ceiling, bestie, don't push it. 🫢


🌈 Description 🌈

these options were extracted from RFC7845 Section 5. periodt. that's the entire description and we respect her for being brief.

fr fr though, don't skip the RFC reference β€” that's where the actual lore lives. πŸ“–

πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./include/uapi/sound/compress_params.h
  • struct snd_enc_vorbis(9)
  • struct snd_enc_real(9)
  • struct snd_enc_flac(9)

go read those too, the whole enc/dec family is lowkey a vibe. 🌸


and that's the page!! πŸ’– this came from the source at ./include/uapi/sound, dated October 2026, and it's titled struct snd_dec_opus(9) β€” so yeah, she's official, she's documented, she's main character energy. slay, stay hydrated, and go decode some opus packets responsibly. πŸ§šβ€β™€οΈβœ¨

πŸ“¦ where this page comes from