• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2013 Rockchip Electronics 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  * @file   Rockchip_OMX_Def.h
19  * @brief   Rockchip_OMX specific define
20  * @author  csy (csy@rock-chips.com)
21  * @version    1.0.0
22  * @history
23  *   2013.11.26 : Create
24  */
25 
26 #ifndef ROCKCHIP_OMX_DEF
27 #define ROCKCHIP_OMX_DEF
28 
29 #include "OMX_Types.h"
30 #include "OMX_IVCommon.h"
31 
32 #define VERSIONMAJOR_NUMBER                1
33 #define VERSIONMINOR_NUMBER                0
34 #define REVISION_NUMBER                    0
35 #define STEP_NUMBER                        0
36 
37 
38 #define MAX_OMX_COMPONENT_NUM              28
39 #define MAX_OMX_COMPONENT_ROLE_NUM         20
40 #define MAX_OMX_COMPONENT_NAME_SIZE        OMX_MAX_STRINGNAME_SIZE
41 #define MAX_OMX_COMPONENT_ROLE_SIZE        OMX_MAX_STRINGNAME_SIZE
42 #define MAX_OMX_COMPONENT_LIBNAME_SIZE     (OMX_MAX_STRINGNAME_SIZE * 2)
43 #define MAX_OMX_MIMETYPE_SIZE              OMX_MAX_STRINGNAME_SIZE
44 
45 #define MAX_TIMESTAMP        40
46 #define MAX_FLAGS            40
47 #define MAX_BUFFER_REF       40
48 
49 #define MAX_BUFFER_PLANE     1
50 
51 #define ROCKCHIP_OMX_INSTALL_PATH "/system/lib/"
52 
53 #define OMX_COLORSPACE_MASK     (0x00f00000)
54 #define OMX_DYNCRANGE_MASK      (0x0f000000)
55 
56 /* note: must sync with gralloc */
57 typedef enum _ANB_PRIVATE_BUF_TYPE {
58     ANB_PRIVATE_BUF_NONE    = 0,
59     ANB_PRIVATE_BUF_VIRTUAL = 0x01,
60     ANB_PRIVATE_BUF_BUTT,
61 } ANB_PRIVATE_BUF_TYPE;
62 
63 typedef enum _ROCKCHIP_CODEC_TYPE {
64     SW_CODEC,
65     HW_VIDEO_DEC_CODEC,
66     HW_VIDEO_ENC_CODEC,
67 } ROCKCHIP_CODEC_TYPE;
68 
69 typedef struct _ROCKCHIP_OMX_PRIORITYMGMTTYPE {
70     OMX_U32 nGroupPriority; /* the value 0 represents the highest priority */
71     /* for a group of components                   */
72     OMX_U32 nGroupID;
73 } ROCKCHIP_OMX_PRIORITYMGMTTYPE;
74 
75 /* set when wfd */
76 typedef struct _ROCKCHIP_OMX_WFD {
77     OMX_U32 nSize;
78     OMX_VERSIONTYPE nVersion;
79     OMX_BOOL bEnable;
80 } ROCKCHIP_OMX_WFD;
81 
82 typedef struct _OMX_VIDEO_PARAMS_EXTENDED {
83     OMX_U32 nSize;
84     OMX_VERSIONTYPE nVersion;
85     OMX_U32 ui32Flags;
86     OMX_BOOL bEnableScaling; // Resolution Scaling
87     OMX_U16 ui16ScaledWidth;
88     OMX_U16 ui16ScaledHeight;
89     OMX_BOOL bEnableCropping; // Resolution Cropping
90     OMX_U16 ui16CropLeft; // Number of columns to be cropped from lefthand-side edge
91     OMX_U16 ui16CropRight; // Number of columns to be cropped from righthand-side edge
92     OMX_U16 ui16CropTop; // Number of rows to be cropped from the top edge
93     OMX_U16 ui16CropBottom; // Number of rows to be cropped from the bottom edge
94 } OMX_VIDEO_PARAMS_EXTENDED;
95 
96 typedef enum _ROCKCHIP_OMX_ERRORTYPE {
97     OMX_ErrorNoEOF              = (OMX_S32) 0x90000001,
98     OMX_ErrorInputDataDecodeYet = (OMX_S32) 0x90000002,
99     OMX_ErrorInputDataEncodeYet = (OMX_S32) 0x90000003,
100     OMX_ErrorCodecInit          = (OMX_S32) 0x90000004,
101     OMX_ErrorCodecDecode        = (OMX_S32) 0x90000005,
102     OMX_ErrorCodecEncode        = (OMX_S32) 0x90000006,
103     OMX_ErrorCodecFlush         = (OMX_S32) 0x90000007,
104     OMX_ErrorOutputBufferUseYet = (OMX_S32) 0x90000008
105 } ROCKCHIP_OMX_ERRORTYPE;
106 
107 typedef enum _ROCKCHIP_OMX_COMMANDTYPE {
108     ROCKCHIP_OMX_CommandComponentDeInit = 0x7F000001,
109     ROCKCHIP_OMX_CommandEmptyBuffer,
110     ROCKCHIP_OMX_CommandFillBuffer,
111     ROCKCHIP_OMX_CommandFakeBuffer
112 } ROCKCHIP_OMX_COMMANDTYPE;
113 
114 typedef enum _ROCKCHIP_OMX_TRANS_STATETYPE {
115     ROCKCHIP_OMX_TransStateInvalid,
116     ROCKCHIP_OMX_TransStateLoadedToIdle,
117     ROCKCHIP_OMX_TransStateIdleToExecuting,
118     ROCKCHIP_OMX_TransStateExecutingToIdle,
119     ROCKCHIP_OMX_TransStateIdleToLoaded,
120     ROCKCHIP_OMX_TransStateMax = 0X7FFFFFFF
121 } ROCKCHIP_OMX_TRANS_STATETYPE;
122 
123 typedef enum _ROCKCHIP_OMX_COLOR_FORMATTYPE {
124     /* to copy a encoded data for drm component using gsc or fimc */
125     OMX_SEC_COLOR_FormatEncodedData                 = OMX_COLOR_FormatYCbYCr,
126     OMX_COLOR_FormatYUV420Flexible                  = 0x7F420888
127 } ROCKCHIP_OMX_COLOR_FORMATTYPE;
128 
129 typedef enum _ROCKCHIP_OMX_SUPPORTFORMAT_TYPE {
130     supportFormat_0 = 0x00,
131     supportFormat_1,
132     supportFormat_2,
133     supportFormat_3,
134     supportFormat_4,
135     supportFormat_5,
136     supportFormat_6,
137     supportFormat_7
138 } ROCKCHIP_OMX_SUPPORTFORMAT_TYPE;
139 
140 typedef enum _ROCKCHIP_OMX_BUFFERPROCESS_TYPE {
141     BUFFER_DEFAULT  = 0x00,
142     BUFFER_COPY     = 0x01,
143     BUFFER_SHARE    = 0x02,
144     BUFFER_METADATA = 0x04,
145     BUFFER_ANBSHARE = 0x08
146 } ROCKCHIP_OMX_BUFFERPROCESS_TYPE;
147 
148 typedef struct _ROCKCHIP_OMX_VIDEO_PROFILELEVEL {
149     OMX_S32  profile;
150     OMX_S32  level;
151 } ROCKCHIP_OMX_VIDEO_PROFILELEVEL;
152 
153 typedef struct _ROCKCHIP_OMX_VIDEO_THUMBNAILMODE {
154     OMX_U32 nSize;
155     OMX_VERSIONTYPE nVersion;
156     OMX_U32 nPortIndex;
157     OMX_BOOL bEnable;
158 } ROCKCHIP_OMX_VIDEO_THUMBNAILMODE;
159 
160 typedef enum _ROCKCHIP_VIDEO_CODINGTYPE_EXT {
161     OMX_VIDEO_CodingFLV1 = 0x01000000,       /**< Sorenson H.263 */
162     OMX_VIDEO_CodingDIVX3,                   /**< DIVX3 */
163     OMX_VIDEO_CodingVP6,                      /**< VP6 */
164     OMX_VIDEO_CodingVC1,                      /**< VP6 */
165     OMX_VIDEO_OLD_CodingHEVC,
166 } ROCKCHIP_VIDEO_CODINGTYPE_EXT;
167 
168 typedef enum {
169     UNSUPPORT_PROFILE = -1,
170     BASELINE_PROFILE = 66,
171     MAIN_PROFILE = 77,
172     HIGHT_PROFILE = 100,
173 } EncProfile;
174 
175 typedef enum {
176     HEVC_UNSUPPORT_PROFILE = -1,
177     HEVC_MAIN_PROFILE = 0x1,
178     HEVC_MAIN10_PROFILE = 0x2,
179     HEVC_MAIN10HDR10_PROFILE = 0x1000,
180 } HEVCEncProfile;
181 
182 typedef enum {
183     UNSUPPORT_BITMODE          = -1,
184     Video_RC_Mode_Disable      = 0,
185     Video_RC_Mode_VBR          = 1,
186     Video_RC_Mode_CBR          = 2,
187 } EncRCMode;
188 
189 #if 1
190 typedef struct _ROCKCHIP_PARAM_ENABLE_NATIVEBUFFER {
191     OMX_U32 nSize;
192     OMX_VERSIONTYPE nVersion;
193     OMX_U32 nPortIndex;
194     OMX_BOOL bEnable;
195 } ROCKCHIP_PARAM_ENABLE_NATIVEBUFFER;
196 
197 typedef struct _ROCKCHIP_PARAM_NATIVEBUFFER_USAGE {
198     OMX_U32 nSize;
199     OMX_VERSIONTYPE nVersion;
200     OMX_U32 nPortIndex;
201     OMX_U32 nUsage;
202 } ROCKCHIP_PARAM_NATIVEBUFFER_USAGE;
203 
204 typedef struct _StoreMetaDataInBuffersParams {
205     OMX_U32 nSize;
206     OMX_VERSIONTYPE nVersion;
207     OMX_U32 nPortIndex;
208     OMX_BOOL bStoreMetaData;
209 } StoreMetaDataInBuffersParams;
210 
211 typedef struct _PrependSPSPPSToIDRFramesParams {
212     OMX_U32 nSize;
213     OMX_VERSIONTYPE nVersion;
214     OMX_BOOL bEnable;
215 } PrependSPSPPSToIDRFramesParams;
216 
217 typedef enum {
218     /*
219      * kMetadataBufferTypeCameraSource is used to indicate that
220      * the source of the metadata buffer is the camera component.
221      */
222     kMetadataBufferTypeCameraSource  = 0,
223 
224     /*
225      * kMetadataBufferTypeGrallocSource is used to indicate that
226      * the payload of the metadata buffers can be interpreted as
227      * a buffer_handle_t.
228      * So in this case,the metadata that the encoder receives
229      * will have a byte stream that consists of two parts:
230      * 1. First, there is an integer indicating that it is a GRAlloc
231      * source (kMetadataBufferTypeGrallocSource)
232      * 2. This is followed by the buffer_handle_t that is a handle to the
233      * GRalloc buffer. The encoder needs to interpret this GRalloc handle
234      * and encode the frames.
235      * --------------------------------------------------------------
236      * |  kMetadataBufferTypeGrallocSource | sizeof(buffer_handle_t) |
237      * --------------------------------------------------------------
238      */
239     kMetadataBufferTypeGrallocSource = 1,
240 
241     // Add more here...
242 
243 } MetadataBufferType;
244 
245 #endif
246 
247 typedef struct _RockchipVideoPlane {
248     void          *addr;
249     OMX_U32   allocSize;
250     OMX_U32   dataSize;
251     OMX_U32   offset;
252     OMX_S32   fd;
253     OMX_S32   type;
254     OMX_U32   stride;
255 } RockchipVideoPlane;
256 
257 #ifndef __OMX_EXPORTS
258 #define __OMX_EXPORTS
259 #define ROCKCHIP_EXPORT_REF __attribute__((visibility("default")))
260 #define ROCKCHIP_IMPORT_REF __attribute__((visibility("default")))
261 #endif
262 
263 #endif
264