• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
25 namespace android {
26 
27 class 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     virtual bool checkFrameCountChange();
36 
37     virtual void update();
38     virtual void commit();
39     virtual void update(size_t size);
40     virtual void commit(size_t size);
41 
42   private:
43     friend class EffectBufferHalInterface;
44 
45     std::unique_ptr<uint8_t[]> mOwnBuffer;
46     const size_t mBufferSize;
47     bool mFrameCountChanged;
48     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
62