Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: compress: add raw opus codec define and opus decoder structs

Adds a raw opus codec define and raw opus decoder structs.
This is for raw OPUS packets not packed in any type of container
(for instance OGG container). The decoder struct fields are
taken from corresponding RFC document: RFC 7845 Section 5.

Cc: Srinivas Kandagatla <srini@kernel.org>
Cc: Vinod Koul <vkoul@kernel.org>
Co-developed-by: Annemarie Porter <annemari@quicinc.com>
Signed-off-by: Annemarie Porter <annemari@quicinc.com>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Alexey Klimov and committed by
Takashi Iwai
5d36370f 1f9fc89c

+42 -1
+42 -1
include/uapi/sound/compress_params.h
··· 43 43 #define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E) 44 44 #define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F) 45 45 #define SND_AUDIOCODEC_APE ((__u32) 0x00000010) 46 - #define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_APE 46 + #define SND_AUDIOCODEC_OPUS_RAW ((__u32) 0x00000011) 47 + #define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_OPUS_RAW 47 48 48 49 /* 49 50 * Profile and modes are listed with bit masks. This allows for a ··· 325 324 __u32 seek_table_present; 326 325 } __attribute__((packed, aligned(4))); 327 326 327 + /** 328 + * struct snd_dec_opus - Opus decoder parameters (raw opus packets) 329 + * @version: Usually should be '1' but can be split into major (4 upper bits) 330 + * and minor (4 lower bits) sub-fields. 331 + * @num_channels: Number of output channels. 332 + * @pre_skip: Number of samples to discard at 48 kHz. 333 + * @sample_rate: Sample rate of original input. 334 + * @output_gain: Gain to apply when decoding (in Q7.8 format). 335 + * @mapping_family: Order and meaning of output channels. Only values 0 and 1 336 + * are expected; values 2..255 are not recommended for playback. 337 + * 338 + * Optional channel mapping table. Describes mapping of opus streams to decoded 339 + * channels. 340 + * @struct snd_dec_opus_ch_map 341 + * @stream_count: Number of streams encoded in each Ogg packet. 342 + * @coupled_count: Number of streams whose decoders are used for two 343 + * channels. 344 + * @channel_map: describes which decoded channel to be used for each one. 345 + * See RFC doc for details. 346 + * This supports only mapping families 0 and 1, therefore max 347 + * number of channels is 8. 348 + * 349 + * These options were extracted from RFC7845 Section 5. 350 + */ 351 + 352 + struct snd_dec_opus { 353 + __u8 version; 354 + __u8 num_channels; 355 + __u16 pre_skip; 356 + __u32 sample_rate; 357 + __u16 output_gain; 358 + __u8 mapping_family; 359 + struct snd_dec_opus_ch_map { 360 + __u8 stream_count; 361 + __u8 coupled_count; 362 + __u8 channel_map[8]; 363 + } chan_map; 364 + } __attribute__((packed, aligned(4))); 365 + 328 366 union snd_codec_options { 329 367 struct snd_enc_wma wma; 330 368 struct snd_enc_vorbis vorbis; ··· 374 334 struct snd_dec_wma wma_d; 375 335 struct snd_dec_alac alac_d; 376 336 struct snd_dec_ape ape_d; 337 + struct snd_dec_opus opus_d; 377 338 struct { 378 339 __u32 out_sample_rate; 379 340 } src_d;