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_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H
18 #define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H
19 
20 #include <system/audio_effect.h>
21 
22 #include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
23 #include <hidl/Status.h>
24 
25 #include <hidl/MQDescriptor.h>
26 namespace android {
27 namespace hardware {
28 namespace audio {
29 namespace effect {
30 namespace V2_0 {
31 namespace implementation {
32 
33 using ::android::hardware::audio::common::V2_0::Uuid;
34 using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
35 using ::android::hardware::audio::effect::V2_0::IEffect;
36 using ::android::hardware::audio::effect::V2_0::IEffectsFactory;
37 using ::android::hardware::audio::effect::V2_0::Result;
38 using ::android::hardware::Return;
39 using ::android::hardware::Void;
40 using ::android::hardware::hidl_vec;
41 using ::android::hardware::hidl_string;
42 using ::android::sp;
43 
44 struct EffectsFactory : public IEffectsFactory {
45     // Methods from ::android::hardware::audio::effect::V2_0::IEffectsFactory follow.
46     Return<void> getAllDescriptors(getAllDescriptors_cb _hidl_cb)  override;
47     Return<void> getDescriptor(const Uuid& uid, getDescriptor_cb _hidl_cb)  override;
48     Return<void> createEffect(
49             const Uuid& uid, int32_t session, int32_t ioHandle, createEffect_cb _hidl_cb)  override;
50     Return<void> debugDump(const hidl_handle& fd)  override;
51 
52   private:
53     static sp<IEffect> dispatchEffectInstanceCreation(
54             const effect_descriptor_t& halDescriptor, effect_handle_t handle);
55 };
56 
57 extern "C" IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* name);
58 
59 }  // namespace implementation
60 }  // namespace V2_0
61 }  // namespace effect
62 }  // namespace audio
63 }  // namespace hardware
64 }  // namespace android
65 
66 #endif  // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H
67