blob: 9a08f6836503ce145806983c8700798efe69cc09 [file] [log] [blame]
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -07001/*
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_EFFECTS_FACTORY_HAL_INTERFACE_H
18#define ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_INTERFACE_H
19
20#include <hardware/audio_effect.h>
21#include <utils/Errors.h>
22#include <utils/RefBase.h>
23
24#include "EffectHalInterface.h"
25
26namespace android {
27
Mikhail Naganove4f1f632016-08-31 11:35:10 -070028class EffectsFactoryHalInterface : public RefBase
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070029{
30 public:
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070031 // Returns the number of different effects in all loaded libraries.
32 virtual status_t queryNumberEffects(uint32_t *pNumEffects) = 0;
33
34 // Returns a descriptor of the next available effect.
35 virtual status_t getDescriptor(uint32_t index,
36 effect_descriptor_t *pDescriptor) = 0;
37
38 virtual status_t getDescriptor(const effect_uuid_t *pEffectUuid,
39 effect_descriptor_t *pDescriptor) = 0;
40
41 // Creates an effect engine of the specified type.
42 // To release the effect engine, it is necessary to release references
43 // to the returned effect object.
44 virtual status_t createEffect(const effect_uuid_t *pEffectUuid,
45 int32_t sessionId, int32_t ioId,
46 sp<EffectHalInterface> *effect) = 0;
47
48 virtual status_t dumpEffects(int fd) = 0;
49
50 static sp<EffectsFactoryHalInterface> create();
51
52 // Helper function to compare effect uuid to EFFECT_UUID_NULL.
53 static bool isNullUuid(const effect_uuid_t *pEffectUuid);
54
55 protected:
56 // Subclasses can not be constructed directly by clients.
57 EffectsFactoryHalInterface() {}
Mikhail Naganov1dc98672016-08-18 17:50:29 -070058
59 virtual ~EffectsFactoryHalInterface() {}
Mikhail Naganov4a3d5c22016-08-15 13:47:42 -070060};
61
62} // namespace android
63
64#endif // ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_INTERFACE_H