1 /* 2 * Copyright (c) 2022 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 /** 17 * @addtogroup Codec 18 * @{ 19 * 20 * @brief Defines APIs related to the Codec module. 21 * 22 * The Codec module provides APIs for initializing the custom data and audio and video codecs, 23 * setting codec parameters, and controlling and transferring data. 24 * 25 * @since 3.1 26 */ 27 28 /** 29 * @file codec_component_manager.h 30 * 31 * @brief Provides APIs for managing the Codec component. 32 * 33 * The APIs can be used to obtain the component encoding and decoding capability list, 34 * and create or destroy components for the Codec module. 35 * 36 * @since 3.1 37 */ 38 39 #ifndef CODEC_COMPONENT_MANAGER_H 40 #define CODEC_COMPONENT_MANAGER_H 41 42 #include "codec_component_if.h" 43 44 #ifdef __cplusplus 45 #if __cplusplus 46 extern "C" { 47 #endif 48 #endif /* __cplusplus */ 49 50 /** 51 * @brief Defines the APIs for managing the codec components. 52 * 53 * The APIs can be used to: 54 * Obtain the number of codec components and a codec capability list. 55 * Create or destroy a codec component. 56 */ 57 struct CodecComponentManager { 58 /** 59 * @brief Obtains the number of codec components. 60 * 61 * All codec capability sets can be further obtained based on the number of codec components. 62 * 63 * @return Returns the number of codec components obtained. 64 */ 65 int32_t (*GetComponentNum)(); 66 67 /** 68 * @brief Obtains the codec capability list. 69 * 70 * You can use this API to obtain the encoding and decoding capabilities provided by the Codec module. 71 * The capability is represented in the {@link CodecCompCapability} structure. 72 * 73 * @param capList Indicates the pointer to the component capability list {@link CodecCompCapability} obtained. 74 * @param count Indicates the number of codec components, which is obtained by {@link GetComponentNum}. 75 * 76 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 77 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 78 * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 79 * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 80 */ 81 int32_t (*GetComponentCapabilityList)(CodecCompCapability *capList, int32_t count); 82 83 /** 84 * @brief Creates a codec instance. 85 * 86 * You can use this API to create a codec component instance based on the component name. 87 * 88 * @param component Indicates the pointer to the codec component created. 89 * @param componentId Indicates the id to the codec component created. 90 * @param compName Indicates the name of the component to create. 91 * @param appData Indicates the pointer to the value defined by the application. 92 * The value is returned by the callback. 93 * @param callbacks Indicates the pointer to the callback defined by <b>OMX_CALLBACKTYPE</b>. 94 * For details, see {@link CodecCallbackType}. 95 * 96 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 97 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 98 * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 99 * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 100 */ 101 int32_t (*CreateComponent)(struct CodecComponentType **component, uint32_t *componentId, char *compName, 102 int64_t appData, struct CodecCallbackType *callbacks); 103 104 /** 105 * @brief Destroys a codec component instance. 106 * 107 * @param componentId Indicates the codec component id to destroy. 108 * 109 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 110 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 111 * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 112 * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 113 */ 114 int32_t (*DestroyComponent)(uint32_t componentId); 115 116 struct HdfRemoteService *(*AsObject)(struct CodecComponentManager *self); 117 }; 118 119 /** 120 * @brief Instantiates the <b>CodecComponentManager</b> object. 121 * 122 * @return Returns the <b>CodecComponentManager</b> object instantiated. 123 */ 124 struct CodecComponentManager *GetCodecComponentManager(void); 125 126 /** 127 * @brief Releases the <b>CodecComponentManager</b> object. 128 */ 129 void CodecComponentManagerRelease(void); 130 131 #ifdef __cplusplus 132 #if __cplusplus 133 } 134 #endif 135 #endif /* __cplusplus */ 136 137 #endif /* CODEC_COMPONENT_MANAGER_H */ 138 /** @} */