mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 11:41:44 +08:00
统一成员变量命名风格
This commit is contained in:
@@ -48,17 +48,17 @@ AACEncoder::AACEncoder() {
|
||||
}
|
||||
|
||||
AACEncoder::~AACEncoder() {
|
||||
if (m_hEncoder != nullptr) {
|
||||
faacEncClose(m_hEncoder);
|
||||
m_hEncoder = nullptr;
|
||||
if (_hEncoder != nullptr) {
|
||||
faacEncClose(_hEncoder);
|
||||
_hEncoder = nullptr;
|
||||
}
|
||||
if (m_pucAacBuf != nullptr) {
|
||||
delete[] m_pucAacBuf;
|
||||
m_pucAacBuf = nullptr;
|
||||
if (_pucAacBuf != nullptr) {
|
||||
delete[] _pucAacBuf;
|
||||
_pucAacBuf = nullptr;
|
||||
}
|
||||
if (m_pucPcmBuf != nullptr) {
|
||||
delete[] m_pucPcmBuf;
|
||||
m_pucPcmBuf = nullptr;
|
||||
if (_pucPcmBuf != nullptr) {
|
||||
delete[] _pucPcmBuf;
|
||||
_pucPcmBuf = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,19 +67,19 @@ bool AACEncoder::init(int iSampleRate, int iChannels, int iSampleBit) {
|
||||
return false;
|
||||
}
|
||||
// (1) Open FAAC engine
|
||||
m_hEncoder = faacEncOpen(iSampleRate, iChannels, &m_ulInputSamples,
|
||||
&m_ulMaxOutputBytes);
|
||||
if (m_hEncoder == NULL) {
|
||||
_hEncoder = faacEncOpen(iSampleRate, iChannels, &_ulInputSamples,
|
||||
&_ulMaxOutputBytes);
|
||||
if (_hEncoder == NULL) {
|
||||
return false;
|
||||
}
|
||||
m_pucAacBuf = new unsigned char[m_ulMaxOutputBytes];
|
||||
m_ulMaxInputBytes = m_ulInputSamples * iSampleBit / 8;
|
||||
m_pucPcmBuf = new unsigned char[m_ulMaxInputBytes * 4];
|
||||
_pucAacBuf = new unsigned char[_ulMaxOutputBytes];
|
||||
_ulMaxInputBytes = _ulInputSamples * iSampleBit / 8;
|
||||
_pucPcmBuf = new unsigned char[_ulMaxInputBytes * 4];
|
||||
|
||||
// (2.1) Get current encoding configuration
|
||||
faacEncConfigurationPtr pConfiguration = faacEncGetCurrentConfiguration(m_hEncoder);
|
||||
faacEncConfigurationPtr pConfiguration = faacEncGetCurrentConfiguration(_hEncoder);
|
||||
if (pConfiguration == NULL) {
|
||||
faacEncClose(m_hEncoder);
|
||||
faacEncClose(_hEncoder);
|
||||
return false;
|
||||
}
|
||||
pConfiguration->aacObjectType =LOW;
|
||||
@@ -95,25 +95,25 @@ bool AACEncoder::init(int iSampleRate, int iChannels, int iSampleBit) {
|
||||
pConfiguration->inputFormat = FAAC_INPUT_16BIT;
|
||||
|
||||
// (2.2) Set encoding configuration
|
||||
if(!faacEncSetConfiguration(m_hEncoder, pConfiguration)){
|
||||
if(!faacEncSetConfiguration(_hEncoder, pConfiguration)){
|
||||
ErrorL << "faacEncSetConfiguration failed";
|
||||
faacEncClose(m_hEncoder);
|
||||
faacEncClose(_hEncoder);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int AACEncoder::inputData(char *pcPcmBufr, int iLen, unsigned char **ppucOutBuffer) {
|
||||
memcpy(m_pucPcmBuf + m_uiPcmLen, pcPcmBufr, iLen);
|
||||
m_uiPcmLen += iLen;
|
||||
if (m_uiPcmLen < m_ulMaxInputBytes) {
|
||||
memcpy(_pucPcmBuf + _uiPcmLen, pcPcmBufr, iLen);
|
||||
_uiPcmLen += iLen;
|
||||
if (_uiPcmLen < _ulMaxInputBytes) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nRet = faacEncEncode(m_hEncoder, (int32_t *) (m_pucPcmBuf), m_ulInputSamples, m_pucAacBuf, m_ulMaxOutputBytes);
|
||||
m_uiPcmLen -= m_ulMaxInputBytes;
|
||||
memmove(m_pucPcmBuf, m_pucPcmBuf + m_ulMaxInputBytes, m_uiPcmLen);
|
||||
*ppucOutBuffer = m_pucAacBuf;
|
||||
int nRet = faacEncEncode(_hEncoder, (int32_t *) (_pucPcmBuf), _ulInputSamples, _pucAacBuf, _ulMaxOutputBytes);
|
||||
_uiPcmLen -= _ulMaxInputBytes;
|
||||
memmove(_pucPcmBuf, _pucPcmBuf + _ulMaxInputBytes, _uiPcmLen);
|
||||
*ppucOutBuffer = _pucAacBuf;
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user