OMX_Types.h revision 849de60c1eae2ec28f0b468b9ec16b339aad17e9
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
54extern "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 */
153typedef unsigned char OMX_U8;
154
155/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
156typedef signed char OMX_S8;
157
158/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
159typedef unsigned short OMX_U16;
160
161/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
162typedef signed short OMX_S16;
163
164/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
165typedef uint32_t OMX_U32;
166
167/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
168typedef 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 */
180typedef unsigned long long OMX_U64;
181
182/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
183typedef 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 */
188typedef unsigned __int64  OMX_U64;
189
190/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
191typedef signed   __int64  OMX_S64;
192
193#else /* WIN32 */
194
195/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
196typedef unsigned long long OMX_U64;
197
198/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
199typedef 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 */
209typedef enum OMX_BOOL {
210    OMX_FALSE = 0,
211    OMX_TRUE = !OMX_FALSE,
212    OMX_BOOL_MAX = 0x7FFFFFFF
213} OMX_BOOL;
214
215/** The OMX_PTR type is intended to be used to pass pointers between the OMX
216    applications and the OMX Core and components.  This is a 32 bit pointer and
217    is aligned on a 32 bit boundary.
218 */
219typedef void* OMX_PTR;
220
221/** The OMX_STRING type is intended to be used to pass "C" type strings between
222    the application and the core and component.  The OMX_STRING type is a 32
223    bit pointer to a zero terminated string.  The  pointer is word aligned and
224    the string is byte aligned.
225 */
226typedef char* OMX_STRING;
227
228/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
229    buffers between the application and the component and core.  The OMX_BYTE
230    type is a 32 bit pointer to a zero terminated string.  The  pointer is word
231    aligned and the string is byte aligned.
232 */
233typedef unsigned char* OMX_BYTE;
234
235/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
236    at runtime.  This identifier should be generated by a component in a way
237    that guarantees that every instance of the identifier running on the system
238    is unique. */
239typedef unsigned char OMX_UUIDTYPE[128];
240
241/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
242    an output port.  This enumeration is common across all component types.
243 */
244typedef enum OMX_DIRTYPE
245{
246    OMX_DirInput,              /**< Port is an input port */
247    OMX_DirOutput,             /**< Port is an output port */
248    OMX_DirMax = 0x7FFFFFFF
249} OMX_DIRTYPE;
250
251/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering
252    for numerical data (i.e. big endian, or little endian).
253 */
254typedef enum OMX_ENDIANTYPE
255{
256    OMX_EndianBig, /**< big endian */
257    OMX_EndianLittle, /**< little endian */
258    OMX_EndianMax = 0x7FFFFFFF
259} OMX_ENDIANTYPE;
260
261
262/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data
263    is signed or unsigned
264 */
265typedef enum OMX_NUMERICALDATATYPE
266{
267    OMX_NumericalDataSigned, /**< signed data */
268    OMX_NumericalDataUnsigned, /**< unsigned data */
269    OMX_NumercialDataMax = 0x7FFFFFFF
270} OMX_NUMERICALDATATYPE;
271
272
273/** Unsigned bounded value type */
274typedef struct OMX_BU32 {
275    OMX_U32 nValue; /**< actual value */
276    OMX_U32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
277    OMX_U32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
278} OMX_BU32;
279
280
281/** Signed bounded value type */
282typedef struct OMX_BS32 {
283    OMX_S32 nValue; /**< actual value */
284    OMX_S32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
285    OMX_S32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
286} OMX_BS32;
287
288
289/** Structure representing some time or duration in microseconds. This structure
290  *  must be interpreted as a signed 64 bit value. The quantity is signed to accommodate
291  *  negative deltas and preroll scenarios. The quantity is represented in microseconds
292  *  to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
293  *  on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g.
294  *  individual audio samples delivered at 192 kHz). The quantity is 64 bit to
295  *  accommodate a large dynamic range (signed 32 bit values would allow only for plus
296  *  or minus 35 minutes).
297  *
298  *  Implementations with limited precision may convert the signed 64 bit value to
299  *  a signed 32 bit value internally but risk loss of precision.
300  */
301#ifndef OMX_SKIP64BIT
302typedef OMX_S64 OMX_TICKS;
303#else
304typedef struct OMX_TICKS
305{
306    OMX_U32 nLowPart;    /** low bits of the signed 64 bit tick value */
307    OMX_U32 nHighPart;   /** high bits of the signed 64 bit tick value */
308} OMX_TICKS;
309#endif
310#define OMX_TICKS_PER_SECOND 1000000
311
312/** Define the public interface for the OMX Handle.  The core will not use
313    this value internally, but the application should only use this value.
314 */
315typedef void* OMX_HANDLETYPE;
316
317typedef struct OMX_MARKTYPE
318{
319    OMX_HANDLETYPE hMarkTargetComponent;   /**< The component that will
320                                                generate a mark event upon
321                                                processing the mark. */
322    OMX_PTR pMarkData;   /**< Application specific data associated with
323                              the mark sent on a mark event to disambiguate
324                              this mark from others. */
325} OMX_MARKTYPE;
326
327
328/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
329 *  platform & operating specific object used to reference the display
330 *  or can be used by a audio port for native audio rendering */
331typedef void* OMX_NATIVE_DEVICETYPE;
332
333/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
334 *  platform & operating specific object used to reference the window */
335typedef void* OMX_NATIVE_WINDOWTYPE;
336
337/** The OMX_VERSIONTYPE union is used to specify the version for
338    a structure or component.  For a component, the version is entirely
339    specified by the component vendor.  Components doing the same function
340    from different vendors may or may not have the same version.  For
341    structures, the version shall be set by the entity that allocates the
342    structure.  For structures specified in the OMX 1.1 specification, the
343    value of the version shall be set to 1.1.0.0 in all cases.  Access to the
344    OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
345    by accessing one of the structure elements to, for example, check only
346    the Major revision.
347 */
348typedef union OMX_VERSIONTYPE
349{
350    struct
351    {
352        OMX_U8 nVersionMajor;   /**< Major version accessor element */
353        OMX_U8 nVersionMinor;   /**< Minor version accessor element */
354        OMX_U8 nRevision;       /**< Revision version accessor element */
355        OMX_U8 nStep;           /**< Step version accessor element */
356    } s;
357    OMX_U32 nVersion;           /**< 32 bit value to make accessing the
358                                    version easily done in a single word
359                                    size copy/compare operation */
360} OMX_VERSIONTYPE;
361
362#ifdef __cplusplus
363}
364#endif /* __cplusplus */
365
366#endif
367/* File EOF */
368