1 /* 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 54 #include <linux/types.h> 55 56 #define SND_DEC_DDP_MAX_PARAMS 18 57 58 /* AUDIO CODECS SUPPORTED */ 59 #define MAX_NUM_CODECS 32 60 #define MAX_NUM_CODEC_DESCRIPTORS 32 61 #define MAX_NUM_BITRATES 32 62 #define MAX_NUM_SAMPLE_RATES 32 63 64 /* compressed TX */ 65 #define MAX_NUM_FRAMES_PER_BUFFER 1 66 #define COMPRESSED_META_DATA_MODE 0x10 67 #define META_DATA_LEN_BYTES 36 68 #define Q6_AC3_DECODER 0x00010BF6 69 #define Q6_EAC3_DECODER 0x00010C3C 70 #define Q6_DTS 0x00010D88 71 #define Q6_DTS_LBR 0x00010DBB 72 73 /* Timestamp flsg */ 74 /* Bit-0 - 1 : Enable Timestamp mode */ 75 /* Bit-0 - 0 : Disable Timestamp mode */ 76 #define COMPRESSED_TIMESTAMP_FLAG 0x0001 77 78 /* Codecs are listed linearly to allow for extensibility */ 79 #define SND_AUDIOCODEC_PCM ((__u32) 0x00000001) 80 #define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002) 81 #define SND_AUDIOCODEC_AMR ((__u32) 0x00000003) 82 #define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004) 83 #define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005) 84 #define SND_AUDIOCODEC_AAC ((__u32) 0x00000006) 85 #define SND_AUDIOCODEC_WMA ((__u32) 0x00000007) 86 #define SND_AUDIOCODEC_REAL ((__u32) 0x00000008) 87 #define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009) 88 #define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A) 89 #define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) 90 #define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) 91 #define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) 92 #define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E) 93 #define SND_AUDIOCODEC_DTS_PASS_THROUGH ((__u32) 0x0000000F) 94 #define SND_AUDIOCODEC_DTS_LBR ((__u32) 0x00000010) 95 #define SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK ((__u32) 0x00000011) 96 #define SND_AUDIOCODEC_PASS_THROUGH ((__u32) 0x00000012) 97 #define SND_AUDIOCODEC_MP2 ((__u32) 0x00000013) 98 #define SND_AUDIOCODEC_DTS_LBR_PASS_THROUGH ((__u32) 0x00000014) 99 #define SND_AUDIOCODEC_AC3 ((__u32) 0x00000015) 100 #define SND_AUDIOCODEC_AC3_PASS_THROUGH ((__u32) 0x00000016) 101 #define SND_AUDIOCODEC_WMA_PRO ((__u32) 0x00000017) 102 #define SND_AUDIOCODEC_DTS ((__u32) 0x00000018) 103 #define SND_AUDIOCODEC_EAC3 ((__u32) 0x00000019) 104 #define SND_AUDIOCODEC_ALAC ((__u32) 0x00000020) 105 #define SND_AUDIOCODEC_APE ((__u32) 0x00000021) 106 #define SND_AUDIOCODEC_DSD ((__u32) 0x00000022) 107 #define SND_AUDIOCODEC_APTX ((__u32) 0x00000023) 108 #define SND_AUDIOCODEC_TRUEHD ((__u32) 0x00000024) 109 #define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_TRUEHD 110 111 /* 112 * Profile and modes are listed with bit masks. This allows for a 113 * more compact representation of fields that will not evolve 114 * (in contrast to the list of codecs) 115 */ 116 117 #define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001) 118 119 /* MP3 modes are only useful for encoders */ 120 #define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001) 121 #define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002) 122 #define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004) 123 #define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008) 124 125 #define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001) 126 127 /* AMR modes are only useful for encoders */ 128 #define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001) 129 #define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002) 130 #define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004) 131 132 #define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000) 133 #define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001) 134 #define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002) 135 #define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004) 136 #define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008) 137 #define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010) 138 #define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020) 139 140 #define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001) 141 142 /* AMRWB modes are only useful for encoders */ 143 #define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001) 144 #define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002) 145 #define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004) 146 147 #define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001) 148 149 #define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001) 150 151 /* AAC modes are required for encoders and decoders */ 152 #define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001) 153 #define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002) 154 #define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004) 155 #define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008) 156 #define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010) 157 #define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020) 158 #define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040) 159 #define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080) 160 #define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100) 161 #define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200) 162 163 /* AAC formats are required for encoders and decoders */ 164 #define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001) 165 #define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002) 166 #define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004) 167 #define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008) 168 #define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010) 169 #define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020) 170 #define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040) 171 172 #define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001) 173 #define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002) 174 #define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004) 175 #define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008) 176 177 #define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001) 178 #define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002) 179 #define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004) 180 #define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008) 181 #define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010) 182 #define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020) 183 #define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040) 184 #define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080) 185 186 #define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001) 187 /* 188 * Some implementations strip the ASF header and only send ASF packets 189 * to the DSP 190 */ 191 #define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002) 192 193 #define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001) 194 195 #define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001) 196 #define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002) 197 #define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004) 198 #define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008) 199 200 #define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001) 201 202 #define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001) 203 204 #define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001) 205 206 /* 207 * Define quality levels for FLAC encoders, from LEVEL0 (fast) 208 * to LEVEL8 (best) 209 */ 210 #define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001) 211 #define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002) 212 #define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004) 213 #define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008) 214 #define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010) 215 #define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020) 216 #define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040) 217 #define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080) 218 #define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100) 219 220 #define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001) 221 #define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002) 222 223 /* IEC61937 payloads without CUVP and preambles */ 224 #define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001) 225 /* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */ 226 #define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002) 227 228 /* 229 * IEC modes are mandatory for decoders. Format autodetection 230 * will only happen on the DSP side with mode 0. The PCM mode should 231 * not be used, the PCM codec should be used instead. 232 */ 233 #define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000) 234 #define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001) 235 #define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002) 236 #define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004) 237 #define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008) 238 #define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010) 239 #define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020) 240 #define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040) 241 #define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080) 242 #define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100) 243 #define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200) 244 #define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400) 245 #define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800) 246 #define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000) 247 #define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000) 248 #define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000) 249 #define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000) 250 #define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000) 251 #define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000) 252 253 #define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001) 254 255 #define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001) 256 #define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002) 257 #define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004) 258 259 #define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001) 260 261 #define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001) 262 #define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002) 263 264 /* <FIXME: multichannel encoders aren't supported for now. Would need 265 an additional definition of channel arrangement> */ 266 267 /* VBR/CBR definitions */ 268 #define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001) 269 #define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002) 270 271 /* Encoder options */ 272 273 struct snd_enc_wma { 274 __u32 super_block_align; /* WMA Type-specific data */ 275 __u32 bits_per_sample; 276 __u32 channelmask; 277 __u32 encodeopt; 278 __u32 encodeopt1; 279 __u32 encodeopt2; 280 __u32 avg_bit_rate; 281 }; 282 283 284 /** 285 * struct snd_enc_vorbis 286 * @quality: Sets encoding quality to n, between -1 (low) and 10 (high). 287 * In the default mode of operation, the quality level is 3. 288 * Normal quality range is 0 - 10. 289 * @managed: Boolean. Set bitrate management mode. This turns off the 290 * normal VBR encoding, but allows hard or soft bitrate constraints to be 291 * enforced by the encoder. This mode can be slower, and may also be 292 * lower quality. It is primarily useful for streaming. 293 * @max_bit_rate: Enabled only if managed is TRUE 294 * @min_bit_rate: Enabled only if managed is TRUE 295 * @downmix: Boolean. Downmix input from stereo to mono (has no effect on 296 * non-stereo streams). Useful for lower-bitrate encoding. 297 * 298 * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc 299 * properties 300 * 301 * For best quality users should specify VBR mode and set quality levels. 302 */ 303 304 struct snd_enc_vorbis { 305 __s32 quality; 306 __u32 managed; 307 __u32 max_bit_rate; 308 __u32 min_bit_rate; 309 __u32 downmix; 310 } __attribute__((packed, aligned(4))); 311 312 313 /** 314 * struct snd_enc_real 315 * @quant_bits: number of coupling quantization bits in the stream 316 * @start_region: coupling start region in the stream 317 * @num_regions: number of regions value 318 * 319 * These options were extracted from the OpenMAX IL spec 320 */ 321 322 struct snd_enc_real { 323 __u32 quant_bits; 324 __u32 start_region; 325 __u32 num_regions; 326 } __attribute__((packed, aligned(4))); 327 328 /** 329 * struct snd_enc_flac 330 * @num: serial number, valid only for OGG formats 331 * needs to be set by application 332 * @gain: Add replay gain tags 333 * 334 * These options were extracted from the FLAC online documentation 335 * at http://flac.sourceforge.net/documentation_tools_flac.html 336 * 337 * To make the API simpler, it is assumed that the user will select quality 338 * profiles. Additional options that affect encoding quality and speed can 339 * be added at a later stage if needed. 340 * 341 * By default the Subset format is used by encoders. 342 * 343 * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are 344 * not supported in this API. 345 */ 346 347 struct snd_enc_flac { 348 __u32 num; 349 __u32 gain; 350 } __attribute__((packed, aligned(4))); 351 352 struct snd_enc_generic { 353 __u32 bw; /* encoder bandwidth */ 354 __s32 reserved[15]; /* Can be used for SND_AUDIOCODEC_BESPOKE */ 355 } __attribute__((packed, aligned(4))); 356 357 struct snd_dec_ddp { 358 __u32 params_length; 359 __u32 params_id[SND_DEC_DDP_MAX_PARAMS]; 360 __u32 params_value[SND_DEC_DDP_MAX_PARAMS]; 361 } __attribute__((packed, aligned(4))); 362 363 struct snd_dec_flac { 364 __u16 sample_size; 365 __u16 min_blk_size; 366 __u16 max_blk_size; 367 __u16 min_frame_size; 368 __u16 max_frame_size; 369 } __attribute__((packed, aligned(4))); 370 371 struct snd_dec_vorbis { 372 __u32 bit_stream_fmt; 373 }; 374 375 struct snd_dec_alac { 376 __u32 frame_length; 377 __u8 compatible_version; 378 __u8 bit_depth; 379 __u8 pb; 380 __u8 mb; 381 __u8 kb; 382 __u8 num_channels; 383 __u16 max_run; 384 __u32 max_frame_bytes; 385 __u32 avg_bit_rate; 386 __u32 sample_rate; 387 __u32 channel_layout_tag; 388 }; 389 390 struct snd_dec_ape { 391 __u16 compatible_version; 392 __u16 compression_level; 393 __u32 format_flags; 394 __u32 blocks_per_frame; 395 __u32 final_frame_blocks; 396 __u32 total_frames; 397 __u16 bits_per_sample; 398 __u16 num_channels; 399 __u32 sample_rate; 400 __u32 seek_table_present; 401 }; 402 403 struct snd_dec_aptx { 404 __u32 lap; 405 __u32 uap; 406 __u32 nap; 407 }; 408 409 union snd_codec_options { 410 struct snd_enc_wma wma; 411 struct snd_enc_vorbis vorbis; 412 struct snd_enc_real real; 413 struct snd_enc_flac flac; 414 struct snd_enc_generic generic; 415 struct snd_dec_ddp ddp; 416 struct snd_dec_flac flac_dec; 417 struct snd_dec_vorbis vorbis_dec; 418 struct snd_dec_alac alac; 419 struct snd_dec_ape ape; 420 struct snd_dec_aptx aptx_dec; 421 }; 422 423 /** struct snd_codec_desc - description of codec capabilities 424 * @max_ch: Maximum number of audio channels 425 * @sample_rates: Sampling rates in Hz, use values like 48000 for this 426 * @num_sample_rates: Number of valid values in sample_rates array 427 * @bit_rate: Indexed array containing supported bit rates 428 * @num_bitrates: Number of valid values in bit_rate array 429 * @rate_control: value is specified by SND_RATECONTROLMODE defines. 430 * @profiles: Supported profiles. See SND_AUDIOPROFILE defines. 431 * @modes: Supported modes. See SND_AUDIOMODE defines 432 * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines 433 * @min_buffer: Minimum buffer size handled by codec implementation 434 * @reserved: reserved for future use 435 * 436 * This structure provides a scalar value for profiles, modes and stream 437 * format fields. 438 * If an implementation supports multiple combinations, they will be listed as 439 * codecs with different descriptors, for example there would be 2 descriptors 440 * for AAC-RAW and AAC-ADTS. 441 * This entails some redundancy but makes it easier to avoid invalid 442 * configurations. 443 * 444 */ 445 446 struct snd_codec_desc { 447 __u32 max_ch; 448 __u32 sample_rates[MAX_NUM_SAMPLE_RATES]; 449 __u32 num_sample_rates; 450 __u32 bit_rate[MAX_NUM_BITRATES]; 451 __u32 num_bitrates; 452 __u32 rate_control; 453 __u32 profiles; 454 __u32 modes; 455 __u32 formats; 456 __u32 min_buffer; 457 __u32 reserved[15]; 458 } __attribute__((packed, aligned(4))); 459 460 /** struct snd_codec 461 * @id: Identifies the supported audio encoder/decoder. 462 * See SND_AUDIOCODEC macros. 463 * @ch_in: Number of input audio channels 464 * @ch_out: Number of output channels. In case of contradiction between 465 * this field and the channelMode field, the channelMode field 466 * overrides. 467 * @sample_rate: Audio sample rate of input data in Hz, use values like 48000 468 * for this. 469 * @bit_rate: Bitrate of encoded data. May be ignored by decoders 470 * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines. 471 * Encoders may rely on profiles for quality levels. 472 * May be ignored by decoders. 473 * @profile: Mandatory for encoders, can be mandatory for specific 474 * decoders as well. See SND_AUDIOPROFILE defines. 475 * @level: Supported level (Only used by WMA at the moment) 476 * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines 477 * @format: Format of encoded bistream. Mandatory when defined. 478 * See SND_AUDIOSTREAMFORMAT defines. 479 * @align: Block alignment in bytes of an audio sample. 480 * Only required for PCM or IEC formats. 481 * @options: encoder-specific settings 482 * @reserved: reserved for future use 483 */ 484 485 struct snd_codec { 486 __u32 id; 487 __u32 ch_in; 488 __u32 ch_out; 489 __u32 sample_rate; 490 __u32 bit_rate; 491 __u32 rate_control; 492 __u32 profile; 493 __u32 level; 494 __u32 ch_mode; 495 __u32 format; 496 __u32 align; 497 __u32 compr_passthr; 498 union snd_codec_options options; 499 __u32 flags; 500 __u32 reserved[2]; 501 } __attribute__((packed, aligned(4))); 502 503 504 /** struct snd_codec_metadata 505 * @length: Length of the encoded buffer. 506 * @offset: Offset from the buffer address to the first byte of the first 507 * encoded frame. All encoded frames are consecutive starting 508 * from this offset. 509 * @timestamp: Session time in microseconds of the first sample in the buffer. 510 * @reserved: Reserved for future use. 511 */ 512 struct snd_codec_metadata { 513 __u32 length; 514 __u32 offset; 515 __u64 timestamp; 516 __u32 reserved[4]; 517 }; 518 519 #endif 520