diff options
author | Andy Hung <hunga@google.com> | 2014-07-21 21:56:01 -0700 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2014-07-24 18:57:27 -0700 |
commit | 9a59276fb465e492138e0576523b54079671e8f4 (patch) | |
tree | e3e51544dc4e641cdfe0b38bfaac530167656eb8 /services/audioflinger/AudioFlinger.h | |
parent | e93b6b7347a7846c8fd746542364ec11b0cd5124 (diff) | |
download | frameworks_av-9a59276fb465e492138e0576523b54079671e8f4.zip frameworks_av-9a59276fb465e492138e0576523b54079671e8f4.tar.gz frameworks_av-9a59276fb465e492138e0576523b54079671e8f4.tar.bz2 |
Add multichannel capability to AudioFlinger
But not enabled (kEnableExtendedChannels == false).
Change-Id: I62f7e31fbd29ad703a9a02f5d1a280b6972dd423
Diffstat (limited to 'services/audioflinger/AudioFlinger.h')
-rw-r--r-- | services/audioflinger/AudioFlinger.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 2830e6d..ab4c567 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -55,6 +55,7 @@ #include "FastMixer.h" #include <media/nbaio/NBAIO.h> #include "AudioWatchdog.h" +#include "AudioMixer.h" #include <powermanager/IPowerManager.h> @@ -327,6 +328,30 @@ private: audio_devices_t devices); void purgeStaleEffects_l(); + // Set kEnableExtendedChannels to true to enable greater than stereo output + // for the MixerThread and device sink. Number of channels allowed is + // FCC_2 <= channels <= AudioMixer::MAX_NUM_CHANNELS. + static const bool kEnableExtendedChannels = false; + + // Returns true if channel mask is permitted for the PCM sink in the MixerThread + static inline bool isValidPcmSinkChannelMask(audio_channel_mask_t channelMask) { + switch (audio_channel_mask_get_representation(channelMask)) { + case AUDIO_CHANNEL_REPRESENTATION_POSITION: { + uint32_t channelCount = FCC_2; // stereo is default + if (kEnableExtendedChannels) { + channelCount = audio_channel_count_from_out_mask(channelMask); + if (channelCount > AudioMixer::MAX_NUM_CHANNELS) { + return false; + } + } + // check that channelMask is the "canonical" one we expect for the channelCount. + return channelMask == audio_channel_out_mask_from_count(channelCount); + } + default: + return false; + } + } + // Set kEnableExtendedPrecision to true to use extended precision in MixerThread static const bool kEnableExtendedPrecision = true; @@ -565,7 +590,7 @@ private: uint32_t version() const { return mHwDevice->common.version; } private: - audio_module_handle_t mHandle; + const audio_module_handle_t mHandle; const char * const mModuleName; audio_hw_device_t * const mHwDevice; const Flags mFlags; |