video: Add missing function prototypes
[GitHub/LineageOS/android_hardware_samsung_slsi_openmax.git] / component / common / Exynos_OMX_Baseport.h
CommitLineData
c6f4bc34
YK
1/*
2 *
3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * @file Exynos_OMX_Baseport.h
20 * @brief
21 * @author SeungBeom Kim (sbcrux.kim@samsung.com)
22 * HyeYeon Chung (hyeon.chung@samsung.com)
23 * @version 2.0.0
24 * @history
25 * 2012.02.20 : Create
26 */
27
28#ifndef EXYNOS_OMX_BASE_PORT
29#define EXYNOS_OMX_BASE_PORT
30
31
32#include "OMX_Component.h"
33#include "Exynos_OMX_Def.h"
34#include "Exynos_OSAL_Queue.h"
35#include "Exynos_OMX_Def.h"
36
37
38#define BUFFER_STATE_ALLOCATED (1 << 0)
39#define BUFFER_STATE_ASSIGNED (1 << 1)
40#define HEADER_STATE_ALLOCATED (1 << 2)
41#define BUFFER_STATE_FREE 0
42
43#define MAX_BUFFER_NUM 40
44
45#define INPUT_PORT_INDEX 0
46#define OUTPUT_PORT_INDEX 1
47#define ALL_PORT_INDEX -1
48#define ALL_PORT_NUM 2
49
50
51typedef struct _EXYNOS_OMX_BUFFERHEADERTYPE
52{
53 OMX_BUFFERHEADERTYPE *OMXBufferHeader;
54 OMX_BOOL bBufferInOMX;
55 OMX_HANDLETYPE ANBHandle;
56 void *pYUVBuf[MAX_BUFFER_PLANE];
57 int buf_fd[MAX_BUFFER_PLANE];
58} EXYNOS_OMX_BUFFERHEADERTYPE;
59
60typedef struct _EXYNOS_OMX_DATABUFFER
61{
62 OMX_HANDLETYPE bufferMutex;
63 OMX_BUFFERHEADERTYPE* bufferHeader;
64 OMX_BOOL dataValid;
65 OMX_U32 allocSize;
66 OMX_U32 dataLen;
67 OMX_U32 usedDataLen;
68 OMX_U32 remainDataLen;
69 OMX_U32 nFlags;
70 OMX_TICKS timeStamp;
71 OMX_PTR pPrivate;
72} EXYNOS_OMX_DATABUFFER;
73
74typedef void* CODEC_EXTRA_BUFFERINFO;
75
76typedef struct _EXYNOS_OMX_SINGLEPLANE_DATA
77{
78 OMX_PTR dataBuffer;
e4e150b8 79 int fd;
c6f4bc34
YK
80} EXYNOS_OMX_SINGLEPLANE_DATA;
81
82typedef struct _EXYNOS_OMX_MULTIPLANE_DATA
83{
84 OMX_U32 validPlaneNum;
85 OMX_PTR dataBuffer[MAX_BUFFER_PLANE];
e4e150b8 86 int fd[MAX_BUFFER_PLANE];
c6f4bc34
YK
87} EXYNOS_OMX_MULTIPLANE_DATA;
88
89typedef struct _EXYNOS_OMX_DATA
90{
91 union {
92 EXYNOS_OMX_SINGLEPLANE_DATA singlePlaneBuffer;
93 EXYNOS_OMX_MULTIPLANE_DATA multiPlaneBuffer;
94 } buffer;
95 OMX_U32 allocSize;
96 OMX_U32 dataLen;
97 OMX_U32 usedDataLen;
98 OMX_U32 remainDataLen;
99 OMX_U32 nFlags;
100 OMX_TICKS timeStamp;
101 OMX_PTR pPrivate;
102 CODEC_EXTRA_BUFFERINFO extInfo;
e4e150b8 103
c6f4bc34
YK
104 /* For Share Buffer */
105 OMX_BUFFERHEADERTYPE* bufferHeader;
106} EXYNOS_OMX_DATA;
107
108typedef struct _EXYNOS_OMX_WAY1_PORT_DATABUFFER
109{
110 EXYNOS_OMX_DATABUFFER dataBuffer;
111} EXYNOS_OMX_PORT_1WAY_DATABUFFER;
112
113typedef struct _EXYNOS_OMX_WAY2_PORT_DATABUFFER
114{
115 EXYNOS_OMX_DATABUFFER inputDataBuffer;
116 EXYNOS_OMX_DATABUFFER outputDataBuffer;
117} EXYNOS_OMX_PORT_2WAY_DATABUFFER;
118
119typedef enum _EXYNOS_OMX_PORT_WAY_TYPE
120{
121 WAY1_PORT = 0x00,
122 WAY2_PORT
123} EXYNOS_OMX_PORT_WAY_TYPE;
124
125typedef enum _EXYNOS_OMX_EXCEPTION_STATE
126{
127 GENERAL_STATE = 0x00,
128 NEED_PORT_FLUSH,
129 NEED_PORT_DISABLE,
4650bb72 130 INVALID_STATE,
c6f4bc34
YK
131} EXYNOS_OMX_EXCEPTION_STATE;
132
133typedef enum _EXYNOS_OMX_PLANE
134{
135 ONE_PLANE = 0x01,
136 TWO_PLANE = 0x02,
137 THREE_PLANE = 0x03,
138/*
139 ANB_START_PLANE = 0x10,
140 ANB_ONE_PLANE = 0x11,
141 ANB_TWO_PLANE = 0x12,
142 ANB_THREE_PLANE = 0x13,
143*/
144} EXYNOS_OMX_PLANE;
145
146typedef struct _EXYNOS_OMX_BASEPORT
147{
148 EXYNOS_OMX_BUFFERHEADERTYPE *extendBufferHeader;
149 OMX_U32 *bufferStateAllocate;
150 OMX_PARAM_PORTDEFINITIONTYPE portDefinition;
151 OMX_HANDLETYPE bufferSemID;
152 EXYNOS_QUEUE bufferQ;
153 OMX_U32 assignedBufferNum;
433e798a 154 OMX_U32 nPlaneCnt;
c6f4bc34
YK
155 OMX_STATETYPE portState;
156 OMX_HANDLETYPE loadedResource;
157 OMX_HANDLETYPE unloadedResource;
158
159 OMX_BOOL bIsPortFlushed;
160 OMX_BOOL bIsPortDisabled;
161 OMX_MARKTYPE markType;
162
163 OMX_CONFIG_RECTTYPE cropRectangle;
164
165 /* Tunnel Info */
166 OMX_HANDLETYPE tunneledComponent;
167 OMX_U32 tunneledPort;
168 OMX_U32 tunnelBufferNum;
169 OMX_BUFFERSUPPLIERTYPE bufferSupplier;
170 OMX_U32 tunnelFlags;
171
172 OMX_BOOL bIsANBEnabled;
173 OMX_BOOL bStoreMetaData;
306d2c90 174 OMX_BOOL bNeedContigMem;
c6f4bc34
YK
175
176 EXYNOS_OMX_BUFFERPROCESS_TYPE bufferProcessType;
177 EXYNOS_OMX_PORT_WAY_TYPE portWayType;
178 OMX_HANDLETYPE codecSemID;
179 EXYNOS_QUEUE codecBufferQ;
180
181 OMX_HANDLETYPE pauseEvent;
182
183 /* Buffer */
184 union {
185 EXYNOS_OMX_PORT_1WAY_DATABUFFER port1WayDataBuffer;
186 EXYNOS_OMX_PORT_2WAY_DATABUFFER port2WayDataBuffer;
187 } way;
188
189 /* Data */
190 EXYNOS_OMX_DATA processData;
191
192 /* for flush of Shared buffer scheme */
193 OMX_HANDLETYPE hAllCodecBufferReturnEvent;
194 OMX_HANDLETYPE hPortMutex;
195 EXYNOS_OMX_EXCEPTION_STATE exceptionFlag;
196} EXYNOS_OMX_BASEPORT;
197
198
199#ifdef __cplusplus
200extern "C" {
201#endif
202
203OMX_ERRORTYPE Exynos_OMX_PortEnableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
204OMX_ERRORTYPE Exynos_OMX_PortDisableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
205OMX_ERRORTYPE Exynos_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent);
206OMX_ERRORTYPE Exynos_OMX_Port_Constructor(OMX_HANDLETYPE hComponent);
207OMX_ERRORTYPE Exynos_OMX_Port_Destructor(OMX_HANDLETYPE hComponent);
208OMX_ERRORTYPE Exynos_ResetDataBuffer(EXYNOS_OMX_DATABUFFER *pDataBuffer);
209OMX_ERRORTYPE Exynos_ResetCodecData(EXYNOS_OMX_DATA *pData);
210OMX_ERRORTYPE Exynos_Shared_BufferToData(EXYNOS_OMX_DATABUFFER *pUseBuffer, EXYNOS_OMX_DATA *pData, EXYNOS_OMX_PLANE nPlane);
433e798a 211OMX_ERRORTYPE Exynos_OMX_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE* bufferHeader);
cc46393d
AS
212OMX_ERRORTYPE Exynos_OMX_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE* bufferHeader);
213OMX_ERRORTYPE Exynos_OMX_FillThisBuffer(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer);
c6f4bc34
YK
214
215#ifdef __cplusplus
216};
217#endif
218
219
220#endif