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