diff options
author | Dima Zavin <dima@android.com> | 2011-04-19 16:53:42 -0700 |
---|---|---|
committer | Dima Zavin <dima@android.com> | 2011-04-27 10:48:25 -0700 |
commit | e81531e91ecae92aff471dbff9cbeb0f95ff4a80 (patch) | |
tree | 203c16c95e297163138f465e3a2a60c827873ce6 /audio/AudioPolicyCompatClient.h | |
parent | f01215993dda68b6b52111d754bd0c7c2d5bcfa3 (diff) | |
download | hardware_libhardware_legacy-e81531e91ecae92aff471dbff9cbeb0f95ff4a80.zip hardware_libhardware_legacy-e81531e91ecae92aff471dbff9cbeb0f95ff4a80.tar.gz hardware_libhardware_legacy-e81531e91ecae92aff471dbff9cbeb0f95ff4a80.tar.bz2 |
hardware_legacy: provide HAL helpers for legacy audio users
This doesn't actually create a HAL, but rather a set of helper static
libraries that device specific libraries (i.e. the old libaudio pieces)
can link against to create a proper audio HAL module.
We provide an audio_policy static wrapper and audio hardware interface
static wrapper.
Change-Id: Ie56195447ad24b83888f752dca24674b0afd8a76
Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'audio/AudioPolicyCompatClient.h')
-rw-r--r-- | audio/AudioPolicyCompatClient.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/audio/AudioPolicyCompatClient.h b/audio/AudioPolicyCompatClient.h new file mode 100644 index 0000000..073d379 --- /dev/null +++ b/audio/AudioPolicyCompatClient.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_AUDIOPOLICYCLIENTLEGACY_H +#define ANDROID_AUDIOPOLICYCLIENTLEGACY_H + +#include <hardware/audio.h> +#include <hardware/audio_policy.h> +#include <hardware/audio_policy_hal.h> + +#include <hardware_legacy/AudioSystemLegacy.h> +#include <hardware_legacy/AudioPolicyInterface.h> + +/************************************/ +/* FOR BACKWARDS COMPATIBILITY ONLY */ +/************************************/ +namespace android_audio_legacy { + +class AudioPolicyCompatClient : public AudioPolicyClientInterface { +public: + AudioPolicyCompatClient(struct audio_policy_service_ops *serviceOps, + void *service) : + mServiceOps(serviceOps) , mService(service) {} + + virtual audio_io_handle_t openOutput(uint32_t *pDevices, + uint32_t *pSamplingRate, + uint32_t *pFormat, + uint32_t *pChannels, + uint32_t *pLatencyMs, + AudioSystem::output_flags flags); + virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, + audio_io_handle_t output2); + virtual status_t closeOutput(audio_io_handle_t output); + virtual status_t suspendOutput(audio_io_handle_t output); + virtual status_t restoreOutput(audio_io_handle_t output); + virtual audio_io_handle_t openInput(uint32_t *pDevices, + uint32_t *pSamplingRate, + uint32_t *pFormat, + uint32_t *pChannels, + uint32_t acoustics); + virtual status_t closeInput(audio_io_handle_t input); + virtual status_t setStreamOutput(AudioSystem::stream_type stream, audio_io_handle_t output); + virtual status_t moveEffects(int session, + audio_io_handle_t srcOutput, + audio_io_handle_t dstOutput); + + virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys); + virtual void setParameters(audio_io_handle_t ioHandle, + const String8& keyValuePairs, + int delayMs = 0); + virtual status_t setStreamVolume(AudioSystem::stream_type stream, + float volume, + audio_io_handle_t output, + int delayMs = 0); + virtual status_t startTone(ToneGenerator::tone_type tone, AudioSystem::stream_type stream); + virtual status_t stopTone(); + virtual status_t setVoiceVolume(float volume, int delayMs = 0); + +private: + struct audio_policy_service_ops* mServiceOps; + void* mService; +}; + +}; // namespace android_audio_legacy + +#endif // ANDROID_AUDIOPOLICYCLIENTLEGACY_H |