From d918dd626c2de5c7ed10fea4707724526d77a1e1 Mon Sep 17 00:00:00 2001 From: Rudolf Tammekivi Date: Tue, 24 Dec 2013 13:42:56 +0200 Subject: [PATCH] audio/msm7x30: Update AUDIO_FORMAT to latest API. Change-Id: I0ab4f665a3d9ab3732274769fa5aec74230abb44 --- legacy/msm7x30/AudioHardware.cpp | 49 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/legacy/msm7x30/AudioHardware.cpp b/legacy/msm7x30/AudioHardware.cpp index 59f82b2..a8cd28a 100644 --- a/legacy/msm7x30/AudioHardware.cpp +++ b/legacy/msm7x30/AudioHardware.cpp @@ -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; } @@ -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; @@ -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, @@ -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; } @@ -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 @@ -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 @@ -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 @@ -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 @@ -2894,7 +2895,7 @@ 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; @@ -2902,7 +2903,7 @@ ssize_t AudioHardware::AudioStreamInMSM72xx::read( void* buffer, ssize_t bytes) 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; @@ -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; @@ -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; @@ -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++; @@ -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;