blob: fad6e6ffbc243ab62ad0102e829257cb656d9a2b [file] [log] [blame]
Vinod Koul50c34cf2011-12-23 10:36:37 +05301/*
2 * compress_params.h - codec types and parameters for compressed data
3 * streaming interface
4 *
5 * Copyright (C) 2011 Intel Corporation
6 * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * Vinod Koul <vinod.koul@linux.intel.com>
8 *
9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23 *
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 *
26 * The definitions in this file are derived from the OpenMAX AL version 1.1
27 * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below.
28 *
29 * Copyright (c) 2007-2010 The Khronos Group Inc.
30 *
31 * Permission is hereby granted, free of charge, to any person obtaining
32 * a copy of this software and/or associated documentation files (the
33 * "Materials "), to deal in the Materials without restriction, including
34 * without limitation the rights to use, copy, modify, merge, publish,
35 * distribute, sublicense, and/or sell copies of the Materials, and to
36 * permit persons to whom the Materials are furnished to do so, subject to
37 * the following conditions:
38 *
39 * The above copyright notice and this permission notice shall be included
40 * in all copies or substantial portions of the Materials.
41 *
42 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
43 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
49 *
50 */
51#ifndef __SND_COMPRESS_PARAMS_H
52#define __SND_COMPRESS_PARAMS_H
53
Bobby Powers10db4e12012-03-23 15:01:51 -070054#include <linux/types.h>
55
Bhalchandra Gajarec87674e2015-10-26 17:08:43 -070056#define SND_DEC_DDP_MAX_PARAMS 18
57
Nidhisha Dhananjayan09e14ec2019-02-13 15:04:28 +053058/* Maximum PCM channels */
59#define MAX_PCM_DECODE_CHANNELS 32
60
Vinod Koul50c34cf2011-12-23 10:36:37 +053061/* AUDIO CODECS SUPPORTED */
62#define MAX_NUM_CODECS 32
63#define MAX_NUM_CODEC_DESCRIPTORS 32
64#define MAX_NUM_BITRATES 32
Vinod Koulb8bab042014-01-04 16:59:13 +053065#define MAX_NUM_SAMPLE_RATES 32
Vinod Koul50c34cf2011-12-23 10:36:37 +053066
Banajit Goswami39feeac2014-08-23 16:00:57 -070067/* compressed TX */
68#define MAX_NUM_FRAMES_PER_BUFFER 1
69#define COMPRESSED_META_DATA_MODE 0x10
70#define META_DATA_LEN_BYTES 36
71#define Q6_AC3_DECODER 0x00010BF6
72#define Q6_EAC3_DECODER 0x00010C3C
73#define Q6_DTS 0x00010D88
74#define Q6_DTS_LBR 0x00010DBB
75
Banajit Goswami1ed9b8f2016-12-14 22:20:15 -080076/* Timestamp flsg */
77/* Bit-0 - 1 : Enable Timestamp mode */
78/* Bit-0 - 0 : Disable Timestamp mode */
79#define COMPRESSED_TIMESTAMP_FLAG 0x0001
80
Vinod Koul50c34cf2011-12-23 10:36:37 +053081/* Codecs are listed linearly to allow for extensibility */
82#define SND_AUDIOCODEC_PCM ((__u32) 0x00000001)
83#define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002)
84#define SND_AUDIOCODEC_AMR ((__u32) 0x00000003)
85#define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004)
86#define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005)
87#define SND_AUDIOCODEC_AAC ((__u32) 0x00000006)
88#define SND_AUDIOCODEC_WMA ((__u32) 0x00000007)
89#define SND_AUDIOCODEC_REAL ((__u32) 0x00000008)
90#define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009)
91#define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A)
92#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B)
93#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
94#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
Charles Keepaxdbb6b942015-12-15 11:29:44 +000095#define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E)
Banajit Goswamiad161912016-11-21 19:26:58 -080096#define SND_AUDIOCODEC_DTS_PASS_THROUGH ((__u32) 0x0000000F)
97#define SND_AUDIOCODEC_DTS_LBR ((__u32) 0x00000010)
98#define SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK ((__u32) 0x00000011)
99#define SND_AUDIOCODEC_PASS_THROUGH ((__u32) 0x00000012)
100#define SND_AUDIOCODEC_MP2 ((__u32) 0x00000013)
101#define SND_AUDIOCODEC_DTS_LBR_PASS_THROUGH ((__u32) 0x00000014)
102#define SND_AUDIOCODEC_AC3 ((__u32) 0x00000015)
103#define SND_AUDIOCODEC_AC3_PASS_THROUGH ((__u32) 0x00000016)
104#define SND_AUDIOCODEC_WMA_PRO ((__u32) 0x00000017)
105#define SND_AUDIOCODEC_DTS ((__u32) 0x00000018)
106#define SND_AUDIOCODEC_EAC3 ((__u32) 0x00000019)
Banajit Goswami1963f732016-12-21 18:42:18 -0800107#define SND_AUDIOCODEC_ALAC ((__u32) 0x00000020)
108#define SND_AUDIOCODEC_APE ((__u32) 0x00000021)
Banajit Goswami5ad78dc2016-12-14 22:17:23 -0800109#define SND_AUDIOCODEC_DSD ((__u32) 0x00000022)
Dhanalakshmi Siddani0758cd32017-01-16 15:17:50 +0530110#define SND_AUDIOCODEC_APTX ((__u32) 0x00000023)
Ben Rombergerfda003a2017-04-06 16:08:16 -0700111#define SND_AUDIOCODEC_TRUEHD ((__u32) 0x00000024)
112#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_TRUEHD
Vinod Koul50c34cf2011-12-23 10:36:37 +0530113
114/*
115 * Profile and modes are listed with bit masks. This allows for a
116 * more compact representation of fields that will not evolve
117 * (in contrast to the list of codecs)
118 */
119
120#define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001)
121
122/* MP3 modes are only useful for encoders */
123#define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001)
124#define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002)
125#define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004)
126#define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008)
127
128#define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001)
129
130/* AMR modes are only useful for encoders */
131#define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001)
132#define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002)
133#define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004)
134
135#define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000)
136#define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001)
137#define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002)
138#define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004)
139#define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008)
140#define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010)
141#define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020)
142
143#define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001)
144
145/* AMRWB modes are only useful for encoders */
146#define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001)
147#define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002)
148#define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004)
149
150#define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001)
151
152#define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001)
153
154/* AAC modes are required for encoders and decoders */
155#define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001)
156#define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002)
157#define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004)
158#define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008)
159#define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010)
160#define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020)
161#define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040)
162#define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080)
163#define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100)
164#define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200)
165
166/* AAC formats are required for encoders and decoders */
167#define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001)
168#define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002)
169#define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004)
170#define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008)
171#define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010)
172#define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020)
173#define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040)
174
175#define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001)
176#define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002)
177#define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004)
178#define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008)
179
180#define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001)
181#define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002)
182#define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004)
183#define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008)
184#define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010)
185#define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020)
186#define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040)
187#define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080)
188
189#define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001)
190/*
191 * Some implementations strip the ASF header and only send ASF packets
192 * to the DSP
193 */
194#define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002)
195
196#define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001)
197
198#define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001)
199#define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002)
200#define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004)
201#define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008)
202
203#define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001)
204
205#define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001)
206
207#define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001)
208
209/*
210 * Define quality levels for FLAC encoders, from LEVEL0 (fast)
211 * to LEVEL8 (best)
212 */
213#define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001)
214#define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002)
215#define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004)
216#define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008)
217#define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010)
218#define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020)
219#define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040)
220#define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080)
221#define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100)
222
223#define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001)
224#define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002)
225
226/* IEC61937 payloads without CUVP and preambles */
227#define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001)
228/* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */
229#define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002)
230
231/*
232 * IEC modes are mandatory for decoders. Format autodetection
233 * will only happen on the DSP side with mode 0. The PCM mode should
234 * not be used, the PCM codec should be used instead.
235 */
236#define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000)
237#define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001)
238#define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002)
239#define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004)
240#define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008)
241#define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010)
242#define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020)
243#define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040)
244#define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080)
245#define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100)
246#define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200)
247#define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400)
248#define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800)
249#define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000)
250#define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000)
251#define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000)
252#define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000)
253#define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000)
254#define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000)
255
256#define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001)
257
258#define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001)
259#define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002)
260#define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004)
261
262#define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001)
263
264#define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001)
265#define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002)
266
267/* <FIXME: multichannel encoders aren't supported for now. Would need
268 an additional definition of channel arrangement> */
269
270/* VBR/CBR definitions */
271#define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001)
272#define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002)
273
274/* Encoder options */
275
276struct snd_enc_wma {
277 __u32 super_block_align; /* WMA Type-specific data */
Banajit Goswamif60b88c2014-08-23 16:29:22 -0700278 __u32 bits_per_sample;
279 __u32 channelmask;
280 __u32 encodeopt;
Banajit Goswami804ce122014-08-23 15:51:20 -0700281 __u32 encodeopt1;
282 __u32 encodeopt2;
Banajit Goswamidcd65962016-12-21 18:34:21 -0800283 __u32 avg_bit_rate;
Vinod Koul50c34cf2011-12-23 10:36:37 +0530284};
285
286
287/**
288 * struct snd_enc_vorbis
289 * @quality: Sets encoding quality to n, between -1 (low) and 10 (high).
290 * In the default mode of operation, the quality level is 3.
291 * Normal quality range is 0 - 10.
292 * @managed: Boolean. Set bitrate management mode. This turns off the
293 * normal VBR encoding, but allows hard or soft bitrate constraints to be
294 * enforced by the encoder. This mode can be slower, and may also be
295 * lower quality. It is primarily useful for streaming.
296 * @max_bit_rate: Enabled only if managed is TRUE
297 * @min_bit_rate: Enabled only if managed is TRUE
298 * @downmix: Boolean. Downmix input from stereo to mono (has no effect on
299 * non-stereo streams). Useful for lower-bitrate encoding.
300 *
301 * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc
302 * properties
303 *
304 * For best quality users should specify VBR mode and set quality levels.
305 */
306
307struct snd_enc_vorbis {
308 __s32 quality;
309 __u32 managed;
310 __u32 max_bit_rate;
311 __u32 min_bit_rate;
312 __u32 downmix;
Vinod Koul2da38e02014-06-19 14:41:00 +0530313} __attribute__((packed, aligned(4)));
Vinod Koul50c34cf2011-12-23 10:36:37 +0530314
315
316/**
317 * struct snd_enc_real
318 * @quant_bits: number of coupling quantization bits in the stream
319 * @start_region: coupling start region in the stream
320 * @num_regions: number of regions value
321 *
322 * These options were extracted from the OpenMAX IL spec
323 */
324
325struct snd_enc_real {
326 __u32 quant_bits;
327 __u32 start_region;
328 __u32 num_regions;
Vinod Koul2da38e02014-06-19 14:41:00 +0530329} __attribute__((packed, aligned(4)));
Vinod Koul50c34cf2011-12-23 10:36:37 +0530330
331/**
332 * struct snd_enc_flac
333 * @num: serial number, valid only for OGG formats
334 * needs to be set by application
335 * @gain: Add replay gain tags
336 *
337 * These options were extracted from the FLAC online documentation
338 * at http://flac.sourceforge.net/documentation_tools_flac.html
339 *
340 * To make the API simpler, it is assumed that the user will select quality
341 * profiles. Additional options that affect encoding quality and speed can
342 * be added at a later stage if needed.
343 *
344 * By default the Subset format is used by encoders.
345 *
346 * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are
347 * not supported in this API.
348 */
349
350struct snd_enc_flac {
351 __u32 num;
352 __u32 gain;
Vinod Koul2da38e02014-06-19 14:41:00 +0530353} __attribute__((packed, aligned(4)));
Vinod Koul50c34cf2011-12-23 10:36:37 +0530354
355struct snd_enc_generic {
356 __u32 bw; /* encoder bandwidth */
Charles Keepaxdbb6b942015-12-15 11:29:44 +0000357 __s32 reserved[15]; /* Can be used for SND_AUDIOCODEC_BESPOKE */
Vinod Koul2da38e02014-06-19 14:41:00 +0530358} __attribute__((packed, aligned(4)));
Vinod Koul50c34cf2011-12-23 10:36:37 +0530359
Banajit Goswami475a66d82016-11-21 19:48:30 -0800360struct snd_dec_ddp {
361 __u32 params_length;
Bhalchandra Gajarec87674e2015-10-26 17:08:43 -0700362 __u32 params_id[SND_DEC_DDP_MAX_PARAMS];
363 __u32 params_value[SND_DEC_DDP_MAX_PARAMS];
Banajit Goswami475a66d82016-11-21 19:48:30 -0800364} __attribute__((packed, aligned(4)));
365
Banajit Goswamiaba6b072015-04-10 18:04:08 -0700366struct snd_dec_flac {
367 __u16 sample_size;
368 __u16 min_blk_size;
369 __u16 max_blk_size;
370 __u16 min_frame_size;
371 __u16 max_frame_size;
372} __attribute__((packed, aligned(4)));
373
Banajit Goswami1963f732016-12-21 18:42:18 -0800374struct snd_dec_vorbis {
375 __u32 bit_stream_fmt;
376};
377
378struct snd_dec_alac {
379 __u32 frame_length;
380 __u8 compatible_version;
381 __u8 bit_depth;
382 __u8 pb;
383 __u8 mb;
384 __u8 kb;
385 __u8 num_channels;
386 __u16 max_run;
387 __u32 max_frame_bytes;
388 __u32 avg_bit_rate;
389 __u32 sample_rate;
390 __u32 channel_layout_tag;
391};
392
393struct snd_dec_ape {
394 __u16 compatible_version;
395 __u16 compression_level;
396 __u32 format_flags;
397 __u32 blocks_per_frame;
398 __u32 final_frame_blocks;
399 __u32 total_frames;
400 __u16 bits_per_sample;
401 __u16 num_channels;
402 __u32 sample_rate;
403 __u32 seek_table_present;
404};
405
Dhanalakshmi Siddani0758cd32017-01-16 15:17:50 +0530406struct snd_dec_aptx {
407 __u32 lap;
408 __u32 uap;
409 __u32 nap;
410};
411
Sanjana B18d99132019-12-06 17:08:57 +0530412/** struct snd_dec_dsd - codec for DSD format
413 * @blk_size - dsd channel block size
414 */
415struct snd_dec_dsd {
416 __u32 blk_size;
417};
418
Nidhisha Dhananjayan09e14ec2019-02-13 15:04:28 +0530419/** struct snd_dec_pcm - codec options for PCM format
420 * @num_channels: Number of channels
421 * @ch_map: Channel map for the above corresponding channels
422 */
423struct snd_dec_pcm {
424 __u32 num_channels;
425 __u8 ch_map[MAX_PCM_DECODE_CHANNELS];
426} __attribute__((packed, aligned(4)));
427
Asish Bhattacharyada7778b2019-06-30 20:00:32 +0530428struct snd_dec_amrwb_plus {
429 __u32 bit_stream_fmt;
430};
Vinod Koul50c34cf2011-12-23 10:36:37 +0530431union snd_codec_options {
432 struct snd_enc_wma wma;
433 struct snd_enc_vorbis vorbis;
434 struct snd_enc_real real;
435 struct snd_enc_flac flac;
436 struct snd_enc_generic generic;
Banajit Goswami475a66d82016-11-21 19:48:30 -0800437 struct snd_dec_ddp ddp;
Banajit Goswamiaba6b072015-04-10 18:04:08 -0700438 struct snd_dec_flac flac_dec;
Banajit Goswami1963f732016-12-21 18:42:18 -0800439 struct snd_dec_vorbis vorbis_dec;
440 struct snd_dec_alac alac;
441 struct snd_dec_ape ape;
Dhanalakshmi Siddani0758cd32017-01-16 15:17:50 +0530442 struct snd_dec_aptx aptx_dec;
Nidhisha Dhananjayan09e14ec2019-02-13 15:04:28 +0530443 struct snd_dec_pcm pcm_dec;
Asish Bhattacharyada7778b2019-06-30 20:00:32 +0530444 struct snd_dec_amrwb_plus amrwbplus;
Sanjana B18d99132019-12-06 17:08:57 +0530445 struct snd_dec_dsd dsd_dec;
Banajit Goswami1963f732016-12-21 18:42:18 -0800446};
Vinod Koul50c34cf2011-12-23 10:36:37 +0530447
448/** struct snd_codec_desc - description of codec capabilities
449 * @max_ch: Maximum number of audio channels
Vinod Koulf0e9c082013-12-16 14:55:34 +0530450 * @sample_rates: Sampling rates in Hz, use values like 48000 for this
Vinod Koul929559b2014-01-07 21:55:42 +0530451 * @num_sample_rates: Number of valid values in sample_rates array
Vinod Koul50c34cf2011-12-23 10:36:37 +0530452 * @bit_rate: Indexed array containing supported bit rates
453 * @num_bitrates: Number of valid values in bit_rate array
454 * @rate_control: value is specified by SND_RATECONTROLMODE defines.
455 * @profiles: Supported profiles. See SND_AUDIOPROFILE defines.
456 * @modes: Supported modes. See SND_AUDIOMODE defines
457 * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines
458 * @min_buffer: Minimum buffer size handled by codec implementation
459 * @reserved: reserved for future use
460 *
461 * This structure provides a scalar value for profiles, modes and stream
462 * format fields.
463 * If an implementation supports multiple combinations, they will be listed as
464 * codecs with different descriptors, for example there would be 2 descriptors
465 * for AAC-RAW and AAC-ADTS.
466 * This entails some redundancy but makes it easier to avoid invalid
467 * configurations.
468 *
469 */
470
471struct snd_codec_desc {
472 __u32 max_ch;
Vinod Koulb8bab042014-01-04 16:59:13 +0530473 __u32 sample_rates[MAX_NUM_SAMPLE_RATES];
Vinod Koul929559b2014-01-07 21:55:42 +0530474 __u32 num_sample_rates;
Vinod Koul50c34cf2011-12-23 10:36:37 +0530475 __u32 bit_rate[MAX_NUM_BITRATES];
476 __u32 num_bitrates;
477 __u32 rate_control;
478 __u32 profiles;
479 __u32 modes;
480 __u32 formats;
481 __u32 min_buffer;
482 __u32 reserved[15];
Vinod Koul2da38e02014-06-19 14:41:00 +0530483} __attribute__((packed, aligned(4)));
Vinod Koul50c34cf2011-12-23 10:36:37 +0530484
485/** struct snd_codec
486 * @id: Identifies the supported audio encoder/decoder.
487 * See SND_AUDIOCODEC macros.
488 * @ch_in: Number of input audio channels
489 * @ch_out: Number of output channels. In case of contradiction between
490 * this field and the channelMode field, the channelMode field
491 * overrides.
Vinod Kould9afee62014-01-04 16:59:12 +0530492 * @sample_rate: Audio sample rate of input data in Hz, use values like 48000
493 * for this.
Vinod Koul50c34cf2011-12-23 10:36:37 +0530494 * @bit_rate: Bitrate of encoded data. May be ignored by decoders
495 * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines.
496 * Encoders may rely on profiles for quality levels.
497 * May be ignored by decoders.
498 * @profile: Mandatory for encoders, can be mandatory for specific
499 * decoders as well. See SND_AUDIOPROFILE defines.
500 * @level: Supported level (Only used by WMA at the moment)
501 * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines
502 * @format: Format of encoded bistream. Mandatory when defined.
503 * See SND_AUDIOSTREAMFORMAT defines.
504 * @align: Block alignment in bytes of an audio sample.
505 * Only required for PCM or IEC formats.
506 * @options: encoder-specific settings
507 * @reserved: reserved for future use
508 */
509
510struct snd_codec {
511 __u32 id;
512 __u32 ch_in;
513 __u32 ch_out;
514 __u32 sample_rate;
515 __u32 bit_rate;
516 __u32 rate_control;
517 __u32 profile;
518 __u32 level;
519 __u32 ch_mode;
520 __u32 format;
521 __u32 align;
Banajit Goswami55910c52015-04-17 01:07:27 -0700522 __u32 compr_passthr;
Vinod Koul50c34cf2011-12-23 10:36:37 +0530523 union snd_codec_options options;
Banajit Goswami1ed9b8f2016-12-14 22:20:15 -0800524 __u32 flags;
525 __u32 reserved[2];
Vinod Koul2da38e02014-06-19 14:41:00 +0530526} __attribute__((packed, aligned(4)));
Vinod Koul50c34cf2011-12-23 10:36:37 +0530527
Banajit Goswami1ed9b8f2016-12-14 22:20:15 -0800528
529/** struct snd_codec_metadata
530 * @length: Length of the encoded buffer.
531 * @offset: Offset from the buffer address to the first byte of the first
532 * encoded frame. All encoded frames are consecutive starting
533 * from this offset.
534 * @timestamp: Session time in microseconds of the first sample in the buffer.
535 * @reserved: Reserved for future use.
536 */
537struct snd_codec_metadata {
538 __u32 length;
539 __u32 offset;
540 __u64 timestamp;
541 __u32 reserved[4];
542};
543
Vinod Koul50c34cf2011-12-23 10:36:37 +0530544#endif