@@ -43,7 +43,8 @@
#define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E)
#define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F)
#define SND_AUDIOCODEC_APE ((__u32) 0x00000010)
-#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_APE
+#define SND_AUDIOCODEC_OPUS_RAW ((__u32) 0x00000011)
+#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_OPUS_RAW
/*
* Profile and modes are listed with bit masks. This allows for a
@@ -324,6 +325,23 @@ struct snd_dec_ape {
__u32 seek_table_present;
} __attribute__((packed, aligned(4)));
+/*
+ * RFC with info on below OPUS decoder fields:
+ * https://www.rfc-editor.org/rfc/rfc7845#section-5
+ */
+struct snd_dec_opus {
+ __u8 version; /* must be 1 */
+ __u8 num_channels;
+ __u16 pre_skip;
+ __u32 sample_rate;
+ __u16 output_gain; /* in Q7.8 format */
+ __u8 mapping_family;
+ __u8 stream_count; /* part of channel mapping */
+ __u8 coupled_count; /* part of channel mapping */
+ __u8 channel_map;
+ __u8 reserved[7]; /* space for channel mapping */
+} __attribute__((packed, aligned(4)));
+
union snd_codec_options {
struct snd_enc_wma wma;
struct snd_enc_vorbis vorbis;
@@ -334,6 +352,7 @@ union snd_codec_options {
struct snd_dec_wma wma_d;
struct snd_dec_alac alac_d;
struct snd_dec_ape ape_d;
+ struct snd_dec_opus opus_d;
struct {
__u32 out_sample_rate;
} src_d;
Adds a raw opus codec define and raw opus decoder struct. 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. This is based on earlier work done by Annemarie Porter <annemari@quicinc.com> Cc: Annemarie Porter <annemari@quicinc.com> Cc: Srinivas Kandagatla <srini@kernel.org> Cc: Vinod Koul <vkoul@kernel.org> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org> --- include/uapi/sound/compress_params.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)