1 /*
2  * Copyright (c) 2008 The Khronos Group Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject
10  * to the following conditions:
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23 
24 /** OMX_Types.h - OpenMax IL version 1.1.2
25  *  The OMX_Types header file contains the primitive type definitions used by
26  *  the core, the application and the component.  This file may need to be
27  *  modified to be used on systems that do not have "char" set to 8 bits,
28  *  "short" set to 16 bits and "long" set to 32 bits.
29  */
30 
31 #ifndef OMX_Types_h
32 #define OMX_Types_h
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37 
38 /** The OMX_API and OMX_APIENTRY are platform specific definitions used
39  *  to declare OMX function prototypes.  They are modified to meet the
40  *  requirements for a particular platform */
41 #ifdef __SYMBIAN32__
42 #   ifdef __OMX_EXPORTS
43 #       define OMX_API __declspec(dllexport)
44 #   else
45 #       ifdef _WIN32
46 #           define OMX_API __declspec(dllexport)
47 #       else
48 #           define OMX_API __declspec(dllimport)
49 #       endif
50 #   endif
51 #else
52 #   if defined(_WIN32) && !defined(__MINGW32__)
53 #      ifdef __OMX_EXPORTS
54 #          define OMX_API __declspec(dllexport)
55 #      else
56 #          define OMX_API __declspec(dllimport)
57 #      endif
58 #   else
59 #      ifdef __OMX_EXPORTS
60 #          define OMX_API
61 #      else
62 #          define OMX_API extern
63 #      endif
64 #   endif
65 #endif
66 
67 #ifndef OMX_APIENTRY
68 #define OMX_APIENTRY
69 #endif
70 
71 /** OMX_IN is used to identify inputs to an OMX function.  This designation
72     will also be used in the case of a pointer that points to a parameter
73     that is used as an output. */
74 #ifndef OMX_IN
75 #define OMX_IN
76 #endif
77 
78 /** OMX_OUT is used to identify outputs from an OMX function.  This
79     designation will also be used in the case of a pointer that points
80     to a parameter that is used as an input. */
81 #ifndef OMX_OUT
82 #define OMX_OUT
83 #endif
84 
85 /** OMX_INOUT is used to identify parameters that may be either inputs or
86     outputs from an OMX function at the same time.  This designation will
87     also be used in the case of a pointer that  points to a parameter that
88     is used both as an input and an output. */
89 #ifndef OMX_INOUT
90 #define OMX_INOUT
91 #endif
92 
93 /** OMX_ALL is used to as a wildcard to select all entities of the same type
94  *  when specifying the index, or referring to a object by an index.  (i.e.
95  *  use OMX_ALL to indicate all N channels). When used as a port index
96  *  for a config or parameter this OMX_ALL denotes that the config or
97  *  parameter applies to the entire component not just one port. */
98 #define OMX_ALL 0xFFFFFFFF
99 
100 /** In the following we define groups that help building doxygen documentation */
101 
102 /** @defgroup core OpenMAX IL core
103  * Functions and structure related to the OMX IL core
104  */
105 
106  /** @defgroup comp OpenMAX IL component
107  * Functions and structure related to the OMX IL component
108  */
109 
110 /** @defgroup rpm Resource and Policy Management
111  * Structures for resource and policy management of components
112  */
113 
114 /** @defgroup buf Buffer Management
115  * Buffer handling functions and structures
116  */
117 
118 /** @defgroup tun Tunneling
119  * @ingroup core comp
120  * Structures and functions to manage tunnels among component ports
121  */
122 
123 /** @defgroup cp Content Pipes
124  *  @ingroup core
125  */
126 
127  /** @defgroup metadata Metadata handling
128   *
129   */
130 
131 #if defined(__GNUC__)
132 #include <stdint.h>
133 #define STDINT_H_AVAILABLE
134 #endif
135 
136 /** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
137 typedef unsigned char OMX_U8;
138 
139 /** OMX_S8 is an 8 bit signed quantity that is byte aligned */
140 typedef signed char OMX_S8;
141 
142 /** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
143 typedef unsigned short OMX_U16;
144 
145 /** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
146 typedef signed short OMX_S16;
147 
148 /** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
149 #ifdef STDINT_H_AVAILABLE
150 typedef uint32_t OMX_U32;
151 #else
152 typedef unsigned long OMX_U32;
153 #endif
154 
155 /** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
156 #ifdef STDINT_H_AVAILABLE
157 typedef int32_t OMX_S32;
158 #else
159 typedef signed long OMX_S32;
160 #endif
161 
162 /* Users with compilers that cannot accept the "long long" designation should
163    define the OMX_SKIP64BIT macro.  It should be noted that this may cause
164    some components to fail to compile if the component was written to require
165    64 bit integral types.  However, these components would NOT compile anyway
166    since the compiler does not support the way the component was written.
167 */
168 #ifndef OMX_SKIP64BIT
169 #ifdef __SYMBIAN32__
170 /** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
171 typedef unsigned long long OMX_U64;
172 
173 /** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
174 typedef signed long long OMX_S64;
175 
176 #elif defined(WIN32)
177 
178 /** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
179 typedef unsigned __int64  OMX_U64;
180 
181 /** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
182 typedef signed   __int64  OMX_S64;
183 
184 #else /* WIN32 */
185 
186 /** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
187 typedef unsigned long long OMX_U64;
188 
189 /** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
190 typedef signed long long OMX_S64;
191 
192 #endif /* WIN32 */
193 #endif
194 
195 /** The OMX_BOOL type is intended to be used to represent a true or a false
196     value when passing parameters to and from the OMX core and components.  The
197     OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
198  */
199 typedef enum OMX_BOOL {
200     OMX_FALSE = 0,
201     OMX_TRUE = !OMX_FALSE,
202     OMX_BOOL_MAX = 0x7FFFFFFF
203 } OMX_BOOL;
204 
205 /** The OMX_PTR type is intended to be used to pass pointers between the OMX
206     applications and the OMX Core and components.  This is a 32 bit pointer and
207     is aligned on a 32 bit boundary.
208  */
209 typedef void* OMX_PTR;
210 
211 /** The OMX_STRING type is intended to be used to pass "C" type strings between
212     the application and the core and component.  The OMX_STRING type is a 32
213     bit pointer to a zero terminated string.  The  pointer is word aligned and
214     the string is byte aligned.
215  */
216 typedef char* OMX_STRING;
217 
218 /** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
219     buffers between the application and the component and core.  The OMX_BYTE
220     type is a 32 bit pointer to a zero terminated string.  The  pointer is word
221     aligned and the string is byte aligned.
222  */
223 typedef unsigned char* OMX_BYTE;
224 
225 /** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
226     at runtime.  This identifier should be generated by a component in a way
227     that guarantees that every instance of the identifier running on the system
228     is unique. */
229 typedef unsigned char OMX_UUIDTYPE[128];
230 
231 /** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
232     an output port.  This enumeration is common across all component types.
233  */
234 typedef enum OMX_DIRTYPE
235 {
236     OMX_DirInput,              /**< Port is an input port */
237     OMX_DirOutput,             /**< Port is an output port */
238     OMX_DirMax = 0x7FFFFFFF
239 } OMX_DIRTYPE;
240 
241 /** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering
242     for numerical data (i.e. big endian, or little endian).
243  */
244 typedef enum OMX_ENDIANTYPE
245 {
246     OMX_EndianBig, /**< big endian */
247     OMX_EndianLittle, /**< little endian */
248     OMX_EndianMax = 0x7FFFFFFF
249 } OMX_ENDIANTYPE;
250 
251 /** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data
252     is signed or unsigned
253  */
254 typedef enum OMX_NUMERICALDATATYPE
255 {
256     OMX_NumericalDataSigned, /**< signed data */
257     OMX_NumericalDataUnsigned, /**< unsigned data */
258     OMX_NumercialDataMax = 0x7FFFFFFF
259 } OMX_NUMERICALDATATYPE;
260 
261 /** Unsigned bounded value type */
262 typedef struct OMX_BU32 {
263     OMX_U32 nValue; /**< actual value */
264     OMX_U32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
265     OMX_U32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
266 } OMX_BU32;
267 
268 /** Signed bounded value type */
269 typedef struct OMX_BS32 {
270     OMX_S32 nValue; /**< actual value */
271     OMX_S32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
272     OMX_S32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
273 } OMX_BS32;
274 
275 /** Structure representing some time or duration in microseconds. This structure
276   *  must be interpreted as a signed 64 bit value. The quantity is signed to accommodate
277   *  negative deltas and preroll scenarios. The quantity is represented in microseconds
278   *  to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
279   *  on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g.
280   *  individual audio samples delivered at 192 kHz). The quantity is 64 bit to
281   *  accommodate a large dynamic range (signed 32 bit values would allow only for plus
282   *  or minus 35 minutes).
283   *
284   *  Implementations with limited precision may convert the signed 64 bit value to
285   *  a signed 32 bit value internally but risk loss of precision.
286   */
287 #ifndef OMX_SKIP64BIT
288 typedef OMX_S64 OMX_TICKS;
289 #else
290 typedef struct OMX_TICKS
291 {
292     OMX_U32 nLowPart;    /** low bits of the signed 64 bit tick value */
293     OMX_U32 nHighPart;   /** high bits of the signed 64 bit tick value */
294 } OMX_TICKS;
295 #endif
296 #define OMX_TICKS_PER_SECOND 1000000
297 
298 /** Define the public interface for the OMX Handle.  The core will not use
299     this value internally, but the application should only use this value.
300  */
301 typedef void* OMX_HANDLETYPE;
302 
303 typedef struct OMX_MARKTYPE
304 {
305     OMX_HANDLETYPE hMarkTargetComponent;   /**< The component that will
306                                                 generate a mark event upon
307                                                 processing the mark. */
308     OMX_PTR pMarkData;   /**< Application specific data associated with
309                               the mark sent on a mark event to disambiguate
310                               this mark from others. */
311 } OMX_MARKTYPE;
312 
313 /** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
314  *  platform & operating specific object used to reference the display
315  *  or can be used by a audio port for native audio rendering */
316 typedef void* OMX_NATIVE_DEVICETYPE;
317 
318 /** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
319  *  platform & operating specific object used to reference the window */
320 typedef void* OMX_NATIVE_WINDOWTYPE;
321 
322 /** Define the OMX IL version that corresponds to this set of header files.
323  *  We also define a combined version that can be used to write or compare
324  *  values of the 32bit nVersion field, assuming a little endian architecture */
325 #define OMX_VERSION_MAJOR 1
326 #define OMX_VERSION_MINOR 1
327 #define OMX_VERSION_REVISION 2
328 #define OMX_VERSION_STEP 0
329 
330 #define OMX_VERSION ((OMX_VERSION_STEP<<24) | (OMX_VERSION_REVISION<<16) | (OMX_VERSION_MINOR<<8) | OMX_VERSION_MAJOR)
331 
332 /** The OMX_VERSIONTYPE union is used to specify the version for
333     a structure or component.  For a component, the version is entirely
334     specified by the component vendor.  Components doing the same function
335     from different vendors may or may not have the same version.  For
336     structures, the version shall be set by the entity that allocates the
337     structure.  For structures specified in the OMX 1.1 specification, the
338     value of the version shall be set to 1.1.0.0 in all cases.  Access to the
339     OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
340     by accessing one of the structure elements to, for example, check only
341     the Major revision.
342  */
343 typedef union OMX_VERSIONTYPE
344 {
345     struct
346     {
347         OMX_U8 nVersionMajor;   /**< Major version accessor element */
348         OMX_U8 nVersionMinor;   /**< Minor version accessor element */
349         OMX_U8 nRevision;       /**< Revision version accessor element */
350         OMX_U8 nStep;           /**< Step version accessor element */
351     } s;
352     OMX_U32 nVersion;           /**< 32 bit value to make accessing the
353                                     version easily done in a single word
354                                     size copy/compare operation */
355 } OMX_VERSIONTYPE;
356 
357 #ifdef __cplusplus
358 }
359 #endif /* __cplusplus */
360 
361 #endif
362 /* File EOF */
363