namespace adts
{
//采样率枚举
typedef enum
{
ADTS_SF_96000=0,
ADTS_SF_88200,
ADTS_SF_64000,
ADTS_SF_48000,
ADTS_SF_44100,
ADTS_SF_32000,
ADTS_SF_24000,
ADTS_SF_22050,
ADTS_SF_16000,
ADTS_SF_12000,
ADTS_SF_11025,
ADTS_SF_8000,
ADTS_SF_7350,
ADTS_SF_d,
ADTS_SF_e,
ADTS_SF_f
}sampling_frequency_index_e;
//adts固定头信息
typedef struct
{
unsigned int syncword:12; //帧同步标识一个帧的开始,固定为0xFFF
unsigned int ID:1; //MPEG 标示符。0表示MPEG-4,1表示MPEG-2
unsigned int layer:2; //固定为'00'
unsigned int protection_absent:1; //标识是否进行误码校验。0表示有CRC校验,1表示没有CRC校验
unsigned int profile:2; //标识使用哪个级别的AAC。1: AAC Main 2:AAC LC (Low Complexity) 3:AAC SSR (Scalable Sample Rate) 4:AAC LTP (Long Term Prediction)
unsigned int sampling_frequency_index:4;//标识使用的采样率的下标
unsigned int private_bit:1; //私有位,编码时设置为0,解码时忽略
unsigned int channel_configuration:3;//标识声道数
unsigned int original_copy:1; //编码时设置为0,解码时忽略
unsigned int home:1; //编码时设置为0,解码时忽略
}fixed_header_t;
//adts可变头信息
typedef struct
{
unsigned int copyrighted_id_bit:1; //编码时设置为0,解码时忽略
unsigned int copyrighted_id_start:1; //编码时设置为0,解码时忽略
unsigned int aac_frame_length:13; //ADTS帧长度包括ADTS长度和AAC声音数据长度的和。即 aac_frame_length = (protection_absent == 0 ? 9 : 7) + audio_data_length
unsigned int adts_buffer_fullness:11; //固定为0x7FF。表示是码率可变的码流
unsigned int number_of_raw_data_blocks_in_frame:2; //表示当前帧有number_of_raw_data_blocks_in_frame + 1 个原始帧(一个AAC原始帧包含一段时间内1024个采样及相关数据)。
}variable_header_t;
}
网友评论