2015-11-28 70 views
2

如何从ADTS头构建CSD数据?我可以为CSD数据创建ADTS标头,但是如何做相反的操作?如何从AAC-ADTS标头构建编解码器特定数据(CSD)?

/* function to construct ADTS header from CSD 
* header_info - contains CSD 
* frameLength - total frame size */  
void addHeaderADTS(uint8_t header_info[], uint32_t frameLength) { 

int profile = (csd_data[0] >> 3) & 0x1F; 
int frequency_idx = ((csd_data[0] & 0x7) << 1) | ((csd_data[1] >> 7) & 0x1); 
int channels = (csd_data[1] >> 3) & 0xF; 

header_info[0] = 0xFF; 
header_info[1] = 0xF1; 
header_info[2] = (((profile - 1) << 6) + (frequency_idx << 2) + (channels >> 2)); 
header_info[3] = (((channels & 3) << 6) + (frameLength >> 11)); 
header_info[4] = ((frameLength & 0x7FF) >> 3); 
header_info[5] = (((frameLength & 7) << 5) + 0x1F); 
header_info[6] = 0xFC; 
return; 

}

+0

给我们提供CSD数据吗?究竟是什么? – Danijel

+0

编解码器特定数据(CSD)csd_data [0] = 0x13,csd_data [1] = 0x0x90。要了解csd,请参阅http://wiki.multimedia.cx/index.php?title=Understanding_AAC&redirect=no http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio –

+0

该wiki上没有CSD页。该wiki页面上也没有csd_data。 – Danijel

回答

1

实测值。使用MakeAACCodecSpecificData函数构建的CSD数据 avc_utils.cpp

相关问题