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 
86 /** OMX_INOUT is used to identify parameters that may be either inputs or
87     outputs from an OMX function at the same time.  This designation will
88     also be used in the case of a pointer that  points to a parameter that
89     is used both as an input and an output. */
90 #ifndef OMX_INOUT
91 #define OMX_INOUT
92 #endif
93 
94 /** OMX_ALL is used to as a wildcard to select all entities of the same type
95  *  when specifying the index, or referring to a object by an index.  (i.e.
96  *  use OMX_ALL to indicate all N channels). When used as a port index
97  *  for a config or parameter this OMX_ALL denotes that the config or
98  *  parameter applies to the entire component not just one port. */
99 #define OMX_ALL 0xFFFFFFFF
100 
101 /** In the following we define groups that help building doxygen documentation */
102 
103 /** @defgroup core OpenMAX IL core
104  * Functions and structure related to the OMX IL core
105  */
106 
107  /** @defgroup comp OpenMAX IL component
108  * Functions and structure related to the OMX IL component
109  */
110 
111 /** @defgroup rpm Resource and Policy Management
112  * Structures for resource and policy management of components
113  */
114 
115 /** @defgroup buf Buffer Management
116  * Buffer handling functions and structures
117  */
118 
119 /** @defgroup tun Tunneling
120  * @ingroup core comp
121  * Structures and functions to manage tunnels among component ports
122  */
123 
124 /** @defgroup cp Content Pipes
125  *  @ingroup core
126  */
127 
128  /** @defgroup metadata Metadata handling
129   *
130   */
131 
132 #if defined(__GNUC__)
133 #include <stdint.h>
134 #define STDINT_H_AVAILABLE
135 #endif
136 
137 /** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
138 typedef unsigned char OMX_U8;
139 
140 /** OMX_S8 is an 8 bit signed quantity that is byte aligned */
141 typedef signed char OMX_S8;
142 
143 /** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
144 typedef unsigned short OMX_U16;
145 
146 /** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
147 typedef signed short OMX_S16;
148 
149 /** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
150 #ifdef STDINT_H_AVAILABLE
151 typedef uint32_t OMX_U32;
152 #else
153 typedef unsigned long OMX_U32;
154 #endif
155 
156 /** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
157 #ifdef STDINT_H_AVAILABLE
158 typedef int32_t OMX_S32;
159 #else
160 typedef signed long OMX_S32;
161 #endif
162 
163 
164 /* Users with compilers that cannot accept the "long long" designation should
165    define the OMX_SKIP64BIT macro.  It should be noted that this may cause
166    some components to fail to compile if the component was written to require
167    64 bit integral types.  However, these components would NOT compile anyway
168    since the compiler does not support the way the component was written.
169 */
170 #ifndef OMX_SKIP64BIT
171 #ifdef __SYMBIAN32__
172 /** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
173 typedef unsigned long long OMX_U64;
174 
175 /** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
176 typedef signed long long OMX_S64;
177 
178 #elif defined(WIN32)
179 
180 /** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
181 typedef unsigned __int64  OMX_U64;
182 
183 /** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
184 typedef signed   __int64  OMX_S64;
185 
186 #else /* WIN32 */
187 
188 /** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
189 typedef unsigned long long OMX_U64;
190 
191 /** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
192 typedef signed long long OMX_S64;
193 
194 #endif /* WIN32 */
195 #endif
196 
197 
198 /** The OMX_BOOL type is intended to be used to represent a true or a false
199     value when passing parameters to and from the OMX core and components.  The
200     OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
201  */
202 typedef enum OMX_BOOL {
203     OMX_FALSE = 0,
204     OMX_TRUE = !OMX_FALSE,
205     OMX_BOOL_MAX = 0x7FFFFFFF
206 } OMX_BOOL;
207 
208 /** The OMX_PTR type is intended to be used to pass pointers between the OMX
209     applications and the OMX Core and components.  This is a 32 bit pointer and
210     is aligned on a 32 bit boundary.
211  */
212 typedef void* OMX_PTR;
213 
214 /** The OMX_STRING type is intended to be used to pass "C" type strings between
215     the application and the core and component.  The OMX_STRING type is a 32
216     bit pointer to a zero terminated string.  The  pointer is word aligned and
217     the string is byte aligned.
218  */
219 typedef char* OMX_STRING;
220 
221 /** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
222     buffers between the application and the component and core.  The OMX_BYTE
223     type is a 32 bit pointer to a zero terminated string.  The  pointer is word
224     aligned and the string is byte aligned.
225  */
226 typedef unsigned char* OMX_BYTE;
227 
228 /** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
229     at runtime.  This identifier should be generated by a component in a way
230     that guarantees that every instance of the identifier running on the system
231     is unique. */
232 typedef unsigned char OMX_UUIDTYPE[128];
233 
234 /** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
235     an output port.  This enumeration is common across all component types.
236  */
237 typedef enum OMX_DIRTYPE
238 {
239     OMX_DirInput,              /**< Port is an input port */
240     OMX_DirOutput,             /**< Port is an output port */
241     OMX_DirMax = 0x7FFFFFFF
242 } OMX_DIRTYPE;
243 
244 /** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering
245     for numerical data (i.e. big endian, or little endian).
246  */
247 typedef enum OMX_ENDIANTYPE
248 {
249     OMX_EndianBig, /**< big endian */
250     OMX_EndianLittle, /**< little endian */
251     OMX_EndianMax = 0x7FFFFFFF
252 } OMX_ENDIANTYPE;
253 
254 
255 /** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data
256     is signed or unsigned
257  */
258 typedef enum OMX_NUMERICALDATATYPE
259 {
260     OMX_NumericalDataSigned, /**< signed data */
261     OMX_NumericalDataUnsigned, /**< unsigned data */
262     OMX_NumercialDataMax = 0x7FFFFFFF
263 } OMX_NUMERICALDATATYPE;
264 
265 
266 /** Unsigned bounded value type */
267 typedef struct OMX_BU32 {
268     OMX_U32 nValue; /**< actual value */
269     OMX_U32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
270     OMX_U32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
271 } OMX_BU32;
272 
273 
274 /** Signed bounded value type */
275 typedef struct OMX_BS32 {
276     OMX_S32 nValue; /**< actual value */
277     OMX_S32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
278     OMX_S32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
279 } OMX_BS32;
280 
281 
282 /** Structure representing some time or duration in microseconds. This structure
283   *  must be interpreted as a signed 64 bit value. The quantity is signed to accommodate
284   *  negative deltas and preroll scenarios. The quantity is represented in microseconds
285   *  to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
286   *  on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g.
287   *  individual audio samples delivered at 192 kHz). The quantity is 64 bit to
288   *  accommodate a large dynamic range (signed 32 bit values would allow only for plus
289   *  or minus 35 minutes).
290   *
291   *  Implementations with limited precision may convert the signed 64 bit value to
292   *  a signed 32 bit value internally but risk loss of precision.
293   */
294 #ifndef OMX_SKIP64BIT
295 typedef OMX_S64 OMX_TICKS;
296 #else
297 typedef struct OMX_TICKS
298 {
299     OMX_U32 nLowPart;    /** low bits of the signed 64 bit tick value */
300     OMX_U32 nHighPart;   /** high bits of the signed 64 bit tick value */
301 } OMX_TICKS;
302 #endif
303 #define OMX_TICKS_PER_SECOND 1000000
304 
305 /** Define the public interface for the OMX Handle.  The core will not use
306     this value internally, but the application should only use this value.
307  */
308 typedef void* OMX_HANDLETYPE;
309 
310 typedef struct OMX_MARKTYPE
311 {
312     OMX_HANDLETYPE hMarkTargetComponent;   /**< The component that will
313                                                 generate a mark event upon
314                                                 processing the mark. */
315     OMX_PTR pMarkData;   /**< Application specific data associated with
316                               the mark sent on a mark event to disambiguate
317                               this mark from others. */
318 } OMX_MARKTYPE;
319 
320 
321 /** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
322  *  platform & operating specific object used to reference the display
323  *  or can be used by a audio port for native audio rendering */
324 typedef void* OMX_NATIVE_DEVICETYPE;
325 
326 /** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
327  *  platform & operating specific object used to reference the window */
328 typedef void* OMX_NATIVE_WINDOWTYPE;
329 
330 
331 /** Define the OMX IL version that corresponds to this set of header files.
332  *  We also define a combined version that can be used to write or compare
333  *  values of the 32bit nVersion field, assuming a little endian architecture */
334 #define OMX_VERSION_MAJOR 1
335 #define OMX_VERSION_MINOR 1
336 #define OMX_VERSION_REVISION 2
337 #define OMX_VERSION_STEP 0
338 
339 #define OMX_VERSION ((OMX_VERSION_STEP<<24) | (OMX_VERSION_REVISION<<16) | (OMX_VERSION_MINOR<<8) | OMX_VERSION_MAJOR)
340 
341 
342 /** The OMX_VERSIONTYPE union is used to specify the version for
343     a structure or component.  For a component, the version is entirely
344     specified by the component vendor.  Components doing the same function
345     from different vendors may or may not have the same version.  For
346     structures, the version shall be set by the entity that allocates the
347     structure.  For structures specified in the OMX 1.1 specification, the
348     value of the version shall be set to 1.1.0.0 in all cases.  Access to the
349     OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
350     by accessing one of the structure elements to, for example, check only
351     the Major revision.
352  */
353 typedef union OMX_VERSIONTYPE
354 {
355     struct
356     {
357         OMX_U8 nVersionMajor;   /**< Major version accessor element */
358         OMX_U8 nVersionMinor;   /**< Minor version accessor element */
359         OMX_U8 nRevision;       /**< Revision version accessor element */
360         OMX_U8 nStep;           /**< Step version accessor element */
361     } s;
362     OMX_U32 nVersion;           /**< 32 bit value to make accessing the
363                                     version easily done in a single word
364                                     size copy/compare operation */
365 } OMX_VERSIONTYPE;
366 
367 #ifdef __cplusplus
368 }
369 #endif /* __cplusplus */
370 
371 #endif
372 /* File EOF */
373