diff options
Diffstat (limited to 'audio')
| -rw-r--r-- | audio/AudioHardwareInterface.cpp | 2 | ||||
| -rw-r--r-- | audio/AudioPolicyManagerBase.cpp | 127 | ||||
| -rw-r--r-- | audio/audio_hw_hal.cpp | 47 | ||||
| -rw-r--r-- | audio/audio_policy_hal.cpp | 2 |
4 files changed, 160 insertions, 18 deletions
diff --git a/audio/AudioHardwareInterface.cpp b/audio/AudioHardwareInterface.cpp index 60cce27..0e109aa 100644 --- a/audio/AudioHardwareInterface.cpp +++ b/audio/AudioHardwareInterface.cpp @@ -71,10 +71,12 @@ AudioStreamOut::~AudioStreamOut() } // default implementation is unsupported +#ifndef ICS_AUDIO_BLOB status_t AudioStreamOut::getNextWriteTimestamp(int64_t *timestamp) { return INVALID_OPERATION; } +#endif AudioStreamIn::~AudioStreamIn() {} diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 134fb3b..722bbd3 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -498,7 +498,12 @@ AudioPolicyManagerBase::IOProfile *AudioPolicyManagerBase::getProfileForDirectOu IOProfile *profile = mHwModules[i]->mOutputProfiles[j]; if (profile->isCompatibleProfile(device, samplingRate, format, channelMask, - AUDIO_OUTPUT_FLAG_DIRECT)) { +#ifdef QCOM_HARDWARE + (audio_output_flags_t)(flags|AUDIO_OUTPUT_FLAG_DIRECT))) +#else + AUDIO_OUTPUT_FLAG_DIRECT)) +#endif + { if (mAvailableOutputDevices & profile->mSupportedDevices) { return mHwModules[i]->mOutputProfiles[j]; } @@ -553,12 +558,12 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str } #endif //AUDIO_POLICY_TEST - // open a direct output if required by specified parameters IOProfile *profile = getProfileForDirectOutput(device, - samplingRate, - format, - channelMask, - (audio_output_flags_t)flags); + samplingRate, + format, + channelMask, + (audio_output_flags_t)flags); + if (profile != NULL) { ALOGV("getOutput() opening direct output device %x", device); @@ -1012,7 +1017,10 @@ status_t AudioPolicyManagerBase::setStreamVolumeIndex(AudioSystem::stream_type s for (size_t i = 0; i < mOutputs.size(); i++) { audio_devices_t curDevice = getDeviceForVolume(mOutputs.valueAt(i)->device()); - if (device == curDevice) { +#ifndef ICS_AUDIO_BLOB + if (device == curDevice) +#endif + { status_t volStatus = checkAndSetVolume(stream, index, mOutputs.keyAt(i), curDevice); if (volStatus != NO_ERROR) { status = volStatus; @@ -1029,6 +1037,7 @@ status_t AudioPolicyManagerBase::getStreamVolumeIndex(AudioSystem::stream_type s if (index == NULL) { return BAD_VALUE; } +#ifndef ICS_AUDIO_BLOB if (!audio_is_output_device(device)) { return BAD_VALUE; } @@ -1040,6 +1049,9 @@ status_t AudioPolicyManagerBase::getStreamVolumeIndex(AudioSystem::stream_type s device = getDeviceForVolume(device); *index = mStreams[stream].getVolumeIndex(device); +#else + *index = mStreams[stream].mIndexCur.valueAt(0); +#endif ALOGV("getStreamVolumeIndex() stream %d device %08x index %d", stream, device, *index); return NO_ERROR; } @@ -1325,8 +1337,13 @@ AudioPolicyManagerBase::AudioPolicyManagerBase(AudioPolicyClientInterface *clien for (size_t j = 0; j < mHwModules[i]->mOutputProfiles.size(); j++) { const IOProfile *outProfile = mHwModules[i]->mOutputProfiles[j]; - - if (outProfile->mSupportedDevices & mAttachedOutputDevices) { +#ifdef QCOM_HARDWARE + if ( (outProfile->mSupportedDevices & mAttachedOutputDevices) && + !(outProfile->mFlags & AUDIO_OUTPUT_FLAG_DIRECT) ) +#else + if (outProfile->mSupportedDevices & mAttachedOutputDevices) +#endif + { AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(outProfile); outputDesc->mDevice = (audio_devices_t)(mDefaultOutputDevice & outProfile->mSupportedDevices); @@ -1628,13 +1645,21 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, ALOGV("opening output for device %08x", device); desc = new AudioOutputDescriptor(profile); desc->mDevice = device; - audio_io_handle_t output = mpClientInterface->openOutput(profile->mModule->mHandle, - &desc->mDevice, - &desc->mSamplingRate, - &desc->mFormat, - &desc->mChannelMask, - &desc->mLatency, - desc->mFlags); + audio_io_handle_t output = 0; +#ifdef QCOM_HARDWARE + if (!(desc->mFlags & AUDIO_OUTPUT_FLAG_LPA || desc->mFlags & AUDIO_OUTPUT_FLAG_TUNNEL || + desc->mFlags & AUDIO_OUTPUT_FLAG_VOIP_RX)) { +#endif + output = mpClientInterface->openOutput(profile->mModule->mHandle, + &desc->mDevice, + &desc->mSamplingRate, + &desc->mFormat, + &desc->mChannelMask, + &desc->mLatency, + desc->mFlags); +#ifdef QCOM_HARDWARE + } +#endif if (output != 0) { if (desc->mFlags & AUDIO_OUTPUT_FLAG_DIRECT) { String8 reply; @@ -1979,6 +2004,9 @@ audio_devices_t AudioPolicyManagerBase::getNewDevice(audio_io_handle_t output, b audio_devices_t device = AUDIO_DEVICE_NONE; AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); +#ifdef QCOM_HARDWARE + AudioOutputDescriptor *primaryOutputDesc = mOutputs.valueFor(mPrimaryOutput); +#endif // check the following by order of priority to request a routing change if necessary: // 1: the strategy enforced audible is active on the output: // use device for strategy enforced audible @@ -1997,7 +2025,13 @@ audio_devices_t AudioPolicyManagerBase::getNewDevice(audio_io_handle_t output, b } else if (isInCall() || outputDesc->isUsedByStrategy(STRATEGY_PHONE)) { device = getDeviceForStrategy(STRATEGY_PHONE, fromCache); - } else if (outputDesc->isUsedByStrategy(STRATEGY_SONIFICATION)) { +#ifdef QCOM_HARDWARE + } else if (outputDesc->isUsedByStrategy(STRATEGY_SONIFICATION) || + (primaryOutputDesc->isUsedByStrategy(STRATEGY_SONIFICATION))) +#else + } else if (outputDesc->isUsedByStrategy(STRATEGY_SONIFICATION)) +#endif + { device = getDeviceForStrategy(STRATEGY_SONIFICATION, fromCache); } else if (outputDesc->isUsedByStrategy(STRATEGY_SONIFICATION_RESPECTFUL)) { device = getDeviceForStrategy(STRATEGY_SONIFICATION_RESPECTFUL, fromCache); @@ -3360,6 +3394,10 @@ const struct StringToEnum sDeviceNameToEnumTable[] = { STRING_TO_ENUM(AUDIO_DEVICE_OUT_SPEAKER), STRING_TO_ENUM(AUDIO_DEVICE_OUT_WIRED_HEADSET), STRING_TO_ENUM(AUDIO_DEVICE_OUT_WIRED_HEADPHONE), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_DEVICE_OUT_ANC_HEADSET), + STRING_TO_ENUM(AUDIO_DEVICE_OUT_ANC_HEADPHONE), +#endif STRING_TO_ENUM(AUDIO_DEVICE_OUT_ALL_SCO), STRING_TO_ENUM(AUDIO_DEVICE_OUT_ALL_A2DP), STRING_TO_ENUM(AUDIO_DEVICE_OUT_AUX_DIGITAL), @@ -3367,18 +3405,36 @@ const struct StringToEnum sDeviceNameToEnumTable[] = { STRING_TO_ENUM(AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET), STRING_TO_ENUM(AUDIO_DEVICE_OUT_USB_DEVICE), STRING_TO_ENUM(AUDIO_DEVICE_OUT_USB_ACCESSORY), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_DEVICE_OUT_FM), + STRING_TO_ENUM(AUDIO_DEVICE_OUT_FM_TX), +#endif STRING_TO_ENUM(AUDIO_DEVICE_OUT_ALL_USB), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_DEVICE_OUT_PROXY), +#endif STRING_TO_ENUM(AUDIO_DEVICE_OUT_REMOTE_SUBMIX), STRING_TO_ENUM(AUDIO_DEVICE_IN_BUILTIN_MIC), STRING_TO_ENUM(AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET), STRING_TO_ENUM(AUDIO_DEVICE_IN_WIRED_HEADSET), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_DEVICE_IN_ANC_HEADSET), +#endif STRING_TO_ENUM(AUDIO_DEVICE_IN_AUX_DIGITAL), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_DEVICE_IN_FM_RX), + STRING_TO_ENUM(AUDIO_DEVICE_IN_FM_RX_A2DP), +#endif STRING_TO_ENUM(AUDIO_DEVICE_IN_VOICE_CALL), STRING_TO_ENUM(AUDIO_DEVICE_IN_BACK_MIC), STRING_TO_ENUM(AUDIO_DEVICE_IN_REMOTE_SUBMIX), STRING_TO_ENUM(AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET), STRING_TO_ENUM(AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET), STRING_TO_ENUM(AUDIO_DEVICE_IN_USB_ACCESSORY), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_DEVICE_IN_PROXY), + STRING_TO_ENUM(AUDIO_DEVICE_IN_COMMUNICATION), +#endif }; const struct StringToEnum sFlagNameToEnumTable[] = { @@ -3386,6 +3442,11 @@ const struct StringToEnum sFlagNameToEnumTable[] = { STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_PRIMARY), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_FAST), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_DEEP_BUFFER), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_VOIP_RX), + STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_LPA), + STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_TUNNEL), +#endif }; const struct StringToEnum sFormatNameToEnumTable[] = { @@ -3394,18 +3455,50 @@ const struct StringToEnum sFormatNameToEnumTable[] = { STRING_TO_ENUM(AUDIO_FORMAT_MP3), STRING_TO_ENUM(AUDIO_FORMAT_AAC), STRING_TO_ENUM(AUDIO_FORMAT_VORBIS), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_FORMAT_AC3), + STRING_TO_ENUM(AUDIO_FORMAT_EAC3), + STRING_TO_ENUM(AUDIO_FORMAT_DTS), + STRING_TO_ENUM(AUDIO_FORMAT_DTS_LBR), + STRING_TO_ENUM(AUDIO_FORMAT_WMA), + STRING_TO_ENUM(AUDIO_FORMAT_WMA_PRO), + STRING_TO_ENUM(AUDIO_FORMAT_AAC_ADIF), + STRING_TO_ENUM(AUDIO_FORMAT_AMR_NB), + STRING_TO_ENUM(AUDIO_FORMAT_AMR_WB), + STRING_TO_ENUM(AUDIO_FORMAT_AMR_WB_PLUS), + STRING_TO_ENUM(AUDIO_FORMAT_EVRC), + STRING_TO_ENUM(AUDIO_FORMAT_EVRCB), + STRING_TO_ENUM(AUDIO_FORMAT_EVRCWB), + STRING_TO_ENUM(AUDIO_FORMAT_QCELP), + STRING_TO_ENUM(AUDIO_FORMAT_MP2), +#endif }; const struct StringToEnum sOutChannelsNameToEnumTable[] = { STRING_TO_ENUM(AUDIO_CHANNEL_OUT_MONO), STRING_TO_ENUM(AUDIO_CHANNEL_OUT_STEREO), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_CHANNEL_OUT_2POINT1), + STRING_TO_ENUM(AUDIO_CHANNEL_OUT_QUAD), + STRING_TO_ENUM(AUDIO_CHANNEL_OUT_SURROUND), + STRING_TO_ENUM(AUDIO_CHANNEL_OUT_PENTA), +#endif STRING_TO_ENUM(AUDIO_CHANNEL_OUT_5POINT1), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_CHANNEL_OUT_6POINT1), +#endif STRING_TO_ENUM(AUDIO_CHANNEL_OUT_7POINT1), }; const struct StringToEnum sInChannelsNameToEnumTable[] = { STRING_TO_ENUM(AUDIO_CHANNEL_IN_MONO), STRING_TO_ENUM(AUDIO_CHANNEL_IN_STEREO), +#ifdef QCOM_HARDWARE + STRING_TO_ENUM(AUDIO_CHANNEL_IN_5POINT1), + STRING_TO_ENUM(AUDIO_CHANNEL_IN_VOICE_CALL_MONO), + STRING_TO_ENUM(AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO), + STRING_TO_ENUM(AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO), +#endif }; diff --git a/audio/audio_hw_hal.cpp b/audio/audio_hw_hal.cpp index 07d735d..e43140f 100644 --- a/audio/audio_hw_hal.cpp +++ b/audio/audio_hw_hal.cpp @@ -248,6 +248,7 @@ static int out_get_render_position(const struct audio_stream_out *stream, return out->legacy_out->getRenderPosition(dsp_frames); } +#ifndef ICS_AUDIO_BLOB static int out_get_next_write_timestamp(const struct audio_stream_out *stream, int64_t *timestamp) { @@ -255,6 +256,7 @@ static int out_get_next_write_timestamp(const struct audio_stream_out *stream, reinterpret_cast<const struct legacy_stream_out *>(stream); return out->legacy_out->getNextWriteTimestamp(timestamp); } +#endif static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect) { @@ -434,11 +436,13 @@ static int adev_set_master_volume(struct audio_hw_device *dev, float volume) return ladev->hwif->setMasterVolume(volume); } +#ifndef ICS_AUDIO_BLOB static int adev_get_master_volume(struct audio_hw_device *dev, float* volume) { struct legacy_audio_device *ladev = to_ladev(dev); return ladev->hwif->getMasterVolume(volume); } +#endif static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode) { @@ -475,6 +479,7 @@ static char * adev_get_parameters(const struct audio_hw_device *dev, return strdup(s8.string()); } +#ifndef ICS_AUDIO_BLOB static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev, const struct audio_config *config) { @@ -482,13 +487,31 @@ static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev, return ladev->hwif->getInputBufferSize(config->sample_rate, (int) config->format, popcount(config->channel_mask)); } +#else +static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev, + uint32_t sample_rate, int format, + int channel_count) +{ + const struct legacy_audio_device *ladev = to_cladev(dev); + return ladev->hwif->getInputBufferSize(sample_rate, format, channel_count); +} +#endif +#ifndef ICS_AUDIO_BLOB static int adev_open_output_stream(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config *config, struct audio_stream_out **stream_out) +#else +static int adev_open_output_stream(struct audio_hw_device *dev, + uint32_t devices, + int *format, + uint32_t *channels, + uint32_t *sample_rate, + struct audio_stream_out **stream_out) +#endif { struct legacy_audio_device *ladev = to_ladev(dev); status_t status; @@ -501,9 +524,15 @@ static int adev_open_output_stream(struct audio_hw_device *dev, devices = convert_audio_device(devices, HAL_API_REV_2_0, HAL_API_REV_1_0); +#ifndef ICS_AUDIO_BLOB out->legacy_out = ladev->hwif->openOutputStream(devices, (int *) &config->format, &config->channel_mask, &config->sample_rate, &status); +#else + out->legacy_out = ladev->hwif->openOutputStream(devices, format, channels, + sample_rate, &status); +#endif + if (!out->legacy_out) { ret = status; goto err_open; @@ -525,7 +554,9 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->stream.set_volume = out_set_volume; out->stream.write = out_write; out->stream.get_render_position = out_get_render_position; +#ifndef ICS_AUDIO_BLOB out->stream.get_next_write_timestamp = out_get_next_write_timestamp; +#endif *stream_out = &out->stream; return 0; @@ -548,9 +579,15 @@ static void adev_close_output_stream(struct audio_hw_device *dev, /** This method creates and opens the audio hardware input stream */ static int adev_open_input_stream(struct audio_hw_device *dev, +#ifndef ICS_AUDIO_BLOB audio_io_handle_t handle, audio_devices_t devices, struct audio_config *config, +#else + uint32_t devices, int *format, + uint32_t *channels, uint32_t *sample_rate, + audio_in_acoustics_t acoustics, +#endif struct audio_stream_in **stream_in) { struct legacy_audio_device *ladev = to_ladev(dev); @@ -564,9 +601,15 @@ static int adev_open_input_stream(struct audio_hw_device *dev, devices = convert_audio_device(devices, HAL_API_REV_2_0, HAL_API_REV_1_0); +#ifndef ICS_AUDIO_BLOB in->legacy_in = ladev->hwif->openInputStream(devices, (int *) &config->format, &config->channel_mask, &config->sample_rate, &status, (AudioSystem::audio_in_acoustics)0); +#else + in->legacy_in = ladev->hwif->openInputStream(devices, format, channels, + sample_rate, &status, + (AudioSystem::audio_in_acoustics)acoustics); +#endif if (!in->legacy_in) { ret = status; goto err_open; @@ -653,7 +696,9 @@ static int legacy_adev_open(const hw_module_t* module, const char* name, ladev->device.init_check = adev_init_check; ladev->device.set_voice_volume = adev_set_voice_volume; ladev->device.set_master_volume = adev_set_master_volume; +#ifndef ICS_AUDIO_BLOB ladev->device.get_master_volume = adev_get_master_volume; +#endif ladev->device.set_mode = adev_set_mode; ladev->device.set_mic_mute = adev_set_mic_mute; ladev->device.get_mic_mute = adev_get_mic_mute; @@ -661,8 +706,8 @@ static int legacy_adev_open(const hw_module_t* module, const char* name, ladev->device.get_parameters = adev_get_parameters; ladev->device.get_input_buffer_size = adev_get_input_buffer_size; ladev->device.open_output_stream = adev_open_output_stream; - ladev->device.close_output_stream = adev_close_output_stream; ladev->device.open_input_stream = adev_open_input_stream; + ladev->device.close_output_stream = adev_close_output_stream; ladev->device.close_input_stream = adev_close_input_stream; ladev->device.dump = adev_dump; diff --git a/audio/audio_policy_hal.cpp b/audio/audio_policy_hal.cpp index bff6b74..99b37bf 100644 --- a/audio/audio_policy_hal.cpp +++ b/audio/audio_policy_hal.cpp @@ -349,8 +349,10 @@ static int create_legacy_ap(const struct audio_policy_device *device, lap->policy.init_stream_volume = ap_init_stream_volume; lap->policy.set_stream_volume_index = ap_set_stream_volume_index; lap->policy.get_stream_volume_index = ap_get_stream_volume_index; +#ifndef ICS_AUDIO_BLOB lap->policy.set_stream_volume_index_for_device = ap_set_stream_volume_index_for_device; lap->policy.get_stream_volume_index_for_device = ap_get_stream_volume_index_for_device; +#endif lap->policy.get_strategy_for_stream = ap_get_strategy_for_stream; lap->policy.get_devices_for_stream = ap_get_devices_for_stream; lap->policy.get_output_for_effect = ap_get_output_for_effect; |
