blob: 202d878f931c2b56ba2d87a257d531d3ab6876ec [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();
Mikhail Naganov66916c22017-01-24 17:46:33 -080038 virtual void update(size_t size);
39 virtual void commit(size_t size);
Mikhail Naganov022b9952017-01-04 16:36:51 -080040
41 private:
42 friend class EffectBufferHalInterface;
43
44 std::unique_ptr<uint8_t[]> mOwnBuffer;
45 const size_t mBufferSize;
46 audio_buffer_t mAudioBuffer;
47
48 // Can not be constructed directly by clients.
49 explicit EffectBufferHalLocal(size_t size);
50 EffectBufferHalLocal(void* external, size_t size);
51
52 virtual ~EffectBufferHalLocal();
53
54 status_t init();
55};
56
57} // namespace android
58
59#endif // ANDROID_HARDWARE_EFFECT_BUFFER_HAL_LOCAL_H