blob: b4994625e898428c52c22b8c9cd79c2d4e34f031 [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#ifndef ANDROID_HARDWARE_EFFECT_HAL_LOCAL_H
18#define ANDROID_HARDWARE_EFFECT_HAL_LOCAL_H
19
Mikhail Naganov00260b52016-10-13 12:54:24 -070020#include <hardware/audio_effect.h>
Mikhail Naganova0c91332016-09-19 10:01:12 -070021#include <media/audiohal/EffectHalInterface.h>
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070022
23namespace android {
24
25class EffectHalLocal : public EffectHalInterface
26{
27 public:
Mikhail Naganov022b9952017-01-04 16:36:51 -080028 // Set the input buffer.
29 virtual status_t setInBuffer(const sp<EffectBufferHalInterface>& buffer);
30
31 // Set the output buffer.
32 virtual status_t setOutBuffer(const sp<EffectBufferHalInterface>& buffer);
33
34 // Effect process function.
35 virtual status_t process();
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070036
37 // Process reverse stream function. This function is used to pass
38 // a reference stream to the effect engine.
Mikhail Naganov022b9952017-01-04 16:36:51 -080039 virtual status_t processReverse();
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070040
41 // Send a command and receive a response to/from effect engine.
42 virtual status_t command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData,
43 uint32_t *replySize, void *pReplyData);
44
45 // Returns the effect descriptor.
46 virtual status_t getDescriptor(effect_descriptor_t *pDescriptor);
47
Mikhail Naganov022b9952017-01-04 16:36:51 -080048 // Free resources on the remote side.
49 virtual status_t close();
50
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070051 effect_handle_t handle() const { return mHandle; }
52
53 private:
54 effect_handle_t mHandle;
Mikhail Naganov022b9952017-01-04 16:36:51 -080055 sp<EffectBufferHalInterface> mInBuffer;
56 sp<EffectBufferHalInterface> mOutBuffer;
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070057
58 friend class EffectsFactoryHalLocal;
59
60 // Can not be constructed directly by clients.
61 explicit EffectHalLocal(effect_handle_t handle);
Mikhail Naganov1dc98672016-08-18 17:50:29 -070062
63 // The destructor automatically releases the effect.
64 virtual ~EffectHalLocal();
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070065};
66
67} // namespace android
68
69#endif // ANDROID_HARDWARE_EFFECT_HAL_LOCAL_H