blob: df7bd4332ede0fbf4b8ac6993172296fe4988fd6 [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_LOCAL_H
18#define ANDROID_HARDWARE_EFFECT_BUFFER_HAL_LOCAL_H
19
20#include <memory>
21
22#include <media/audiohal/EffectBufferHalInterface.h>
23#include <system/audio_effect.h>
24
25namespace android {
26
27class EffectBufferHalLocal : public EffectBufferHalInterface
28{
29 public:
30 virtual audio_buffer_t* audioBuffer();
31 virtual void* externalData() const;
32
33 virtual void setExternalData(void* external);
34 virtual void setFrameCount(size_t frameCount);
35
36 virtual void update();
37 virtual void commit();
38
39 private:
40 friend class EffectBufferHalInterface;
41
42 std::unique_ptr<uint8_t[]> mOwnBuffer;
43 const size_t mBufferSize;
44 audio_buffer_t mAudioBuffer;
45
46 // Can not be constructed directly by clients.
47 explicit EffectBufferHalLocal(size_t size);
48 EffectBufferHalLocal(void* external, size_t size);
49
50 virtual ~EffectBufferHalLocal();
51
52 status_t init();
53};
54
55} // namespace android
56
57#endif // ANDROID_HARDWARE_EFFECT_BUFFER_HAL_LOCAL_H