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 20 #include <media/audiohal/EffectBufferHalInterface.h> 21 #include <media/AudioDeviceTypeAddr.h> 22 #include <system/audio_effect.h> 23 #include <utils/Errors.h> 24 #include <utils/RefBase.h> 25 26 namespace android { 27 28 class EffectHalInterface : public RefBase 29 { 30 public: 31 // Set the input buffer. 32 virtual status_t setInBuffer(const sp<EffectBufferHalInterface>& buffer) = 0; 33 34 // Set the output buffer. 35 virtual status_t setOutBuffer(const sp<EffectBufferHalInterface>& buffer) = 0; 36 37 // Effect process function. Takes input samples as specified 38 // in input buffer descriptor and output processed samples as specified 39 // in output buffer descriptor. 40 virtual status_t process() = 0; 41 42 // Process reverse stream function. This function is used to pass 43 // a reference stream to the effect engine. 44 virtual status_t processReverse() = 0; 45 46 // Send a command and receive a response to/from effect engine. 47 virtual status_t command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, 48 uint32_t *replySize, void *pReplyData) = 0; 49 50 // Returns the effect descriptor. 51 virtual status_t getDescriptor(effect_descriptor_t *pDescriptor) = 0; 52 53 // Free resources on the remote side. 54 virtual status_t close() = 0; 55 56 virtual status_t dump(int fd) = 0; 57 58 // Only implemented in AIDL effect HAL: set a vector of AudioDeviceTypeAddr 59 virtual status_t setDevices(const AudioDeviceTypeAddrVector& deviceTypes) = 0; 60 61 protected: 62 // Subclasses can not be constructed directly by clients. 63 EffectHalInterface() = default; 64 65 // The destructor automatically releases the effect. 66 virtual ~EffectHalInterface() = default; 67 }; 68 69 } // namespace android 70 71 #endif // ANDROID_HARDWARE_EFFECT_HAL_INTERFACE_H 72