/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) AND MIT) */ /* * compress_params.h - codec types and parameters for compressed data * streaming interface * * Copyright (C) 2011 Intel Corporation * Authors: Pierre-Louis Bossart <[email protected]> * Vinod Koul <[email protected]> * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * The definitions in this file are derived from the OpenMAX AL version 1.1 * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below * and are licensed under the MIT license. * * Copyright (c) 2007-2010 The Khronos Group Inc. */ #ifndef __SND_COMPRESS_PARAMS_H #define __SND_COMPRESS_PARAMS_H #include <linux/types.h> /* AUDIO CODECS SUPPORTED */ #define MAX_NUM_CODECS … #define MAX_NUM_CODEC_DESCRIPTORS … #define MAX_NUM_BITRATES … #define MAX_NUM_SAMPLE_RATES … /* Codecs are listed linearly to allow for extensibility */ #define SND_AUDIOCODEC_PCM … #define SND_AUDIOCODEC_MP3 … #define SND_AUDIOCODEC_AMR … #define SND_AUDIOCODEC_AMRWB … #define SND_AUDIOCODEC_AMRWBPLUS … #define SND_AUDIOCODEC_AAC … #define SND_AUDIOCODEC_WMA … #define SND_AUDIOCODEC_REAL … #define SND_AUDIOCODEC_VORBIS … #define SND_AUDIOCODEC_FLAC … #define SND_AUDIOCODEC_IEC61937 … #define SND_AUDIOCODEC_G723_1 … #define SND_AUDIOCODEC_G729 … #define SND_AUDIOCODEC_BESPOKE … #define SND_AUDIOCODEC_ALAC … #define SND_AUDIOCODEC_APE … #define SND_AUDIOCODEC_MAX … /* * Profile and modes are listed with bit masks. This allows for a * more compact representation of fields that will not evolve * (in contrast to the list of codecs) */ #define SND_AUDIOPROFILE_PCM … /* MP3 modes are only useful for encoders */ #define SND_AUDIOCHANMODE_MP3_MONO … #define SND_AUDIOCHANMODE_MP3_STEREO … #define SND_AUDIOCHANMODE_MP3_JOINTSTEREO … #define SND_AUDIOCHANMODE_MP3_DUAL … #define SND_AUDIOPROFILE_AMR … /* AMR modes are only useful for encoders */ #define SND_AUDIOMODE_AMR_DTX_OFF … #define SND_AUDIOMODE_AMR_VAD1 … #define SND_AUDIOMODE_AMR_VAD2 … #define SND_AUDIOSTREAMFORMAT_UNDEFINED … #define SND_AUDIOSTREAMFORMAT_CONFORMANCE … #define SND_AUDIOSTREAMFORMAT_IF1 … #define SND_AUDIOSTREAMFORMAT_IF2 … #define SND_AUDIOSTREAMFORMAT_FSF … #define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD … #define SND_AUDIOSTREAMFORMAT_ITU … #define SND_AUDIOPROFILE_AMRWB … /* AMRWB modes are only useful for encoders */ #define SND_AUDIOMODE_AMRWB_DTX_OFF … #define SND_AUDIOMODE_AMRWB_VAD1 … #define SND_AUDIOMODE_AMRWB_VAD2 … #define SND_AUDIOPROFILE_AMRWBPLUS … #define SND_AUDIOPROFILE_AAC … /* AAC modes are required for encoders and decoders */ #define SND_AUDIOMODE_AAC_MAIN … #define SND_AUDIOMODE_AAC_LC … #define SND_AUDIOMODE_AAC_SSR … #define SND_AUDIOMODE_AAC_LTP … #define SND_AUDIOMODE_AAC_HE … #define SND_AUDIOMODE_AAC_SCALABLE … #define SND_AUDIOMODE_AAC_ERLC … #define SND_AUDIOMODE_AAC_LD … #define SND_AUDIOMODE_AAC_HE_PS … #define SND_AUDIOMODE_AAC_HE_MPS … /* AAC formats are required for encoders and decoders */ #define SND_AUDIOSTREAMFORMAT_MP2ADTS … #define SND_AUDIOSTREAMFORMAT_MP4ADTS … #define SND_AUDIOSTREAMFORMAT_MP4LOAS … #define SND_AUDIOSTREAMFORMAT_MP4LATM … #define SND_AUDIOSTREAMFORMAT_ADIF … #define SND_AUDIOSTREAMFORMAT_MP4FF … #define SND_AUDIOSTREAMFORMAT_RAW … #define SND_AUDIOPROFILE_WMA7 … #define SND_AUDIOPROFILE_WMA8 … #define SND_AUDIOPROFILE_WMA9 … #define SND_AUDIOPROFILE_WMA10 … #define SND_AUDIOPROFILE_WMA9_PRO … #define SND_AUDIOPROFILE_WMA9_LOSSLESS … #define SND_AUDIOPROFILE_WMA10_LOSSLESS … #define SND_AUDIOMODE_WMA_LEVEL1 … #define SND_AUDIOMODE_WMA_LEVEL2 … #define SND_AUDIOMODE_WMA_LEVEL3 … #define SND_AUDIOMODE_WMA_LEVEL4 … #define SND_AUDIOMODE_WMAPRO_LEVELM0 … #define SND_AUDIOMODE_WMAPRO_LEVELM1 … #define SND_AUDIOMODE_WMAPRO_LEVELM2 … #define SND_AUDIOMODE_WMAPRO_LEVELM3 … #define SND_AUDIOSTREAMFORMAT_WMA_ASF … /* * Some implementations strip the ASF header and only send ASF packets * to the DSP */ #define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR … #define SND_AUDIOPROFILE_REALAUDIO … #define SND_AUDIOMODE_REALAUDIO_G2 … #define SND_AUDIOMODE_REALAUDIO_8 … #define SND_AUDIOMODE_REALAUDIO_10 … #define SND_AUDIOMODE_REALAUDIO_SURROUND … #define SND_AUDIOPROFILE_VORBIS … #define SND_AUDIOMODE_VORBIS … #define SND_AUDIOPROFILE_FLAC … /* * Define quality levels for FLAC encoders, from LEVEL0 (fast) * to LEVEL8 (best) */ #define SND_AUDIOMODE_FLAC_LEVEL0 … #define SND_AUDIOMODE_FLAC_LEVEL1 … #define SND_AUDIOMODE_FLAC_LEVEL2 … #define SND_AUDIOMODE_FLAC_LEVEL3 … #define SND_AUDIOMODE_FLAC_LEVEL4 … #define SND_AUDIOMODE_FLAC_LEVEL5 … #define SND_AUDIOMODE_FLAC_LEVEL6 … #define SND_AUDIOMODE_FLAC_LEVEL7 … #define SND_AUDIOMODE_FLAC_LEVEL8 … #define SND_AUDIOSTREAMFORMAT_FLAC … #define SND_AUDIOSTREAMFORMAT_FLAC_OGG … /* IEC61937 payloads without CUVP and preambles */ #define SND_AUDIOPROFILE_IEC61937 … /* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */ #define SND_AUDIOPROFILE_IEC61937_SPDIF … /* * IEC modes are mandatory for decoders. Format autodetection * will only happen on the DSP side with mode 0. The PCM mode should * not be used, the PCM codec should be used instead. */ #define SND_AUDIOMODE_IEC_REF_STREAM_HEADER … #define SND_AUDIOMODE_IEC_LPCM … #define SND_AUDIOMODE_IEC_AC3 … #define SND_AUDIOMODE_IEC_MPEG1 … #define SND_AUDIOMODE_IEC_MP3 … #define SND_AUDIOMODE_IEC_MPEG2 … #define SND_AUDIOMODE_IEC_AACLC … #define SND_AUDIOMODE_IEC_DTS … #define SND_AUDIOMODE_IEC_ATRAC … #define SND_AUDIOMODE_IEC_SACD … #define SND_AUDIOMODE_IEC_EAC3 … #define SND_AUDIOMODE_IEC_DTS_HD … #define SND_AUDIOMODE_IEC_MLP … #define SND_AUDIOMODE_IEC_DST … #define SND_AUDIOMODE_IEC_WMAPRO … #define SND_AUDIOMODE_IEC_REF_CXT … #define SND_AUDIOMODE_IEC_HE_AAC … #define SND_AUDIOMODE_IEC_HE_AAC2 … #define SND_AUDIOMODE_IEC_MPEG_SURROUND … #define SND_AUDIOPROFILE_G723_1 … #define SND_AUDIOMODE_G723_1_ANNEX_A … #define SND_AUDIOMODE_G723_1_ANNEX_B … #define SND_AUDIOMODE_G723_1_ANNEX_C … #define SND_AUDIOPROFILE_G729 … #define SND_AUDIOMODE_G729_ANNEX_A … #define SND_AUDIOMODE_G729_ANNEX_B … /* <FIXME: multichannel encoders aren't supported for now. Would need an additional definition of channel arrangement> */ /* VBR/CBR definitions */ #define SND_RATECONTROLMODE_CONSTANTBITRATE … #define SND_RATECONTROLMODE_VARIABLEBITRATE … /* Encoder options */ struct snd_enc_wma { … }; /** * struct snd_enc_vorbis - Vorbis encoder parameters * @quality: Sets encoding quality to n, between -1 (low) and 10 (high). * In the default mode of operation, the quality level is 3. * Normal quality range is 0 - 10. * @managed: Boolean. Set bitrate management mode. This turns off the * normal VBR encoding, but allows hard or soft bitrate constraints to be * enforced by the encoder. This mode can be slower, and may also be * lower quality. It is primarily useful for streaming. * @max_bit_rate: Enabled only if managed is TRUE * @min_bit_rate: Enabled only if managed is TRUE * @downmix: Boolean. Downmix input from stereo to mono (has no effect on * non-stereo streams). Useful for lower-bitrate encoding. * * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc * properties * * For best quality users should specify VBR mode and set quality levels. */ struct snd_enc_vorbis { … } __attribute__((packed, aligned …)); /** * struct snd_enc_real - RealAudio encoder parameters * @quant_bits: number of coupling quantization bits in the stream * @start_region: coupling start region in the stream * @num_regions: number of regions value * * These options were extracted from the OpenMAX IL spec */ struct snd_enc_real { … } __attribute__((packed, aligned …)); /** * struct snd_enc_flac - FLAC encoder parameters * @num: serial number, valid only for OGG formats * needs to be set by application * @gain: Add replay gain tags * * These options were extracted from the FLAC online documentation * at http://flac.sourceforge.net/documentation_tools_flac.html * * To make the API simpler, it is assumed that the user will select quality * profiles. Additional options that affect encoding quality and speed can * be added at a later stage if needed. * * By default the Subset format is used by encoders. * * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are * not supported in this API. */ struct snd_enc_flac { … } __attribute__((packed, aligned …)); struct snd_enc_generic { … } __attribute__((packed, aligned …)); struct snd_dec_flac { … } __attribute__((packed, aligned …)); struct snd_dec_wma { … } __attribute__((packed, aligned …)); struct snd_dec_alac { … } __attribute__((packed, aligned …)); struct snd_dec_ape { … } __attribute__((packed, aligned …)); snd_codec_options __attribute__((packed, aligned …)); /** struct snd_codec_desc - description of codec capabilities * @max_ch: Maximum number of audio channels * @sample_rates: Sampling rates in Hz, use values like 48000 for this * @num_sample_rates: Number of valid values in sample_rates array * @bit_rate: Indexed array containing supported bit rates * @num_bitrates: Number of valid values in bit_rate array * @rate_control: value is specified by SND_RATECONTROLMODE defines. * @profiles: Supported profiles. See SND_AUDIOPROFILE defines. * @modes: Supported modes. See SND_AUDIOMODE defines * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines * @min_buffer: Minimum buffer size handled by codec implementation * @reserved: reserved for future use * * This structure provides a scalar value for profiles, modes and stream * format fields. * If an implementation supports multiple combinations, they will be listed as * codecs with different descriptors, for example there would be 2 descriptors * for AAC-RAW and AAC-ADTS. * This entails some redundancy but makes it easier to avoid invalid * configurations. * */ struct snd_codec_desc { … } __attribute__((packed, aligned …)); /** struct snd_codec * @id: Identifies the supported audio encoder/decoder. * See SND_AUDIOCODEC macros. * @ch_in: Number of input audio channels * @ch_out: Number of output channels. In case of contradiction between * this field and the channelMode field, the channelMode field * overrides. * @sample_rate: Audio sample rate of input data in Hz, use values like 48000 * for this. * @bit_rate: Bitrate of encoded data. May be ignored by decoders * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines. * Encoders may rely on profiles for quality levels. * May be ignored by decoders. * @profile: Mandatory for encoders, can be mandatory for specific * decoders as well. See SND_AUDIOPROFILE defines. * @level: Supported level (Only used by WMA at the moment) * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines * @format: Format of encoded bistream. Mandatory when defined. * See SND_AUDIOSTREAMFORMAT defines. * @align: Block alignment in bytes of an audio sample. * Only required for PCM or IEC formats. * @options: encoder-specific settings * @reserved: reserved for future use */ struct snd_codec { … } __attribute__((packed, aligned …)); #endif