blob: 680b7a13227782a1aeb3608556d92010b0973c10 [file] [log] [blame]
Kevin Rocard4bcd67f2018-02-28 14:33:38 -08001/*
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
Kevin Rocard51e076a2018-02-28 14:36:53 -080017#ifndef ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_HIDL_4_0_H
18#define ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_HIDL_4_0_H
Kevin Rocard4bcd67f2018-02-28 14:33:38 -080019
Kevin Rocard51e076a2018-02-28 14:36:53 -080020#include <android/hardware/audio/effect/4.0/IEffectsFactory.h>
21#include <android/hardware/audio/effect/4.0/types.h>
Kevin Rocard4bcd67f2018-02-28 14:33:38 -080022#include <media/audiohal/EffectsFactoryHalInterface.h>
23
24#include "ConversionHelperHidl.h"
25
26namespace android {
Kevin Rocard51e076a2018-02-28 14:36:53 -080027namespace V4_0 {
Kevin Rocard4bcd67f2018-02-28 14:33:38 -080028
Kevin Rocard51e076a2018-02-28 14:36:53 -080029using ::android::hardware::audio::effect::V4_0::EffectDescriptor;
30using ::android::hardware::audio::effect::V4_0::IEffectsFactory;
Kevin Rocard4bcd67f2018-02-28 14:33:38 -080031using ::android::hardware::hidl_vec;
32
33class EffectsFactoryHalHidl : public EffectsFactoryHalInterface, public ConversionHelperHidl
34{
35 public:
36 // Returns the number of different effects in all loaded libraries.
37 virtual status_t queryNumberEffects(uint32_t *pNumEffects);
38
39 // Returns a descriptor of the next available effect.
40 virtual status_t getDescriptor(uint32_t index,
41 effect_descriptor_t *pDescriptor);
42
43 virtual status_t getDescriptor(const effect_uuid_t *pEffectUuid,
44 effect_descriptor_t *pDescriptor);
45
46 // Creates an effect engine of the specified type.
47 // To release the effect engine, it is necessary to release references
48 // to the returned effect object.
49 virtual status_t createEffect(const effect_uuid_t *pEffectUuid,
50 int32_t sessionId, int32_t ioId,
51 sp<EffectHalInterface> *effect);
52
53 virtual status_t dumpEffects(int fd);
54
55 status_t allocateBuffer(size_t size, sp<EffectBufferHalInterface>* buffer) override;
56 status_t mirrorBuffer(void* external, size_t size,
57 sp<EffectBufferHalInterface>* buffer) override;
58
59 private:
60 friend class EffectsFactoryHalInterface;
61
62 sp<IEffectsFactory> mEffectsFactory;
63 hidl_vec<EffectDescriptor> mLastDescriptors;
64
65 // Can not be constructed directly by clients.
66 EffectsFactoryHalHidl();
67 virtual ~EffectsFactoryHalHidl();
68
69 status_t queryAllDescriptors();
70};
71
Kevin Rocard51e076a2018-02-28 14:36:53 -080072} // namespace V4_0
Kevin Rocard4bcd67f2018-02-28 14:33:38 -080073} // namespace android
74
Kevin Rocard51e076a2018-02-28 14:36:53 -080075#endif // ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_HIDL_4_0_H