blob: 56a365cfb24c74fade8c7802d7973004ee91c228 [file] [log] [blame]
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -07001/*
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 Naganova0c91332016-09-19 10:01:12 -070017#define LOG_TAG "EffectHalLocal"
Mikhail Naganove4f1f632016-08-31 11:35:10 -070018//#define LOG_NDEBUG 0
19
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070020#include <media/EffectsFactoryApi.h>
21#include <utils/Log.h>
22
23#include "EffectHalLocal.h"
24
25namespace android {
26
27EffectHalLocal::EffectHalLocal(effect_handle_t handle)
28 : mHandle(handle) {
29}
30
31EffectHalLocal::~EffectHalLocal() {
32 int status = EffectRelease(mHandle);
Mikhail Naganove4f1f632016-08-31 11:35:10 -070033 ALOGW_IF(status, "Error releasing effect %p: %s", mHandle, strerror(-status));
34 mHandle = 0;
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070035}
36
37status_t EffectHalLocal::process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
38 return (*mHandle)->process(mHandle, inBuffer, outBuffer);
39}
40
41status_t EffectHalLocal::processReverse(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
42 return (*mHandle)->process_reverse(mHandle, inBuffer, outBuffer);
43}
44
45status_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
50status_t EffectHalLocal::getDescriptor(effect_descriptor_t *pDescriptor) {
51 return (*mHandle)->get_descriptor(mHandle, pDescriptor);
52}
53
54} // namespace android