1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef OHOS_VDI_AUDIO_EFFECT_V1_0_IEFFECTFACTORY_H 17094332d3Sopenharmony_ci#define OHOS_VDI_AUDIO_EFFECT_V1_0_IEFFECTFACTORY_H 18094332d3Sopenharmony_ci 19094332d3Sopenharmony_ci#include <stdint.h> 20094332d3Sopenharmony_ci#include "effect_types_vdi.h" 21094332d3Sopenharmony_ci#include "ieffect_control_vdi.h" 22094332d3Sopenharmony_ci 23094332d3Sopenharmony_ci#ifdef __cplusplus 24094332d3Sopenharmony_ciextern "C" { 25094332d3Sopenharmony_ci#endif /* __cplusplus */ 26094332d3Sopenharmony_ci 27094332d3Sopenharmony_ci#define IEFFECT_VDI_MODEL_MAJOR_VERSION 1 28094332d3Sopenharmony_ci#define IEFFECT_VDI_MODEL_MINOR_VERSION 0 29094332d3Sopenharmony_ci 30094332d3Sopenharmony_citypedef int32_t (*ComandProccess)(const int8_t *commandData, uint32_t commandSize, 31094332d3Sopenharmony_ci int8_t *replyData, uint32_t *replySize); 32094332d3Sopenharmony_cistruct EffectCommandTable { 33094332d3Sopenharmony_ci enum EffectCommandTableIndexVdi cmd; 34094332d3Sopenharmony_ci ComandProccess func; 35094332d3Sopenharmony_ci}; 36094332d3Sopenharmony_ci 37094332d3Sopenharmony_ci/** 38094332d3Sopenharmony_ci * @brief Defines Audio effect model data process interfaces. 39094332d3Sopenharmony_ci * 40094332d3Sopenharmony_ci * @since 4.0 41094332d3Sopenharmony_ci * @version 1.0 42094332d3Sopenharmony_ci */ 43094332d3Sopenharmony_cistruct EffectFactory { 44094332d3Sopenharmony_ci int32_t version; /**< version tag to match the corresponding version of the APIs and the library */ 45094332d3Sopenharmony_ci char *effectLibName; /**< To identify the effect library name for knowing which effect library it is */ 46094332d3Sopenharmony_ci char *supplier; /**< To identify who supply the effect library, it can be assigned as the EOM/ISV name */ 47094332d3Sopenharmony_ci /** 48094332d3Sopenharmony_ci * 49094332d3Sopenharmony_ci * @brief 50094332d3Sopenharmony_ci * the input and output buffer have to be specificed, if they are not specified,the process have to use the 51094332d3Sopenharmony_ci * data process function which is provided by the command 52094332d3Sopenharmony_ci * 53094332d3Sopenharmony_ci * @param self Indicates the pointer to the effect interfaces to operate. 54094332d3Sopenharmony_ci * @param EffectInfo Indicates the information of the effect control. 55094332d3Sopenharmony_ci * @param handle Indicates the double pointer to the <b>EffectControl</b> object. 56094332d3Sopenharmony_ci * 57094332d3Sopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise. 58094332d3Sopenharmony_ci * 59094332d3Sopenharmony_ci * @since 4.0 60094332d3Sopenharmony_ci * @version 1.0 61094332d3Sopenharmony_ci */ 62094332d3Sopenharmony_ci int32_t (*CreateController)(struct EffectFactory *self, const struct EffectInfoVdi *info, 63094332d3Sopenharmony_ci struct IEffectControlVdi **handle); 64094332d3Sopenharmony_ci /** 65094332d3Sopenharmony_ci * 66094332d3Sopenharmony_ci * @brief Destroy the effect controller specified by the controllerId 67094332d3Sopenharmony_ci * 68094332d3Sopenharmony_ci * @param self Indicates the pointer to the effect interfaces to operate. 69094332d3Sopenharmony_ci * @param handle Indicates the pointer to the <b>EffectControl</b> object. 70094332d3Sopenharmony_ci * 71094332d3Sopenharmony_ci * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise. 72094332d3Sopenharmony_ci * 73094332d3Sopenharmony_ci * @since 4.0 74094332d3Sopenharmony_ci * @version 1.0 75094332d3Sopenharmony_ci */ 76094332d3Sopenharmony_ci int32_t (*DestroyController)(struct EffectFactory *self, struct IEffectControlVdi *handle); 77094332d3Sopenharmony_ci 78094332d3Sopenharmony_ci /** 79094332d3Sopenharmony_ci * @brief Get the effect descriptor by effectId. 80094332d3Sopenharmony_ci * 81094332d3Sopenharmony_ci * @param self Indicates the pointer to the effect interfaces to operate. 82094332d3Sopenharmony_ci * @param effectId Indicates the effectId of the effect. 83094332d3Sopenharmony_ci * @param desc Indicates the descriptor of the effect controller. 84094332d3Sopenharmony_ci * 85094332d3Sopenharmony_ci * @return Returns <b>0</b> if the command send success; returns a non-zero value otherwise. 86094332d3Sopenharmony_ci * 87094332d3Sopenharmony_ci * @since 4.0 88094332d3Sopenharmony_ci * @version 1.0 89094332d3Sopenharmony_ci */ 90094332d3Sopenharmony_ci int32_t (*GetDescriptor)(struct EffectFactory *self, const char *effectId, 91094332d3Sopenharmony_ci struct EffectControllerDescriptorVdi *desc); 92094332d3Sopenharmony_ci}; 93094332d3Sopenharmony_ci 94094332d3Sopenharmony_ci/* this name is going to get effect lib, it has to be realized */ 95094332d3Sopenharmony_cistruct EffectFactory *GetEffectoyFactoryLib(void); 96094332d3Sopenharmony_ci 97094332d3Sopenharmony_ci#ifdef __cplusplus 98094332d3Sopenharmony_ci} 99094332d3Sopenharmony_ci#endif /* __cplusplus */ 100094332d3Sopenharmony_ci 101094332d3Sopenharmony_ci#endif /* OHOS_VDI_AUDIO_EFFECT_V1_0_IEFFECTFACTORY_H */