1c5e268c6Sopenharmony_ci/*
2c5e268c6Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3c5e268c6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c5e268c6Sopenharmony_ci * you may not use this file except in compliance with the License.
5c5e268c6Sopenharmony_ci * You may obtain a copy of the License at
6c5e268c6Sopenharmony_ci *
7c5e268c6Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8c5e268c6Sopenharmony_ci *
9c5e268c6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10c5e268c6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c5e268c6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c5e268c6Sopenharmony_ci * See the License for the specific language governing permissions and
13c5e268c6Sopenharmony_ci * limitations under the License.
14c5e268c6Sopenharmony_ci */
15c5e268c6Sopenharmony_ci
16c5e268c6Sopenharmony_ci/**
17c5e268c6Sopenharmony_ci * @addtogroup Codec
18c5e268c6Sopenharmony_ci * @{
19c5e268c6Sopenharmony_ci *
20c5e268c6Sopenharmony_ci * @brief Defines APIs of the Codec module.
21c5e268c6Sopenharmony_ci *
22c5e268c6Sopenharmony_ci * The Codec module provides APIs for initializing the custom data and audio and video codecs,
23c5e268c6Sopenharmony_ci * setting codec parameters, and controlling and transferring data.
24c5e268c6Sopenharmony_ci *
25c5e268c6Sopenharmony_ci * @since 4.1
26c5e268c6Sopenharmony_ci * @version 2.0
27c5e268c6Sopenharmony_ci */
28c5e268c6Sopenharmony_ci
29c5e268c6Sopenharmony_ci/**
30c5e268c6Sopenharmony_ci * @file ICodecComponent.idl
31c5e268c6Sopenharmony_ci *
32c5e268c6Sopenharmony_ci * @brief Declares the APIs for codec components.
33c5e268c6Sopenharmony_ci *
34c5e268c6Sopenharmony_ci * You can use these APIs to obtain component information, send commands to components,
35c5e268c6Sopenharmony_ci * set component parameters, and control and transfer buffer data. 
36c5e268c6Sopenharmony_ci * After creating a component, you can use these APIs to implement encoding and decoding.
37c5e268c6Sopenharmony_ci *
38c5e268c6Sopenharmony_ci * @since 4.1
39c5e268c6Sopenharmony_ci * @version 2.0
40c5e268c6Sopenharmony_ci */
41c5e268c6Sopenharmony_ci 
42c5e268c6Sopenharmony_ci/**
43c5e268c6Sopenharmony_ci * @brief Defines the path for the package of the Codec module APIs.
44c5e268c6Sopenharmony_ci *
45c5e268c6Sopenharmony_ci * @since 4.1
46c5e268c6Sopenharmony_ci * @version 2.0
47c5e268c6Sopenharmony_ci */
48c5e268c6Sopenharmony_cipackage ohos.hdi.codec.v2_0;
49c5e268c6Sopenharmony_ci
50c5e268c6Sopenharmony_ciimport ohos.hdi.codec.v2_0.CodecTypes;
51c5e268c6Sopenharmony_ciimport ohos.hdi.codec.v2_0.ICodecCallback;
52c5e268c6Sopenharmony_ci
53c5e268c6Sopenharmony_ci/**
54c5e268c6Sopenharmony_ci * @brief Defines the APIs for codec components.
55c5e268c6Sopenharmony_ci *
56c5e268c6Sopenharmony_ci * The APIs can be used to:
57c5e268c6Sopenharmony_ci * - Obtain the component version.
58c5e268c6Sopenharmony_ci * - Obtain and set component parameters.
59c5e268c6Sopenharmony_ci * - Send a command to a component and obtain the component state.
60c5e268c6Sopenharmony_ci * - Set callbacks.
61c5e268c6Sopenharmony_ci * - Set or release the buffer used by a component.
62c5e268c6Sopenharmony_ci * - Manage the input and output buffers for encoding and decoding.
63c5e268c6Sopenharmony_ci * For details, see the description of the APIs.
64c5e268c6Sopenharmony_ci */
65c5e268c6Sopenharmony_ci
66c5e268c6Sopenharmony_ciinterface ICodecComponent {
67c5e268c6Sopenharmony_ci
68c5e268c6Sopenharmony_ci    /**
69c5e268c6Sopenharmony_ci     * @brief Obtains the version of this codec component.
70c5e268c6Sopenharmony_ci     *
71c5e268c6Sopenharmony_ci     *
72c5e268c6Sopenharmony_ci     * @param verInfo Indicates the pointer to the component version information. For details, see {@link CompVerInfo}.
73c5e268c6Sopenharmony_ci     *
74c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
75c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
76c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
77c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
78c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
79c5e268c6Sopenharmony_ci     *
80c5e268c6Sopenharmony_ci     * @since 4.1
81c5e268c6Sopenharmony_ci     */
82c5e268c6Sopenharmony_ci    GetComponentVersion([out] struct CompVerInfo verInfo);
83c5e268c6Sopenharmony_ci	
84c5e268c6Sopenharmony_ci	/**
85c5e268c6Sopenharmony_ci     * @brief Sends a command to this component.
86c5e268c6Sopenharmony_ci     *
87c5e268c6Sopenharmony_ci     * If the command is used to set the component state, a callback will be invoked to return the result.
88c5e268c6Sopenharmony_ci     * There is no callback invoked for other commands.
89c5e268c6Sopenharmony_ci     *
90c5e268c6Sopenharmony_ci     * @param cmd Indicates the command to send. For details, see {@link CodecCommandType}.
91c5e268c6Sopenharmony_ci     * @param param Indicates the parameter carried in the command.
92c5e268c6Sopenharmony_ci     * - If <b>cmd</b> is <b>CODEC_COMMAND_STATE_SET</b>, <b>param</b> can be set to any value of {@link CodecStateType}.
93c5e268c6Sopenharmony_ci     * - If <b>cmd</b> is <b>CODEC_COMMAND_FLUSH</b>, <b>CODEC_COMMAND_PORT_DISABLE</b>, <b>CODEC_COMMAND_PORT_ENABLE</b>,
94c5e268c6Sopenharmony_ci     * or <b>CODEC_COMMAND_MARK_BUFFER</b>, <b>param</b> is the target port.
95c5e268c6Sopenharmony_ci     * @param cmdData Indicates the pointer to the <b>OMX_MARKTYPE</b> structure when <b>cmd</b>
96c5e268c6Sopenharmony_ci     * is <b>CODEC_COMMAND_MARK_BUFFER</b>.
97c5e268c6Sopenharmony_ci     *
98c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
99c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
100c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
101c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
102c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
103c5e268c6Sopenharmony_ci     *
104c5e268c6Sopenharmony_ci     * @since 4.1
105c5e268c6Sopenharmony_ci     */
106c5e268c6Sopenharmony_ci    SendCommand([in] enum CodecCommandType cmd, [in] unsigned int param, [in] byte[] cmdData);
107c5e268c6Sopenharmony_ci	
108c5e268c6Sopenharmony_ci    /**
109c5e268c6Sopenharmony_ci     * @brief Obtains the parameter settings of this component.
110c5e268c6Sopenharmony_ci     *
111c5e268c6Sopenharmony_ci     * For the component in a state other than OMX_StateInvalid, you can use this API to obtain the
112c5e268c6Sopenharmony_ci     * component's parameter settings. For details about the component states, see {@link OMX_STATETYPE}.
113c5e268c6Sopenharmony_ci     *
114c5e268c6Sopenharmony_ci     * @param index Indicates the index of the structure to fill. For details,
115c5e268c6Sopenharmony_ci     * see <b>OMX_INDEXTYPE</b> defined by OMX IL.
116c5e268c6Sopenharmony_ci     * @param inParamStruct Indicates the pointer to the application allocated structure to be filled by the component.
117c5e268c6Sopenharmony_ci     * @param outParamStruct Indicates the pointer to the application allocated structure filled by the component.
118c5e268c6Sopenharmony_ci     *
119c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
120c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
121c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
122c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about
123c5e268c6Sopenharmony_ci     * the error codes, see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
124c5e268c6Sopenharmony_ci     *
125c5e268c6Sopenharmony_ci     * @since 4.1
126c5e268c6Sopenharmony_ci     */
127c5e268c6Sopenharmony_ci    GetParameter([in] unsigned int index, [in] byte[] inParamStruct, [out] byte[] outParamStruct);
128c5e268c6Sopenharmony_ci	
129c5e268c6Sopenharmony_ci    /**
130c5e268c6Sopenharmony_ci     * @brief Sets parameters for this component, that is, sends an initialization
131c5e268c6Sopenharmony_ci     * parameter structure to the component.
132c5e268c6Sopenharmony_ci     *
133c5e268c6Sopenharmony_ci     * You can use this API to set component parameters when:
134c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateLoaded state (the component has been loaded).
135c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateWaitForResources state (the component is waiting for required resources).
136c5e268c6Sopenharmony_ci     * - The component or port is disabled.
137c5e268c6Sopenharmony_ci     * For details about the component states, see {@link OMX_STATETYPE}.
138c5e268c6Sopenharmony_ci     *
139c5e268c6Sopenharmony_ci     * @param index Indicates the index of the structure to set. For details, see <b>OMX_INDEXTYPE</b> defined by OMX IL.
140c5e268c6Sopenharmony_ci     * @param paramStruct Indicates the pointer to the application allocated structure used to set
141c5e268c6Sopenharmony_ci     * parameters for this component.
142c5e268c6Sopenharmony_ci     *
143c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
144c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
145c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
146c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
147c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
148c5e268c6Sopenharmony_ci     *
149c5e268c6Sopenharmony_ci     * @since 4.1
150c5e268c6Sopenharmony_ci     */
151c5e268c6Sopenharmony_ci    SetParameter([in] unsigned int index, [in] byte[] paramStruct);
152c5e268c6Sopenharmony_ci	
153c5e268c6Sopenharmony_ci    /**
154c5e268c6Sopenharmony_ci     * @brief Obtains the configuration of this component.
155c5e268c6Sopenharmony_ci     *
156c5e268c6Sopenharmony_ci     * You can use this API to obtain the component configuration after a component is loaded.
157c5e268c6Sopenharmony_ci     *
158c5e268c6Sopenharmony_ci     * @param index Indicates the index of the structure to fill. For details, see {@link OMX_INDEXTYPE}.
159c5e268c6Sopenharmony_ci     * @param inCfgStruct Indicates the pointer to the application allocated structure to be filled by the component.
160c5e268c6Sopenharmony_ci     * @param outCfgStruct Indicates the pointer to the application allocated structure filled by the component.
161c5e268c6Sopenharmony_ci     *
162c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
163c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
164c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
165c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
166c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
167c5e268c6Sopenharmony_ci     *
168c5e268c6Sopenharmony_ci     * @since 4.1
169c5e268c6Sopenharmony_ci     */
170c5e268c6Sopenharmony_ci    GetConfig([in] unsigned int index, [in] byte[] inCfgStruct, [out] byte[] outCfgStruct);
171c5e268c6Sopenharmony_ci	
172c5e268c6Sopenharmony_ci    /**
173c5e268c6Sopenharmony_ci     * @brief Sets the component configuration.
174c5e268c6Sopenharmony_ci     *
175c5e268c6Sopenharmony_ci     * You can use this API to set the component configuration after a component is loaded.
176c5e268c6Sopenharmony_ci     *
177c5e268c6Sopenharmony_ci     * @param index Indicates the index of the structure to set. For details, see {@link OMX_INDEXTYPE}.
178c5e268c6Sopenharmony_ci     * @param cfgStruct Indicates the pointer to the application allocated structure used to set the component.
179c5e268c6Sopenharmony_ci     *
180c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
181c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
182c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
183c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
184c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
185c5e268c6Sopenharmony_ci     *
186c5e268c6Sopenharmony_ci     * @since 4.1
187c5e268c6Sopenharmony_ci     */
188c5e268c6Sopenharmony_ci    SetConfig([in] unsigned int index, [in] byte[] cfgStruct);
189c5e268c6Sopenharmony_ci	
190c5e268c6Sopenharmony_ci    /**
191c5e268c6Sopenharmony_ci     * @brief Obtains the extended index of this component based on a given string.
192c5e268c6Sopenharmony_ci     *
193c5e268c6Sopenharmony_ci     * The extended string can be converted into an OpenMAX IL structure index, which is used (as an input parameter)
194c5e268c6Sopenharmony_ci     * in {@link GetParameter} or {@link SetParameter}.
195c5e268c6Sopenharmony_ci     *
196c5e268c6Sopenharmony_ci     * @param paramName Indicates the string that can be converted into the structure index.
197c5e268c6Sopenharmony_ci     * @param indexType Indicates the structure index obtained. For details, see {@link OMX_INDEXTYPE}.
198c5e268c6Sopenharmony_ci     *
199c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
200c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
201c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
202c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
203c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
204c5e268c6Sopenharmony_ci     *
205c5e268c6Sopenharmony_ci     * @since 4.1
206c5e268c6Sopenharmony_ci     */
207c5e268c6Sopenharmony_ci    GetExtensionIndex([in] String paramName, [out] unsigned int indexType);
208c5e268c6Sopenharmony_ci	
209c5e268c6Sopenharmony_ci    /**
210c5e268c6Sopenharmony_ci     * @brief Obtains the current state of this component.
211c5e268c6Sopenharmony_ci     *
212c5e268c6Sopenharmony_ci     * 
213c5e268c6Sopenharmony_ci     *
214c5e268c6Sopenharmony_ci     * @param state Indicates the pointer to the state obtained. For details about the component
215c5e268c6Sopenharmony_ci     * states, see {@link CodecStateType}.
216c5e268c6Sopenharmony_ci     *
217c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
218c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
219c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
220c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
221c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
222c5e268c6Sopenharmony_ci     *
223c5e268c6Sopenharmony_ci     * @since 4.1
224c5e268c6Sopenharmony_ci     */
225c5e268c6Sopenharmony_ci    GetState([out] enum CodecStateType state);
226c5e268c6Sopenharmony_ci	
227c5e268c6Sopenharmony_ci    /**
228c5e268c6Sopenharmony_ci     * @brief Sets up tunneling for this component.
229c5e268c6Sopenharmony_ci     *
230c5e268c6Sopenharmony_ci     * For a component in the OMX_StateLoaded state (the component is loaded), you can use this API
231c5e268c6Sopenharmony_ci     * to determine whether
232c5e268c6Sopenharmony_ci     * tunneling is possible and if yes, to set up the tunneling.
233c5e268c6Sopenharmony_ci     * For details about the component states, see {@link OMX_STATETYPE}.
234c5e268c6Sopenharmony_ci     *
235c5e268c6Sopenharmony_ci     * @param port Indicates the port on the component used for the setting.
236c5e268c6Sopenharmony_ci     * @param tunneledComp Indicates the handle of the tunnel component.
237c5e268c6Sopenharmony_ci     * @param tunneledPort Indicates the port on the component to be used for tunneling.
238c5e268c6Sopenharmony_ci     * @param inTunnelSetup Indicates the pointer to the tunnel setup structure {@link OMX_TUNNELSETUPTYPE} to set.
239c5e268c6Sopenharmony_ci     * @param outTunnelSetup Indicates the pointer to the tunnel setup structure {@link OMX_TUNNELSETUPTYPE} set.
240c5e268c6Sopenharmony_ci     *
241c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
242c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
243c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
244c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
245c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
246c5e268c6Sopenharmony_ci     *
247c5e268c6Sopenharmony_ci     * @since 4.1
248c5e268c6Sopenharmony_ci     */
249c5e268c6Sopenharmony_ci    ComponentTunnelRequest([in] unsigned int port, [in] int tunneledComp, [in] unsigned int tunneledPort, [in]
250c5e268c6Sopenharmony_ci    struct CodecTunnelSetupType inTunnelSetup, [out] struct CodecTunnelSetupType outTunnelSetup);
251c5e268c6Sopenharmony_ci	
252c5e268c6Sopenharmony_ci    /**
253c5e268c6Sopenharmony_ci     * @brief Requests the component to use a buffer that is already allocated by another component.
254c5e268c6Sopenharmony_ci     *
255c5e268c6Sopenharmony_ci     * This API is used when:
256c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateLoaded state (the component is loaded) and has received a request for
257c5e268c6Sopenharmony_ci     * changing the state to OMX_StateIdle.
258c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateWaitForResources state, the required resources are available, and the
259c5e268c6Sopenharmony_ci     * component is ready to enter the OMX_StateIdle state.
260c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port.
261c5e268c6Sopenharmony_ci     * For details about the component states, see {@link OMX_STATETYPE}.
262c5e268c6Sopenharmony_ci     *
263c5e268c6Sopenharmony_ci     * @param portIndex Indicates the component port.
264c5e268c6Sopenharmony_ci     * @param inBuffer Indicates the pointer to the structure of the buffer to be used. For details, see {@link OmxCodecBuffer}.
265c5e268c6Sopenharmony_ci     * @param outBuffer Indicates the pointer to the structure of the buffer to be used. For details, see {@link OmxCodecBuffer}.
266c5e268c6Sopenharmony_ci     *
267c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
268c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
269c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
270c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
271c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
272c5e268c6Sopenharmony_ci     *
273c5e268c6Sopenharmony_ci     * @since 4.1
274c5e268c6Sopenharmony_ci     */
275c5e268c6Sopenharmony_ci    UseBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer, [out] struct OmxCodecBuffer outBuffer);
276c5e268c6Sopenharmony_ci	
277c5e268c6Sopenharmony_ci    /**
278c5e268c6Sopenharmony_ci     * @brief Requests the component to allocate a new buffer.
279c5e268c6Sopenharmony_ci     *
280c5e268c6Sopenharmony_ci     * This API is used to request a new buffer from a component when:
281c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateLoaded state and has received a request for changing the
282c5e268c6Sopenharmony_ci     * state to OMX_StateIdle.
283c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateWaitForResources state, the required resources are available,
284c5e268c6Sopenharmony_ci     * and the component is ready to enter the OMX_StateIdle state.
285c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port.
286c5e268c6Sopenharmony_ci     * For details about the component states, see {@link OMX_STATETYPE}.
287c5e268c6Sopenharmony_ci     *
288c5e268c6Sopenharmony_ci     * @param portIndex Indicates the component port.
289c5e268c6Sopenharmony_ci     * @param inBuffer Indicates the pointer to the structure of the buffer to be allocated. For details about
290c5e268c6Sopenharmony_ci     * the structure, see {@link OmxCodecBuffer}.
291c5e268c6Sopenharmony_ci     * @param outBuffer Indicates the pointer to the structure of the buffer allocated. For details about the
292c5e268c6Sopenharmony_ci     * structure, see {@link OmxCodecBuffer}.
293c5e268c6Sopenharmony_ci     *
294c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
295c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
296c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
297c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
298c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
299c5e268c6Sopenharmony_ci     *
300c5e268c6Sopenharmony_ci     * @since 4.1
301c5e268c6Sopenharmony_ci     */
302c5e268c6Sopenharmony_ci    AllocateBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer,
303c5e268c6Sopenharmony_ci    [out] struct OmxCodecBuffer outBuffer);
304c5e268c6Sopenharmony_ci	
305c5e268c6Sopenharmony_ci    /**
306c5e268c6Sopenharmony_ci     * @brief Releases a buffer.
307c5e268c6Sopenharmony_ci     *
308c5e268c6Sopenharmony_ci     * This API is used when:
309c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateIdle state and has received a request for changing the
310c5e268c6Sopenharmony_ci     * state to OMX_StateLoaded.
311c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port.
312c5e268c6Sopenharmony_ci     * For details about the component states, see {@link OMX_STATETYPE}.
313c5e268c6Sopenharmony_ci     * - This API can be called at any time. However, if it is not called in any of the previous conditions,
314c5e268c6Sopenharmony_ci     * the component may report an <b>OMX_ErrorPortUnpopulated</b> event.
315c5e268c6Sopenharmony_ci     *
316c5e268c6Sopenharmony_ci     * @param portIndex Indicates the component port.
317c5e268c6Sopenharmony_ci     * @param buffer Indicates the pointer to the structure of the buffer to release. For details about the
318c5e268c6Sopenharmony_ci     * structure, see {@link OmxCodecBuffer}.
319c5e268c6Sopenharmony_ci     *
320c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
321c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
322c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
323c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
324c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
325c5e268c6Sopenharmony_ci     *
326c5e268c6Sopenharmony_ci     * @since 4.1
327c5e268c6Sopenharmony_ci     */
328c5e268c6Sopenharmony_ci    FreeBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer buffer);
329c5e268c6Sopenharmony_ci	
330c5e268c6Sopenharmony_ci    /**
331c5e268c6Sopenharmony_ci     * @brief Empties a buffer.
332c5e268c6Sopenharmony_ci     *
333c5e268c6Sopenharmony_ci     * This API can be called when the component is in the OMX_StateExecuting or OMX_StatePause state. For details
334c5e268c6Sopenharmony_ci     * about the component states, see {@link OMX_STATETYPE}.
335c5e268c6Sopenharmony_ci     *
336c5e268c6Sopenharmony_ci     * @param buffer Indicates the pointer to the structure of the buffer to empty. For details about the structure,
337c5e268c6Sopenharmony_ci     * see {@link OmxCodecBuffer}.
338c5e268c6Sopenharmony_ci     *
339c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
340c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
341c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
342c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
343c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
344c5e268c6Sopenharmony_ci     *
345c5e268c6Sopenharmony_ci     * @since 4.1
346c5e268c6Sopenharmony_ci     */
347c5e268c6Sopenharmony_ci    EmptyThisBuffer([in] struct OmxCodecBuffer buffer);
348c5e268c6Sopenharmony_ci	
349c5e268c6Sopenharmony_ci    /**
350c5e268c6Sopenharmony_ci     * @brief Fills a buffer with the encoding and decoding output by this component.
351c5e268c6Sopenharmony_ci     *
352c5e268c6Sopenharmony_ci     * This API can be called when the component is in the OMX_StateExecuting or OMX_StatePause state. For details
353c5e268c6Sopenharmony_ci     * about the component states, see {@link OMX_STATETYPE}.
354c5e268c6Sopenharmony_ci     *
355c5e268c6Sopenharmony_ci     * @param buffer Indicates the pointer to the structure of the buffer to be filled. For details about the
356c5e268c6Sopenharmony_ci     * structure, see {@link OmxCodecBuffer}.
357c5e268c6Sopenharmony_ci     *
358c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
359c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
360c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
361c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
362c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
363c5e268c6Sopenharmony_ci     *
364c5e268c6Sopenharmony_ci     * @since 4.1
365c5e268c6Sopenharmony_ci     */
366c5e268c6Sopenharmony_ci    FillThisBuffer([in] struct OmxCodecBuffer buffer);
367c5e268c6Sopenharmony_ci	
368c5e268c6Sopenharmony_ci    /**
369c5e268c6Sopenharmony_ci     * @brief Sets callbacks for this component.
370c5e268c6Sopenharmony_ci     *
371c5e268c6Sopenharmony_ci     * The callbacks will be invoked to report an event or report available input or output information when the
372c5e268c6Sopenharmony_ci     * component is in the OMX_StateLoaded state. For details about the component states, see {@link OMX_STATETYPE}.
373c5e268c6Sopenharmony_ci     *
374c5e268c6Sopenharmony_ci     * @param callbacks Indicates the pointer to the {@link ICodecCallback} object.
375c5e268c6Sopenharmony_ci     * @param appData Indicates the pointer to an application-defined value that will be returned by the callback.
376c5e268c6Sopenharmony_ci     *
377c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
378c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
379c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
380c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
381c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
382c5e268c6Sopenharmony_ci     *
383c5e268c6Sopenharmony_ci     * @since 4.1
384c5e268c6Sopenharmony_ci     */
385c5e268c6Sopenharmony_ci    SetCallbacks([in] ICodecCallback callbacks, [in] long appData);
386c5e268c6Sopenharmony_ci	
387c5e268c6Sopenharmony_ci    /**
388c5e268c6Sopenharmony_ci     * @brief Deinitializes this component.
389c5e268c6Sopenharmony_ci     *
390c5e268c6Sopenharmony_ci     * This API will deinitialize and close a component in the OMX_StateLoaded state. For details about the
391c5e268c6Sopenharmony_ci     * component states, see {@link OMX_STATETYPE}.
392c5e268c6Sopenharmony_ci     *
393c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
394c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
395c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
396c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
397c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
398c5e268c6Sopenharmony_ci     *
399c5e268c6Sopenharmony_ci     * @since 4.1
400c5e268c6Sopenharmony_ci     */
401c5e268c6Sopenharmony_ci    ComponentDeInit();
402c5e268c6Sopenharmony_ci	
403c5e268c6Sopenharmony_ci    /**
404c5e268c6Sopenharmony_ci     * @brief Uses the image provided by EGL as a buffer on the specified port.
405c5e268c6Sopenharmony_ci     *
406c5e268c6Sopenharmony_ci     * This API is used when:
407c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateLoaded state and has received a request for changing the
408c5e268c6Sopenharmony_ci     * state to OMX_StateIdle.
409c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateWaitForResources state, the required resources are available,
410c5e268c6Sopenharmony_ci     * and the component is ready to enter the OMX_StateIdle state.
411c5e268c6Sopenharmony_ci     * - The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port.
412c5e268c6Sopenharmony_ci     * For details about the component states, see {@link OMX_STATETYPE}.
413c5e268c6Sopenharmony_ci     *
414c5e268c6Sopenharmony_ci     * @param portIndex Indicates the component port.
415c5e268c6Sopenharmony_ci     * @param inBuffer Indicates the pointer to the {@link OmxCodecBuffer} structure.
416c5e268c6Sopenharmony_ci     * @param outBuffer Indicates the pointer to the {@link OmxCodecBuffer} structure.
417c5e268c6Sopenharmony_ci     * @param eglImage Indicates the pointer to the image allocated by EGL.
418c5e268c6Sopenharmony_ci     *
419c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
420c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
421c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
422c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
423c5e268c6Sopenharmony_ci     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
424c5e268c6Sopenharmony_ci     *
425c5e268c6Sopenharmony_ci     * @since 4.1
426c5e268c6Sopenharmony_ci     */
427c5e268c6Sopenharmony_ci    UseEglImage([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer, [out] struct OmxCodecBuffer
428c5e268c6Sopenharmony_ci    outBuffer, [in] byte[] eglImage);
429c5e268c6Sopenharmony_ci	
430c5e268c6Sopenharmony_ci    /**
431c5e268c6Sopenharmony_ci     * @brief Obtains the component role based on the index.
432c5e268c6Sopenharmony_ci     *
433c5e268c6Sopenharmony_ci     * 
434c5e268c6Sopenharmony_ci     *
435c5e268c6Sopenharmony_ci     * @param role Indicates the role name obtained.
436c5e268c6Sopenharmony_ci     * @param index Indicates the index of the role. A component supports multiple roles.
437c5e268c6Sopenharmony_ci     *
438c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
439c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
440c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
441c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error
442c5e268c6Sopenharmony_ci     * codes, see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
443c5e268c6Sopenharmony_ci     *
444c5e268c6Sopenharmony_ci     * @since 4.1
445c5e268c6Sopenharmony_ci     */
446c5e268c6Sopenharmony_ci    ComponentRoleEnum([out] unsigned char[] role, [in] unsigned int index);
447c5e268c6Sopenharmony_ci}