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 | |
| 17 | #ifndef ANDROID_HARDWARE_EFFECT_HAL_INTERFACE_H |
| 18 | #define ANDROID_HARDWARE_EFFECT_HAL_INTERFACE_H |
| 19 | |
Mikhail Naganov | 022b995 | 2017-01-04 16:36:51 -0800 | [diff] [blame] | 20 | #include <media/audiohal/EffectBufferHalInterface.h> |
Mikhail Naganov | 00260b5 | 2016-10-13 12:54:24 -0700 | [diff] [blame] | 21 | #include <system/audio_effect.h> |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 22 | #include <utils/Errors.h> |
| 23 | #include <utils/RefBase.h> |
| 24 | |
| 25 | namespace android { |
| 26 | |
Mikhail Naganov | e4f1f63 | 2016-08-31 11:35:10 -0700 | [diff] [blame] | 27 | class EffectHalInterface : public RefBase |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 28 | { |
| 29 | public: |
Mikhail Naganov | 022b995 | 2017-01-04 16:36:51 -0800 | [diff] [blame] | 30 | // Set the input buffer. |
| 31 | virtual status_t setInBuffer(const sp<EffectBufferHalInterface>& buffer) = 0; |
| 32 | |
| 33 | // Set the output buffer. |
| 34 | virtual status_t setOutBuffer(const sp<EffectBufferHalInterface>& buffer) = 0; |
| 35 | |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 36 | // Effect process function. Takes input samples as specified |
| 37 | // in input buffer descriptor and output processed samples as specified |
| 38 | // in output buffer descriptor. |
Mikhail Naganov | 022b995 | 2017-01-04 16:36:51 -0800 | [diff] [blame] | 39 | virtual status_t process() = 0; |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 40 | |
| 41 | // Process reverse stream function. This function is used to pass |
| 42 | // a reference stream to the effect engine. |
Mikhail Naganov | 022b995 | 2017-01-04 16:36:51 -0800 | [diff] [blame] | 43 | virtual status_t processReverse() = 0; |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 44 | |
| 45 | // Send a command and receive a response to/from effect engine. |
| 46 | virtual status_t command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, |
| 47 | uint32_t *replySize, void *pReplyData) = 0; |
| 48 | |
| 49 | // Returns the effect descriptor. |
| 50 | virtual status_t getDescriptor(effect_descriptor_t *pDescriptor) = 0; |
| 51 | |
Mikhail Naganov | 022b995 | 2017-01-04 16:36:51 -0800 | [diff] [blame] | 52 | // Free resources on the remote side. |
| 53 | virtual status_t close() = 0; |
| 54 | |
Mikhail Naganov | 6b111f3 | 2017-04-27 18:52:37 -0700 | [diff] [blame^] | 55 | // Whether it's a local implementation. |
| 56 | virtual bool isLocal() const = 0; |
| 57 | |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 58 | protected: |
| 59 | // Subclasses can not be constructed directly by clients. |
| 60 | EffectHalInterface() {} |
Mikhail Naganov | 1dc9867 | 2016-08-18 17:50:29 -0700 | [diff] [blame] | 61 | |
| 62 | // The destructor automatically releases the effect. |
| 63 | virtual ~EffectHalInterface() {} |
Mikhail Naganov | 4a3d5c2 | 2016-08-15 13:47:42 -0700 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } // namespace android |
| 67 | |
| 68 | #endif // ANDROID_HARDWARE_EFFECT_HAL_INTERFACE_H |