mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
nuttx/audio: Add compress audio macros
add compress audio macors and some subfmt Signed-off-by: yangyalei <yangyalei@xiaomi.com>
This commit is contained in:
+7
-1
@@ -418,6 +418,7 @@ static int audio_configure(FAR struct file *filep,
|
||||
upper->info.subformat = caps->ac_format.b[0];
|
||||
upper->info.samplerate =
|
||||
caps->ac_controls.hw[0] | (caps->ac_controls.b[3] << 16);
|
||||
memcpy(&upper->info.codec, &caps->ac_codec, sizeof(caps->ac_codec));
|
||||
}
|
||||
|
||||
priv->state = AUDIO_STATE_PREPARED;
|
||||
@@ -1062,7 +1063,12 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case AUDIOIOC_GETAUDIOINFO:
|
||||
{
|
||||
memcpy((void *)arg, &upper->info, sizeof(struct audio_info_s));
|
||||
if (lower->ops->ioctl == NULL ||
|
||||
lower->ops->ioctl(lower, AUDIOIOC_GETAUDIOINFO, arg) < 0)
|
||||
{
|
||||
memcpy((void *)arg, &upper->info, sizeof(struct audio_info_s));
|
||||
}
|
||||
|
||||
ret = OK;
|
||||
}
|
||||
break;
|
||||
|
||||
+302
-23
@@ -165,31 +165,183 @@
|
||||
#define AUDIO_FMT_MSBC 0x0e
|
||||
#define AUDIO_FMT_CVSD 0x0f
|
||||
#define AUDIO_FMT_AMR 0x10
|
||||
#define AUDIO_FMT_OPUS 0x11
|
||||
|
||||
/* Audio Sub-Format Types ***************************************************/
|
||||
#define AUDIO_FMT_AMRWB 0x11
|
||||
#define AUDIO_FMT_AMRWBPLUS 0x12
|
||||
#define AUDIO_FMT_OPUS 0x13
|
||||
#define AUDIO_FMT_REAL 0x14
|
||||
#define AUDIO_FMT_IEC61937 0x15
|
||||
#define AUDIO_FMT_G723_1 0x16
|
||||
#define AUDIO_FMT_G729 0x17
|
||||
#define AUDIO_FMT_ALAC 0x18
|
||||
#define AUDIO_FMT_APE 0x19
|
||||
|
||||
#define AUDIO_SUBFMT_END 0x00
|
||||
#define AUDIO_SUBFMT_PCM_MP1 0x01
|
||||
#define AUDIO_SUBFMT_PCM_MP2 0x02
|
||||
#define AUDIO_SUBFMT_PCM_MP3 0x03
|
||||
#define AUDIO_SUBFMT_PCM_MU_LAW 0x04
|
||||
#define AUDIO_SUBFMT_PCM_A_LAW 0x05
|
||||
#define AUDIO_SUBFMT_PCM_U8 0x06
|
||||
#define AUDIO_SUBFMT_PCM_S8 0x07
|
||||
#define AUDIO_SUBFMT_PCM_U16_LE 0x08
|
||||
#define AUDIO_SUBFMT_PCM_S16_BE 0x09
|
||||
#define AUDIO_SUBFMT_PCM_S16_LE 0x0a
|
||||
#define AUDIO_SUBFMT_PCM_U16_BE 0x0b
|
||||
#define AUDIO_SUBFMT_PCM_U32_LE 0x0c
|
||||
#define AUDIO_SUBFMT_PCM_U32_BE 0x0d
|
||||
#define AUDIO_SUBFMT_PCM_S32_LE 0x0e
|
||||
#define AUDIO_SUBFMT_PCM_S32_BE 0x0f
|
||||
#define AUDIO_SUBFMT_MIDI_0 0x10
|
||||
#define AUDIO_SUBFMT_MIDI_1 0x11
|
||||
#define AUDIO_SUBFMT_MIDI_2 0x12
|
||||
#define AUDIO_SUBFMT_AMRNB 0x13
|
||||
#define AUDIO_SUBFMT_AMRWB 0x14
|
||||
|
||||
#define AUDIO_PROFILE_PCM 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_PCM_MP1 0x01
|
||||
#define AUDIO_SUBFMT_PCM_MP2 0x02
|
||||
#define AUDIO_SUBFMT_PCM_MP3 0x03
|
||||
#define AUDIO_SUBFMT_PCM_MU_LAW 0x04
|
||||
#define AUDIO_SUBFMT_PCM_A_LAW 0x05
|
||||
#define AUDIO_SUBFMT_PCM_U8 0x06
|
||||
#define AUDIO_SUBFMT_PCM_S8 0x07
|
||||
#define AUDIO_SUBFMT_PCM_U16_LE 0x08
|
||||
#define AUDIO_SUBFMT_PCM_S16_BE 0x09
|
||||
#define AUDIO_SUBFMT_PCM_S16_LE 0x0a
|
||||
#define AUDIO_SUBFMT_PCM_U16_BE 0x0b
|
||||
#define AUDIO_SUBFMT_PCM_U24_LE 0x0c
|
||||
#define AUDIO_SUBFMT_PCM_S24_BE 0x0d
|
||||
#define AUDIO_SUBFMT_PCM_S24_LE 0x0e
|
||||
#define AUDIO_SUBFMT_PCM_U24_BE 0x0f
|
||||
#define AUDIO_SUBFMT_PCM_U32_LE 0x10
|
||||
#define AUDIO_SUBFMT_PCM_U32_BE 0x11
|
||||
#define AUDIO_SUBFMT_PCM_S32_LE 0x12
|
||||
#define AUDIO_SUBFMT_PCM_S32_BE 0x13
|
||||
#define AUDIO_SUBFMT_PCM_FLOAT_LE 0x14
|
||||
#define AUDIO_SUBFMT_PCM_FLOAT_BE 0x15
|
||||
|
||||
#define AUDIO_SUBFMT_MIDI_0 0x01
|
||||
#define AUDIO_SUBFMT_MIDI_1 0x02
|
||||
#define AUDIO_SUBFMT_MIDI_2 0x03
|
||||
|
||||
#define AUDIO_CHANMODE_MP3_MONO 0x01
|
||||
#define AUDIO_CHANMODE_MP3_STEREO 0x02
|
||||
#define AUDIO_CHANMODE_MP3_JOINTSTEREO 0x03
|
||||
#define AUDIO_CHANMODE_MP3_DUAL 0x04
|
||||
|
||||
#define AUDIO_PROFILE_AMR 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_AMR_DTX_OFF 0x01
|
||||
#define AUDIO_SUBFMT_AMR_VAD1 0x02
|
||||
#define AUDIO_SUBFMT_AMR_VAD2 0x03
|
||||
|
||||
#define AUDIO_STREAMFORMAT_UNDEF 0x01
|
||||
#define AUDIO_STREAMFORMAT_CONFORMANCE 0x02
|
||||
#define AUDIO_STREAMFORMAT_IF1 0x03
|
||||
#define AUDIO_STREAMFORMAT_IF2 0x04
|
||||
#define AUDIO_STREAMFORMAT_FSF 0x05
|
||||
#define AUDIO_STREAMFORMAT_RTPPAYLOAD 0x06
|
||||
#define AUDIO_STREAMFORMAT_ITU 0x07
|
||||
|
||||
#define AUDIO_PROFILE_AMRWB 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_AMRWB_DTX_OFF 0x01
|
||||
#define AUDIO_SUBFMT_AMRWB_VAD1 0x02
|
||||
#define AUDIO_SUBFMT_AMRWB_VAD2 0x03
|
||||
|
||||
#define AUDIO_PROFILE_AMRWBPLUS 0x01
|
||||
|
||||
#define AUDIO_PROFILE_AAC 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_AAC_MAIN 0x01
|
||||
#define AUDIO_SUBFMT_AAC_LC 0x02
|
||||
#define AUDIO_SUBFMT_AAC_SSR 0x03
|
||||
#define AUDIO_SUBFMT_AAC_LTP 0x04
|
||||
#define AUDIO_SUBFMT_AAC_HE 0x05
|
||||
#define AUDIO_SUBFMT_AAC_SCALABLE 0x06
|
||||
#define AUDIO_SUBFMT_AAC_ERLC 0x07
|
||||
#define AUDIO_SUBFMT_AAC_LD 0x08
|
||||
#define AUDIO_SUBFMT_AAC_HE_PS 0x09
|
||||
#define AUDIO_SUBFMT_AAC_HE_MPS 0x0a
|
||||
|
||||
#define AUDIO_STREAMFORMAT_MP2ADTS 0x01
|
||||
#define AUDIO_STREAMFORMAT_MP4ADTS 0x02
|
||||
#define AUDIO_STREAMFORMAT_MP4LOAS 0x03
|
||||
#define AUDIO_STREAMFORMAT_MP4LATM 0x04
|
||||
#define AUDIO_STREAMFORMAT_ADIF 0x05
|
||||
#define AUDIO_STREAMFORMAT_MP4FF 0x06
|
||||
#define AUDIO_STREAMFORMAT_RAW 0x07
|
||||
#define AUDIO_STREAMFORMAT_LATM 0x08
|
||||
|
||||
#define AUDIO_PROFILE_WMA7 0x01
|
||||
#define AUDIO_PROFILE_WMA8 0x02
|
||||
#define AUDIO_PROFILE_WMA9 0x03
|
||||
#define AUDIO_PROFILE_WMA10 0x04
|
||||
#define AUDIO_PROFILE_WMA9_PRO 0x05
|
||||
#define AUDIO_PROFILE_WMA9_LOSSLESS 0x06
|
||||
#define AUDIO_PROFILE_WMA10_LOSSLESS 0x07
|
||||
|
||||
#define AUDIO_SUBFMT_WMA_LEVEL1 0x01
|
||||
#define AUDIO_SUBFMT_WMA_LEVEL2 0x02
|
||||
#define AUDIO_SUBFMT_WMA_LEVEL3 0x03
|
||||
#define AUDIO_SUBFMT_WMA_LEVEL4 0x04
|
||||
#define AUDIO_SUBFMT_WMAPRO_LEVELM0 0x05
|
||||
#define AUDIO_SUBFMT_WMAPRO_LEVELM1 0x06
|
||||
#define AUDIO_SUBFMT_WMAPRO_LEVELM2 0x07
|
||||
#define AUDIO_SUBFMT_WMAPRO_LEVELM3 0x08
|
||||
|
||||
#define AUDIO_STREAMFORMAT_WMA_ASF 0x01
|
||||
#define AUDIO_STREAMFORMAT_WMA_NOASF_HDR 0x02
|
||||
|
||||
#define AUDIO_PROFILE_SBC 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_SBC 0x01
|
||||
|
||||
#define AUDIO_STREAMFORMAT_SBC_PACKED 0x01 /* SBC data with MTU packed */
|
||||
|
||||
#define AUDIO_PROFILE_REALAUDIO 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_REALAUDIO_G2 0x01
|
||||
#define AUDIO_SUBFMT_REALAUDIO_8 0x02
|
||||
#define AUDIO_SUBFMT_REALAUDIO_10 0x03
|
||||
#define AUDIO_SUBFMT_REALAUDIO_SURROUND 0x04
|
||||
|
||||
#define AUDIO_PROFILE_VORBIS 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_VORBIS 0x01
|
||||
|
||||
#define AUDIO_PROFILE_FLAC 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL0 0x01
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL1 0x02
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL2 0x03
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL3 0x04
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL4 0x05
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL5 0x06
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL6 0x07
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL7 0x08
|
||||
#define AUDIO_SUBFMT_FLAC_LEVEL8 0x09
|
||||
|
||||
#define AUDIO_STREAMFORMAT_FLAC 0x01
|
||||
#define AUDIO_STREAMFORMAT_FLAC_OGG 0x02
|
||||
|
||||
#define AUDIO_PROFILE_IEC61937 0x01
|
||||
#define AUDIO_PROFILE_IEC61937_SPDIF 0x02
|
||||
|
||||
#define AUDIO_SUBFMT_IEC_REF_STREAM_HEADER 0x01
|
||||
#define AUDIO_SUBFMT_IEC_LPCM 0x02
|
||||
#define AUDIO_SUBFMT_IEC_AC3 0x03
|
||||
#define AUDIO_SUBFMT_IEC_MPEG1 0x04
|
||||
#define AUDIO_SUBFMT_IEC_MP3 0x05
|
||||
#define AUDIO_SUBFMT_IEC_MPEG2 0x06
|
||||
#define AUDIO_SUBFMT_IEC_AACLC 0x07
|
||||
#define AUDIO_SUBFMT_IEC_DTS 0x08
|
||||
#define AUDIO_SUBFMT_IEC_ATRAC 0x09
|
||||
#define AUDIO_SUBFMT_IEC_SACD 0x0a
|
||||
#define AUDIO_SUBFMT_IEC_EAC3 0x0b
|
||||
#define AUDIO_SUBFMT_IEC_DTS_HD 0x0c
|
||||
#define AUDIO_SUBFMT_IEC_MLP 0x0d
|
||||
#define AUDIO_SUBFMT_IEC_DST 0x0e
|
||||
#define AUDIO_SUBFMT_IEC_WMAPRO 0x0f
|
||||
#define AUDIO_SUBFMT_IEC_REF_CXT 0x10
|
||||
#define AUDIO_SUBFMT_IEC_HE_AAC 0x11
|
||||
#define AUDIO_SUBFMT_IEC_HE_AAC2 0x12
|
||||
#define AUDIO_SUBFMT_IEC_MPEG_SURROUND 0x13
|
||||
|
||||
#define AUDIO_PROFILE_G723_1 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_G723_1_ANNEX_A 0x01
|
||||
#define AUDIO_SUBFMT_G723_1_ANNEX_B 0x02
|
||||
#define AUDIO_SUBFMT_G723_1_ANNEX_C 0x03
|
||||
|
||||
#define AUDIO_PROFILE_G729 0x01
|
||||
|
||||
#define AUDIO_SUBFMT_G729_ANNEX_A 0x01
|
||||
#define AUDIO_SUBFMT_G729_ANNEX_B 0x02
|
||||
|
||||
#define AUDIO_RATECONTROL_CONSTANT 0x01
|
||||
#define AUDIO_RATECONTROL_VARIABLE 0x02
|
||||
|
||||
/* Audio Hardware-Format Types **********************************************/
|
||||
|
||||
@@ -410,6 +562,125 @@ struct audio_status_s
|
||||
|
||||
/* This structure is used to describe the audio device capabilities */
|
||||
|
||||
struct audio_enc_wma_s
|
||||
{
|
||||
uint32_t super_block_align;
|
||||
};
|
||||
|
||||
struct audio_enc_vorbis_s
|
||||
{
|
||||
int32_t quality;
|
||||
uint32_t managed;
|
||||
uint32_t max_bit_rate;
|
||||
uint32_t min_bit_rate;
|
||||
uint32_t downmix;
|
||||
};
|
||||
|
||||
struct audio_enc_real_s
|
||||
{
|
||||
uint32_t quant_bits;
|
||||
uint32_t start_region;
|
||||
uint32_t num_regions;
|
||||
};
|
||||
|
||||
struct audio_enc_flac_s
|
||||
{
|
||||
uint32_t num;
|
||||
uint32_t gain;
|
||||
};
|
||||
|
||||
struct audio_enc_sbc_s
|
||||
{
|
||||
uint8_t blocks;
|
||||
uint8_t subbands;
|
||||
uint8_t alloc_method;
|
||||
uint8_t bitpool;
|
||||
};
|
||||
|
||||
struct audio_enc_lc3_s
|
||||
{
|
||||
float frame_duration;
|
||||
};
|
||||
|
||||
struct audio_enc_generic_s
|
||||
{
|
||||
uint32_t bw;
|
||||
int32_t reserved[15];
|
||||
};
|
||||
|
||||
struct audio_dec_flac_s
|
||||
{
|
||||
uint16_t sample_size;
|
||||
uint16_t min_blk_size;
|
||||
uint16_t max_blk_size;
|
||||
uint16_t min_frame_size;
|
||||
uint16_t max_frame_size;
|
||||
uint16_t reserved;
|
||||
};
|
||||
|
||||
struct audio_dec_wma_s
|
||||
{
|
||||
uint32_t encoder_option;
|
||||
uint32_t adv_encoder_option;
|
||||
uint32_t adv_encoder_option2;
|
||||
uint32_t reserved;
|
||||
};
|
||||
|
||||
struct audio_dec_alac_s
|
||||
{
|
||||
uint32_t frame_length;
|
||||
uint8_t compatible_version;
|
||||
uint8_t pb;
|
||||
uint8_t mb;
|
||||
uint8_t kb;
|
||||
uint32_t max_run;
|
||||
uint32_t max_frame_bytes;
|
||||
};
|
||||
|
||||
struct audio_dec_ape_s
|
||||
{
|
||||
uint16_t compatible_version;
|
||||
uint16_t compression_level;
|
||||
uint32_t format_flags;
|
||||
uint32_t blocks_per_frame;
|
||||
uint32_t final_frame_blocks;
|
||||
uint32_t total_frames;
|
||||
uint32_t seek_table_present;
|
||||
};
|
||||
|
||||
struct audio_dec_lc3_s
|
||||
{
|
||||
float frame_duration;
|
||||
};
|
||||
|
||||
union audio_codec_options_u
|
||||
{
|
||||
struct audio_enc_wma_s wma;
|
||||
struct audio_enc_vorbis_s vorbis;
|
||||
struct audio_enc_real_s real;
|
||||
struct audio_enc_flac_s flac;
|
||||
struct audio_enc_sbc_s sbc;
|
||||
struct audio_enc_lc3_s lc3;
|
||||
struct audio_enc_generic_s generic;
|
||||
struct audio_dec_flac_s flac_d;
|
||||
struct audio_dec_wma_s wma_d;
|
||||
struct audio_dec_alac_s alac_d;
|
||||
struct audio_dec_ape_s ape_d;
|
||||
struct audio_dec_lc3_s lc3_d;
|
||||
};
|
||||
|
||||
struct audio_codec_s
|
||||
{
|
||||
uint32_t bit_rate;
|
||||
uint32_t rate_control;
|
||||
uint32_t profile;
|
||||
uint32_t level;
|
||||
uint32_t ch_mode;
|
||||
uint32_t format;
|
||||
uint32_t align;
|
||||
union audio_codec_options_u options;
|
||||
};
|
||||
|
||||
struct audio_caps_s
|
||||
{
|
||||
uint8_t ac_len; /* Length of the structure */
|
||||
@@ -443,6 +714,10 @@ struct audio_caps_s
|
||||
uint64_t qw;
|
||||
#endif
|
||||
} ac_controls;
|
||||
|
||||
/* Codec info */
|
||||
|
||||
struct audio_codec_s ac_codec;
|
||||
};
|
||||
|
||||
struct audio_caps_desc_s
|
||||
@@ -463,6 +738,10 @@ struct audio_info_s
|
||||
uint8_t subformat; /* Audio subformat
|
||||
* (maybe should be combined with format?)
|
||||
*/
|
||||
|
||||
/* Codec extra params */
|
||||
|
||||
struct audio_codec_s codec;
|
||||
};
|
||||
|
||||
/* This structure describes the preferred number and size of
|
||||
|
||||
Reference in New Issue
Block a user