| 1 | /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) AND MIT) */ |
| 2 | /* |
| 3 | * compress_params.h - codec types and parameters for compressed data |
| 4 | * streaming interface |
| 5 | * |
| 6 | * Copyright (C) 2011 Intel Corporation |
| 7 | * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
| 8 | * Vinod Koul <vinod.koul@linux.intel.com> |
| 9 | * |
| 10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 11 | * |
| 12 | * The definitions in this file are derived from the OpenMAX AL version 1.1 |
| 13 | * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below |
| 14 | * and are licensed under the MIT license. |
| 15 | * |
| 16 | * Copyright (c) 2007-2010 The Khronos Group Inc. |
| 17 | */ |
| 18 | #ifndef __SND_COMPRESS_PARAMS_H |
| 19 | #define __SND_COMPRESS_PARAMS_H |
| 20 | |
| 21 | #include <linux/types.h> |
| 22 | |
| 23 | /* AUDIO CODECS SUPPORTED */ |
| 24 | #define MAX_NUM_CODECS 32 |
| 25 | #define MAX_NUM_CODEC_DESCRIPTORS 32 |
| 26 | #define MAX_NUM_BITRATES 32 |
| 27 | #define MAX_NUM_SAMPLE_RATES 32 |
| 28 | |
| 29 | /* Codecs are listed linearly to allow for extensibility */ |
| 30 | #define SND_AUDIOCODEC_PCM ((__u32) 0x00000001) |
| 31 | #define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002) |
| 32 | #define SND_AUDIOCODEC_AMR ((__u32) 0x00000003) |
| 33 | #define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004) |
| 34 | #define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005) |
| 35 | #define SND_AUDIOCODEC_AAC ((__u32) 0x00000006) |
| 36 | #define SND_AUDIOCODEC_WMA ((__u32) 0x00000007) |
| 37 | #define SND_AUDIOCODEC_REAL ((__u32) 0x00000008) |
| 38 | #define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009) |
| 39 | #define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A) |
| 40 | #define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) |
| 41 | #define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) |
| 42 | #define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) |
| 43 | #define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E) |
| 44 | #define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F) |
| 45 | #define SND_AUDIOCODEC_APE ((__u32) 0x00000010) |
| 46 | #define SND_AUDIOCODEC_OPUS_RAW ((__u32) 0x00000011) |
| 47 | #define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_OPUS_RAW |
| 48 | |
| 49 | /* |
| 50 | * Profile and modes are listed with bit masks. This allows for a |
| 51 | * more compact representation of fields that will not evolve |
| 52 | * (in contrast to the list of codecs) |
| 53 | */ |
| 54 | |
| 55 | #define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001) |
| 56 | |
| 57 | /* MP3 modes are only useful for encoders */ |
| 58 | #define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001) |
| 59 | #define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002) |
| 60 | #define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004) |
| 61 | #define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008) |
| 62 | |
| 63 | #define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001) |
| 64 | |
| 65 | /* AMR modes are only useful for encoders */ |
| 66 | #define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001) |
| 67 | #define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002) |
| 68 | #define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004) |
| 69 | |
| 70 | #define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000) |
| 71 | #define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001) |
| 72 | #define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002) |
| 73 | #define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004) |
| 74 | #define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008) |
| 75 | #define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010) |
| 76 | #define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020) |
| 77 | |
| 78 | #define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001) |
| 79 | |
| 80 | /* AMRWB modes are only useful for encoders */ |
| 81 | #define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001) |
| 82 | #define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002) |
| 83 | #define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004) |
| 84 | |
| 85 | #define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001) |
| 86 | |
| 87 | #define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001) |
| 88 | |
| 89 | /* AAC modes are required for encoders and decoders */ |
| 90 | #define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001) |
| 91 | #define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002) |
| 92 | #define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004) |
| 93 | #define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008) |
| 94 | #define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010) |
| 95 | #define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020) |
| 96 | #define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040) |
| 97 | #define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080) |
| 98 | #define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100) |
| 99 | #define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200) |
| 100 | |
| 101 | /* AAC formats are required for encoders and decoders */ |
| 102 | #define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001) |
| 103 | #define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002) |
| 104 | #define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004) |
| 105 | #define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008) |
| 106 | #define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010) |
| 107 | #define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020) |
| 108 | #define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040) |
| 109 | |
| 110 | #define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001) |
| 111 | #define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002) |
| 112 | #define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004) |
| 113 | #define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008) |
| 114 | #define SND_AUDIOPROFILE_WMA9_PRO ((__u32) 0x00000010) |
| 115 | #define SND_AUDIOPROFILE_WMA9_LOSSLESS ((__u32) 0x00000020) |
| 116 | #define SND_AUDIOPROFILE_WMA10_LOSSLESS ((__u32) 0x00000040) |
| 117 | |
| 118 | #define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001) |
| 119 | #define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002) |
| 120 | #define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004) |
| 121 | #define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008) |
| 122 | #define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010) |
| 123 | #define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020) |
| 124 | #define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040) |
| 125 | #define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080) |
| 126 | |
| 127 | #define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001) |
| 128 | /* |
| 129 | * Some implementations strip the ASF header and only send ASF packets |
| 130 | * to the DSP |
| 131 | */ |
| 132 | #define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002) |
| 133 | |
| 134 | #define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001) |
| 135 | |
| 136 | #define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001) |
| 137 | #define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002) |
| 138 | #define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004) |
| 139 | #define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008) |
| 140 | |
| 141 | #define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001) |
| 142 | |
| 143 | #define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001) |
| 144 | |
| 145 | #define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001) |
| 146 | |
| 147 | /* |
| 148 | * Define quality levels for FLAC encoders, from LEVEL0 (fast) |
| 149 | * to LEVEL8 (best) |
| 150 | */ |
| 151 | #define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001) |
| 152 | #define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002) |
| 153 | #define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004) |
| 154 | #define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008) |
| 155 | #define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010) |
| 156 | #define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020) |
| 157 | #define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040) |
| 158 | #define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080) |
| 159 | #define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100) |
| 160 | |
| 161 | #define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001) |
| 162 | #define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002) |
| 163 | |
| 164 | /* IEC61937 payloads without CUVP and preambles */ |
| 165 | #define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001) |
| 166 | /* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */ |
| 167 | #define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002) |
| 168 | |
| 169 | /* |
| 170 | * IEC modes are mandatory for decoders. Format autodetection |
| 171 | * will only happen on the DSP side with mode 0. The PCM mode should |
| 172 | * not be used, the PCM codec should be used instead. |
| 173 | */ |
| 174 | #define ((__u32) 0x00000000) |
| 175 | #define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001) |
| 176 | #define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002) |
| 177 | #define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004) |
| 178 | #define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008) |
| 179 | #define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010) |
| 180 | #define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020) |
| 181 | #define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040) |
| 182 | #define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080) |
| 183 | #define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100) |
| 184 | #define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200) |
| 185 | #define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400) |
| 186 | #define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800) |
| 187 | #define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000) |
| 188 | #define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000) |
| 189 | #define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000) |
| 190 | #define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000) |
| 191 | #define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000) |
| 192 | #define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000) |
| 193 | |
| 194 | #define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001) |
| 195 | |
| 196 | #define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001) |
| 197 | #define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002) |
| 198 | #define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004) |
| 199 | |
| 200 | #define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001) |
| 201 | |
| 202 | #define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001) |
| 203 | #define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002) |
| 204 | |
| 205 | /* <FIXME: multichannel encoders aren't supported for now. Would need |
| 206 | an additional definition of channel arrangement> */ |
| 207 | |
| 208 | /* VBR/CBR definitions */ |
| 209 | #define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001) |
| 210 | #define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002) |
| 211 | |
| 212 | /* Encoder options */ |
| 213 | |
| 214 | struct snd_enc_wma { |
| 215 | __u32 super_block_align; /* WMA Type-specific data */ |
| 216 | }; |
| 217 | |
| 218 | |
| 219 | /** |
| 220 | * struct snd_enc_vorbis - Vorbis encoder parameters |
| 221 | * @quality: Sets encoding quality to n, between -1 (low) and 10 (high). |
| 222 | * In the default mode of operation, the quality level is 3. |
| 223 | * Normal quality range is 0 - 10. |
| 224 | * @managed: Boolean. Set bitrate management mode. This turns off the |
| 225 | * normal VBR encoding, but allows hard or soft bitrate constraints to be |
| 226 | * enforced by the encoder. This mode can be slower, and may also be |
| 227 | * lower quality. It is primarily useful for streaming. |
| 228 | * @max_bit_rate: Enabled only if managed is TRUE |
| 229 | * @min_bit_rate: Enabled only if managed is TRUE |
| 230 | * @downmix: Boolean. Downmix input from stereo to mono (has no effect on |
| 231 | * non-stereo streams). Useful for lower-bitrate encoding. |
| 232 | * |
| 233 | * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc |
| 234 | * properties |
| 235 | * |
| 236 | * For best quality users should specify VBR mode and set quality levels. |
| 237 | */ |
| 238 | |
| 239 | struct snd_enc_vorbis { |
| 240 | __s32 quality; |
| 241 | __u32 managed; |
| 242 | __u32 max_bit_rate; |
| 243 | __u32 min_bit_rate; |
| 244 | __u32 downmix; |
| 245 | } __attribute__((packed, aligned(4))); |
| 246 | |
| 247 | |
| 248 | /** |
| 249 | * struct snd_enc_real - RealAudio encoder parameters |
| 250 | * @quant_bits: number of coupling quantization bits in the stream |
| 251 | * @start_region: coupling start region in the stream |
| 252 | * @num_regions: number of regions value |
| 253 | * |
| 254 | * These options were extracted from the OpenMAX IL spec |
| 255 | */ |
| 256 | |
| 257 | struct snd_enc_real { |
| 258 | __u32 quant_bits; |
| 259 | __u32 start_region; |
| 260 | __u32 num_regions; |
| 261 | } __attribute__((packed, aligned(4))); |
| 262 | |
| 263 | /** |
| 264 | * struct snd_enc_flac - FLAC encoder parameters |
| 265 | * @num: serial number, valid only for OGG formats |
| 266 | * needs to be set by application |
| 267 | * @gain: Add replay gain tags |
| 268 | * |
| 269 | * These options were extracted from the FLAC online documentation |
| 270 | * at http://flac.sourceforge.net/documentation_tools_flac.html |
| 271 | * |
| 272 | * To make the API simpler, it is assumed that the user will select quality |
| 273 | * profiles. Additional options that affect encoding quality and speed can |
| 274 | * be added at a later stage if needed. |
| 275 | * |
| 276 | * By default the Subset format is used by encoders. |
| 277 | * |
| 278 | * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are |
| 279 | * not supported in this API. |
| 280 | */ |
| 281 | |
| 282 | struct snd_enc_flac { |
| 283 | __u32 num; |
| 284 | __u32 gain; |
| 285 | } __attribute__((packed, aligned(4))); |
| 286 | |
| 287 | struct snd_enc_generic { |
| 288 | __u32 bw; /* encoder bandwidth */ |
| 289 | __s32 reserved[15]; /* Can be used for SND_AUDIOCODEC_BESPOKE */ |
| 290 | } __attribute__((packed, aligned(4))); |
| 291 | |
| 292 | struct snd_dec_flac { |
| 293 | __u16 sample_size; |
| 294 | __u16 min_blk_size; |
| 295 | __u16 max_blk_size; |
| 296 | __u16 min_frame_size; |
| 297 | __u16 max_frame_size; |
| 298 | __u16 reserved; |
| 299 | } __attribute__((packed, aligned(4))); |
| 300 | |
| 301 | struct snd_dec_wma { |
| 302 | __u32 encoder_option; |
| 303 | __u32 adv_encoder_option; |
| 304 | __u32 adv_encoder_option2; |
| 305 | __u32 reserved; |
| 306 | } __attribute__((packed, aligned(4))); |
| 307 | |
| 308 | struct snd_dec_alac { |
| 309 | __u32 frame_length; |
| 310 | __u8 compatible_version; |
| 311 | __u8 pb; |
| 312 | __u8 mb; |
| 313 | __u8 kb; |
| 314 | __u32 max_run; |
| 315 | __u32 max_frame_bytes; |
| 316 | } __attribute__((packed, aligned(4))); |
| 317 | |
| 318 | struct snd_dec_ape { |
| 319 | __u16 compatible_version; |
| 320 | __u16 compression_level; |
| 321 | __u32 format_flags; |
| 322 | __u32 blocks_per_frame; |
| 323 | __u32 final_frame_blocks; |
| 324 | __u32 total_frames; |
| 325 | __u32 seek_table_present; |
| 326 | } __attribute__((packed, aligned(4))); |
| 327 | |
| 328 | /** |
| 329 | * struct snd_dec_opus - Opus decoder parameters (raw opus packets) |
| 330 | * @version: Usually should be '1' but can be split into major (4 upper bits) |
| 331 | * and minor (4 lower bits) sub-fields. |
| 332 | * @num_channels: Number of output channels. |
| 333 | * @pre_skip: Number of samples to discard at 48 kHz. |
| 334 | * @sample_rate: Sample rate of original input. |
| 335 | * @output_gain: Gain to apply when decoding (in Q7.8 format). |
| 336 | * @mapping_family: Order and meaning of output channels. Only values 0 and 1 |
| 337 | * are expected; values 2..255 are not recommended for playback. |
| 338 | * |
| 339 | * @chan_map: Optional channel mapping table. Describes mapping of opus streams |
| 340 | * to decoded channels. Fields: |
| 341 | * @chan_map.stream_count: Number of streams encoded in each Ogg packet. |
| 342 | * @chan_map.coupled_count: Number of streams whose decoders are used |
| 343 | * for two channels. |
| 344 | * @chan_map.channel_map: Which decoded channel to be used for each one. |
| 345 | * Supports only mapping families 0 and 1, |
| 346 | * max number of channels is 8. |
| 347 | * |
| 348 | * These options were extracted from RFC7845 Section 5. |
| 349 | */ |
| 350 | |
| 351 | struct snd_dec_opus { |
| 352 | __u8 version; |
| 353 | __u8 num_channels; |
| 354 | __u16 pre_skip; |
| 355 | __u32 sample_rate; |
| 356 | __u16 output_gain; |
| 357 | __u8 mapping_family; |
| 358 | struct snd_dec_opus_ch_map { |
| 359 | __u8 stream_count; |
| 360 | __u8 coupled_count; |
| 361 | __u8 channel_map[8]; |
| 362 | } chan_map; |
| 363 | } __attribute__((packed, aligned(4))); |
| 364 | |
| 365 | union snd_codec_options { |
| 366 | struct snd_enc_wma wma; |
| 367 | struct snd_enc_vorbis vorbis; |
| 368 | struct snd_enc_real real; |
| 369 | struct snd_enc_flac flac; |
| 370 | struct snd_enc_generic generic; |
| 371 | struct snd_dec_flac flac_d; |
| 372 | struct snd_dec_wma wma_d; |
| 373 | struct snd_dec_alac alac_d; |
| 374 | struct snd_dec_ape ape_d; |
| 375 | struct snd_dec_opus opus_d; |
| 376 | struct { |
| 377 | __u32 out_sample_rate; |
| 378 | } src_d; |
| 379 | } __attribute__((packed, aligned(4))); |
| 380 | |
| 381 | struct snd_codec_desc_src { |
| 382 | __u32 out_sample_rate_min; |
| 383 | __u32 out_sample_rate_max; |
| 384 | } __attribute__((packed, aligned(4))); |
| 385 | |
| 386 | /** struct snd_codec_desc - description of codec capabilities |
| 387 | * @max_ch: Maximum number of audio channels |
| 388 | * @sample_rates: Sampling rates in Hz, use values like 48000 for this |
| 389 | * @num_sample_rates: Number of valid values in sample_rates array |
| 390 | * @bit_rate: Indexed array containing supported bit rates |
| 391 | * @num_bitrates: Number of valid values in bit_rate array |
| 392 | * @rate_control: value is specified by SND_RATECONTROLMODE defines. |
| 393 | * @profiles: Supported profiles. See SND_AUDIOPROFILE defines. |
| 394 | * @modes: Supported modes. See SND_AUDIOMODE defines |
| 395 | * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines |
| 396 | * @min_buffer: Minimum buffer size handled by codec implementation |
| 397 | * @pcm_formats: Output (for decoders) or input (for encoders) |
| 398 | * PCM formats (required to accel mode, 0 for other modes) |
| 399 | * @u_space: union space (for codec dependent data) |
| 400 | * @reserved: reserved for future use |
| 401 | * |
| 402 | * This structure provides a scalar value for profiles, modes and stream |
| 403 | * format fields. |
| 404 | * If an implementation supports multiple combinations, they will be listed as |
| 405 | * codecs with different descriptors, for example there would be 2 descriptors |
| 406 | * for AAC-RAW and AAC-ADTS. |
| 407 | * This entails some redundancy but makes it easier to avoid invalid |
| 408 | * configurations. |
| 409 | * |
| 410 | */ |
| 411 | |
| 412 | struct snd_codec_desc { |
| 413 | __u32 max_ch; |
| 414 | __u32 sample_rates[MAX_NUM_SAMPLE_RATES]; |
| 415 | __u32 num_sample_rates; |
| 416 | __u32 bit_rate[MAX_NUM_BITRATES]; |
| 417 | __u32 num_bitrates; |
| 418 | __u32 rate_control; |
| 419 | __u32 profiles; |
| 420 | __u32 modes; |
| 421 | __u32 formats; |
| 422 | __u32 min_buffer; |
| 423 | __u32 pcm_formats; |
| 424 | union { |
| 425 | __u32 u_space[6]; |
| 426 | struct snd_codec_desc_src src; |
| 427 | } __attribute__((packed, aligned(4))); |
| 428 | __u32 reserved[8]; |
| 429 | } __attribute__((packed, aligned(4))); |
| 430 | |
| 431 | /** struct snd_codec |
| 432 | * @id: Identifies the supported audio encoder/decoder. |
| 433 | * See SND_AUDIOCODEC macros. |
| 434 | * @ch_in: Number of input audio channels |
| 435 | * @ch_out: Number of output channels. In case of contradiction between |
| 436 | * this field and the channelMode field, the channelMode field |
| 437 | * overrides. |
| 438 | * @sample_rate: Audio sample rate of input data in Hz, use values like 48000 |
| 439 | * for this. |
| 440 | * @bit_rate: Bitrate of encoded data. May be ignored by decoders |
| 441 | * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines. |
| 442 | * Encoders may rely on profiles for quality levels. |
| 443 | * May be ignored by decoders. |
| 444 | * @profile: Mandatory for encoders, can be mandatory for specific |
| 445 | * decoders as well. See SND_AUDIOPROFILE defines. |
| 446 | * @level: Supported level (Only used by WMA at the moment) |
| 447 | * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines |
| 448 | * @format: Format of encoded bistream. Mandatory when defined. |
| 449 | * See SND_AUDIOSTREAMFORMAT defines. |
| 450 | * @align: Block alignment in bytes of an audio sample. |
| 451 | * Only required for PCM or IEC formats. |
| 452 | * @options: encoder-specific settings |
| 453 | * @pcm_format: Output (for decoders) or input (for encoders) |
| 454 | * PCM formats (required to accel mode, 0 for other modes) |
| 455 | * @reserved: reserved for future use |
| 456 | */ |
| 457 | |
| 458 | struct snd_codec { |
| 459 | __u32 id; |
| 460 | __u32 ch_in; |
| 461 | __u32 ch_out; |
| 462 | __u32 sample_rate; |
| 463 | __u32 bit_rate; |
| 464 | __u32 rate_control; |
| 465 | __u32 profile; |
| 466 | __u32 level; |
| 467 | __u32 ch_mode; |
| 468 | __u32 format; |
| 469 | __u32 align; |
| 470 | union snd_codec_options options; |
| 471 | __u32 pcm_format; |
| 472 | __u32 reserved[2]; |
| 473 | } __attribute__((packed, aligned(4))); |
| 474 | |
| 475 | #endif |
| 476 | |