blob: da16923b1e841e3c164a52b0c7315971bcb65d84 [file] [log] [blame]
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -07001/*
Kevin Rocard96d2cd92018-11-14 16:22:07 -08002 * Copyright (C) 2018 The Android Open Source Project
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -07003 *
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
Kevin Rocard96d2cd92018-11-14 16:22:07 -080017#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>
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -070025
Kevin Rocard62588b62017-12-20 11:07:12 -080026#include <hardware/audio_effect.h>
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -070027#include <system/audio_effect.h>
28
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -070029#include <hidl/Status.h>
30
31#include <hidl/MQDescriptor.h>
32namespace android {
33namespace hardware {
34namespace audio {
35namespace effect {
Kevin Rocard96d2cd92018-11-14 16:22:07 -080036namespace CPP_VERSION {
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -070037namespace implementation {
38
Kevin Rocard55b10612018-11-12 12:33:16 -080039using ::android::sp;
40using ::android::hardware::hidl_string;
41using ::android::hardware::hidl_vec;
42using ::android::hardware::Return;
43using ::android::hardware::Void;
Mikhail Naganov7d015382022-01-15 01:15:12 +000044using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
Mikhail Naganov3907f762018-12-13 09:42:17 -080045using namespace ::android::hardware::audio::effect::CPP_VERSION;
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -070046
47struct EffectsFactory : public IEffectsFactory {
Kevin Rocard96d2cd92018-11-14 16:22:07 -080048 // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow.
Kevin Rocard22505e62017-12-14 18:50:12 -080049 Return<void> getAllDescriptors(getAllDescriptors_cb _hidl_cb) override;
Eric Laurentceaeee12019-11-13 13:47:50 -080050 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,
Kevin Rocard22505e62017-12-14 18:50:12 -080053 createEffect_cb _hidl_cb) override;
Eric Laurentceaeee12019-11-13 13:47:50 -080054#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
Kevin Rocard55b10612018-11-12 12:33:16 -080059 Return<void> debugDump(
Kevin Rocard96d2cd92018-11-14 16:22:07 -080060 const hidl_handle& fd); //< in CPP_VERSION::IEffectsFactory only, alias of debug
Kevin Rocard3d410272018-04-19 17:52:32 -070061 Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -070062
Kevin Rocard22505e62017-12-14 18:50:12 -080063 private:
64 static sp<IEffect> dispatchEffectInstanceCreation(const effect_descriptor_t& halDescriptor,
65 effect_handle_t handle);
Eric Laurentceaeee12019-11-13 13:47:50 -080066 Return<void> createEffectImpl(const Uuid& uuid, int32_t session, int32_t ioHandle,
67 int32_t device, createEffect_cb _hidl_cb);
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -070068};
69
70extern "C" IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* name);
71
72} // namespace implementation
Kevin Rocard96d2cd92018-11-14 16:22:07 -080073} // namespace CPP_VERSION
Mikhail Naganov7cbf2f12016-10-27 20:05:35 -070074} // namespace effect
75} // namespace audio
76} // namespace hardware
77} // namespace android
Kevin Rocard96d2cd92018-11-14 16:22:07 -080078
79#endif // ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H