blob: d2b624b0ed22a061e5db3b651ad465a7ab379377 [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);
Mikhail Naganov40be8a32017-04-26 17:22:00 -070035 virtual bool checkFrameCountChange();
Mikhail Naganov022b9952017-01-04 16:36:51 -080036
37 virtual void update();
38 virtual void commit();
Mikhail Naganov66916c22017-01-24 17:46:33 -080039 virtual void update(size_t size);
40 virtual void commit(size_t size);
Mikhail Naganov022b9952017-01-04 16:36:51 -080041
42 private:
43 friend class EffectBufferHalInterface;
44
45 std::unique_ptr<uint8_t[]> mOwnBuffer;
46 const size_t mBufferSize;
Mikhail Naganov40be8a32017-04-26 17:22:00 -070047 bool mFrameCountChanged;
Mikhail Naganov022b9952017-01-04 16:36:51 -080048 audio_buffer_t mAudioBuffer;
49
50 // Can not be constructed directly by clients.
51 explicit EffectBufferHalLocal(size_t size);
52 EffectBufferHalLocal(void* external, size_t size);
53
54 virtual ~EffectBufferHalLocal();
55
56 status_t init();
57};
58
59} // namespace android
60
61#endif // ANDROID_HARDWARE_EFFECT_BUFFER_HAL_LOCAL_H