diff options
author | Eric Laurent <elaurent@google.com> | 2014-06-07 10:01:16 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-07 10:01:16 +0000 |
commit | 7e45ef9db7446d33c941961c14555413641e444b (patch) | |
tree | b3e2dca352431bace292402d2498f888ebd7a377 /services | |
parent | 3e648747e7e40752580ae7fd0ff2e803623680cd (diff) | |
parent | 318cd78e3b8503113919191b3711eb8be5d23d35 (diff) | |
download | frameworks_av-7e45ef9db7446d33c941961c14555413641e444b.zip frameworks_av-7e45ef9db7446d33c941961c14555413641e444b.tar.gz frameworks_av-7e45ef9db7446d33c941961c14555413641e444b.tar.bz2 |
am 318cd78e: Merge "audio policy: added audio HAL version in audio_policy.conf" into lmp-preview-dev
* commit '318cd78e3b8503113919191b3711eb8be5d23d35':
audio policy: added audio HAL version in audio_policy.conf
Diffstat (limited to 'services')
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.cpp | 12 | ||||
-rw-r--r-- | services/audiopolicy/AudioPolicyManager.h | 5 | ||||
-rw-r--r-- | services/audiopolicy/audio_policy.conf | 145 | ||||
-rw-r--r-- | services/audiopolicy/audio_policy_conf.h | 1 |
4 files changed, 160 insertions, 3 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index 64ed8fb..d4c9374 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -4695,7 +4695,8 @@ status_t AudioPolicyManager::EffectDescriptor::dump(int fd) // --- HwModule class implementation AudioPolicyManager::HwModule::HwModule(const char *name) - : mName(strndup(name, AUDIO_HARDWARE_MODULE_ID_MAX_LEN)), mHandle(0) + : mName(strndup(name, AUDIO_HARDWARE_MODULE_ID_MAX_LEN)), + mHalVersion(AUDIO_DEVICE_API_VERSION_MIN), mHandle(0) { } @@ -4854,6 +4855,8 @@ void AudioPolicyManager::HwModule::dump(int fd) result.append(buffer); snprintf(buffer, SIZE, " - handle: %d\n", mHandle); result.append(buffer); + snprintf(buffer, SIZE, " - version: %u.%u\n", mHalVersion >> 8, mHalVersion & 0xFF); + result.append(buffer); write(fd, result.string(), result.size()); if (mOutputProfiles.size()) { write(fd, " - outputs:\n", strlen(" - outputs:\n")); @@ -5816,6 +5819,7 @@ void AudioPolicyManager::loadHwModules(cnode *root) void AudioPolicyManager::loadGlobalConfig(cnode *root, const sp<HwModule>& module) { cnode *node = config_find(root, GLOBAL_CONFIG_TAG); + if (node == NULL) { return; } @@ -5848,6 +5852,12 @@ void AudioPolicyManager::loadGlobalConfig(cnode *root, const sp<HwModule>& modul } else if (strcmp(SPEAKER_DRC_ENABLED_TAG, node->name) == 0) { mSpeakerDrcEnabled = stringToBool((char *)node->value); ALOGV("loadGlobalConfig() mSpeakerDrcEnabled = %d", mSpeakerDrcEnabled); + } else if (strcmp(AUDIO_HAL_VERSION_TAG, node->name) == 0) { + uint32_t major, minor; + sscanf((char *)node->value, "%u.%u", &major, &minor); + module->mHalVersion = HARDWARE_DEVICE_API_VERSION(major, minor); + ALOGV("loadGlobalConfig() mHalVersion = %04x major %u minor %u", + module->mHalVersion, major, minor); } node = node->next; } diff --git a/services/audiopolicy/AudioPolicyManager.h b/services/audiopolicy/AudioPolicyManager.h index b572f13..1abeb6a 100644 --- a/services/audiopolicy/AudioPolicyManager.h +++ b/services/audiopolicy/AudioPolicyManager.h @@ -359,8 +359,9 @@ protected: void dump(int fd); - const char *const mName; // base name of the audio HW module (primary, a2dp ...) - audio_module_handle_t mHandle; + const char *const mName; // base name of the audio HW module (primary, a2dp ...) + uint32_t mHalVersion; // audio HAL API version + audio_module_handle_t mHandle; Vector < sp<IOProfile> > mOutputProfiles; // output profiles exposed by this module Vector < sp<IOProfile> > mInputProfiles; // input profiles exposed by this module DeviceVector mDeclaredDevices; // devices declared in audio_policy.conf diff --git a/services/audiopolicy/audio_policy.conf b/services/audiopolicy/audio_policy.conf new file mode 100644 index 0000000..9b83fef --- /dev/null +++ b/services/audiopolicy/audio_policy.conf @@ -0,0 +1,145 @@ +# +# Template audio policy configuration file +# + +# Global configuration section: +# - before audio HAL version 3.0: +# lists input and output devices always present on the device +# as well as the output device selected by default. +# Devices are designated by a string that corresponds to the enum in audio.h +# +# global_configuration { +# attached_output_devices AUDIO_DEVICE_OUT_SPEAKER +# default_output_device AUDIO_DEVICE_OUT_SPEAKER +# attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_REMOTE_SUBMIX +# } +# +# - after and including audio HAL 3.0 the global_configuration section is included in each +# hardware module section. +# it also includes the audio HAL version of this hw module: +# global_configuration { +# ... +# audio_hal_version <major.minor> # audio HAL version in e.g. 3.0 +# } +# other attributes (attached devices, default device) have to be included in the +# global_configuration section of each hardware module + + +# audio hardware module section: contains descriptors for all audio hw modules present on the +# device. Each hw module node is named after the corresponding hw module library base name. +# For instance, "primary" corresponds to audio.primary.<device>.so. +# The "primary" module is mandatory and must include at least one output with +# AUDIO_OUTPUT_FLAG_PRIMARY flag. +# Each module descriptor contains one or more output profile descriptors and zero or more +# input profile descriptors. Each profile lists all the parameters supported by a given output +# or input stream category. +# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding +# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n". +# +# For audio HAL version posterior to 3.0 the following sections or sub sections can be present in +# a hw module section: +# - A "global_configuration" section: see above +# - Optionally a "devices" section: +# This section contains descriptors for audio devices with attributes like an address or a +# gain controller. The syntax for the devices section and device descriptor is as follows: +# devices { +# <device name> { # <device name>: any string without space +# type <device type> # <device type> e.g. AUDIO_DEVICE_OUT_SPEAKER +# address <address> # optional: device address, char string less than 64 in length +# } +# } +# - one or more "gains" sections can be present in a device descriptor section. +# If present, they describe the capabilities of gain controllers attached to this input or +# output device. e.g. : +# <device name> { # <device name>: any string without space +# type <device type> # <device type> e.g. AUDIO_DEVICE_OUT_SPEAKER +# address <address> # optional: device address, char string less than 64 in length +# gains { +# <gain name> { +# mode <gain modes supported> # e.g. AUDIO_GAIN_MODE_CHANNELS +# channel_mask <controlled channels> # needed if mode AUDIO_GAIN_MODE_CHANNELS +# min_value_mB <min value in millibel> +# max_value_mB <max value in millibel> +# default_value_mB <default value in millibel> +# step_value_mB <step value in millibel> +# min_ramp_ms <min duration in ms> # needed if mode AUDIO_GAIN_MODE_RAMP +# max_ramp_ms <max duration ms> # needed if mode AUDIO_GAIN_MODE_RAMP +# } +# } +# } +# - when a device descriptor is present, output and input profiles can refer to this device by +# its name in their "devices" section instead of specifying a device type. e.g. : +# outputs { +# primary { +# sampling_rates 44100 +# channel_masks AUDIO_CHANNEL_OUT_STEREO +# formats AUDIO_FORMAT_PCM_16_BIT +# devices <device name> +# flags AUDIO_OUTPUT_FLAG_PRIMARY +# } +# } +# sample audio_policy.conf file below + +audio_hw_modules { + primary { + global_configuration { + attached_output_devices AUDIO_DEVICE_OUT_SPEAKER + default_output_device AUDIO_DEVICE_OUT_SPEAKER + attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC + audio_hal_version 3.0 + } + devices { + speaker { + type AUDIO_DEVICE_OUT_SPEAKER + gains { + gain_1 { + mode AUDIO_GAIN_MODE_JOINT + min_value_mB -8400 + max_value_mB 4000 + default_value_mB 0 + step_value_mB 100 + } + } + } + } + outputs { + primary { + sampling_rates 48000 + channel_masks AUDIO_CHANNEL_OUT_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices speaker + flags AUDIO_OUTPUT_FLAG_PRIMARY + } + } + inputs { + primary { + sampling_rates 8000|16000 + channel_masks AUDIO_CHANNEL_IN_MONO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_IN_BUILTIN_MIC + } + } + } + r_submix { + global_configuration { + attached_input_devices AUDIO_DEVICE_IN_REMOTE_SUBMIX + audio_hal_version 2.0 + } + outputs { + submix { + sampling_rates 48000 + channel_masks AUDIO_CHANNEL_OUT_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_OUT_REMOTE_SUBMIX + } + } + inputs { + submix { + sampling_rates 48000 + channel_masks AUDIO_CHANNEL_IN_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_IN_REMOTE_SUBMIX + } + } + } +} diff --git a/services/audiopolicy/audio_policy_conf.h b/services/audiopolicy/audio_policy_conf.h index 79f20f1..2535a67 100644 --- a/services/audiopolicy/audio_policy_conf.h +++ b/services/audiopolicy/audio_policy_conf.h @@ -35,6 +35,7 @@ #define DEFAULT_OUTPUT_DEVICE_TAG "default_output_device" #define ATTACHED_INPUT_DEVICES_TAG "attached_input_devices" #define SPEAKER_DRC_ENABLED_TAG "speaker_drc_enabled" +#define AUDIO_HAL_VERSION_TAG "audio_hal_version" // hw modules descriptions #define AUDIO_HW_MODULE_TAG "audio_hw_modules" |