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