1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_VDI_AUDIO_EFFECT_V1_0_IEFFECTFACTORY_H 17 #define OHOS_VDI_AUDIO_EFFECT_V1_0_IEFFECTFACTORY_H 18 19 #include <stdint.h> 20 #include "effect_types_vdi.h" 21 #include "ieffect_control_vdi.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif /* __cplusplus */ 26 27 #define IEFFECT_VDI_MODEL_MAJOR_VERSION 1 28 #define IEFFECT_VDI_MODEL_MINOR_VERSION 0 29 30 typedef int32_t (*ComandProccess)(const int8_t *commandData, uint32_t commandSize, 31 int8_t *replyData, uint32_t *replySize); 32 struct EffectCommandTable { 33 enum EffectCommandTableIndexVdi cmd; 34 ComandProccess func; 35 }; 36 37 /** 38 * @brief Defines Audio effect model data process interfaces. 39 * 40 * @since 4.0 41 * @version 1.0 42 */ 43 struct EffectFactory { 44 int32_t version; /**< version tag to match the corresponding version of the APIs and the library */ 45 char *effectLibName; /**< To identify the effect library name for knowing which effect library it is */ 46 char *supplier; /**< To identify who supply the effect library, it can be assigned as the EOM/ISV name */ 47 /** 48 * 49 * @brief 50 * the input and output buffer have to be specificed, if they are not specified,the process have to use the 51 * data process function which is provided by the command 52 * 53 * @param self Indicates the pointer to the effect interfaces to operate. 54 * @param EffectInfo Indicates the information of the effect control. 55 * @param handle Indicates the double pointer to the <b>EffectControl</b> object. 56 * 57 * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise. 58 * 59 * @since 4.0 60 * @version 1.0 61 */ 62 int32_t (*CreateController)(struct EffectFactory *self, const struct EffectInfoVdi *info, 63 struct IEffectControlVdi **handle); 64 /** 65 * 66 * @brief Destroy the effect controller specified by the controllerId 67 * 68 * @param self Indicates the pointer to the effect interfaces to operate. 69 * @param handle Indicates the pointer to the <b>EffectControl</b> object. 70 * 71 * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise. 72 * 73 * @since 4.0 74 * @version 1.0 75 */ 76 int32_t (*DestroyController)(struct EffectFactory *self, struct IEffectControlVdi *handle); 77 78 /** 79 * @brief Get the effect descriptor by effectId. 80 * 81 * @param self Indicates the pointer to the effect interfaces to operate. 82 * @param effectId Indicates the effectId of the effect. 83 * @param desc Indicates the descriptor of the effect controller. 84 * 85 * @return Returns <b>0</b> if the command send success; returns a non-zero value otherwise. 86 * 87 * @since 4.0 88 * @version 1.0 89 */ 90 int32_t (*GetDescriptor)(struct EffectFactory *self, const char *effectId, 91 struct EffectControllerDescriptorVdi *desc); 92 }; 93 94 /* this name is going to get effect lib, it has to be realized */ 95 struct EffectFactory *GetEffectoyFactoryLib(void); 96 97 #ifdef __cplusplus 98 } 99 #endif /* __cplusplus */ 100 101 #endif /* OHOS_VDI_AUDIO_EFFECT_V1_0_IEFFECTFACTORY_H */