diff options
author | Glenn Kasten <gkasten@google.com> | 2013-12-10 09:10:28 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2013-12-16 14:10:22 -0800 |
commit | 2c3d2379ee6eadb32b63bf6de538cfd6487e8e20 (patch) | |
tree | d1d5c9644cf13a56ddce81506eead75f925ef4b4 | |
parent | 5082dbeb19e37883230510129c94336063a4f91c (diff) | |
download | hardware_libhardware_legacy-2c3d2379ee6eadb32b63bf6de538cfd6487e8e20.zip hardware_libhardware_legacy-2c3d2379ee6eadb32b63bf6de538cfd6487e8e20.tar.gz hardware_libhardware_legacy-2c3d2379ee6eadb32b63bf6de538cfd6487e8e20.tar.bz2 |
Use audio_channel_mask_t in AudioPolicy
Also:
- use %x format for logging channel masks
- use AUDIO_CHANNEL_IN_* constants from system/audio.h instead of AudioSystemLegacy.h symbols
- remove redundant casts
- use "channelMask" instead of "channels" to avoid possible confusion with channel counts
Change-Id: If05d6b1cae5cf1b560cd53a93ae9e592b719ec9e
-rw-r--r-- | audio/AudioPolicyManagerBase.cpp | 32 | ||||
-rw-r--r-- | include/hardware_legacy/AudioPolicyInterface.h | 4 | ||||
-rw-r--r-- | include/hardware_legacy/AudioPolicyManagerBase.h | 10 |
3 files changed, 23 insertions, 23 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index b3a9044..054fbc4 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -496,7 +496,7 @@ AudioPolicyManagerBase::IOProfile *AudioPolicyManagerBase::getProfileForDirectOu audio_devices_t device, uint32_t samplingRate, audio_format_t format, - uint32_t channelMask, + audio_channel_mask_t channelMask, audio_output_flags_t flags) { for (size_t i = 0; i < mHwModules.size(); i++) { @@ -530,7 +530,7 @@ AudioPolicyManagerBase::IOProfile *AudioPolicyManagerBase::getProfileForDirectOu audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type stream, uint32_t samplingRate, audio_format_t format, - uint32_t channelMask, + audio_channel_mask_t channelMask, AudioSystem::output_flags flags, const audio_offload_info_t *offloadInfo) { @@ -623,7 +623,7 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str outputDesc->mDevice = device; outputDesc->mSamplingRate = samplingRate; outputDesc->mFormat = (audio_format_t)format; - outputDesc->mChannelMask = (audio_channel_mask_t)channelMask; + outputDesc->mChannelMask = channelMask; outputDesc->mLatency = 0; outputDesc->mFlags =(audio_output_flags_t) (outputDesc->mFlags | flags); outputDesc->mRefCount[stream] = 0; @@ -901,7 +901,7 @@ void AudioPolicyManagerBase::releaseOutput(audio_io_handle_t output) audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, uint32_t samplingRate, audio_format_t format, - uint32_t channelMask, + audio_channel_mask_t channelMask, AudioSystem::audio_in_acoustics acoustics) { audio_io_handle_t input = 0; @@ -918,13 +918,13 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, // adapt channel selection to input source switch(inputSource) { case AUDIO_SOURCE_VOICE_UPLINK: - channelMask = AudioSystem::CHANNEL_IN_VOICE_UPLINK; + channelMask = AUDIO_CHANNEL_IN_VOICE_UPLINK; break; case AUDIO_SOURCE_VOICE_DOWNLINK: - channelMask = AudioSystem::CHANNEL_IN_VOICE_DNLINK; + channelMask = AUDIO_CHANNEL_IN_VOICE_DNLINK; break; case AUDIO_SOURCE_VOICE_CALL: - channelMask = (AudioSystem::CHANNEL_IN_VOICE_UPLINK | AudioSystem::CHANNEL_IN_VOICE_DNLINK); + channelMask = AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_VOICE_DNLINK; break; default: break; @@ -952,7 +952,7 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, inputDesc->mDevice = device; inputDesc->mSamplingRate = samplingRate; inputDesc->mFormat = (audio_format_t)format; - inputDesc->mChannelMask = (audio_channel_mask_t)channelMask; + inputDesc->mChannelMask = channelMask; inputDesc->mRefCount = 0; input = mpClientInterface->openInput(profile->mModule->mHandle, &inputDesc->mDevice, @@ -965,7 +965,7 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, (samplingRate != inputDesc->mSamplingRate) || (format != inputDesc->mFormat) || (channelMask != inputDesc->mChannelMask)) { - ALOGV("getInput() failed opening input: samplingRate %d, format %d, channelMask %d", + ALOGI("getInput() failed opening input: samplingRate %d, format %d, channelMask %x", samplingRate, format, channelMask); if (input != 0) { mpClientInterface->closeInput(input); @@ -2010,7 +2010,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, } if (profile->mChannelMasks[0] == 0) { profile->mChannelMasks.clear(); - profile->mChannelMasks.add((audio_channel_mask_t)0); + profile->mChannelMasks.add(0); } } } @@ -2662,7 +2662,7 @@ uint32_t AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, AudioPolicyManagerBase::IOProfile *AudioPolicyManagerBase::getInputProfile(audio_devices_t device, uint32_t samplingRate, audio_format_t format, - uint32_t channelMask) + audio_channel_mask_t channelMask) { // Choose an input profile based on the requested capture parameters: select the first available // profile supporting all requested parameters. @@ -3249,7 +3249,7 @@ uint32_t AudioPolicyManagerBase::getMaxEffectsMemory() AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor( const IOProfile *profile) : mId(0), mSamplingRate(0), mFormat((audio_format_t)0), - mChannelMask((audio_channel_mask_t)0), mLatency(0), + mChannelMask(0), mLatency(0), mFlags((audio_output_flags_t)0), mDevice(AUDIO_DEVICE_NONE), mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0) { @@ -3400,7 +3400,7 @@ status_t AudioPolicyManagerBase::AudioOutputDescriptor::dump(int fd) // --- AudioInputDescriptor class implementation AudioPolicyManagerBase::AudioInputDescriptor::AudioInputDescriptor(const IOProfile *profile) - : mSamplingRate(0), mFormat((audio_format_t)0), mChannelMask((audio_channel_mask_t)0), + : mSamplingRate(0), mFormat((audio_format_t)0), mChannelMask(0), mDevice(AUDIO_DEVICE_NONE), mRefCount(0), mInputSource(0), mProfile(profile) { @@ -3550,7 +3550,7 @@ AudioPolicyManagerBase::IOProfile::~IOProfile() bool AudioPolicyManagerBase::IOProfile::isCompatibleProfile(audio_devices_t device, uint32_t samplingRate, audio_format_t format, - uint32_t channelMask, + audio_channel_mask_t channelMask, audio_output_flags_t flags) const { if (samplingRate == 0 || format == 0 || channelMask == 0) { @@ -3810,7 +3810,7 @@ void AudioPolicyManagerBase::loadInChannels(char *name, IOProfile *profile) ALOGV("loadInChannels() %s", name); if (str != NULL && strcmp(str, DYNAMIC_VALUE_TAG) == 0) { - profile->mChannelMasks.add((audio_channel_mask_t)0); + profile->mChannelMasks.add(0); return; } @@ -3837,7 +3837,7 @@ void AudioPolicyManagerBase::loadOutChannels(char *name, IOProfile *profile) // by convention, "0' in the first entry in mChannelMasks indicates the supported channel // masks should be read from the output stream after it is opened for the first time if (str != NULL && strcmp(str, DYNAMIC_VALUE_TAG) == 0) { - profile->mChannelMasks.add((audio_channel_mask_t)0); + profile->mChannelMasks.add(0); return; } diff --git a/include/hardware_legacy/AudioPolicyInterface.h b/include/hardware_legacy/AudioPolicyInterface.h index 927fe6d..6a01684 100644 --- a/include/hardware_legacy/AudioPolicyInterface.h +++ b/include/hardware_legacy/AudioPolicyInterface.h @@ -92,7 +92,7 @@ public: virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, uint32_t samplingRate, audio_format_t format, - uint32_t channels, + audio_channel_mask_t channelMask, AudioSystem::output_flags flags, const audio_offload_info_t *offloadInfo) = 0; // indicates to the audio policy manager that the output starts being used by corresponding stream. @@ -110,7 +110,7 @@ public: virtual audio_io_handle_t getInput(int inputSource, uint32_t samplingRate, audio_format_t format, - uint32_t channels, + audio_channel_mask_t channelMask, AudioSystem::audio_in_acoustics acoustics) = 0; // indicates to the audio policy manager that the input starts being used. virtual status_t startInput(audio_io_handle_t input) = 0; diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index 84fb30e..a1f7d37 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -89,7 +89,7 @@ public: virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, uint32_t samplingRate, audio_format_t format, - uint32_t channels, + audio_channel_mask_t channelMask, AudioSystem::output_flags flags, const audio_offload_info_t *offloadInfo); virtual status_t startOutput(audio_io_handle_t output, @@ -102,7 +102,7 @@ public: virtual audio_io_handle_t getInput(int inputSource, uint32_t samplingRate, audio_format_t format, - uint32_t channels, + audio_channel_mask_t channelMask, AudioSystem::audio_in_acoustics acoustics); // indicates to the audio policy manager that the input starts being used. @@ -209,7 +209,7 @@ protected: bool isCompatibleProfile(audio_devices_t device, uint32_t samplingRate, audio_format_t format, - uint32_t channelMask, + audio_channel_mask_t channelMask, audio_output_flags_t flags) const; void dump(int fd); @@ -483,11 +483,11 @@ protected: IOProfile *getInputProfile(audio_devices_t device, uint32_t samplingRate, audio_format_t format, - uint32_t channelMask); + audio_channel_mask_t channelMask); IOProfile *getProfileForDirectOutput(audio_devices_t device, uint32_t samplingRate, audio_format_t format, - uint32_t channelMask, + audio_channel_mask_t channelMask, audio_output_flags_t flags); audio_io_handle_t selectOutputForEffects(const SortedVector<audio_io_handle_t>& outputs); |