diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-07-11 23:39:44 +0100 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-11-22 18:47:52 +0000 |
commit | a58dabe2983c3fe0e1cbad574cbe2cb6d5b6e5e8 (patch) | |
tree | 729e16f44c21be99089b6a853410ab392bb66409 /services/audioflinger/AudioFlinger.cpp | |
parent | 96076964863ee6887f0bed9d0f11f424b48ab9b9 (diff) | |
download | frameworks_av-a58dabe2983c3fe0e1cbad574cbe2cb6d5b6e5e8.zip frameworks_av-a58dabe2983c3fe0e1cbad574cbe2cb6d5b6e5e8.tar.gz frameworks_av-a58dabe2983c3fe0e1cbad574cbe2cb6d5b6e5e8.tar.bz2 |
Add support for ICS audio blobs
Enable with the ICS_AUDIO_BLOB CFLAG
Change-Id: Ie174d5997202b8931c1f11db62b6ec2e377f096a
Diffstat (limited to 'services/audioflinger/AudioFlinger.cpp')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 76d6447..d811c23 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -206,11 +206,13 @@ static int load_audio_interface(const char *if_name, audio_hw_device_t **dev) if (rc) { goto out; } +#ifndef ICS_AUDIO_BLOB if ((*dev)->common.version != AUDIO_DEVICE_API_VERSION_CURRENT) { ALOGE("%s wrong audio hw device version %04x", __func__, (*dev)->common.version); rc = BAD_VALUE; goto out; } +#endif return 0; out: @@ -724,6 +726,7 @@ status_t AudioFlinger::setMasterMute(bool muted) mMasterMute = muted; // Set master mute in the HALs which support it. +#ifndef ICS_AUDIO_BLOB for (size_t i = 0; i < mAudioHwDevs.size(); i++) { AutoMutex lock(mHardwareLock); AudioHwDevice *dev = mAudioHwDevs.valueAt(i); @@ -734,6 +737,7 @@ status_t AudioFlinger::setMasterMute(bool muted) } mHardwareStatus = AUDIO_HW_IDLE; } +#endif // Now set the master mute in each playback thread. Playback threads // assigned to HALs which do not have master mute support will apply master @@ -991,7 +995,11 @@ size_t AudioFlinger::getInputBufferSize(uint32_t sampleRate, audio_format_t form format: format, }; audio_hw_device_t *dev = mPrimaryHardwareDev->hwDevice(); +#ifndef ICS_AUDIO_BLOB size_t size = dev->get_input_buffer_size(dev, &config); +#else + size_t size = dev->get_input_buffer_size(dev, sampleRate, format, popcount(channelMask)); +#endif mHardwareStatus = AUDIO_HW_IDLE; return size; } @@ -2844,11 +2852,13 @@ void AudioFlinger::MixerThread::threadLoop_mix() int64_t pts; status_t status = INVALID_OPERATION; +#ifndef ICS_AUDIO_BLOB if (mNormalSink != 0) { status = mNormalSink->getNextWriteTimestamp(&pts); } else { status = mOutputSink->getNextWriteTimestamp(&pts); } +#endif if (status != NO_ERROR) { pts = AudioBufferProvider::kInvalidPTS; @@ -6877,6 +6887,7 @@ audio_module_handle_t AudioFlinger::loadHwModule_l(const char *name) { // scope for auto-lock pattern AutoMutex lock(mHardwareLock); +#ifndef ICS_AUDIO_BLOB if (0 == mAudioHwDevs.size()) { mHardwareStatus = AUDIO_HW_GET_MASTER_VOLUME; if (NULL != dev->get_master_volume) { @@ -6894,6 +6905,7 @@ audio_module_handle_t AudioFlinger::loadHwModule_l(const char *name) } } } +#endif mHardwareStatus = AUDIO_HW_SET_MASTER_VOLUME; if ((NULL != dev->set_master_volume) && @@ -6902,12 +6914,14 @@ audio_module_handle_t AudioFlinger::loadHwModule_l(const char *name) AudioHwDevice::AHWD_CAN_SET_MASTER_VOLUME); } +#ifndef ICS_AUDIO_BLOB mHardwareStatus = AUDIO_HW_SET_MASTER_MUTE; if ((NULL != dev->set_master_mute) && (OK == dev->set_master_mute(dev, mMasterMute))) { flags = static_cast<AudioHwDevice::Flags>(flags | AudioHwDevice::AHWD_CAN_SET_MASTER_MUTE); } +#endif mHardwareStatus = AUDIO_HW_IDLE; } @@ -6981,12 +6995,23 @@ audio_io_handle_t AudioFlinger::openOutput(audio_module_handle_t module, mHardwareStatus = AUDIO_HW_OUTPUT_OPEN; +#ifndef ICS_AUDIO_BLOB status = hwDevHal->open_output_stream(hwDevHal, id, *pDevices, (audio_output_flags_t)flags, &config, &outStream); +#else + status = hwDevHal->open_output_stream(hwDevHal, + *pDevices, + (int *)&config.format, + &config.channel_mask, + &config.sample_rate, + &outStream); + uint32_t newflags = flags | AUDIO_OUTPUT_FLAG_PRIMARY; + flags = (audio_output_flags_t)newflags; +#endif mHardwareStatus = AUDIO_HW_IDLE; ALOGV("openOutput() openOutputStream returned output %p, SamplingRate %d, Format %d, Channels %x, status %d", @@ -7162,8 +7187,16 @@ audio_io_handle_t AudioFlinger::openInput(audio_module_handle_t module, audio_hw_device_t *inHwHal = inHwDev->hwDevice(); audio_io_handle_t id = nextUniqueId(); +#ifndef ICS_AUDIO_BLOB status = inHwHal->open_input_stream(inHwHal, id, *pDevices, &config, &inStream); +#else + status = inHwHal->open_input_stream(inHwHal, *pDevices, + (int *)&config.format, + &config.channel_mask, + &config.sample_rate, (audio_in_acoustics_t)0, + &inStream); +#endif ALOGV("openInput() openInputStream returned input %p, SamplingRate %d, Format %d, Channels %x, status %d", inStream, config.sample_rate, @@ -7180,7 +7213,15 @@ audio_io_handle_t AudioFlinger::openInput(audio_module_handle_t module, (popcount(config.channel_mask) <= FCC_2) && (popcount(reqChannels) <= FCC_2)) { ALOGV("openInput() reopening with proposed sampling rate and channel mask"); inStream = NULL; +#ifndef ICS_AUDIO_BLOB status = inHwHal->open_input_stream(inHwHal, id, *pDevices, &config, &inStream); +#else + status = inHwHal->open_input_stream(inHwHal, *pDevices, + (int *)&config.format, + &config.channel_mask, + &config.sample_rate, (audio_in_acoustics_t)0, + &inStream); +#endif } if (status == NO_ERROR && inStream != NULL) { |