Skip to content

Commit

Permalink
audio/msm7x30: Update AUDIO_FORMAT to latest API.
Browse files Browse the repository at this point in the history
Change-Id: I0ab4f665a3d9ab3732274769fa5aec74230abb44
  • Loading branch information
Blefish authored and mikeNG committed Sep 26, 2014
1 parent dfac6e4 commit d918dd6
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions legacy/msm7x30/AudioHardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,11 +950,11 @@ static unsigned calculate_audpre_table_index(unsigned index)
size_t AudioHardware::getInputBufferSize(uint32_t sampleRate, int format, int channelCount)
{

if ((format != AudioSystem::PCM_16_BIT) &&
(format != AudioSystem::AMR_NB) &&
(format != AudioSystem::EVRC) &&
(format != AudioSystem::QCELP) &&
(format != AudioSystem::AAC)){
if ((format != AUDIO_FORMAT_PCM_16_BIT) &&
(format != AUDIO_FORMAT_AMR_NB) &&
(format != AUDIO_FORMAT_EVRC) &&
(format != AUDIO_FORMAT_QCELP) &&
(format != AUDIO_FORMAT_AAC)){
ALOGW("getInputBufferSize bad format: %d", format);
return 0;
}
Expand All @@ -963,13 +963,13 @@ size_t AudioHardware::getInputBufferSize(uint32_t sampleRate, int format, int ch
return 0;
}

if (format == AudioSystem::AMR_NB)
if (format == AUDIO_FORMAT_AMR_NB)
return 320*channelCount;
if (format == AudioSystem::EVRC)
else if (format == AUDIO_FORMAT_EVRC)
return 230*channelCount;
else if (format == AudioSystem::QCELP)
else if (format == AUDIO_FORMAT_QCELP)
return 350*channelCount;
else if (format == AudioSystem::AAC)
else if (format == AUDIO_FORMAT_AAC)
return 2048;
else if (sampleRate == AUDIO_HW_VOIP_SAMPLERATE_8K)
return 320*channelCount;
Expand All @@ -992,6 +992,7 @@ size_t AudioHardware::getInputBufferSize(uint32_t sampleRate, int format, int ch
return 2048*channelCount;
}
}
return 0;
}
static status_t set_volume_rpc(uint32_t device,
uint32_t method,
Expand Down Expand Up @@ -2296,16 +2297,16 @@ status_t AudioHardware::AudioStreamInMSM72xx::set(
{
if ((pFormat == 0) ||
((*pFormat != AUDIO_HW_IN_FORMAT) &&
(*pFormat != AudioSystem::AMR_NB) &&
(*pFormat != AudioSystem::EVRC) &&
(*pFormat != AudioSystem::QCELP) &&
(*pFormat != AudioSystem::AAC)))
(*pFormat != AUDIO_FORMAT_AMR_NB) &&
(*pFormat != AUDIO_FORMAT_EVRC) &&
(*pFormat != AUDIO_FORMAT_QCELP) &&
(*pFormat != AUDIO_FORMAT_AAC)))
{
*pFormat = AUDIO_HW_IN_FORMAT;
return BAD_VALUE;
}

if((*pFormat == AudioSystem::AAC) && (*pChannels & (AudioSystem::CHANNEL_IN_VOICE_DNLINK | AudioSystem::CHANNEL_IN_VOICE_UPLINK))) {
if((*pFormat == AUDIO_FORMAT_AAC) && (*pChannels & (AudioSystem::CHANNEL_IN_VOICE_DNLINK | AudioSystem::CHANNEL_IN_VOICE_UPLINK))) {
ALOGE("voice call recording in AAC format does not support");
return BAD_VALUE;
}
Expand Down Expand Up @@ -2475,7 +2476,7 @@ status_t AudioHardware::AudioStreamInMSM72xx::set(
mSampleRate = config.sample_rate;
mBufferSize = config.buffer_size;
}
else if (*pFormat == AudioSystem::EVRC)
else if (*pFormat == AUDIO_FORMAT_EVRC)
{
ALOGI("Recording format: EVRC");
// open evrc input device
Expand Down Expand Up @@ -2544,7 +2545,7 @@ status_t AudioHardware::AudioStreamInMSM72xx::set(
goto Error;
}
}
else if (*pFormat == AudioSystem::QCELP)
else if (*pFormat == AUDIO_FORMAT_QCELP)
{
ALOGI("Recording format: QCELP");
// open qcelp input device
Expand Down Expand Up @@ -2614,7 +2615,7 @@ status_t AudioHardware::AudioStreamInMSM72xx::set(
goto Error;
}
}
else if (*pFormat == AudioSystem::AMR_NB)
else if (*pFormat == AUDIO_FORMAT_AMR_NB)
{
ALOGI("Recording format: AMR_NB");
// open amr_nb input device
Expand Down Expand Up @@ -2684,7 +2685,7 @@ status_t AudioHardware::AudioStreamInMSM72xx::set(
goto Error;
}
}
else if (*pFormat == AudioSystem::AAC)
else if (*pFormat == AUDIO_FORMAT_AAC)
{
ALOGI("Recording format: AAC");
// open aac input device
Expand Down Expand Up @@ -2894,15 +2895,15 @@ ssize_t AudioHardware::AudioStreamInMSM72xx::read( void* buffer, ssize_t bytes)
}
}
}
else if ((mFormat == AudioSystem::EVRC) || (mFormat == AudioSystem::QCELP) || (mFormat == AudioSystem::AMR_NB))
else if ((mFormat == AUDIO_FORMAT_EVRC) || (mFormat == AUDIO_FORMAT_QCELP) || (mFormat == AUDIO_FORMAT_AMR_NB))
{
uint8_t readBuf[36];
uint8_t *dataPtr;
while (count) {
dataPtr = readBuf;
ssize_t bytesRead = ::read(mFd, readBuf, 36);
if (bytesRead >= 0) {
if (mFormat == AudioSystem::AMR_NB){
if (mFormat == AUDIO_FORMAT_AMR_NB){
amr_transcode(dataPtr,p);
p += AMRNB_FRAME_SIZE;
count -= AMRNB_FRAME_SIZE;
Expand All @@ -2915,7 +2916,7 @@ ssize_t AudioHardware::AudioStreamInMSM72xx::read( void* buffer, ssize_t bytes)
}
else {
dataPtr++;
if (mFormat == AudioSystem::EVRC){
if (mFormat == AUDIO_FORMAT_EVRC){
memcpy(p, dataPtr, EVRC_FRAME_SIZE);
p += EVRC_FRAME_SIZE;
count -= EVRC_FRAME_SIZE;
Expand All @@ -2926,7 +2927,7 @@ ssize_t AudioHardware::AudioStreamInMSM72xx::read( void* buffer, ssize_t bytes)
break;
}
}
else if (mFormat == AudioSystem::QCELP){
else if (mFormat == AUDIO_FORMAT_QCELP){
memcpy(p, dataPtr, QCELP_FRAME_SIZE);
p += QCELP_FRAME_SIZE;
count -= QCELP_FRAME_SIZE;
Expand All @@ -2946,7 +2947,7 @@ ssize_t AudioHardware::AudioStreamInMSM72xx::read( void* buffer, ssize_t bytes)
}
}
}
else if (mFormat == AudioSystem::AAC)
else if (mFormat == AUDIO_FORMAT_AAC)
{
*((uint32_t*)recogPtr) = 0x51434F4D ;// ('Q','C','O', 'M') Number to identify format as AAC by higher layers
recogPtr++;
Expand Down Expand Up @@ -2997,7 +2998,7 @@ ssize_t AudioHardware::AudioStreamInMSM72xx::read( void* buffer, ssize_t bytes)
}
}

if (mFormat == AudioSystem::AAC)
if (mFormat == AUDIO_FORMAT_AAC)
return aac_framesize;

return bytes;
Expand Down

0 comments on commit d918dd6

Please sign in to comment.