Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
Mikhail Naganov | a0c9133 | 2016-09-19 10:01:12 -0700 | [diff] [blame^] | 17 | #define LOG_TAG "EffectHalLocal" |
Mikhail Naganov | e4f1f63 | 2016-08-31 11:35:10 -0700 | [diff] [blame] | 18 | //#define LOG_NDEBUG 0 |
| 19 | |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 20 | #include <media/EffectsFactoryApi.h> |
| 21 | #include <utils/Log.h> |
| 22 | |
| 23 | #include "EffectHalLocal.h" |
| 24 | |
| 25 | namespace android { |
| 26 | |
| 27 | EffectHalLocal::EffectHalLocal(effect_handle_t handle) |
| 28 | : mHandle(handle) { |
| 29 | } |
| 30 | |
| 31 | EffectHalLocal::~EffectHalLocal() { |
| 32 | int status = EffectRelease(mHandle); |
Mikhail Naganov | e4f1f63 | 2016-08-31 11:35:10 -0700 | [diff] [blame] | 33 | ALOGW_IF(status, "Error releasing effect %p: %s", mHandle, strerror(-status)); |
| 34 | mHandle = 0; |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | status_t EffectHalLocal::process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) { |
| 38 | return (*mHandle)->process(mHandle, inBuffer, outBuffer); |
| 39 | } |
| 40 | |
| 41 | status_t EffectHalLocal::processReverse(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) { |
| 42 | return (*mHandle)->process_reverse(mHandle, inBuffer, outBuffer); |
| 43 | } |
| 44 | |
| 45 | status_t EffectHalLocal::command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, |
| 46 | uint32_t *replySize, void *pReplyData) { |
| 47 | return (*mHandle)->command(mHandle, cmdCode, cmdSize, pCmdData, replySize, pReplyData); |
| 48 | } |
| 49 | |
| 50 | status_t EffectHalLocal::getDescriptor(effect_descriptor_t *pDescriptor) { |
| 51 | return (*mHandle)->get_descriptor(mHandle, pDescriptor); |
| 52 | } |
| 53 | |
| 54 | } // namespace android |