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