blob: 11fdc3037b4974c8635ba38298dbb9c24230061b [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
17#include <media/EffectsFactoryApi.h>
18#include <utils/Log.h>
19
20#include "EffectHalLocal.h"
21
22namespace android {
23
24EffectHalLocal::EffectHalLocal(effect_handle_t handle)
25 : mHandle(handle) {
26}
27
28EffectHalLocal::~EffectHalLocal() {
29 int status = EffectRelease(mHandle);
30 if (status != 0) {
31 ALOGW("Error releasing effect %p: %s", mHandle, strerror(-status));
32 }
33}
34
35status_t EffectHalLocal::process(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
36 return (*mHandle)->process(mHandle, inBuffer, outBuffer);
37}
38
39status_t EffectHalLocal::processReverse(audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
40 return (*mHandle)->process_reverse(mHandle, inBuffer, outBuffer);
41}
42
43status_t EffectHalLocal::command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData,
44 uint32_t *replySize, void *pReplyData) {
45 return (*mHandle)->command(mHandle, cmdCode, cmdSize, pCmdData, replySize, pReplyData);
46}
47
48status_t EffectHalLocal::getDescriptor(effect_descriptor_t *pDescriptor) {
49 return (*mHandle)->get_descriptor(mHandle, pDescriptor);
50}
51
52} // namespace android