diff options
author | Eric Laurent <elaurent@google.com> | 2012-03-29 10:12:40 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2012-04-04 08:44:57 -0700 |
commit | a4c5a550e2a3bc237179b8684e51718e05894492 (patch) | |
tree | be7b6d154763ed772738a0126d10e6317920767d /services/audioflinger/AudioPolicyService.cpp | |
parent | 1a9ed11a472493cac7f6dfcbfac2064526a493ed (diff) | |
download | frameworks_av-a4c5a550e2a3bc237179b8684e51718e05894492.zip frameworks_av-a4c5a550e2a3bc237179b8684e51718e05894492.tar.gz frameworks_av-a4c5a550e2a3bc237179b8684e51718e05894492.tar.bz2 |
audio policy: load audio hw modules.
Audio HW modules are now loaded upon request from audio policy manager
according to the configuration in audio_policy.conf.
Removed hard coded HW module loading by AudioFlinger at init time.
Added methods to IAudioFlinger and AudioPolicyInterface
to control the loading of audio HW modules.
Added methods to open an output or input stream on a specific hw module.
Change-Id: I361b294ece1a9b56b2fb39cc64259dbb73b804f4
Diffstat (limited to 'services/audioflinger/AudioPolicyService.cpp')
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 80 |
1 files changed, 66 insertions, 14 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 62ab45d..15f4349 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -1329,13 +1329,27 @@ status_t AudioPolicyService::loadPreProcessorConfig(const char *path) /* implementation of the interface to the policy manager */ extern "C" { + +static audio_module_handle_t aps_load_hw_module(void *service, + const char *name) +{ + sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); + if (af == 0) { + ALOGW("%s: could not get AudioFlinger", __func__); + return 0; + } + + return af->loadHwModule(name); +} + +// deprecated: replaced by aps_open_output_on_module() static audio_io_handle_t aps_open_output(void *service, - uint32_t *pDevices, - uint32_t *pSamplingRate, - audio_format_t *pFormat, - uint32_t *pChannels, - uint32_t *pLatencyMs, - audio_policy_output_flags_t flags) + audio_devices_t *pDevices, + uint32_t *pSamplingRate, + audio_format_t *pFormat, + audio_channel_mask_t *pChannelMask, + uint32_t *pLatencyMs, + audio_policy_output_flags_t flags) { sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); if (af == 0) { @@ -1343,7 +1357,26 @@ static audio_io_handle_t aps_open_output(void *service, return 0; } - return af->openOutput(pDevices, pSamplingRate, pFormat, pChannels, + return af->openOutput((audio_module_handle_t)0, pDevices, pSamplingRate, pFormat, pChannelMask, + pLatencyMs, flags); +} + +static audio_io_handle_t aps_open_output_on_module(void *service, + audio_module_handle_t module, + audio_devices_t *pDevices, + uint32_t *pSamplingRate, + audio_format_t *pFormat, + audio_channel_mask_t *pChannelMask, + uint32_t *pLatencyMs, + audio_policy_output_flags_t flags) +{ + sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); + if (af == 0) { + ALOGW("%s: could not get AudioFlinger", __func__); + return 0; + } + ALOGW("%s: %d", __func__, module); + return af->openOutput(module, pDevices, pSamplingRate, pFormat, pChannelMask, pLatencyMs, flags); } @@ -1390,12 +1423,29 @@ static int aps_restore_output(void *service, audio_io_handle_t output) return af->restoreOutput(output); } +// deprecated: replaced by aps_open_input_on_module() static audio_io_handle_t aps_open_input(void *service, - uint32_t *pDevices, - uint32_t *pSamplingRate, - audio_format_t *pFormat, - uint32_t *pChannels, - audio_in_acoustics_t acoustics) + audio_devices_t *pDevices, + uint32_t *pSamplingRate, + audio_format_t *pFormat, + audio_channel_mask_t *pChannelMask, + audio_in_acoustics_t acoustics) +{ + sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); + if (af == 0) { + ALOGW("%s: could not get AudioFlinger", __func__); + return 0; + } + + return af->openInput((audio_module_handle_t)0, pDevices, pSamplingRate, pFormat, pChannelMask); +} + +static audio_io_handle_t aps_open_input_on_module(void *service, + audio_module_handle_t module, + audio_devices_t *pDevices, + uint32_t *pSamplingRate, + audio_format_t *pFormat, + audio_channel_mask_t *pChannelMask) { sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); if (af == 0) { @@ -1403,8 +1453,7 @@ static audio_io_handle_t aps_open_input(void *service, return 0; } - return af->openInput(pDevices, pSamplingRate, pFormat, pChannels, - acoustics); + return af->openInput(module, pDevices, pSamplingRate, pFormat, pChannelMask); } static int aps_close_input(void *service, audio_io_handle_t input) @@ -1503,6 +1552,9 @@ namespace { stop_tone : aps_stop_tone, set_voice_volume : aps_set_voice_volume, move_effects : aps_move_effects, + load_hw_module : aps_load_hw_module, + open_output_on_module : aps_open_output_on_module, + open_input_on_module : aps_open_input_on_module, }; }; // namespace <unnamed> |