• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_EFFECTS_FACTORY_HAL_HIDL_H
18 #define ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_HIDL_H
19 
20 #include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
21 #include <android/hardware/audio/effect/2.0/types.h>
22 #include <media/audiohal/EffectsFactoryHalInterface.h>
23 
24 #include "ConversionHelperHidl.h"
25 
26 namespace android {
27 
28 using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
29 using ::android::hardware::audio::effect::V2_0::IEffectsFactory;
30 using ::android::hardware::hidl_vec;
31 
32 class EffectsFactoryHalHidl : public EffectsFactoryHalInterface, public ConversionHelperHidl
33 {
34   public:
35     // Returns the number of different effects in all loaded libraries.
36     virtual status_t queryNumberEffects(uint32_t *pNumEffects);
37 
38     // Returns a descriptor of the next available effect.
39     virtual status_t getDescriptor(uint32_t index,
40             effect_descriptor_t *pDescriptor);
41 
42     virtual status_t getDescriptor(const effect_uuid_t *pEffectUuid,
43             effect_descriptor_t *pDescriptor);
44 
45     // Creates an effect engine of the specified type.
46     // To release the effect engine, it is necessary to release references
47     // to the returned effect object.
48     virtual status_t createEffect(const effect_uuid_t *pEffectUuid,
49             int32_t sessionId, int32_t ioId,
50             sp<EffectHalInterface> *effect);
51 
52     virtual status_t dumpEffects(int fd);
53 
54     status_t allocateBuffer(size_t size, sp<EffectBufferHalInterface>* buffer) override;
55     status_t mirrorBuffer(void* external, size_t size,
56                           sp<EffectBufferHalInterface>* buffer) override;
57 
58   private:
59     friend class EffectsFactoryHalInterface;
60 
61     sp<IEffectsFactory> mEffectsFactory;
62     hidl_vec<EffectDescriptor> mLastDescriptors;
63 
64     // Can not be constructed directly by clients.
65     EffectsFactoryHalHidl();
66     virtual ~EffectsFactoryHalHidl();
67 
68     status_t queryAllDescriptors();
69 };
70 
71 } // namespace android
72 
73 #endif // ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_HIDL_H
74