compress_params.h 18 KB

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