162306a36Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) AND MIT) */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * compress_params.h - codec types and parameters for compressed data 462306a36Sopenharmony_ci * streaming interface 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright (C) 2011 Intel Corporation 762306a36Sopenharmony_ci * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 862306a36Sopenharmony_ci * Vinod Koul <vinod.koul@linux.intel.com> 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1162306a36Sopenharmony_ci * 1262306a36Sopenharmony_ci * The definitions in this file are derived from the OpenMAX AL version 1.1 1362306a36Sopenharmony_ci * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below 1462306a36Sopenharmony_ci * and are licensed under the MIT license. 1562306a36Sopenharmony_ci * 1662306a36Sopenharmony_ci * Copyright (c) 2007-2010 The Khronos Group Inc. 1762306a36Sopenharmony_ci */ 1862306a36Sopenharmony_ci#ifndef __SND_COMPRESS_PARAMS_H 1962306a36Sopenharmony_ci#define __SND_COMPRESS_PARAMS_H 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#include <linux/types.h> 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci/* AUDIO CODECS SUPPORTED */ 2462306a36Sopenharmony_ci#define MAX_NUM_CODECS 32 2562306a36Sopenharmony_ci#define MAX_NUM_CODEC_DESCRIPTORS 32 2662306a36Sopenharmony_ci#define MAX_NUM_BITRATES 32 2762306a36Sopenharmony_ci#define MAX_NUM_SAMPLE_RATES 32 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* Codecs are listed linearly to allow for extensibility */ 3062306a36Sopenharmony_ci#define SND_AUDIOCODEC_PCM ((__u32) 0x00000001) 3162306a36Sopenharmony_ci#define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002) 3262306a36Sopenharmony_ci#define SND_AUDIOCODEC_AMR ((__u32) 0x00000003) 3362306a36Sopenharmony_ci#define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004) 3462306a36Sopenharmony_ci#define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005) 3562306a36Sopenharmony_ci#define SND_AUDIOCODEC_AAC ((__u32) 0x00000006) 3662306a36Sopenharmony_ci#define SND_AUDIOCODEC_WMA ((__u32) 0x00000007) 3762306a36Sopenharmony_ci#define SND_AUDIOCODEC_REAL ((__u32) 0x00000008) 3862306a36Sopenharmony_ci#define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009) 3962306a36Sopenharmony_ci#define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A) 4062306a36Sopenharmony_ci#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) 4162306a36Sopenharmony_ci#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) 4262306a36Sopenharmony_ci#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) 4362306a36Sopenharmony_ci#define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E) 4462306a36Sopenharmony_ci#define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F) 4562306a36Sopenharmony_ci#define SND_AUDIOCODEC_APE ((__u32) 0x00000010) 4662306a36Sopenharmony_ci#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_APE 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/* 4962306a36Sopenharmony_ci * Profile and modes are listed with bit masks. This allows for a 5062306a36Sopenharmony_ci * more compact representation of fields that will not evolve 5162306a36Sopenharmony_ci * (in contrast to the list of codecs) 5262306a36Sopenharmony_ci */ 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001) 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci/* MP3 modes are only useful for encoders */ 5762306a36Sopenharmony_ci#define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001) 5862306a36Sopenharmony_ci#define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002) 5962306a36Sopenharmony_ci#define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004) 6062306a36Sopenharmony_ci#define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008) 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci#define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci/* AMR modes are only useful for encoders */ 6562306a36Sopenharmony_ci#define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001) 6662306a36Sopenharmony_ci#define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002) 6762306a36Sopenharmony_ci#define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004) 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000) 7062306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001) 7162306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002) 7262306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004) 7362306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008) 7462306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010) 7562306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020) 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci#define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001) 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci/* AMRWB modes are only useful for encoders */ 8062306a36Sopenharmony_ci#define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001) 8162306a36Sopenharmony_ci#define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002) 8262306a36Sopenharmony_ci#define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004) 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001) 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001) 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci/* AAC modes are required for encoders and decoders */ 8962306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001) 9062306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002) 9162306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004) 9262306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008) 9362306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010) 9462306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020) 9562306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040) 9662306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080) 9762306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100) 9862306a36Sopenharmony_ci#define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200) 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci/* AAC formats are required for encoders and decoders */ 10162306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001) 10262306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002) 10362306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004) 10462306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008) 10562306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010) 10662306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020) 10762306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040) 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci#define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001) 11062306a36Sopenharmony_ci#define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002) 11162306a36Sopenharmony_ci#define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004) 11262306a36Sopenharmony_ci#define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008) 11362306a36Sopenharmony_ci#define SND_AUDIOPROFILE_WMA9_PRO ((__u32) 0x00000010) 11462306a36Sopenharmony_ci#define SND_AUDIOPROFILE_WMA9_LOSSLESS ((__u32) 0x00000020) 11562306a36Sopenharmony_ci#define SND_AUDIOPROFILE_WMA10_LOSSLESS ((__u32) 0x00000040) 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001) 11862306a36Sopenharmony_ci#define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002) 11962306a36Sopenharmony_ci#define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004) 12062306a36Sopenharmony_ci#define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008) 12162306a36Sopenharmony_ci#define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010) 12262306a36Sopenharmony_ci#define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020) 12362306a36Sopenharmony_ci#define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040) 12462306a36Sopenharmony_ci#define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080) 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001) 12762306a36Sopenharmony_ci/* 12862306a36Sopenharmony_ci * Some implementations strip the ASF header and only send ASF packets 12962306a36Sopenharmony_ci * to the DSP 13062306a36Sopenharmony_ci */ 13162306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002) 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci#define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001) 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci#define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001) 13662306a36Sopenharmony_ci#define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002) 13762306a36Sopenharmony_ci#define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004) 13862306a36Sopenharmony_ci#define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008) 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001) 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci#define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001) 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci#define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001) 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci/* 14762306a36Sopenharmony_ci * Define quality levels for FLAC encoders, from LEVEL0 (fast) 14862306a36Sopenharmony_ci * to LEVEL8 (best) 14962306a36Sopenharmony_ci */ 15062306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001) 15162306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002) 15262306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004) 15362306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008) 15462306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010) 15562306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020) 15662306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040) 15762306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080) 15862306a36Sopenharmony_ci#define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100) 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001) 16162306a36Sopenharmony_ci#define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002) 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci/* IEC61937 payloads without CUVP and preambles */ 16462306a36Sopenharmony_ci#define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001) 16562306a36Sopenharmony_ci/* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */ 16662306a36Sopenharmony_ci#define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002) 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci/* 16962306a36Sopenharmony_ci * IEC modes are mandatory for decoders. Format autodetection 17062306a36Sopenharmony_ci * will only happen on the DSP side with mode 0. The PCM mode should 17162306a36Sopenharmony_ci * not be used, the PCM codec should be used instead. 17262306a36Sopenharmony_ci */ 17362306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000) 17462306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001) 17562306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002) 17662306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004) 17762306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008) 17862306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010) 17962306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020) 18062306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040) 18162306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080) 18262306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100) 18362306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200) 18462306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400) 18562306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800) 18662306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000) 18762306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000) 18862306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000) 18962306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000) 19062306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000) 19162306a36Sopenharmony_ci#define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000) 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci#define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001) 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci#define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001) 19662306a36Sopenharmony_ci#define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002) 19762306a36Sopenharmony_ci#define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004) 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci#define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001) 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci#define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001) 20262306a36Sopenharmony_ci#define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002) 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci/* <FIXME: multichannel encoders aren't supported for now. Would need 20562306a36Sopenharmony_ci an additional definition of channel arrangement> */ 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci/* VBR/CBR definitions */ 20862306a36Sopenharmony_ci#define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001) 20962306a36Sopenharmony_ci#define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002) 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci/* Encoder options */ 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_cistruct snd_enc_wma { 21462306a36Sopenharmony_ci __u32 super_block_align; /* WMA Type-specific data */ 21562306a36Sopenharmony_ci}; 21662306a36Sopenharmony_ci 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci/** 21962306a36Sopenharmony_ci * struct snd_enc_vorbis - Vorbis encoder parameters 22062306a36Sopenharmony_ci * @quality: Sets encoding quality to n, between -1 (low) and 10 (high). 22162306a36Sopenharmony_ci * In the default mode of operation, the quality level is 3. 22262306a36Sopenharmony_ci * Normal quality range is 0 - 10. 22362306a36Sopenharmony_ci * @managed: Boolean. Set bitrate management mode. This turns off the 22462306a36Sopenharmony_ci * normal VBR encoding, but allows hard or soft bitrate constraints to be 22562306a36Sopenharmony_ci * enforced by the encoder. This mode can be slower, and may also be 22662306a36Sopenharmony_ci * lower quality. It is primarily useful for streaming. 22762306a36Sopenharmony_ci * @max_bit_rate: Enabled only if managed is TRUE 22862306a36Sopenharmony_ci * @min_bit_rate: Enabled only if managed is TRUE 22962306a36Sopenharmony_ci * @downmix: Boolean. Downmix input from stereo to mono (has no effect on 23062306a36Sopenharmony_ci * non-stereo streams). Useful for lower-bitrate encoding. 23162306a36Sopenharmony_ci * 23262306a36Sopenharmony_ci * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc 23362306a36Sopenharmony_ci * properties 23462306a36Sopenharmony_ci * 23562306a36Sopenharmony_ci * For best quality users should specify VBR mode and set quality levels. 23662306a36Sopenharmony_ci */ 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_cistruct snd_enc_vorbis { 23962306a36Sopenharmony_ci __s32 quality; 24062306a36Sopenharmony_ci __u32 managed; 24162306a36Sopenharmony_ci __u32 max_bit_rate; 24262306a36Sopenharmony_ci __u32 min_bit_rate; 24362306a36Sopenharmony_ci __u32 downmix; 24462306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci/** 24862306a36Sopenharmony_ci * struct snd_enc_real - RealAudio encoder parameters 24962306a36Sopenharmony_ci * @quant_bits: number of coupling quantization bits in the stream 25062306a36Sopenharmony_ci * @start_region: coupling start region in the stream 25162306a36Sopenharmony_ci * @num_regions: number of regions value 25262306a36Sopenharmony_ci * 25362306a36Sopenharmony_ci * These options were extracted from the OpenMAX IL spec 25462306a36Sopenharmony_ci */ 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_cistruct snd_enc_real { 25762306a36Sopenharmony_ci __u32 quant_bits; 25862306a36Sopenharmony_ci __u32 start_region; 25962306a36Sopenharmony_ci __u32 num_regions; 26062306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci/** 26362306a36Sopenharmony_ci * struct snd_enc_flac - FLAC encoder parameters 26462306a36Sopenharmony_ci * @num: serial number, valid only for OGG formats 26562306a36Sopenharmony_ci * needs to be set by application 26662306a36Sopenharmony_ci * @gain: Add replay gain tags 26762306a36Sopenharmony_ci * 26862306a36Sopenharmony_ci * These options were extracted from the FLAC online documentation 26962306a36Sopenharmony_ci * at http://flac.sourceforge.net/documentation_tools_flac.html 27062306a36Sopenharmony_ci * 27162306a36Sopenharmony_ci * To make the API simpler, it is assumed that the user will select quality 27262306a36Sopenharmony_ci * profiles. Additional options that affect encoding quality and speed can 27362306a36Sopenharmony_ci * be added at a later stage if needed. 27462306a36Sopenharmony_ci * 27562306a36Sopenharmony_ci * By default the Subset format is used by encoders. 27662306a36Sopenharmony_ci * 27762306a36Sopenharmony_ci * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are 27862306a36Sopenharmony_ci * not supported in this API. 27962306a36Sopenharmony_ci */ 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_cistruct snd_enc_flac { 28262306a36Sopenharmony_ci __u32 num; 28362306a36Sopenharmony_ci __u32 gain; 28462306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_cistruct snd_enc_generic { 28762306a36Sopenharmony_ci __u32 bw; /* encoder bandwidth */ 28862306a36Sopenharmony_ci __s32 reserved[15]; /* Can be used for SND_AUDIOCODEC_BESPOKE */ 28962306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_cistruct snd_dec_flac { 29262306a36Sopenharmony_ci __u16 sample_size; 29362306a36Sopenharmony_ci __u16 min_blk_size; 29462306a36Sopenharmony_ci __u16 max_blk_size; 29562306a36Sopenharmony_ci __u16 min_frame_size; 29662306a36Sopenharmony_ci __u16 max_frame_size; 29762306a36Sopenharmony_ci __u16 reserved; 29862306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_cistruct snd_dec_wma { 30162306a36Sopenharmony_ci __u32 encoder_option; 30262306a36Sopenharmony_ci __u32 adv_encoder_option; 30362306a36Sopenharmony_ci __u32 adv_encoder_option2; 30462306a36Sopenharmony_ci __u32 reserved; 30562306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_cistruct snd_dec_alac { 30862306a36Sopenharmony_ci __u32 frame_length; 30962306a36Sopenharmony_ci __u8 compatible_version; 31062306a36Sopenharmony_ci __u8 pb; 31162306a36Sopenharmony_ci __u8 mb; 31262306a36Sopenharmony_ci __u8 kb; 31362306a36Sopenharmony_ci __u32 max_run; 31462306a36Sopenharmony_ci __u32 max_frame_bytes; 31562306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_cistruct snd_dec_ape { 31862306a36Sopenharmony_ci __u16 compatible_version; 31962306a36Sopenharmony_ci __u16 compression_level; 32062306a36Sopenharmony_ci __u32 format_flags; 32162306a36Sopenharmony_ci __u32 blocks_per_frame; 32262306a36Sopenharmony_ci __u32 final_frame_blocks; 32362306a36Sopenharmony_ci __u32 total_frames; 32462306a36Sopenharmony_ci __u32 seek_table_present; 32562306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ciunion snd_codec_options { 32862306a36Sopenharmony_ci struct snd_enc_wma wma; 32962306a36Sopenharmony_ci struct snd_enc_vorbis vorbis; 33062306a36Sopenharmony_ci struct snd_enc_real real; 33162306a36Sopenharmony_ci struct snd_enc_flac flac; 33262306a36Sopenharmony_ci struct snd_enc_generic generic; 33362306a36Sopenharmony_ci struct snd_dec_flac flac_d; 33462306a36Sopenharmony_ci struct snd_dec_wma wma_d; 33562306a36Sopenharmony_ci struct snd_dec_alac alac_d; 33662306a36Sopenharmony_ci struct snd_dec_ape ape_d; 33762306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci/** struct snd_codec_desc - description of codec capabilities 34062306a36Sopenharmony_ci * @max_ch: Maximum number of audio channels 34162306a36Sopenharmony_ci * @sample_rates: Sampling rates in Hz, use values like 48000 for this 34262306a36Sopenharmony_ci * @num_sample_rates: Number of valid values in sample_rates array 34362306a36Sopenharmony_ci * @bit_rate: Indexed array containing supported bit rates 34462306a36Sopenharmony_ci * @num_bitrates: Number of valid values in bit_rate array 34562306a36Sopenharmony_ci * @rate_control: value is specified by SND_RATECONTROLMODE defines. 34662306a36Sopenharmony_ci * @profiles: Supported profiles. See SND_AUDIOPROFILE defines. 34762306a36Sopenharmony_ci * @modes: Supported modes. See SND_AUDIOMODE defines 34862306a36Sopenharmony_ci * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines 34962306a36Sopenharmony_ci * @min_buffer: Minimum buffer size handled by codec implementation 35062306a36Sopenharmony_ci * @reserved: reserved for future use 35162306a36Sopenharmony_ci * 35262306a36Sopenharmony_ci * This structure provides a scalar value for profiles, modes and stream 35362306a36Sopenharmony_ci * format fields. 35462306a36Sopenharmony_ci * If an implementation supports multiple combinations, they will be listed as 35562306a36Sopenharmony_ci * codecs with different descriptors, for example there would be 2 descriptors 35662306a36Sopenharmony_ci * for AAC-RAW and AAC-ADTS. 35762306a36Sopenharmony_ci * This entails some redundancy but makes it easier to avoid invalid 35862306a36Sopenharmony_ci * configurations. 35962306a36Sopenharmony_ci * 36062306a36Sopenharmony_ci */ 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_cistruct snd_codec_desc { 36362306a36Sopenharmony_ci __u32 max_ch; 36462306a36Sopenharmony_ci __u32 sample_rates[MAX_NUM_SAMPLE_RATES]; 36562306a36Sopenharmony_ci __u32 num_sample_rates; 36662306a36Sopenharmony_ci __u32 bit_rate[MAX_NUM_BITRATES]; 36762306a36Sopenharmony_ci __u32 num_bitrates; 36862306a36Sopenharmony_ci __u32 rate_control; 36962306a36Sopenharmony_ci __u32 profiles; 37062306a36Sopenharmony_ci __u32 modes; 37162306a36Sopenharmony_ci __u32 formats; 37262306a36Sopenharmony_ci __u32 min_buffer; 37362306a36Sopenharmony_ci __u32 reserved[15]; 37462306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 37562306a36Sopenharmony_ci 37662306a36Sopenharmony_ci/** struct snd_codec 37762306a36Sopenharmony_ci * @id: Identifies the supported audio encoder/decoder. 37862306a36Sopenharmony_ci * See SND_AUDIOCODEC macros. 37962306a36Sopenharmony_ci * @ch_in: Number of input audio channels 38062306a36Sopenharmony_ci * @ch_out: Number of output channels. In case of contradiction between 38162306a36Sopenharmony_ci * this field and the channelMode field, the channelMode field 38262306a36Sopenharmony_ci * overrides. 38362306a36Sopenharmony_ci * @sample_rate: Audio sample rate of input data in Hz, use values like 48000 38462306a36Sopenharmony_ci * for this. 38562306a36Sopenharmony_ci * @bit_rate: Bitrate of encoded data. May be ignored by decoders 38662306a36Sopenharmony_ci * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines. 38762306a36Sopenharmony_ci * Encoders may rely on profiles for quality levels. 38862306a36Sopenharmony_ci * May be ignored by decoders. 38962306a36Sopenharmony_ci * @profile: Mandatory for encoders, can be mandatory for specific 39062306a36Sopenharmony_ci * decoders as well. See SND_AUDIOPROFILE defines. 39162306a36Sopenharmony_ci * @level: Supported level (Only used by WMA at the moment) 39262306a36Sopenharmony_ci * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines 39362306a36Sopenharmony_ci * @format: Format of encoded bistream. Mandatory when defined. 39462306a36Sopenharmony_ci * See SND_AUDIOSTREAMFORMAT defines. 39562306a36Sopenharmony_ci * @align: Block alignment in bytes of an audio sample. 39662306a36Sopenharmony_ci * Only required for PCM or IEC formats. 39762306a36Sopenharmony_ci * @options: encoder-specific settings 39862306a36Sopenharmony_ci * @reserved: reserved for future use 39962306a36Sopenharmony_ci */ 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_cistruct snd_codec { 40262306a36Sopenharmony_ci __u32 id; 40362306a36Sopenharmony_ci __u32 ch_in; 40462306a36Sopenharmony_ci __u32 ch_out; 40562306a36Sopenharmony_ci __u32 sample_rate; 40662306a36Sopenharmony_ci __u32 bit_rate; 40762306a36Sopenharmony_ci __u32 rate_control; 40862306a36Sopenharmony_ci __u32 profile; 40962306a36Sopenharmony_ci __u32 level; 41062306a36Sopenharmony_ci __u32 ch_mode; 41162306a36Sopenharmony_ci __u32 format; 41262306a36Sopenharmony_ci __u32 align; 41362306a36Sopenharmony_ci union snd_codec_options options; 41462306a36Sopenharmony_ci __u32 reserved[3]; 41562306a36Sopenharmony_ci} __attribute__((packed, aligned(4))); 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ci#endif 418