1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2022-2023 Shenzhen Kaihong DID 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#ifndef CODEC_OMX_ADAPTER_INTERFACE_H
17094332d3Sopenharmony_ci#define CODEC_OMX_ADAPTER_INTERFACE_H
18094332d3Sopenharmony_ci#include "codec_callback_if.h"
19094332d3Sopenharmony_ci#include "codec_types.h"
20094332d3Sopenharmony_ci#ifdef __cplusplus
21094332d3Sopenharmony_ciextern "C" {
22094332d3Sopenharmony_ci#endif
23094332d3Sopenharmony_ci
24094332d3Sopenharmony_cistruct CodecComponentNode;
25094332d3Sopenharmony_ci/**
26094332d3Sopenharmony_ci * @brief Create a component by name.
27094332d3Sopenharmony_ci */
28094332d3Sopenharmony_ciint32_t OMXAdapterCreateComponent(struct CodecComponentNode **codecNode, char *compName, int64_t appData,
29094332d3Sopenharmony_ci                                  struct CodecCallbackType *callbacks);
30094332d3Sopenharmony_ci/**
31094332d3Sopenharmony_ci * @brief Release the component by handle.
32094332d3Sopenharmony_ci */
33094332d3Sopenharmony_ciint32_t OmxAdapterDestroyComponent(struct CodecComponentNode *codecNode);
34094332d3Sopenharmony_ci/**
35094332d3Sopenharmony_ci * @brief Get the version of the component.
36094332d3Sopenharmony_ci */
37094332d3Sopenharmony_ciint32_t OmxAdapterComponentVersion(struct CodecComponentNode *codecNode, struct CompVerInfo *verInfo);
38094332d3Sopenharmony_ci/**
39094332d3Sopenharmony_ci * @brief Send command to the component.
40094332d3Sopenharmony_ci */
41094332d3Sopenharmony_ciint32_t OmxAdapterSendCommand(struct CodecComponentNode *codecNode, OMX_COMMANDTYPE cmd, uint32_t param,
42094332d3Sopenharmony_ci                              int8_t *cmdData, uint32_t cmdDataLen);
43094332d3Sopenharmony_ci/**
44094332d3Sopenharmony_ci * @brief Get the parameter by index.
45094332d3Sopenharmony_ci */
46094332d3Sopenharmony_ciint32_t OmxAdapterGetParameter(struct CodecComponentNode *codecNode, OMX_INDEXTYPE paramIndex, int8_t *param,
47094332d3Sopenharmony_ci                               uint32_t paramLen);
48094332d3Sopenharmony_ci/**
49094332d3Sopenharmony_ci * @brief Set the parameter by index.
50094332d3Sopenharmony_ci */
51094332d3Sopenharmony_ciint32_t OmxAdapterSetParameter(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *param,
52094332d3Sopenharmony_ci                               uint32_t paramLen);
53094332d3Sopenharmony_ci/**
54094332d3Sopenharmony_ci * @brief Get the config by index.
55094332d3Sopenharmony_ci *
56094332d3Sopenharmony_ci * This func can be invoked when the component is in any state except the OMX_StateInvalid state.
57094332d3Sopenharmony_ci */
58094332d3Sopenharmony_ciint32_t OmxAdapterGetConfig(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *config,
59094332d3Sopenharmony_ci                            uint32_t configLen);
60094332d3Sopenharmony_ciint32_t OmxAdapterSetConfig(struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *config,
61094332d3Sopenharmony_ci                            uint32_t configLen);
62094332d3Sopenharmony_ciint32_t OmxAdapterGetExtensionIndex(struct CodecComponentNode *codecNode, const char *parameterName,
63094332d3Sopenharmony_ci                                    OMX_INDEXTYPE *indexType);
64094332d3Sopenharmony_ciint32_t OmxAdapterGetState(struct CodecComponentNode *codecNode, OMX_STATETYPE *state);
65094332d3Sopenharmony_ci/**
66094332d3Sopenharmony_ci * @brief Set up tunneled communication between an output port and an input port.
67094332d3Sopenharmony_ci */
68094332d3Sopenharmony_ciint32_t OmxAdapterComponentTunnelRequest(struct CodecComponentNode *codecNode, uint32_t port,
69094332d3Sopenharmony_ci                                         int32_t omxHandleTypeTunneledComp, uint32_t tunneledPort,
70094332d3Sopenharmony_ci                                         struct OMX_TUNNELSETUPTYPE *tunnelSetup);
71094332d3Sopenharmony_ci/**
72094332d3Sopenharmony_ci * @brief The component uses a buffer already allocated by the IL client.
73094332d3Sopenharmony_ci */
74094332d3Sopenharmony_ciint32_t OmxAdapterUseBuffer(struct CodecComponentNode *codecNode, uint32_t portIndex,
75094332d3Sopenharmony_ci                            struct OmxCodecBuffer *omxBuffer);
76094332d3Sopenharmony_ci/**
77094332d3Sopenharmony_ci * @brief The component allocate a buffer.
78094332d3Sopenharmony_ci */
79094332d3Sopenharmony_ciint32_t OmxAdapterAllocateBuffer(struct CodecComponentNode *codecNode, uint32_t portIndex,
80094332d3Sopenharmony_ci                                 struct OmxCodecBuffer *omxBuffer);
81094332d3Sopenharmony_ci/**
82094332d3Sopenharmony_ci * @brief The component free the buffer.
83094332d3Sopenharmony_ci */
84094332d3Sopenharmony_ciint32_t OmxAdapterFreeBuffer(struct CodecComponentNode *codecNode, uint32_t portIndex,
85094332d3Sopenharmony_ci                             struct OmxCodecBuffer *omxBuffer);
86094332d3Sopenharmony_ci/**
87094332d3Sopenharmony_ci * @brief Send a filled buffer to the input port of the component.
88094332d3Sopenharmony_ci */
89094332d3Sopenharmony_ciint32_t OmxAdapterEmptyThisBuffer(struct CodecComponentNode *codecNode, struct OmxCodecBuffer *omxBuffer);
90094332d3Sopenharmony_ci/**
91094332d3Sopenharmony_ci * @brief Send a empty buffer to the output port of the component.
92094332d3Sopenharmony_ci */
93094332d3Sopenharmony_ciint32_t OmxAdapterFillThisBuffer(struct CodecComponentNode *codecNode, struct OmxCodecBuffer *omxBuffer);
94094332d3Sopenharmony_ci/**
95094332d3Sopenharmony_ci * @brief Set the callback.
96094332d3Sopenharmony_ci */
97094332d3Sopenharmony_ciint32_t OmxAdapterSetCallbacks(struct CodecComponentNode *codecNode, struct CodecCallbackType *omxCallback,
98094332d3Sopenharmony_ci                               int64_t appData);
99094332d3Sopenharmony_ci/**
100094332d3Sopenharmony_ci * @brief DeInit the component.
101094332d3Sopenharmony_ci */
102094332d3Sopenharmony_ciint32_t OmxAdapterDeInit(struct CodecComponentNode *codecNode);
103094332d3Sopenharmony_ci/**
104094332d3Sopenharmony_ci * @brief The component use the buffer allocated in EGL.
105094332d3Sopenharmony_ci */
106094332d3Sopenharmony_ciint32_t OmxAdapterUseEglImage(struct CodecComponentNode *codecNode, struct OmxCodecBuffer *buffer,
107094332d3Sopenharmony_ci                              uint32_t portIndex, int8_t *eglImage, uint32_t eglImageLen);
108094332d3Sopenharmony_ci/**
109094332d3Sopenharmony_ci * @brief Get the role of the component.
110094332d3Sopenharmony_ci */
111094332d3Sopenharmony_ciint32_t OmxAdapterComponentRoleEnum(struct CodecComponentNode *codecNode, uint8_t *role, uint32_t roleLen,
112094332d3Sopenharmony_ci                                    uint32_t index);
113094332d3Sopenharmony_ci/**
114094332d3Sopenharmony_ci * @brief Set the role for the component.
115094332d3Sopenharmony_ci */
116094332d3Sopenharmony_ciint32_t OmxAdapterSetComponentRole(struct CodecComponentNode *codecNode, char *compName);
117094332d3Sopenharmony_ci/**
118094332d3Sopenharmony_ci * @brief build hidumper reply.
119094332d3Sopenharmony_ci */
120094332d3Sopenharmony_ciint32_t OmxAdapterWriteDumperData(char *info, uint32_t size, uint32_t compId, struct CodecComponentNode *codecNode);
121094332d3Sopenharmony_ci#ifdef __cplusplus
122094332d3Sopenharmony_ci};
123094332d3Sopenharmony_ci#endif
124094332d3Sopenharmony_ci
125094332d3Sopenharmony_ci#endif  // CODEC_OMX_ADAPTER_INTERFACE_H