1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2022 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/** 17094332d3Sopenharmony_ci * @addtogroup Codec 18094332d3Sopenharmony_ci * @{ 19094332d3Sopenharmony_ci * 20094332d3Sopenharmony_ci * @brief Defines APIs related to the Codec module. 21094332d3Sopenharmony_ci * 22094332d3Sopenharmony_ci * The Codec module provides APIs for initializing the custom data and audio and video codecs, 23094332d3Sopenharmony_ci * setting codec parameters, and controlling and transferring data. 24094332d3Sopenharmony_ci * 25094332d3Sopenharmony_ci * @since 3.1 26094332d3Sopenharmony_ci */ 27094332d3Sopenharmony_ci 28094332d3Sopenharmony_ci/** 29094332d3Sopenharmony_ci * @file codec_component_manager.h 30094332d3Sopenharmony_ci * 31094332d3Sopenharmony_ci * @brief Provides APIs for managing the Codec component. 32094332d3Sopenharmony_ci * 33094332d3Sopenharmony_ci * The APIs can be used to obtain the component encoding and decoding capability list, 34094332d3Sopenharmony_ci * and create or destroy components for the Codec module. 35094332d3Sopenharmony_ci * 36094332d3Sopenharmony_ci * @since 3.1 37094332d3Sopenharmony_ci */ 38094332d3Sopenharmony_ci 39094332d3Sopenharmony_ci#ifndef CODEC_COMPONENT_MANAGER_H 40094332d3Sopenharmony_ci#define CODEC_COMPONENT_MANAGER_H 41094332d3Sopenharmony_ci 42094332d3Sopenharmony_ci#include "codec_component_if.h" 43094332d3Sopenharmony_ci 44094332d3Sopenharmony_ci#ifdef __cplusplus 45094332d3Sopenharmony_ci#if __cplusplus 46094332d3Sopenharmony_ciextern "C" { 47094332d3Sopenharmony_ci#endif 48094332d3Sopenharmony_ci#endif /* __cplusplus */ 49094332d3Sopenharmony_ci 50094332d3Sopenharmony_ci/** 51094332d3Sopenharmony_ci * @brief Defines the APIs for managing the codec components. 52094332d3Sopenharmony_ci * 53094332d3Sopenharmony_ci * The APIs can be used to: 54094332d3Sopenharmony_ci * Obtain the number of codec components and a codec capability list. 55094332d3Sopenharmony_ci * Create or destroy a codec component. 56094332d3Sopenharmony_ci */ 57094332d3Sopenharmony_cistruct CodecComponentManager { 58094332d3Sopenharmony_ci /** 59094332d3Sopenharmony_ci * @brief Obtains the number of codec components. 60094332d3Sopenharmony_ci * 61094332d3Sopenharmony_ci * All codec capability sets can be further obtained based on the number of codec components. 62094332d3Sopenharmony_ci * 63094332d3Sopenharmony_ci * @return Returns the number of codec components obtained. 64094332d3Sopenharmony_ci */ 65094332d3Sopenharmony_ci int32_t (*GetComponentNum)(); 66094332d3Sopenharmony_ci 67094332d3Sopenharmony_ci /** 68094332d3Sopenharmony_ci * @brief Obtains the codec capability list. 69094332d3Sopenharmony_ci * 70094332d3Sopenharmony_ci * You can use this API to obtain the encoding and decoding capabilities provided by the Codec module. 71094332d3Sopenharmony_ci * The capability is represented in the {@link CodecCompCapability} structure. 72094332d3Sopenharmony_ci * 73094332d3Sopenharmony_ci * @param capList Indicates the pointer to the component capability list {@link CodecCompCapability} obtained. 74094332d3Sopenharmony_ci * @param count Indicates the number of codec components, which is obtained by {@link GetComponentNum}. 75094332d3Sopenharmony_ci * 76094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 77094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 78094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 79094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 80094332d3Sopenharmony_ci */ 81094332d3Sopenharmony_ci int32_t (*GetComponentCapabilityList)(CodecCompCapability *capList, int32_t count); 82094332d3Sopenharmony_ci 83094332d3Sopenharmony_ci /** 84094332d3Sopenharmony_ci * @brief Creates a codec instance. 85094332d3Sopenharmony_ci * 86094332d3Sopenharmony_ci * You can use this API to create a codec component instance based on the component name. 87094332d3Sopenharmony_ci * 88094332d3Sopenharmony_ci * @param component Indicates the pointer to the codec component created. 89094332d3Sopenharmony_ci * @param componentId Indicates the id to the codec component created. 90094332d3Sopenharmony_ci * @param compName Indicates the name of the component to create. 91094332d3Sopenharmony_ci * @param appData Indicates the pointer to the value defined by the application. 92094332d3Sopenharmony_ci * The value is returned by the callback. 93094332d3Sopenharmony_ci * @param callbacks Indicates the pointer to the callback defined by <b>OMX_CALLBACKTYPE</b>. 94094332d3Sopenharmony_ci * For details, see {@link CodecCallbackType}. 95094332d3Sopenharmony_ci * 96094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 97094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 98094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 99094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 100094332d3Sopenharmony_ci */ 101094332d3Sopenharmony_ci int32_t (*CreateComponent)(struct CodecComponentType **component, uint32_t *componentId, char *compName, 102094332d3Sopenharmony_ci int64_t appData, struct CodecCallbackType *callbacks); 103094332d3Sopenharmony_ci 104094332d3Sopenharmony_ci /** 105094332d3Sopenharmony_ci * @brief Destroys a codec component instance. 106094332d3Sopenharmony_ci * 107094332d3Sopenharmony_ci * @param componentId Indicates the codec component id to destroy. 108094332d3Sopenharmony_ci * 109094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 110094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 111094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 112094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 113094332d3Sopenharmony_ci */ 114094332d3Sopenharmony_ci int32_t (*DestroyComponent)(uint32_t componentId); 115094332d3Sopenharmony_ci 116094332d3Sopenharmony_ci struct HdfRemoteService *(*AsObject)(struct CodecComponentManager *self); 117094332d3Sopenharmony_ci}; 118094332d3Sopenharmony_ci 119094332d3Sopenharmony_ci/** 120094332d3Sopenharmony_ci * @brief Instantiates the <b>CodecComponentManager</b> object. 121094332d3Sopenharmony_ci * 122094332d3Sopenharmony_ci * @return Returns the <b>CodecComponentManager</b> object instantiated. 123094332d3Sopenharmony_ci */ 124094332d3Sopenharmony_cistruct CodecComponentManager *GetCodecComponentManager(void); 125094332d3Sopenharmony_ci 126094332d3Sopenharmony_ci/** 127094332d3Sopenharmony_ci * @brief Releases the <b>CodecComponentManager</b> object. 128094332d3Sopenharmony_ci */ 129094332d3Sopenharmony_civoid CodecComponentManagerRelease(void); 130094332d3Sopenharmony_ci 131094332d3Sopenharmony_ci#ifdef __cplusplus 132094332d3Sopenharmony_ci#if __cplusplus 133094332d3Sopenharmony_ci} 134094332d3Sopenharmony_ci#endif 135094332d3Sopenharmony_ci#endif /* __cplusplus */ 136094332d3Sopenharmony_ci 137094332d3Sopenharmony_ci#endif /* CODEC_COMPONENT_MANAGER_H */ 138094332d3Sopenharmony_ci/** @} */