1 /* 2 * Copyright 2015 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __RK_TYPE_H__ 18 #define __RK_TYPE_H__ 19 20 #include <stddef.h> 21 22 typedef unsigned char RK_U8; 23 typedef unsigned short RK_U16; 24 typedef unsigned int RK_U32; 25 typedef unsigned long RK_ULONG; 26 typedef RK_ULONG RK_UL; 27 typedef unsigned long long int RK_U64; 28 29 typedef signed char RK_S8; 30 typedef signed short RK_S16; 31 typedef signed int RK_S32; 32 typedef signed long RK_LONG; 33 typedef RK_LONG RK_SL; 34 typedef signed long long int RK_S64; 35 36 typedef float RK_FLOAT; 37 typedef double RK_DOUBLE; 38 39 typedef unsigned long RK_SIZE_T; 40 typedef unsigned int RK_HANDLE; 41 42 typedef unsigned char rk_u8; 43 typedef unsigned short rk_u16; 44 typedef unsigned int rk_u32; 45 typedef unsigned long rk_ulong; 46 typedef rk_ulong rk_ul; 47 typedef unsigned long long int rk_u64; 48 49 typedef signed char rk_s8; 50 typedef signed short rk_s16; 51 typedef signed int rk_s32; 52 typedef signed long rk_long; 53 typedef rk_long rk_sl; 54 typedef signed long long int rk_s64; 55 56 typedef float rk_float; 57 typedef double rk_double; 58 59 typedef unsigned long rk_size_t; 60 typedef unsigned int rk_handle; 61 62 typedef enum { 63 RK_FALSE = 0, 64 RK_TRUE = 1, 65 } RK_BOOL; 66 67 typedef enum { 68 rk_false = 0, 69 rk_true = 1, 70 } rk_bool; 71 72 #ifndef NULL 73 #define NULL 0L 74 #endif 75 76 #define RK_RET RK_S32 77 #define RK_NULL 0L 78 #define RK_OK 0 79 #define RK_NOK (-1) 80 #define RK_SUCCESS 0 81 #define RK_FAILURE (-1) 82 83 #define RK_VOID void 84 #define RK_UNUSED(x) ((void)((x))) 85 86 #define rk_ret rk_s32 87 #define rk_null 0L 88 #define rk_ok 0 89 #define rk_nok (-1) 90 #define rk_success 0 91 #define rk_failure (-1) 92 93 #define rk_void void 94 #define rk_unused(x) ((void)((x))) 95 96 #ifndef MODULE_TAG 97 #define MODULE_TAG NULL 98 #endif 99 100 /** 101 * @ingroup rk_mpi 102 * @brief The type of mpp context 103 * @details This type is used when calling mpp_init(), which including decoder, 104 * encoder and Image Signal Process(ISP). So far decoder and encoder 105 * are supported perfectly, and ISP will be supported in the future. 106 */ 107 typedef enum { 108 MPP_CTX_DEC, /**< decoder */ 109 MPP_CTX_ENC, /**< encoder */ 110 MPP_CTX_ISP, /**< isp */ 111 MPP_CTX_BUTT, /**< undefined */ 112 } MppCtxType; 113 114 /** 115 * @ingroup rk_mpi 116 * @brief Enumeration used to define the possible video compression codings. 117 * sync with the omx_video.h 118 * 119 * @note This essentially refers to file extensions. If the coding is 120 * being used to specify the ENCODE type, then additional work 121 * must be done to configure the exact flavor of the compression 122 * to be used. For decode cases where the user application can 123 * not differentiate between MPEG-4 and H.264 bit streams, it is 124 * up to the codec to handle this. 125 */ 126 typedef enum { 127 MPP_VIDEO_CodingUnused, /**< Value when coding is N/A */ 128 MPP_VIDEO_CodingAutoDetect, /**< Autodetection of coding type */ 129 MPP_VIDEO_CodingMPEG2, /**< AKA: H.262 */ 130 MPP_VIDEO_CodingH263, /**< H.263 */ 131 MPP_VIDEO_CodingMPEG4, /**< MPEG-4 */ 132 MPP_VIDEO_CodingWMV, /**< Windows Media Video (WMV1,WMV2,WMV3)*/ 133 MPP_VIDEO_CodingRV, /**< all versions of Real Video */ 134 MPP_VIDEO_CodingAVC, /**< H.264/AVC */ 135 MPP_VIDEO_CodingMJPEG, /**< Motion JPEG */ 136 MPP_VIDEO_CodingVP8, /**< VP8 */ 137 MPP_VIDEO_CodingVP9, /**< VP9 */ 138 MPP_VIDEO_CodingVC1 = 0x01000000, /**< Windows Media Video (WMV1,WMV2,WMV3)*/ 139 MPP_VIDEO_CodingFLV1, /**< Sorenson H.263 */ 140 MPP_VIDEO_CodingDIVX3, /**< DIVX3 */ 141 MPP_VIDEO_CodingVP6, 142 MPP_VIDEO_CodingHEVC, /**< H.265/HEVC */ 143 MPP_VIDEO_CodingAVSPLUS, /**< AVS+ */ 144 MPP_VIDEO_CodingAVS, /**< AVS profile=0x20 */ 145 MPP_VIDEO_CodingAVS2, /**< AVS2 */ 146 MPP_VIDEO_CodingAV1, /**< av1 */ 147 MPP_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 148 MPP_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ 149 MPP_VIDEO_CodingMax = 0x7FFFFFFF 150 } MppCodingType; 151 152 /* 153 * All external interface object list here. 154 * The interface object is defined as void * for expandability 155 * The cross include between these objects will introduce extra 156 * compiling difficulty. So we move them together in this header. 157 * 158 * Object interface header list: 159 * 160 * MppCtx - rk_mpi.h 161 * MppParam - rk_mpi.h 162 * 163 * MppFrame - mpp_frame.h 164 * MppPacket - mpp_packet.h 165 * 166 * MppBuffer - mpp_buffer.h 167 * MppBufferGroup - mpp_buffer.h 168 * 169 * MppTask - mpp_task.h 170 * MppMeta - mpp_meta.h 171 */ 172 173 typedef void* MppCtx; 174 typedef void* MppParam; 175 176 typedef void* MppFrame; 177 typedef void* MppPacket; 178 179 typedef void* MppBuffer; 180 typedef void* MppBufferGroup; 181 182 typedef void* MppTask; 183 typedef void* MppMeta; 184 185 /* KmppObjDef - mpp object name size and access table trie definition */ 186 typedef void* KmppObjDef; 187 /* KmppObj - mpp object for string name access and function access */ 188 typedef void* KmppObj; 189 /* KmppShm - mpp share memory for kernel / userspace transaction */ 190 typedef void* KmppShm; 191 192 /* kmpp transaction object */ 193 typedef void* KmppMeta; 194 typedef void* KmppFrame; 195 typedef void* KmppPacket; 196 197 typedef void* KmppBuffer; 198 typedef void* KmppBufGrp; 199 200 /* MUST be the same to the KmppObjShm in rk-mpp-kobj.h */ 201 typedef struct KmppShmPtr_t { 202 /* uaddr - the userspace base address for userspace access */ 203 union { 204 rk_u64 uaddr; 205 void *uptr; 206 }; 207 /* kaddr - the kernel base address for kernel access */ 208 union { 209 rk_u64 kaddr; 210 void *kptr; 211 }; 212 /* DO NOT access reserved data only used by kernel */ 213 } KmppShmPtr; 214 215 #endif /*__RK_TYPE_H__*/ 216