Shunkai Yao | dca65ce | 2022-12-02 05:35:41 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2022 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 | #pragma once |
| 18 | |
| 19 | #include <media/audiohal/EffectsFactoryHalInterface.h> |
| 20 | |
| 21 | namespace android { |
| 22 | namespace effect { |
| 23 | |
| 24 | using namespace aidl::android::hardware::audio::effect; |
| 25 | |
| 26 | class EffectsFactoryHalAidl final : public EffectsFactoryHalInterface { |
| 27 | public: |
| 28 | explicit EffectsFactoryHalAidl(std::shared_ptr<IFactory> effectsFactory); |
| 29 | |
| 30 | // Returns the number of different effects in all loaded libraries. |
| 31 | status_t queryNumberEffects(uint32_t *pNumEffects) override; |
| 32 | |
| 33 | // Returns a descriptor of the next available effect. |
| 34 | status_t getDescriptor(uint32_t index, effect_descriptor_t* pDescriptor) override; |
| 35 | |
| 36 | status_t getDescriptor(const effect_uuid_t* pEffectUuid, |
| 37 | effect_descriptor_t* pDescriptor) override; |
| 38 | |
| 39 | status_t getDescriptors(const effect_uuid_t* pEffectType, |
| 40 | std::vector<effect_descriptor_t>* descriptors) override; |
| 41 | |
| 42 | // Creates an effect engine of the specified type. |
| 43 | // To release the effect engine, it is necessary to release references |
| 44 | // to the returned effect object. |
| 45 | status_t createEffect(const effect_uuid_t* pEffectUuid, int32_t sessionId, int32_t ioId, |
| 46 | int32_t deviceId, sp<EffectHalInterface>* effect) override; |
| 47 | |
| 48 | status_t dumpEffects(int fd) override; |
| 49 | |
| 50 | status_t allocateBuffer(size_t size, sp<EffectBufferHalInterface>* buffer) override; |
| 51 | status_t mirrorBuffer(void* external, size_t size, |
| 52 | sp<EffectBufferHalInterface>* buffer) override; |
| 53 | |
| 54 | android::detail::AudioHalVersionInfo getHalVersion() const override; |
| 55 | |
| 56 | private: |
| 57 | std::shared_ptr<IFactory> mEffectsFactory; |
| 58 | virtual ~EffectsFactoryHalAidl() = default; |
| 59 | }; |
| 60 | |
| 61 | } // namespace effect |
| 62 | } // namespace android |