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_if.h 30094332d3Sopenharmony_ci * 31094332d3Sopenharmony_ci * @brief Defines the APIs for codec components. 32094332d3Sopenharmony_ci * 33094332d3Sopenharmony_ci * The APIs can be used to obtain component information, send commands to components, set component parameters, 34094332d3Sopenharmony_ci * and control and transfer buffer data. 35094332d3Sopenharmony_ci * 36094332d3Sopenharmony_ci * @since 3.1 37094332d3Sopenharmony_ci */ 38094332d3Sopenharmony_ci 39094332d3Sopenharmony_ci#ifndef CODEC_COMPONENT_H 40094332d3Sopenharmony_ci#define CODEC_COMPONENT_H 41094332d3Sopenharmony_ci 42094332d3Sopenharmony_ci#include <stdint.h> 43094332d3Sopenharmony_ci#include "codec_callback_if.h" 44094332d3Sopenharmony_ci#include "codec_component_type.h" 45094332d3Sopenharmony_ci 46094332d3Sopenharmony_ci#ifdef __cplusplus 47094332d3Sopenharmony_ciextern "C" { 48094332d3Sopenharmony_ci#endif /* __cplusplus */ 49094332d3Sopenharmony_ci 50094332d3Sopenharmony_ci#define CODEC_COMPONENT_INTERFACE_DESC "CODEC_HDI_2.0_COMPONENT" 51094332d3Sopenharmony_ci 52094332d3Sopenharmony_ci/** 53094332d3Sopenharmony_ci * @brief Defines the APIs for codec components. 54094332d3Sopenharmony_ci * 55094332d3Sopenharmony_ci * The APIs can be used to: 56094332d3Sopenharmony_ci * Obtain the component version. 57094332d3Sopenharmony_ci * Obtain and set component parameters. 58094332d3Sopenharmony_ci * Send a command to a component to obtain the component status. 59094332d3Sopenharmony_ci * Set a callback. 60094332d3Sopenharmony_ci * Set or release the buffer used by a component. 61094332d3Sopenharmony_ci * Process the input and output buffers for encoding and decoding. 62094332d3Sopenharmony_ci * For details, see the description of the APIs. 63094332d3Sopenharmony_ci */ 64094332d3Sopenharmony_cistruct CodecComponentType { 65094332d3Sopenharmony_ci /** 66094332d3Sopenharmony_ci * @brief Obtains the version of a codec component. 67094332d3Sopenharmony_ci * 68094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 69094332d3Sopenharmony_ci * @param verInfo Indicates info of the component. For details, see {@link CompVerInfo} 70094332d3Sopenharmony_ci * 71094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 72094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 73094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 74094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 75094332d3Sopenharmony_ci */ 76094332d3Sopenharmony_ci int32_t (*GetComponentVersion)(struct CodecComponentType *self, struct CompVerInfo *verInfo); 77094332d3Sopenharmony_ci 78094332d3Sopenharmony_ci /** 79094332d3Sopenharmony_ci * @brief Sends a command to a component. 80094332d3Sopenharmony_ci * 81094332d3Sopenharmony_ci * If the command is used to set status, a callback will be invoked to return the result. There is no event 82094332d3Sopenharmony_ci * reporting for other commands. 83094332d3Sopenharmony_ci * 84094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 85094332d3Sopenharmony_ci * @param cmd Indicates the command to be executed by the component. For details, see {@link OMX_COMMANDTYPE}. 86094332d3Sopenharmony_ci * @param param Indicates the parameters to be carried in the command. 87094332d3Sopenharmony_ci * If <b>cmd</b> is <b>OMX_CommandStateSet</b>, see {@link OMX_STATETYPE} for the value of <b>param</b>. 88094332d3Sopenharmony_ci * If <b>cmd</b> is <b>OMX_CommandFlush</b>, <b>OMX_CommandPortDisable</b>, <b>OMX_CommandPortEnable</b>, 89094332d3Sopenharmony_ci * or <b>OMX_CommandMarkBuffer</b>, <b>param</b> specifies the target port. 90094332d3Sopenharmony_ci * @param cmdData Indicates the pointer to <b>OMX_MARKTYPE</b> if <b>cmd</b> is <b>OMX_CommandMarkBuffer</b>. 91094332d3Sopenharmony_ci * @param cmdDataLen Indicates the length of <b>cmdData</b>, in bytes. 92094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 93094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 94094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 95094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 96094332d3Sopenharmony_ci */ 97094332d3Sopenharmony_ci int32_t (*SendCommand)(struct CodecComponentType *self, enum OMX_COMMANDTYPE cmd, uint32_t param, 98094332d3Sopenharmony_ci int8_t *cmdData, uint32_t cmdDataLen); 99094332d3Sopenharmony_ci 100094332d3Sopenharmony_ci /** 101094332d3Sopenharmony_ci * @brief Obtains parameter settings of a component. 102094332d3Sopenharmony_ci * 103094332d3Sopenharmony_ci * When a component is in a state other than OMX_StateInvalid, 104094332d3Sopenharmony_ci * you can call this API to obtain component parameters. 105094332d3Sopenharmony_ci * 106094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 107094332d3Sopenharmony_ci * @param paramIndex Indicates the index of the structure to fill. For details, see {@link OMX_INDEXTYPE}. 108094332d3Sopenharmony_ci * @param paramStruct Indicates the pointer to the structure, allocated by the application, 109094332d3Sopenharmony_ci * to be filled by the component. 110094332d3Sopenharmony_ci * @param paramStructLen Indicates the length of <b>paramStruct</b>, in bytes. 111094332d3Sopenharmony_ci * 112094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 113094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 114094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 115094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 116094332d3Sopenharmony_ci */ 117094332d3Sopenharmony_ci int32_t (*GetParameter)(struct CodecComponentType *self, uint32_t paramIndex, int8_t *paramStruct, 118094332d3Sopenharmony_ci uint32_t paramStructLen); 119094332d3Sopenharmony_ci 120094332d3Sopenharmony_ci /** 121094332d3Sopenharmony_ci * @brief Sets parameters for a component. 122094332d3Sopenharmony_ci * 123094332d3Sopenharmony_ci * This API can be used to set component parameters when the component is in the <b>OMX_StateLoaded</b> or 124094332d3Sopenharmony_ci * <b>OMX_StateWaitForResources</b> state or the port is disabled. 125094332d3Sopenharmony_ci * 126094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 127094332d3Sopenharmony_ci * @param index Indicates the index of the structure to set. For details, see {@link OMX_INDEXTYPE}. 128094332d3Sopenharmony_ci * @param paramStruct Indicates the pointer to the structure allocated by the application 129094332d3Sopenharmony_ci * for component initialization. 130094332d3Sopenharmony_ci * @param paramStructLen Indicates the length of <b>paramStruct</b>, in bytes. 131094332d3Sopenharmony_ci * 132094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 133094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 134094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 135094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 136094332d3Sopenharmony_ci */ 137094332d3Sopenharmony_ci int32_t (*SetParameter)(struct CodecComponentType *self, uint32_t index, int8_t *paramStruct, 138094332d3Sopenharmony_ci uint32_t paramStructLen); 139094332d3Sopenharmony_ci 140094332d3Sopenharmony_ci /** 141094332d3Sopenharmony_ci * @brief Obtains the configuration of a component. 142094332d3Sopenharmony_ci * 143094332d3Sopenharmony_ci * This API can be used to obtain the component configuration after a component is loaded. 144094332d3Sopenharmony_ci * 145094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 146094332d3Sopenharmony_ci * @param index Indicates the index of the structure to fill. For details, see {@link OMX_INDEXTYPE}. 147094332d3Sopenharmony_ci * @param cfgStruct Indicates the pointer to the structure, allocated by the application, 148094332d3Sopenharmony_ci * to be filled by the component. 149094332d3Sopenharmony_ci * @param cfgStructLen Indicates the length of <b>cfgStruct</b>, in bytes. 150094332d3Sopenharmony_ci * 151094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 152094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 153094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 154094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 155094332d3Sopenharmony_ci */ 156094332d3Sopenharmony_ci int32_t (*GetConfig)(struct CodecComponentType *self, uint32_t index, int8_t *cfgStruct, uint32_t cfgStructLen); 157094332d3Sopenharmony_ci 158094332d3Sopenharmony_ci /** 159094332d3Sopenharmony_ci * @brief Sets the component parameters. 160094332d3Sopenharmony_ci * 161094332d3Sopenharmony_ci * This API can be used to set a component after it is loaded. 162094332d3Sopenharmony_ci * 163094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 164094332d3Sopenharmony_ci * @param index Indicates the index of the structure to set. For details, see {@link OMX_INDEXTYPE}. 165094332d3Sopenharmony_ci * @param cfgStruct Indicates the pointer to the structure allocated by the application 166094332d3Sopenharmony_ci * for component initialization. 167094332d3Sopenharmony_ci * @param cfgStructLen Indicates the length of <b>cfgStruct</b>, in bytes. 168094332d3Sopenharmony_ci * 169094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 170094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 171094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 172094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 173094332d3Sopenharmony_ci */ 174094332d3Sopenharmony_ci int32_t (*SetConfig)(struct CodecComponentType *self, uint32_t index, int8_t *cfgStruct, uint32_t cfgStructLen); 175094332d3Sopenharmony_ci 176094332d3Sopenharmony_ci /** 177094332d3Sopenharmony_ci * @brief Obtains the extended index of a component based on a given string. 178094332d3Sopenharmony_ci * 179094332d3Sopenharmony_ci * This API converts an extended string into an Openmax IL structure index. 180094332d3Sopenharmony_ci * 181094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 182094332d3Sopenharmony_ci * @param paramName Indicates the pointer to the string to be converted. 183094332d3Sopenharmony_ci * @param indexType Indicates the pointer to the configuration index converted from the given <b>paramName</b>. 184094332d3Sopenharmony_ci * For details, see {@link OMX_INDEXTYPE}. 185094332d3Sopenharmony_ci * 186094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 187094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 188094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 189094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 190094332d3Sopenharmony_ci */ 191094332d3Sopenharmony_ci int32_t (*GetExtensionIndex)(struct CodecComponentType *self, const char *paramName, uint32_t *indexType); 192094332d3Sopenharmony_ci 193094332d3Sopenharmony_ci /** 194094332d3Sopenharmony_ci * @brief Obtains component status. 195094332d3Sopenharmony_ci * 196094332d3Sopenharmony_ci * For details about component status, see {@link OMX_STATETYPE}. 197094332d3Sopenharmony_ci * 198094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 199094332d3Sopenharmony_ci * @param state Indicates the pointer to the status obtained. For more details, see {@link OMX_STATETYPE}. 200094332d3Sopenharmony_ci * 201094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 202094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 203094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 204094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 205094332d3Sopenharmony_ci */ 206094332d3Sopenharmony_ci int32_t (*GetState)(struct CodecComponentType *self, enum OMX_STATETYPE *state); 207094332d3Sopenharmony_ci 208094332d3Sopenharmony_ci /** 209094332d3Sopenharmony_ci * @brief Sets tunnel communication for a component. 210094332d3Sopenharmony_ci * 211094332d3Sopenharmony_ci * When a component is in the OMX_StateLoaded state, you can call this API to set tunnel communication 212094332d3Sopenharmony_ci * if the component supports tunnel transmission. 213094332d3Sopenharmony_ci * 214094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 215094332d3Sopenharmony_ci * @param port Indicates the port to set for the component. 216094332d3Sopenharmony_ci * @param tunneledComp Indicates the tunnel handle of the component. 217094332d3Sopenharmony_ci * @param tunneledPort Indicates the port to be used for tunnel communication. 218094332d3Sopenharmony_ci * @param tunnelSetup Indicates the pointer to the tunnel structure set. For details, 219094332d3Sopenharmony_ci * see {@link OMX_TUNNELSETUPTYPE}. 220094332d3Sopenharmony_ci * 221094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 222094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 223094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 224094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 225094332d3Sopenharmony_ci */ 226094332d3Sopenharmony_ci int32_t (*ComponentTunnelRequest)(struct CodecComponentType *self, uint32_t port, 227094332d3Sopenharmony_ci int32_t tunneledComp, uint32_t tunneledPort, struct OMX_TUNNELSETUPTYPE *tunnelSetup); 228094332d3Sopenharmony_ci 229094332d3Sopenharmony_ci /** 230094332d3Sopenharmony_ci * @brief Specify the buffer of the component port. 231094332d3Sopenharmony_ci * 232094332d3Sopenharmony_ci * This API is used when: 233094332d3Sopenharmony_ci * The component is in the OMX_StateLoaded state, and has sent a request for changing the state to OMX_StateIdle. 234094332d3Sopenharmony_ci * The component is in the OMX_StateWaitForResources state, the required resources are available, 235094332d3Sopenharmony_ci * and the component is ready to enter the OMX_StateIdle state. 236094332d3Sopenharmony_ci * The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port. 237094332d3Sopenharmony_ci * 238094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 239094332d3Sopenharmony_ci * @param portIndex Indicates the port of the component. 240094332d3Sopenharmony_ci * @param buffer Indicates the pointer to the buffer to use. For details, see {@link OmxCodecBuffer}. 241094332d3Sopenharmony_ci * 242094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 243094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 244094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 245094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 246094332d3Sopenharmony_ci */ 247094332d3Sopenharmony_ci int32_t (*UseBuffer)(struct CodecComponentType *self, uint32_t portIndex, struct OmxCodecBuffer *buffer); 248094332d3Sopenharmony_ci 249094332d3Sopenharmony_ci /** 250094332d3Sopenharmony_ci * @brief Requests a port buffer from the component. 251094332d3Sopenharmony_ci * 252094332d3Sopenharmony_ci * This API is used to request a new buffer from a component when: 253094332d3Sopenharmony_ci * The component is in the OMX_StateLoaded state and has sent a request for changing the state to OMX_StateIdle. 254094332d3Sopenharmony_ci * The component is in the OMX_StateWaitForResources state, the required resources are available, 255094332d3Sopenharmony_ci * and the component is ready to enter the OMX_StateIdle state. 256094332d3Sopenharmony_ci * The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port. 257094332d3Sopenharmony_ci * 258094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 259094332d3Sopenharmony_ci * @param portIndex Indicates the port of the component. 260094332d3Sopenharmony_ci * @param buffer Indicates the pointer to the buffer requested. For details, see {@link OmxCodecBuffer}. 261094332d3Sopenharmony_ci * 262094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 263094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 264094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 265094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 266094332d3Sopenharmony_ci */ 267094332d3Sopenharmony_ci int32_t (*AllocateBuffer)(struct CodecComponentType *self, uint32_t portIndex, struct OmxCodecBuffer *buffer); 268094332d3Sopenharmony_ci 269094332d3Sopenharmony_ci /** 270094332d3Sopenharmony_ci * @brief Releases a buffer. 271094332d3Sopenharmony_ci * 272094332d3Sopenharmony_ci * This API is used to release a buffer when: 273094332d3Sopenharmony_ci * The component is in the OMX_StateIdle state and has sent a request for changing the state to OMX_StateLoaded. 274094332d3Sopenharmony_ci * The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port. 275094332d3Sopenharmony_ci * This API can be called at any time. However, if it is not called in any of the previous conditions, 276094332d3Sopenharmony_ci * the component may report an OMX_ErrorPortUnpopulated event. 277094332d3Sopenharmony_ci * 278094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 279094332d3Sopenharmony_ci * @param portIndex Indicates the port of the component. 280094332d3Sopenharmony_ci * @param buffer Indicates the pointer to the buffer to release. For details, see {@link OmxCodecBuffer}. 281094332d3Sopenharmony_ci * 282094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 283094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 284094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 285094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 286094332d3Sopenharmony_ci */ 287094332d3Sopenharmony_ci int32_t (*FreeBuffer)(struct CodecComponentType *self, uint32_t portIndex, const struct OmxCodecBuffer *buffer); 288094332d3Sopenharmony_ci 289094332d3Sopenharmony_ci /** 290094332d3Sopenharmony_ci * @brief Specify the buffer to be emptied by a component. 291094332d3Sopenharmony_ci * 292094332d3Sopenharmony_ci * This API should be called when the component is in the OMX_StateExecuting or OMX_StatePause state. 293094332d3Sopenharmony_ci * 294094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 295094332d3Sopenharmony_ci * @param buffer Indicates the pointer to the {@link OmxCodecBuffer} structure. 296094332d3Sopenharmony_ci * 297094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 298094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 299094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 300094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 301094332d3Sopenharmony_ci */ 302094332d3Sopenharmony_ci int32_t (*EmptyThisBuffer)(struct CodecComponentType *self, const struct OmxCodecBuffer *buffer); 303094332d3Sopenharmony_ci 304094332d3Sopenharmony_ci /** 305094332d3Sopenharmony_ci * @brief Specify the buffer to be filled with the encoding and decoding output by a component. 306094332d3Sopenharmony_ci * 307094332d3Sopenharmony_ci * This API should be called when the component is in the OMX_StateExecuting or OMX_StatePause state. 308094332d3Sopenharmony_ci * 309094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 310094332d3Sopenharmony_ci * @param buffer Indicates the pointer to the {@link OmxCodecBuffer} structure. 311094332d3Sopenharmony_ci * 312094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 313094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 314094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 315094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 316094332d3Sopenharmony_ci */ 317094332d3Sopenharmony_ci int32_t (*FillThisBuffer)(struct CodecComponentType *self, const struct OmxCodecBuffer *buffer); 318094332d3Sopenharmony_ci 319094332d3Sopenharmony_ci /** 320094332d3Sopenharmony_ci * @brief Set a callback for the codec component. 321094332d3Sopenharmony_ci * 322094332d3Sopenharmony_ci * This API is called to report an event or report available input or output information when the component 323094332d3Sopenharmony_ci * is in the OMX_StateLoaded state. 324094332d3Sopenharmony_ci * 325094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 326094332d3Sopenharmony_ci * @param callback Indicates the pointer to the {@link CodecCallbackType} object. 327094332d3Sopenharmony_ci * @param appData Indicates the pointer to the value defined by the application. 328094332d3Sopenharmony_ci * The value is returned by the callback. 329094332d3Sopenharmony_ci * 330094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 331094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 332094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 333094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 334094332d3Sopenharmony_ci */ 335094332d3Sopenharmony_ci int32_t (*SetCallbacks)(struct CodecComponentType *self, struct CodecCallbackType *callback, int64_t appData); 336094332d3Sopenharmony_ci 337094332d3Sopenharmony_ci /** 338094332d3Sopenharmony_ci * @brief Deinitializes a component. 339094332d3Sopenharmony_ci * 340094332d3Sopenharmony_ci * This API can be called to close a component in the OMX_StateLoaded state. 341094332d3Sopenharmony_ci * 342094332d3Sopenharmony_ci * @param self Indicates the pointer to the codec component to close. 343094332d3Sopenharmony_ci * 344094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 345094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 346094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 347094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 348094332d3Sopenharmony_ci */ 349094332d3Sopenharmony_ci int32_t (*ComponentDeInit)(struct CodecComponentType *self); 350094332d3Sopenharmony_ci 351094332d3Sopenharmony_ci /** 352094332d3Sopenharmony_ci * @brief Uses the space allocated by EGL. 353094332d3Sopenharmony_ci * 354094332d3Sopenharmony_ci * This API is used when: 355094332d3Sopenharmony_ci * The component is in the OMX_StateLoaded state and has sent a request for changing the state to OMX_StateIdle. 356094332d3Sopenharmony_ci * The component is in the OMX_StateWaitForResources state, the required resources are available, 357094332d3Sopenharmony_ci * and the component is ready to enter the OMX_StateIdle state. 358094332d3Sopenharmony_ci * The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port. 359094332d3Sopenharmony_ci * 360094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 361094332d3Sopenharmony_ci * @param buffer Indicates the pointer to the {@link OmxCodecBuffer} structure. 362094332d3Sopenharmony_ci * @param portIndex Indicates the port of the component. 363094332d3Sopenharmony_ci * @param eglImage Indicates the pointer to the image provided by EGL. 364094332d3Sopenharmony_ci * @param eglImageLen Indicates the length of <b>eglImage</b>, in bytes. 365094332d3Sopenharmony_ci * 366094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 367094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 368094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 369094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 370094332d3Sopenharmony_ci */ 371094332d3Sopenharmony_ci int32_t (*UseEglImage)(struct CodecComponentType *self, struct OmxCodecBuffer *buffer, uint32_t portIndex, 372094332d3Sopenharmony_ci int8_t *eglImage, uint32_t eglImageLen); 373094332d3Sopenharmony_ci 374094332d3Sopenharmony_ci /** 375094332d3Sopenharmony_ci * @brief Obtains the component role. 376094332d3Sopenharmony_ci * 377094332d3Sopenharmony_ci * This API is used to obtain the role of a component based on the role index. 378094332d3Sopenharmony_ci * 379094332d3Sopenharmony_ci * @param self Indicates the pointer to the target codec component. 380094332d3Sopenharmony_ci * @param role Indicates the pointer to the role name. 381094332d3Sopenharmony_ci * @param roleLen Indicates the length of the role, in bytes. 382094332d3Sopenharmony_ci * @param index Indicates the index of a role. A component may support multiple roles. 383094332d3Sopenharmony_ci * 384094332d3Sopenharmony_ci * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 385094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation failed due to invalid parameters. 386094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_INVALID_OBJECT</b> if the operation failed due to invalid objects. 387094332d3Sopenharmony_ci * @return Returns <b>HDF_ERR_MALLOC_FAIL</b> if the operation failed due to insufficient memory. 388094332d3Sopenharmony_ci */ 389094332d3Sopenharmony_ci int32_t (*ComponentRoleEnum)(struct CodecComponentType *self, uint8_t *role, uint32_t roleLen, uint32_t index); 390094332d3Sopenharmony_ci 391094332d3Sopenharmony_ci struct HdfRemoteService *(*AsObject)(struct CodecComponentType *self); 392094332d3Sopenharmony_ci}; 393094332d3Sopenharmony_ci 394094332d3Sopenharmony_ci/** 395094332d3Sopenharmony_ci * @brief Instantiates a <b>CodecComponentType</b> object. 396094332d3Sopenharmony_ci * 397094332d3Sopenharmony_ci * @param remote Indicates the pointer to the <b>RemoteService</b>. 398094332d3Sopenharmony_ci * 399094332d3Sopenharmony_ci * @return Returns the <b>CodecComponentType</b> object instantiated. 400094332d3Sopenharmony_ci */ 401094332d3Sopenharmony_cistruct CodecComponentType *CodecComponentTypeGet(struct HdfRemoteService *remote); 402094332d3Sopenharmony_ci 403094332d3Sopenharmony_ci/** 404094332d3Sopenharmony_ci * @brief Releases a <b>CodecComponentType</b> object. 405094332d3Sopenharmony_ci * 406094332d3Sopenharmony_ci * @param instance Indicates the pointer to the <b>CodecComponentType</b> object to release. 407094332d3Sopenharmony_ci */ 408094332d3Sopenharmony_civoid CodecComponentTypeRelease(struct CodecComponentType *instance); 409094332d3Sopenharmony_ci 410094332d3Sopenharmony_ci#ifdef __cplusplus 411094332d3Sopenharmony_ci} 412094332d3Sopenharmony_ci#endif /* __cplusplus */ 413094332d3Sopenharmony_ci 414094332d3Sopenharmony_ci#endif // CODEC_COMPONENT_H