blob: 4c4ec87b54512840d45454f249eb6fdc88fd3a32 [file] [log] [blame]
Mikhail Naganov022b9952017-01-04 16:36:51 -08001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_HARDWARE_EFFECT_BUFFER_HAL_HIDL_H
18#define ANDROID_HARDWARE_EFFECT_BUFFER_HAL_HIDL_H
19
20#include <android/hardware/audio/effect/2.0/types.h>
21#include <android/hidl/memory/1.0/IMemory.h>
22#include <hidl/HidlSupport.h>
23#include <media/audiohal/EffectBufferHalInterface.h>
24#include <system/audio_effect.h>
25
26using android::hardware::audio::effect::V2_0::AudioBuffer;
27using android::hardware::hidl_memory;
28using android::hidl::memory::V1_0::IMemory;
29
30namespace android {
31
32class EffectBufferHalHidl : public EffectBufferHalInterface
33{
34 public:
35 virtual audio_buffer_t* audioBuffer();
36 virtual void* externalData() const;
37
38 virtual void setExternalData(void* external);
39 virtual void setFrameCount(size_t frameCount);
40
41 virtual void update();
42 virtual void commit();
43
44 const AudioBuffer& hidlBuffer() const { return mHidlBuffer; }
45
46 private:
47 friend class EffectBufferHalInterface;
48
49 static uint64_t makeUniqueId();
50
51 const size_t mBufferSize;
52 void* mExternalData;
53 AudioBuffer mHidlBuffer;
54 sp<IMemory> mMemory;
55 audio_buffer_t mAudioBuffer;
56
57 // Can not be constructed directly by clients.
58 explicit EffectBufferHalHidl(size_t size);
59
60 virtual ~EffectBufferHalHidl();
61
62 status_t init();
63};
64
65} // namespace android
66
67#endif // ANDROID_HARDWARE_EFFECT_BUFFER_HAL_HIDL_H