| 1 | /* |
| 2 | ** Copyright 2003-2010, VisualOn, Inc. |
| 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 | File: voType.h |
| 18 | |
| 19 | Content: data type definition |
| 20 | |
| 21 | *******************************************************************************/ |
| 22 | #ifndef __voType_H__ |
| 23 | #define __voType_H__ |
| 24 | |
| 25 | #ifdef __cplusplus |
| 26 | extern "C" { |
| 27 | #endif /* __cplusplus */ |
| 28 | |
| 29 | #ifdef _WIN32 |
| 30 | # define VO_API __cdecl |
| 31 | # define VO_CBI __stdcall |
| 32 | #else |
| 33 | # define VO_API |
| 34 | # define VO_CBI |
| 35 | #endif //_WIN32 |
| 36 | |
| 37 | /** VO_IN is used to identify inputs to an VO function. This designation |
| 38 | will also be used in the case of a pointer that points to a parameter |
| 39 | that is used as an output. */ |
| 40 | #ifndef VO_IN |
| 41 | #define VO_IN |
| 42 | #endif |
| 43 | |
| 44 | /** VO_OUT is used to identify outputs from an VO function. This |
| 45 | designation will also be used in the case of a pointer that points |
| 46 | to a parameter that is used as an input. */ |
| 47 | #ifndef VO_OUT |
| 48 | #define VO_OUT |
| 49 | #endif |
| 50 | |
| 51 | /** VO_INOUT is used to identify parameters that may be either inputs or |
| 52 | outputs from an VO function at the same time. This designation will |
| 53 | also be used in the case of a pointer that points to a parameter that |
| 54 | is used both as an input and an output. */ |
| 55 | #ifndef VO_INOUT |
| 56 | #define VO_INOUT |
| 57 | #endif |
| 58 | |
| 59 | #define VO_MAX_ENUM_VALUE 0X7FFFFFFF |
| 60 | |
| 61 | /** VO_VOID */ |
| 62 | typedef void VO_VOID; |
| 63 | |
| 64 | /** VO_U8 is an 8 bit unsigned quantity that is byte aligned */ |
| 65 | typedef unsigned char VO_U8; |
| 66 | |
| 67 | /** VO_BYTE is an 8 bit unsigned quantity that is byte aligned */ |
| 68 | typedef unsigned char VO_BYTE; |
| 69 | |
| 70 | /** VO_S8 is an 8 bit signed quantity that is byte aligned */ |
| 71 | typedef signed char VO_S8; |
| 72 | |
| 73 | /** VO_CHAR is an 8 bit signed quantity that is byte aligned */ |
| 74 | typedef char VO_CHAR; |
| 75 | |
| 76 | /** VO_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */ |
| 77 | typedef unsigned short VO_U16; |
| 78 | |
| 79 | /** VO_S16 is a 16 bit signed quantity that is 16 bit word aligned */ |
| 80 | typedef signed short VO_S16; |
| 81 | |
| 82 | /** VO_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */ |
| 83 | typedef unsigned long VO_U32; |
| 84 | |
| 85 | /** VO_S32 is a 32 bit signed quantity that is 32 bit word aligned */ |
| 86 | typedef signed long VO_S32; |
| 87 | |
| 88 | /* Users with compilers that cannot accept the "long long" designation should |
| 89 | define the VO_SKIP64BIT macro. It should be noted that this may cause |
| 90 | some components to fail to compile if the component was written to require |
| 91 | 64 bit integral types. However, these components would NOT compile anyway |
| 92 | since the compiler does not support the way the component was written. |
| 93 | */ |
| 94 | #ifndef VO_SKIP64BIT |
| 95 | #ifdef _MSC_VER |
| 96 | /** VO_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ |
| 97 | typedef unsigned __int64 VO_U64; |
| 98 | /** VO_S64 is a 64 bit signed quantity that is 64 bit word aligned */ |
| 99 | typedef signed __int64 VO_S64; |
| 100 | #else // WIN32 |
| 101 | /** VO_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ |
| 102 | typedef unsigned long long VO_U64; |
| 103 | /** VO_S64 is a 64 bit signed quantity that is 64 bit word aligned */ |
| 104 | typedef signed long long VO_S64; |
| 105 | #endif // WIN32 |
| 106 | #endif // VO_SKIP64BIT |
| 107 | |
| 108 | /** The VO_BOOL type is intended to be used to represent a true or a false |
| 109 | value when passing parameters to and from the VO core and components. The |
| 110 | VO_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary. |
| 111 | */ |
| 112 | typedef enum VO_BOOL { |
| 113 | VO_FALSE = 0, |
| 114 | VO_TRUE = !VO_FALSE, |
| 115 | VO_BOOL_MAX = VO_MAX_ENUM_VALUE |
| 116 | } VO_BOOL; |
| 117 | |
| 118 | /** The VO_PTR type is intended to be used to pass pointers between the VO |
| 119 | applications and the VO Core and components. This is a 32 bit pointer and |
| 120 | is aligned on a 32 bit boundary. |
| 121 | */ |
| 122 | typedef void* VO_PTR; |
| 123 | |
| 124 | /** The VO_HANDLE type is intended to be used to pass pointers between the VO |
| 125 | applications and the VO Core and components. This is a 32 bit pointer and |
| 126 | is aligned on a 32 bit boundary. |
| 127 | */ |
| 128 | typedef void* VO_HANDLE; |
| 129 | |
| 130 | /** The VO_STRING type is intended to be used to pass "C" type strings between |
| 131 | the application and the core and component. The VO_STRING type is a 32 |
| 132 | bit pointer to a zero terminated string. The pointer is word aligned and |
| 133 | the string is byte aligned. |
| 134 | */ |
| 135 | typedef char* VO_PCHAR; |
| 136 | |
| 137 | /** The VO_PBYTE type is intended to be used to pass arrays of bytes such as |
| 138 | buffers between the application and the component and core. The VO_PBYTE |
| 139 | type is a 32 bit pointer to a zero terminated string. The pointer is word |
| 140 | aligned and the string is byte aligned. |
| 141 | */ |
| 142 | typedef unsigned char* VO_PBYTE; |
| 143 | |
| 144 | #ifndef NULL |
| 145 | #ifdef __cplusplus |
| 146 | #define NULL 0 |
| 147 | #else |
| 148 | #define NULL ((void *)0) |
| 149 | #endif |
| 150 | #endif |
| 151 | |
| 152 | /** |
| 153 | * Input stream format, Frame or Stream.. |
| 154 | */ |
| 155 | typedef enum { |
| 156 | VO_INPUT_FRAME = 1, /*!< Input contains completely frame(s) data. */ |
| 157 | VO_INPUT_STREAM, /*!< Input is stream data. */ |
| 158 | VO_INPUT_STREAM_MAX = VO_MAX_ENUM_VALUE |
| 159 | } VO_INPUT_TYPE; |
| 160 | |
| 161 | |
| 162 | /** |
| 163 | * General data buffer, used as input or output. |
| 164 | */ |
| 165 | typedef struct { |
| 166 | VO_PBYTE Buffer; /*!< Buffer pointer */ |
| 167 | VO_U32 Length; /*!< Buffer size in byte */ |
| 168 | VO_S64 Time; /*!< The time of the buffer */ |
| 169 | } VO_CODECBUFFER; |
| 170 | |
| 171 | |
| 172 | /** |
| 173 | * The init memdata flag. |
| 174 | */ |
| 175 | typedef enum{ |
| 176 | VO_IMF_USERMEMOPERATOR =0, /*!< memData is the pointer of memoperator function*/ |
| 177 | VO_IMF_PREALLOCATEDBUFFER =1, /*!< memData is preallocated memory*/ |
| 178 | VO_IMF_MAX = VO_MAX_ENUM_VALUE |
| 179 | }VO_INIT_MEM_FlAG; |
| 180 | |
| 181 | |
| 182 | /** |
| 183 | * The init memory structure.. |
| 184 | */ |
| 185 | typedef struct{ |
| 186 | VO_INIT_MEM_FlAG memflag; /*!<memory flag */ |
| 187 | VO_PTR memData; /*!<a pointer to VO_MEM_OPERATOR or a preallocated buffer */ |
| 188 | VO_U32 reserved1; /*!<reserved */ |
| 189 | VO_U32 reserved2; /*!<reserved */ |
| 190 | }VO_CODEC_INIT_USERDATA; |
| 191 | |
| 192 | |
| 193 | #ifdef __cplusplus |
| 194 | } |
| 195 | #endif /* __cplusplus */ |
| 196 | |
| 197 | #endif // __voType_H__ |