Shunkai Yao | ed624a7 | 2022-12-12 06:11:46 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2022 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 | #define LOG_TAG "EffectBufferHalAidl" |
| 18 | //#define LOG_NDEBUG 0 |
| 19 | |
| 20 | #include <utils/Log.h> |
| 21 | |
| 22 | #include "EffectBufferHalAidl.h" |
| 23 | |
| 24 | namespace android { |
| 25 | namespace effect { |
| 26 | |
| 27 | // static |
| 28 | status_t EffectBufferHalAidl::allocate(size_t size, sp<EffectBufferHalInterface>* buffer) { |
| 29 | ALOGE("%s not implemented yet %zu %p", __func__, size, buffer); |
| 30 | return mirror(nullptr, size, buffer); |
| 31 | } |
| 32 | |
| 33 | status_t EffectBufferHalAidl::mirror(void* external, size_t size, |
| 34 | sp<EffectBufferHalInterface>* buffer) { |
| 35 | // buffer->setExternalData(external); |
| 36 | ALOGW("%s not implemented yet %p %zu %p", __func__, external, size, buffer); |
| 37 | return OK; |
| 38 | } |
| 39 | |
| 40 | EffectBufferHalAidl::EffectBufferHalAidl(size_t size) |
| 41 | : mBufferSize(size), |
| 42 | mFrameCountChanged(false), |
| 43 | mExternalData(nullptr), |
| 44 | mAudioBuffer{0, {nullptr}} { |
| 45 | } |
| 46 | |
| 47 | EffectBufferHalAidl::~EffectBufferHalAidl() { |
| 48 | } |
| 49 | |
| 50 | status_t EffectBufferHalAidl::init() { |
| 51 | ALOGW("%s not implemented yet", __func__); |
| 52 | return OK; |
| 53 | } |
| 54 | |
| 55 | audio_buffer_t* EffectBufferHalAidl::audioBuffer() { |
| 56 | return &mAudioBuffer; |
| 57 | } |
| 58 | |
| 59 | void* EffectBufferHalAidl::externalData() const { |
| 60 | return mExternalData; |
| 61 | } |
| 62 | |
| 63 | void EffectBufferHalAidl::setFrameCount(size_t frameCount) { |
| 64 | mAudioBuffer.frameCount = frameCount; |
| 65 | mFrameCountChanged = true; |
| 66 | } |
| 67 | |
| 68 | bool EffectBufferHalAidl::checkFrameCountChange() { |
| 69 | bool result = mFrameCountChanged; |
| 70 | mFrameCountChanged = false; |
| 71 | return result; |
| 72 | } |
| 73 | |
| 74 | void EffectBufferHalAidl::setExternalData(void* external) { |
| 75 | mExternalData = external; |
| 76 | } |
| 77 | |
| 78 | void EffectBufferHalAidl::update() { |
| 79 | ALOGW("%s not implemented yet", __func__); |
| 80 | } |
| 81 | |
| 82 | void EffectBufferHalAidl::commit() { |
| 83 | ALOGW("%s not implemented yet", __func__); |
| 84 | } |
| 85 | |
| 86 | } // namespace effect |
| 87 | } // namespace android |