1 /* 2 * Copyright (C) 2018 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_AUDIO_EFFECT_EFFECTSFACTORY_H 18 #define ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H 19 20 #include <system/audio_effect.h> 21 22 #include PATH(android/hardware/audio/effect/FILE_VERSION/IEffectsFactory.h) 23 24 #include <hidl/MQDescriptor.h> 25 26 #include <hardware/audio_effect.h> 27 #include <system/audio_effect.h> 28 29 #include <hidl/Status.h> 30 31 #include <hidl/MQDescriptor.h> 32 namespace android { 33 namespace hardware { 34 namespace audio { 35 namespace effect { 36 namespace CPP_VERSION { 37 namespace implementation { 38 39 using ::android::sp; 40 using ::android::hardware::hidl_string; 41 using ::android::hardware::hidl_vec; 42 using ::android::hardware::Return; 43 using ::android::hardware::Void; 44 using namespace ::android::hardware::audio::common::CPP_VERSION; 45 using namespace ::android::hardware::audio::effect::CPP_VERSION; 46 47 struct EffectsFactory : public IEffectsFactory { 48 // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow. 49 Return<void> getAllDescriptors(getAllDescriptors_cb _hidl_cb) override; 50 Return<void> getDescriptor(const Uuid& uuid, getDescriptor_cb _hidl_cb) override; 51 #if MAJOR_VERSION <= 5 52 Return<void> createEffect(const Uuid& uuid, int32_t session, int32_t ioHandle, 53 createEffect_cb _hidl_cb) override; 54 #else 55 Return<void> createEffect(const Uuid& uuid, int32_t session, int32_t ioHandle, int32_t device, 56 createEffect_cb _hidl_cb) override; 57 #endif 58 59 Return<void> debugDump( 60 const hidl_handle& fd); //< in CPP_VERSION::IEffectsFactory only, alias of debug 61 Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override; 62 63 private: 64 static sp<IEffect> dispatchEffectInstanceCreation(const effect_descriptor_t& halDescriptor, 65 effect_handle_t handle); 66 Return<void> createEffectImpl(const Uuid& uuid, int32_t session, int32_t ioHandle, 67 int32_t device, createEffect_cb _hidl_cb); 68 }; 69 70 extern "C" IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* name); 71 72 } // namespace implementation 73 } // namespace CPP_VERSION 74 } // namespace effect 75 } // namespace audio 76 } // namespace hardware 77 } // namespace android 78 79 #endif // ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H 80