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_Core.h - OpenMax IL version 1.1.2
42  *  The OMX_Core header file contains the definitions used by both the
43  *  application and the component to access common items.
44  */
45 
46 #ifndef OMX_Core_h
47 #define OMX_Core_h
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif /* __cplusplus */
52 
53 
54 /* Each OMX header shall include all required header files to allow the
55  *  header to compile without errors.  The includes below are required
56  *  for this header file to compile successfully
57  */
58 
59 #include <OMX_Index.h>
60 
61 
62 /** The OMX_COMMANDTYPE enumeration is used to specify the action in the
63  *  OMX_SendCommand macro.
64  *  @ingroup core
65  */
66 typedef enum OMX_COMMANDTYPE
67 {
68     OMX_CommandStateSet,    /**< Change the component state */
69     OMX_CommandFlush,       /**< Flush the data queue(s) of a component */
70     OMX_CommandPortDisable, /**< Disable a port on a component. */
71     OMX_CommandPortEnable,  /**< Enable a port on a component. */
72     OMX_CommandMarkBuffer,  /**< Mark a component/buffer for observation */
73     OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
74     OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
75     OMX_CommandMax = 0X7FFFFFFF
76 } OMX_COMMANDTYPE;
77 
78 
79 
80 /** The OMX_STATETYPE enumeration is used to indicate or change the component
81  *  state.  This enumeration reflects the current state of the component when
82  *  used with the OMX_GetState macro or becomes the parameter in a state change
83  *  command when used with the OMX_SendCommand macro.
84  *
85  *  The component will be in the Loaded state after the component is initially
86  *  loaded into memory.  In the Loaded state, the component is not allowed to
87  *  allocate or hold resources other than to build it's internal parameter
88  *  and configuration tables.  The application will send one or more
89  *  SetParameters/GetParameters and SetConfig/GetConfig commands to the
90  *  component and the component will record each of these parameter and
91  *  configuration changes for use later.  When the application sends the
92  *  Idle command, the component will acquire the resources needed for the
93  *  specified configuration and will transition to the idle state if the
94  *  allocation is successful.  If the component cannot successfully
95  *  transition to the idle state for any reason, the state of the component
96  *  shall be fully rolled back to the Loaded state (e.g. all allocated
97  *  resources shall be released).  When the component receives the command
98  *  to go to the Executing state, it shall begin processing buffers by
99  *  sending all input buffers it holds to the application.  While
100  *  the component is in the Idle state, the application may also send the
101  *  Pause command.  If the component receives the pause command while in the
102  *  Idle state, the component shall send all input buffers it holds to the
103  *  application, but shall not begin processing buffers.  This will allow the
104  *  application to prefill buffers.
105  *
106  *  @ingroup comp
107  */
108 
109 typedef enum OMX_STATETYPE
110 {
111     OMX_StateInvalid,      /**< component has detected that it's internal data
112                                 structures are corrupted to the point that
113                                 it cannot determine it's state properly */
114     OMX_StateLoaded,      /**< component has been loaded but has not completed
115                                 initialization.  The OMX_SetParameter macro
116                                 and the OMX_GetParameter macro are the only
117                                 valid macros allowed to be sent to the
118                                 component in this state. */
119     OMX_StateIdle,        /**< component initialization has been completed
120                                 successfully and the component is ready to
121                                 to start. */
122     OMX_StateExecuting,   /**< component has accepted the start command and
123                                 is processing data (if data is available) */
124     OMX_StatePause,       /**< component has received pause command */
125     OMX_StateWaitForResources, /**< component is waiting for resources, either after
126                                 preemption or before it gets the resources requested.
127                                 See specification for complete details. */
128     OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
129     OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
130     OMX_StateMax = 0X7FFFFFFF
131 } OMX_STATETYPE;
132 
133 /** The OMX_ERRORTYPE enumeration defines the standard OMX Errors.  These
134  *  errors should cover most of the common failure cases.  However,
135  *  vendors are free to add additional error messages of their own as
136  *  long as they follow these rules:
137  *  1.  Vendor error messages shall be in the range of 0x90000000 to
138  *      0x9000FFFF.
139  *  2.  Vendor error messages shall be defined in a header file provided
140  *      with the component.  No error messages are allowed that are
141  *      not defined.
142  */
143 typedef enum OMX_ERRORTYPE
144 {
145   OMX_ErrorNone = 0,
146 
147   /** There were insufficient resources to perform the requested operation */
148   OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000,
149 
150   /** There was an error, but the cause of the error could not be determined */
151   OMX_ErrorUndefined = (OMX_S32) 0x80001001,
152 
153   /** The component name string was not valid */
154   OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002,
155 
156   /** No component with the specified name string was found */
157   OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003,
158 
159   /** The component specified did not have a "OMX_ComponentInit" or
160       "OMX_ComponentDeInit entry point */
161   OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004,
162 
163   /** One or more parameters were not valid */
164   OMX_ErrorBadParameter = (OMX_S32) 0x80001005,
165 
166   /** The requested function is not implemented */
167   OMX_ErrorNotImplemented = (OMX_S32) 0x80001006,
168 
169   /** The buffer was emptied before the next buffer was ready */
170   OMX_ErrorUnderflow = (OMX_S32) 0x80001007,
171 
172   /** The buffer was not available when it was needed */
173   OMX_ErrorOverflow = (OMX_S32) 0x80001008,
174 
175   /** The hardware failed to respond as expected */
176   OMX_ErrorHardware = (OMX_S32) 0x80001009,
177 
178   /** The component is in the state OMX_StateInvalid */
179   OMX_ErrorInvalidState = (OMX_S32) 0x8000100A,
180 
181   /** Stream is found to be corrupt */
182   OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B,
183 
184   /** Ports being connected are not compatible */
185   OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C,
186 
187   /** Resources allocated to an idle component have been
188       lost resulting in the component returning to the loaded state */
189   OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D,
190 
191   /** No more indicies can be enumerated */
192   OMX_ErrorNoMore = (OMX_S32) 0x8000100E,
193 
194   /** The component detected a version mismatch */
195   OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F,
196 
197   /** The component is not ready to return data at this time */
198   OMX_ErrorNotReady = (OMX_S32) 0x80001010,
199 
200   /** There was a timeout that occurred */
201   OMX_ErrorTimeout = (OMX_S32) 0x80001011,
202 
203   /** This error occurs when trying to transition into the state you are already in */
204   OMX_ErrorSameState = (OMX_S32) 0x80001012,
205 
206   /** Resources allocated to an executing or paused component have been
207       preempted, causing the component to return to the idle state */
208   OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013,
209 
210   /** A non-supplier port sends this error to the IL client (via the EventHandler callback)
211       during the allocation of buffers (on a transition from the LOADED to the IDLE state or
212       on a port restart) when it deems that it has waited an unusually long time for the supplier
213       to send it an allocated buffer via a UseBuffer call. */
214   OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014,
215 
216   /** A non-supplier port sends this error to the IL client (via the EventHandler callback)
217       during the deallocation of buffers (on a transition from the IDLE to LOADED state or
218       on a port stop) when it deems that it has waited an unusually long time for the supplier
219       to request the deallocation of a buffer header via a FreeBuffer call. */
220   OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015,
221 
222   /** A supplier port sends this error to the IL client (via the EventHandler callback)
223       during the stopping of a port (either on a transition from the IDLE to LOADED
224       state or a port stop) when it deems that it has waited an unusually long time for
225       the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */
226   OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016,
227 
228   /** Attempting a state transtion that is not allowed */
229   OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017,
230 
231   /* Attempting a command that is not allowed during the present state. */
232   OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018,
233 
234   /** The values encapsulated in the parameter or config structure are not supported. */
235   OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019,
236 
237   /** The parameter or config indicated by the given index is not supported. */
238   OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A,
239 
240   /** The port index supplied is incorrect. */
241   OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B,
242 
243   /** The port has lost one or more of its buffers and it thus unpopulated. */
244   OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C,
245 
246   /** Component suspended due to temporary loss of resources */
247   OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D,
248 
249   /** Component suspended due to an inability to acquire dynamic resources */
250   OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E,
251 
252   /** When the macroblock error reporting is enabled the component returns new error
253   for every frame that has errors */
254   OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F,
255 
256   /** A component reports this error when it cannot parse or determine the format of an input stream. */
257   OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020,
258 
259   /** The content open operation failed. */
260   OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021,
261 
262   /** The content creation operation failed. */
263   OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022,
264 
265   /** Separate table information is being used */
266   OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023,
267 
268   /** Tunneling is unsupported by the component*/
269   OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024,
270 
271   OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */
272   OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */
273   OMX_ErrorMax = 0x7FFFFFFF
274 } OMX_ERRORTYPE;
275 
276 /** @ingroup core */
277 typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN  OMX_HANDLETYPE hComponent);
278 
279 /** @ingroup core */
280 typedef struct OMX_COMPONENTREGISTERTYPE
281 {
282   const char          * pName;       /* Component name, 128 byte limit (including '\0') applies */
283   OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */
284 } OMX_COMPONENTREGISTERTYPE;
285 
286 /** @ingroup core */
287 extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[];
288 
289 /** @ingroup rpm */
290 typedef struct OMX_PRIORITYMGMTTYPE {
291  OMX_U32 nSize;             /**< size of the structure in bytes */
292  OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
293  OMX_U32 nGroupPriority;            /**< Priority of the component group */
294  OMX_U32 nGroupID;                  /**< ID of the component group */
295 } OMX_PRIORITYMGMTTYPE;
296 
297 /* Component name and Role names are limited to 128 characters including the terminating '\0'. */
298 #define OMX_MAX_STRINGNAME_SIZE 128
299 
300 /** @ingroup comp */
301 typedef struct OMX_PARAM_COMPONENTROLETYPE {
302     OMX_U32 nSize;              /**< size of the structure in bytes */
303     OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
304     OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE];  /**< name of standard component which defines component role */
305 } OMX_PARAM_COMPONENTROLETYPE;
306 
307 /** End of Stream Buffer Flag:
308   *
309   * A component sets EOS when it has no more data to emit on a particular
310   * output port. Thus an output port shall set EOS on the last buffer it
311   * emits. A component's determination of when an output port should
312   * cease sending data is implemenation specific.
313   * @ingroup buf
314   */
315 
316 #define OMX_BUFFERFLAG_EOS 0x00000001
317 
318 /** Start Time Buffer Flag:
319  *
320  * The source of a stream (e.g. a demux component) sets the STARTTIME
321  * flag on the buffer that contains the starting timestamp for the
322  * stream. The starting timestamp corresponds to the first data that
323  * should be displayed at startup or after a seek.
324  * The first timestamp of the stream is not necessarily the start time.
325  * For instance, in the case of a seek to a particular video frame,
326  * the target frame may be an interframe. Thus the first buffer of
327  * the stream will be the intra-frame preceding the target frame and
328  * the starttime will occur with the target frame (with any other
329  * required frames required to reconstruct the target intervening).
330  *
331  * The STARTTIME flag is directly associated with the buffer's
332  * timestamp ' thus its association to buffer data and its
333  * propagation is identical to the timestamp's.
334  *
335  * When a Sync Component client receives a buffer with the
336  * STARTTIME flag it shall perform a SetConfig on its sync port
337  * using OMX_ConfigTimeClientStartTime and passing the buffer's
338  * timestamp.
339  *
340  * @ingroup buf
341  */
342 
343 #define OMX_BUFFERFLAG_STARTTIME 0x00000002
344 
345 
346 
347 /** Decode Only Buffer Flag:
348  *
349  * The source of a stream (e.g. a demux component) sets the DECODEONLY
350  * flag on any buffer that should shall be decoded but should not be
351  * displayed. This flag is used, for instance, when a source seeks to
352  * a target interframe that requires the decode of frames preceding the
353  * target to facilitate the target's reconstruction. In this case the
354  * source would emit the frames preceding the target downstream
355  * but mark them as decode only.
356  *
357  * The DECODEONLY is associated with buffer data and propagated in a
358  * manner identical to the buffer timestamp.
359  *
360  * A component that renders data should ignore all buffers with
361  * the DECODEONLY flag set.
362  *
363  * @ingroup buf
364  */
365 
366 #define OMX_BUFFERFLAG_DECODEONLY 0x00000004
367 
368 
369 /* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt
370  * @ingroup buf
371  */
372 
373 #define OMX_BUFFERFLAG_DATACORRUPT 0x00000008
374 
375 /* End of Frame: The buffer contains exactly one end of frame and no data
376  *  occurs after the end of frame. This flag is an optional hint. The absence
377  *  of this flag does not imply the absence of an end of frame within the buffer.
378  * @ingroup buf
379 */
380 #define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010
381 
382 /* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame '
383  *  a frame that has no dependency on any other frame information
384  *  @ingroup buf
385  */
386 #define OMX_BUFFERFLAG_SYNCFRAME 0x00000020
387 
388 /* Extra data present flag: there is extra data appended to the data stream
389  * residing in the buffer
390  * @ingroup buf
391  */
392 #define OMX_BUFFERFLAG_EXTRADATA 0x00000040
393 
394 /** Codec Config Buffer Flag:
395 * OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an
396 * output port when all bytes in the buffer form part or all of a set of
397 * codec specific configuration data.  Examples include SPS/PPS nal units
398 * for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for
399 * OMX_AUDIO_CodingAAC.  Any component that for a given stream sets
400 * OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes
401 * with frame data in the same buffer, and shall send all buffers
402 * containing codec configuration bytes before any buffers containing
403 * frame data that those configurations bytes describe.
404 * If the stream format for a particular codec has a frame specific
405 * header at the start of each frame, for example OMX_AUDIO_CodingMP3 or
406 * OMX_AUDIO_CodingAAC in ADTS mode, then these shall be presented as
407 * normal without setting OMX_BUFFERFLAG_CODECCONFIG.
408  * @ingroup buf
409  */
410 #define OMX_BUFFERFLAG_CODECCONFIG 0x00000080
411 
412 
413 
414 /** @ingroup buf */
415 typedef struct OMX_BUFFERHEADERTYPE
416 {
417     OMX_U32 nSize;              /**< size of the structure in bytes */
418     OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
419     OMX_U8* pBuffer;            /**< Pointer to actual block of memory
420                                      that is acting as the buffer */
421     OMX_U32 nAllocLen;          /**< size of the buffer allocated, in bytes */
422     OMX_U32 nFilledLen;         /**< number of bytes currently in the
423                                      buffer */
424     OMX_U32 nOffset;            /**< start offset of valid data in bytes from
425                                      the start of the buffer */
426     OMX_PTR pAppPrivate;        /**< pointer to any data the application
427                                      wants to associate with this buffer */
428     OMX_PTR pPlatformPrivate;   /**< pointer to any data the platform
429                                      wants to associate with this buffer */
430     OMX_PTR pInputPortPrivate;  /**< pointer to any data the input port
431                                      wants to associate with this buffer */
432     OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port
433                                      wants to associate with this buffer */
434     OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a
435                                               mark event upon processing this buffer. */
436     OMX_PTR pMarkData;          /**< Application specific data associated with
437                                      the mark sent on a mark event to disambiguate
438                                      this mark from others. */
439     OMX_U32 nTickCount;         /**< Optional entry that the component and
440                                      application can update with a tick count
441                                      when they access the component.  This
442                                      value should be in microseconds.  Since
443                                      this is a value relative to an arbitrary
444                                      starting point, this value cannot be used
445                                      to determine absolute time.  This is an
446                                      optional entry and not all components
447                                      will update it.*/
448  OMX_TICKS nTimeStamp;          /**< Timestamp corresponding to the sample
449                                      starting at the first logical sample
450                                      boundary in the buffer. Timestamps of
451                                      successive samples within the buffer may
452                                      be inferred by adding the duration of the
453                                      of the preceding buffer to the timestamp
454                                      of the preceding buffer.*/
455   OMX_U32     nFlags;           /**< buffer specific flags */
456   OMX_U32 nOutputPortIndex;     /**< The index of the output port (if any) using
457                                      this buffer */
458   OMX_U32 nInputPortIndex;      /**< The index of the input port (if any) using
459                                      this buffer */
460 } OMX_BUFFERHEADERTYPE;
461 
462 /** The OMX_EXTRADATATYPE enumeration is used to define the
463  * possible extra data payload types.
464  * NB: this enum is binary backwards compatible with the previous
465  * OMX_EXTRADATA_QUANT define.  This should be replaced with
466  * OMX_ExtraDataQuantization.
467  */
468 typedef enum OMX_EXTRADATATYPE
469 {
470    OMX_ExtraDataNone = 0,                       /**< Indicates that no more extra data sections follow */
471    OMX_ExtraDataQuantization,                   /**< The data payload contains quantization data */
472    OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
473    OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
474    OMX_ExtraDataMax = 0x7FFFFFFF
475 } OMX_EXTRADATATYPE;
476 
477 
478 typedef struct OMX_OTHER_EXTRADATATYPE  {
479     OMX_U32 nSize;
480     OMX_VERSIONTYPE nVersion;
481     OMX_U32 nPortIndex;
482     OMX_EXTRADATATYPE eType;       /* Extra Data type */
483     OMX_U32 nDataSize;   /* Size of the supporting data to follow */
484     OMX_U8  data[1];     /* Supporting data hint  */
485 } OMX_OTHER_EXTRADATATYPE;
486 
487 /** @ingroup comp */
488 typedef struct OMX_PORT_PARAM_TYPE {
489     OMX_U32 nSize;              /**< size of the structure in bytes */
490     OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
491     OMX_U32 nPorts;             /**< The number of ports for this component */
492     OMX_U32 nStartPortNumber;   /** first port number for this type of port */
493 } OMX_PORT_PARAM_TYPE;
494 
495 /** @ingroup comp */
496 typedef enum OMX_EVENTTYPE
497 {
498     OMX_EventCmdComplete,         /**< component has sucessfully completed a command */
499     OMX_EventError,               /**< component has detected an error condition */
500     OMX_EventMark,                /**< component has detected a buffer mark */
501     OMX_EventPortSettingsChanged, /**< component is reported a port settings change */
502     OMX_EventBufferFlag,          /**< component has detected an EOS */
503     OMX_EventResourcesAcquired,   /**< component has been granted resources and is
504                                        automatically starting the state change from
505                                        OMX_StateWaitForResources to OMX_StateIdle. */
506     OMX_EventComponentResumed,     /**< Component resumed due to reacquisition of resources */
507     OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */
508     OMX_EventPortFormatDetected,      /**< Component has detected a supported format. */
509     OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
510     OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
511 
512     /** Event when tunneled decoder has rendered an output or reached EOS
513      *  nData1 must contain the number of timestamps returned
514      *  pEventData must point to an array of the OMX_VIDEO_RENDEREVENTTYPE structs containing the
515      *  render-timestamps of each frame. Component may batch rendered timestamps using this event,
516      *  but must signal the event no more than 40ms after the first frame in the batch. The frames
517      *  must be ordered by system timestamp inside and across batches.
518      *
519      *  If component is doing frame-rate conversion, it must signal the render time of each
520      *  converted frame, and must interpolate media timestamps for in-between frames.
521      *
522      *  When the component reached EOS, it must signal an EOS timestamp using the same mechanism.
523      *  This is in addition to the timestamp of the last rendered frame, and should follow that
524      *  frame.
525      */
526     OMX_EventOutputRendered = 0x7F000001,
527 
528     /** For framework internal use only: event sent by OMXNodeInstance when it receives a graphic
529      *  input buffer with a new dataspace for encoding. |arg1| will contain the dataspace. |arg2|
530      *  will contain the ColorAspects requested by the component (or framework defaults) using
531      *  the following bitfield layout:
532      *
533      *       +----------+-------------+----------------+------------+
534      *       |   Range  |  Primaries  |  MatrixCoeffs  |  Transfer  |
535      *       +----------+-------------+----------------+------------+
536      *  bits:  31....24   23.......16   15...........8   7........0
537      *
538      *  TODO: We would really need to tie this to an output buffer, but OMX does not provide a
539      *  fool-proof way to do that for video encoders.
540      */
541     OMX_EventDataSpaceChanged,
542     OMX_EventMax = 0x7FFFFFFF
543 } OMX_EVENTTYPE;
544 
545 typedef struct OMX_CALLBACKTYPE
546 {
547     /** The EventHandler method is used to notify the application when an
548         event of interest occurs.  Events are defined in the OMX_EVENTTYPE
549         enumeration.  Please see that enumeration for details of what will
550         be returned for each type of event. Callbacks should not return
551         an error to the component, so if an error occurs, the application
552         shall handle it internally.  This is a blocking call.
553 
554         The application should return from this call within 5 msec to avoid
555         blocking the component for an excessively long period of time.
556 
557         @param hComponent
558             handle of the component to access.  This is the component
559             handle returned by the call to the GetHandle function.
560         @param pAppData
561             pointer to an application defined value that was provided in the
562             pAppData parameter to the OMX_GetHandle method for the component.
563             This application defined value is provided so that the application
564             can have a component specific context when receiving the callback.
565         @param eEvent
566             Event that the component wants to notify the application about.
567         @param nData1
568             nData will be the OMX_ERRORTYPE for an error event and will be
569             an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event.
570          @param nData2
571             nData2 will hold further information related to the event. Can be OMX_STATETYPE for
572             a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event.
573             Default value is 0 if not used. )
574         @param pEventData
575             Pointer to additional event-specific data (see spec for meaning).
576       */
577 
578    OMX_ERRORTYPE (*EventHandler)(
579         OMX_IN OMX_HANDLETYPE hComponent,
580         OMX_IN OMX_PTR pAppData,
581         OMX_IN OMX_EVENTTYPE eEvent,
582         OMX_IN OMX_U32 nData1,
583         OMX_IN OMX_U32 nData2,
584         OMX_IN OMX_PTR pEventData);
585 
586     /** The EmptyBufferDone method is used to return emptied buffers from an
587         input port back to the application for reuse.  This is a blocking call
588         so the application should not attempt to refill the buffers during this
589         call, but should queue them and refill them in another thread.  There
590         is no error return, so the application shall handle any errors generated
591         internally.
592 
593         The application should return from this call within 5 msec.
594 
595         @param hComponent
596             handle of the component to access.  This is the component
597             handle returned by the call to the GetHandle function.
598         @param pAppData
599             pointer to an application defined value that was provided in the
600             pAppData parameter to the OMX_GetHandle method for the component.
601             This application defined value is provided so that the application
602             can have a component specific context when receiving the callback.
603         @param pBuffer
604             pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
605             or AllocateBuffer indicating the buffer that was emptied.
606         @ingroup buf
607      */
608     OMX_ERRORTYPE (*EmptyBufferDone)(
609         OMX_IN OMX_HANDLETYPE hComponent,
610         OMX_IN OMX_PTR pAppData,
611         OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
612 
613     /** The FillBufferDone method is used to return filled buffers from an
614         output port back to the application for emptying and then reuse.
615         This is a blocking call so the application should not attempt to
616         empty the buffers during this call, but should queue the buffers
617         and empty them in another thread.  There is no error return, so
618         the application shall handle any errors generated internally.  The
619         application shall also update the buffer header to indicate the
620         number of bytes placed into the buffer.
621 
622         The application should return from this call within 5 msec.
623 
624         @param hComponent
625             handle of the component to access.  This is the component
626             handle returned by the call to the GetHandle function.
627         @param pAppData
628             pointer to an application defined value that was provided in the
629             pAppData parameter to the OMX_GetHandle method for the component.
630             This application defined value is provided so that the application
631             can have a component specific context when receiving the callback.
632         @param pBuffer
633             pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
634             or AllocateBuffer indicating the buffer that was filled.
635         @ingroup buf
636      */
637     OMX_ERRORTYPE (*FillBufferDone)(
638         OMX_OUT OMX_HANDLETYPE hComponent,
639         OMX_OUT OMX_PTR pAppData,
640         OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
641 
642 } OMX_CALLBACKTYPE;
643 
644 /** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier
645     preference when tunneling between two ports.
646     @ingroup tun buf
647 */
648 typedef enum OMX_BUFFERSUPPLIERTYPE
649 {
650     OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified,
651                                               or don't care */
652     OMX_BufferSupplyInput,             /**< input port supplies the buffers */
653     OMX_BufferSupplyOutput,            /**< output port supplies the buffers */
654     OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
655     OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
656     OMX_BufferSupplyMax = 0x7FFFFFFF
657 } OMX_BUFFERSUPPLIERTYPE;
658 
659 
660 /** buffer supplier parameter
661  * @ingroup tun
662  */
663 typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE {
664     OMX_U32 nSize; /**< size of the structure in bytes */
665     OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
666     OMX_U32 nPortIndex; /**< port that this structure applies to */
667     OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */
668 } OMX_PARAM_BUFFERSUPPLIERTYPE;
669 
670 
671 /**< indicates that buffers received by an input port of a tunnel
672      may not modify the data in the buffers
673      @ingroup tun
674  */
675 #define OMX_PORTTUNNELFLAG_READONLY 0x00000001
676 
677 
678 /** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output
679     port to an input port as part the two ComponentTunnelRequest calls
680     resulting from a OMX_SetupTunnel call from the IL Client.
681     @ingroup tun
682  */
683 typedef struct OMX_TUNNELSETUPTYPE
684 {
685     OMX_U32 nTunnelFlags;             /**< bit flags for tunneling */
686     OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */
687 } OMX_TUNNELSETUPTYPE;
688 
689 /* OMX Component headers is included to enable the core to use
690    macros for functions into the component for OMX release 1.0.
691    Developers should not access any structures or data from within
692    the component header directly */
693 /* TO BE REMOVED - #include <OMX_Component.h> */
694 
695 /** GetComponentVersion will return information about the component.
696     This is a blocking call.  This macro will go directly from the
697     application to the component (via a core macro).  The
698     component will return from this call within 5 msec.
699     @param [in] hComponent
700         handle of component to execute the command
701     @param [out] pComponentName
702         pointer to an empty string of length 128 bytes.  The component
703         will write its name into this string.  The name will be
704         terminated by a single zero byte.  The name of a component will
705         be 127 bytes or less to leave room for the trailing zero byte.
706         An example of a valid component name is "OMX.ABC.ChannelMixer\0".
707     @param [out] pComponentVersion
708         pointer to an OMX Version structure that the component will fill
709         in.  The component will fill in a value that indicates the
710         component version.  NOTE: the component version is NOT the same
711         as the OMX Specification version (found in all structures).  The
712         component version is defined by the vendor of the component and
713         its value is entirely up to the component vendor.
714     @param [out] pSpecVersion
715         pointer to an OMX Version structure that the component will fill
716         in.  The SpecVersion is the version of the specification that the
717         component was built against.  Please note that this value may or
718         may not match the structure's version.  For example, if the
719         component was built against the 2.0 specification, but the
720         application (which creates the structure is built against the
721         1.0 specification the versions would be different.
722     @param [out] pComponentUUID
723         pointer to the UUID of the component which will be filled in by
724         the component.  The UUID is a unique identifier that is set at
725         RUN time for the component and is unique to each instantion of
726         the component.
727     @return OMX_ERRORTYPE
728         If the command successfully executes, the return code will be
729         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
730     @ingroup comp
731  */
732 #define OMX_GetComponentVersion(                            \
733         hComponent,                                         \
734         pComponentName,                                     \
735         pComponentVersion,                                  \
736         pSpecVersion,                                       \
737         pComponentUUID)                                     \
738     ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion(  \
739         hComponent,                                         \
740         pComponentName,                                     \
741         pComponentVersion,                                  \
742         pSpecVersion,                                       \
743         pComponentUUID)                 /* Macro End */
744 
745 
746 /** Send a command to the component.  This call is a non-blocking call.
747     The component should check the parameters and then queue the command
748     to the component thread to be executed.  The component thread shall
749     send the EventHandler() callback at the conclusion of the command.
750     This macro will go directly from the application to the component (via
751     a core macro).  The component will return from this call within 5 msec.
752 
753     When the command is "OMX_CommandStateSet" the component will queue a
754     state transition to the new state idenfied in nParam.
755 
756     When the command is "OMX_CommandFlush", to flush a port's buffer queues,
757     the command will force the component to return all buffers NOT CURRENTLY
758     BEING PROCESSED to the application, in the order in which the buffers
759     were received.
760 
761     When the command is "OMX_CommandPortDisable" or
762     "OMX_CommandPortEnable", the component's port (given by the value of
763     nParam) will be stopped or restarted.
764 
765     When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the
766     pCmdData will point to a OMX_MARKTYPE structure containing the component
767     handle of the component to examine the buffer chain for the mark.  nParam1
768     contains the index of the port on which the buffer mark is applied.
769 
770     Specification text for more details.
771 
772     @param [in] hComponent
773         handle of component to execute the command
774     @param [in] Cmd
775         Command for the component to execute
776     @param [in] nParam
777         Parameter for the command to be executed.  When Cmd has the value
778         OMX_CommandStateSet, value is a member of OMX_STATETYPE.  When Cmd has
779         the value OMX_CommandFlush, value of nParam indicates which port(s)
780         to flush. -1 is used to flush all ports a single port index will
781         only flush that port.  When Cmd has the value "OMX_CommandPortDisable"
782         or "OMX_CommandPortEnable", the component's port is given by
783         the value of nParam.  When Cmd has the value "OMX_CommandMarkBuffer"
784         the components pot is given by the value of nParam.
785     @param [in] pCmdData
786         Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value
787         "OMX_CommandMarkBuffer".
788     @return OMX_ERRORTYPE
789         If the command successfully executes, the return code will be
790         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
791     @ingroup comp
792  */
793 #define OMX_SendCommand(                                    \
794          hComponent,                                        \
795          Cmd,                                               \
796          nParam,                                            \
797          pCmdData)                                          \
798      ((OMX_COMPONENTTYPE*)hComponent)->SendCommand(         \
799          hComponent,                                        \
800          Cmd,                                               \
801          nParam,                                            \
802          pCmdData)                          /* Macro End */
803 
804 
805 /** The OMX_GetParameter macro will get one of the current parameter
806     settings from the component.  This macro cannot only be invoked when
807     the component is in the OMX_StateInvalid state.  The nParamIndex
808     parameter is used to indicate which structure is being requested from
809     the component.  The application shall allocate the correct structure
810     and shall fill in the structure size and version information before
811     invoking this macro.  When the parameter applies to a port, the
812     caller shall fill in the appropriate nPortIndex value indicating the
813     port on which the parameter applies. If the component has not had
814     any settings changed, then the component should return a set of
815     valid DEFAULT  parameters for the component.  This is a blocking
816     call.
817 
818     The component should return from this call within 20 msec.
819 
820     @param [in] hComponent
821         Handle of the component to be accessed.  This is the component
822         handle returned by the call to the OMX_GetHandle function.
823     @param [in] nParamIndex
824         Index of the structure to be filled.  This value is from the
825         OMX_INDEXTYPE enumeration.
826     @param [in,out] pComponentParameterStructure
827         Pointer to application allocated structure to be filled by the
828         component.
829     @return OMX_ERRORTYPE
830         If the command successfully executes, the return code will be
831         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
832     @ingroup comp
833  */
834 #define OMX_GetParameter(                                   \
835         hComponent,                                         \
836         nParamIndex,                                        \
837         pComponentParameterStructure)                        \
838     ((OMX_COMPONENTTYPE*)hComponent)->GetParameter(         \
839         hComponent,                                         \
840         nParamIndex,                                        \
841         pComponentParameterStructure)    /* Macro End */
842 
843 
844 /** The OMX_SetParameter macro will send an initialization parameter
845     structure to a component.  Each structure shall be sent one at a time,
846     in a separate invocation of the macro.  This macro can only be
847     invoked when the component is in the OMX_StateLoaded state, or the
848     port is disabled (when the parameter applies to a port). The
849     nParamIndex parameter is used to indicate which structure is being
850     passed to the component.  The application shall allocate the
851     correct structure and shall fill in the structure size and version
852     information (as well as the actual data) before invoking this macro.
853     The application is free to dispose of this structure after the call
854     as the component is required to copy any data it shall retain.  This
855     is a blocking call.
856 
857     The component should return from this call within 20 msec.
858 
859     @param [in] hComponent
860         Handle of the component to be accessed.  This is the component
861         handle returned by the call to the OMX_GetHandle function.
862     @param [in] nIndex
863         Index of the structure to be sent.  This value is from the
864         OMX_INDEXTYPE enumeration.
865     @param [in] pComponentParameterStructure
866         pointer to application allocated structure to be used for
867         initialization by the component.
868     @return OMX_ERRORTYPE
869         If the command successfully executes, the return code will be
870         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
871     @ingroup comp
872  */
873 #define OMX_SetParameter(                                   \
874         hComponent,                                         \
875         nParamIndex,                                        \
876         pComponentParameterStructure)                        \
877     ((OMX_COMPONENTTYPE*)hComponent)->SetParameter(         \
878         hComponent,                                         \
879         nParamIndex,                                        \
880         pComponentParameterStructure)    /* Macro End */
881 
882 
883 /** The OMX_GetConfig macro will get one of the configuration structures
884     from a component.  This macro can be invoked anytime after the
885     component has been loaded.  The nParamIndex call parameter is used to
886     indicate which structure is being requested from the component.  The
887     application shall allocate the correct structure and shall fill in the
888     structure size and version information before invoking this macro.
889     If the component has not had this configuration parameter sent before,
890     then the component should return a set of valid DEFAULT values for the
891     component.  This is a blocking call.
892 
893     The component should return from this call within 5 msec.
894 
895     @param [in] hComponent
896         Handle of the component to be accessed.  This is the component
897         handle returned by the call to the OMX_GetHandle function.
898     @param [in] nIndex
899         Index of the structure to be filled.  This value is from the
900         OMX_INDEXTYPE enumeration.
901     @param [in,out] pComponentConfigStructure
902         pointer to application allocated structure to be filled by the
903         component.
904     @return OMX_ERRORTYPE
905         If the command successfully executes, the return code will be
906         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
907     @ingroup comp
908 */
909 #define OMX_GetConfig(                                      \
910         hComponent,                                         \
911         nConfigIndex,                                       \
912         pComponentConfigStructure)                           \
913     ((OMX_COMPONENTTYPE*)hComponent)->GetConfig(            \
914         hComponent,                                         \
915         nConfigIndex,                                       \
916         pComponentConfigStructure)       /* Macro End */
917 
918 
919 /** The OMX_SetConfig macro will send one of the configuration
920     structures to a component.  Each structure shall be sent one at a time,
921     each in a separate invocation of the macro.  This macro can be invoked
922     anytime after the component has been loaded.  The application shall
923     allocate the correct structure and shall fill in the structure size
924     and version information (as well as the actual data) before invoking
925     this macro.  The application is free to dispose of this structure after
926     the call as the component is required to copy any data it shall retain.
927     This is a blocking call.
928 
929     The component should return from this call within 5 msec.
930 
931     @param [in] hComponent
932         Handle of the component to be accessed.  This is the component
933         handle returned by the call to the OMX_GetHandle function.
934     @param [in] nConfigIndex
935         Index of the structure to be sent.  This value is from the
936         OMX_INDEXTYPE enumeration above.
937     @param [in] pComponentConfigStructure
938         pointer to application allocated structure to be used for
939         initialization by the component.
940     @return OMX_ERRORTYPE
941         If the command successfully executes, the return code will be
942         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
943     @ingroup comp
944  */
945 #define OMX_SetConfig(                                      \
946         hComponent,                                         \
947         nConfigIndex,                                       \
948         pComponentConfigStructure)                           \
949     ((OMX_COMPONENTTYPE*)hComponent)->SetConfig(            \
950         hComponent,                                         \
951         nConfigIndex,                                       \
952         pComponentConfigStructure)       /* Macro End */
953 
954 
955 /** The OMX_GetExtensionIndex macro will invoke a component to translate
956     a vendor specific configuration or parameter string into an OMX
957     structure index.  There is no requirement for the vendor to support
958     this command for the indexes already found in the OMX_INDEXTYPE
959     enumeration (this is done to save space in small components).  The
960     component shall support all vendor supplied extension indexes not found
961     in the master OMX_INDEXTYPE enumeration.  This is a blocking call.
962 
963     The component should return from this call within 5 msec.
964 
965     @param [in] hComponent
966         Handle of the component to be accessed.  This is the component
967         handle returned by the call to the GetHandle function.
968     @param [in] cParameterName
969         OMX_STRING that shall be less than 128 characters long including
970         the trailing null byte.  This is the string that will get
971         translated by the component into a configuration index.
972     @param [out] pIndexType
973         a pointer to a OMX_INDEXTYPE to receive the index value.
974     @return OMX_ERRORTYPE
975         If the command successfully executes, the return code will be
976         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
977     @ingroup comp
978  */
979 #define OMX_GetExtensionIndex(                              \
980         hComponent,                                         \
981         cParameterName,                                     \
982         pIndexType)                                         \
983     ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex(    \
984         hComponent,                                         \
985         cParameterName,                                     \
986         pIndexType)                     /* Macro End */
987 
988 
989 /** The OMX_GetState macro will invoke the component to get the current
990     state of the component and place the state value into the location
991     pointed to by pState.
992 
993     The component should return from this call within 5 msec.
994 
995     @param [in] hComponent
996         Handle of the component to be accessed.  This is the component
997         handle returned by the call to the OMX_GetHandle function.
998     @param [out] pState
999         pointer to the location to receive the state.  The value returned
1000         is one of the OMX_STATETYPE members
1001     @return OMX_ERRORTYPE
1002         If the command successfully executes, the return code will be
1003         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1004     @ingroup comp
1005  */
1006 #define OMX_GetState(                                       \
1007         hComponent,                                         \
1008         pState)                                             \
1009     ((OMX_COMPONENTTYPE*)hComponent)->GetState(             \
1010         hComponent,                                         \
1011         pState)                         /* Macro End */
1012 
1013 
1014 /** The OMX_UseBuffer macro will request that the component use
1015     a buffer (and allocate its own buffer header) already allocated
1016     by another component, or by the IL Client. This is a blocking
1017     call.
1018 
1019     The component should return from this call within 20 msec.
1020 
1021     @param [in] hComponent
1022         Handle of the component to be accessed.  This is the component
1023         handle returned by the call to the OMX_GetHandle function.
1024     @param [out] ppBuffer
1025         pointer to an OMX_BUFFERHEADERTYPE structure used to receive the
1026         pointer to the buffer header
1027     @return OMX_ERRORTYPE
1028         If the command successfully executes, the return code will be
1029         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1030     @ingroup comp buf
1031  */
1032 
1033 #define OMX_UseBuffer(                                      \
1034            hComponent,                                      \
1035            ppBufferHdr,                                     \
1036            nPortIndex,                                      \
1037            pAppPrivate,                                     \
1038            nSizeBytes,                                      \
1039            pBuffer)                                         \
1040     ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer(            \
1041            hComponent,                                      \
1042            ppBufferHdr,                                     \
1043            nPortIndex,                                      \
1044            pAppPrivate,                                     \
1045            nSizeBytes,                                      \
1046            pBuffer)
1047 
1048 
1049 /** The OMX_AllocateBuffer macro will request that the component allocate
1050     a new buffer and buffer header.  The component will allocate the
1051     buffer and the buffer header and return a pointer to the buffer
1052     header.  This is a blocking call.
1053 
1054     The component should return from this call within 5 msec.
1055 
1056     @param [in] hComponent
1057         Handle of the component to be accessed.  This is the component
1058         handle returned by the call to the OMX_GetHandle function.
1059     @param [out] ppBuffer
1060         pointer to an OMX_BUFFERHEADERTYPE structure used to receive
1061         the pointer to the buffer header
1062     @param [in] nPortIndex
1063         nPortIndex is used to select the port on the component the buffer will
1064         be used with.  The port can be found by using the nPortIndex
1065         value as an index into the Port Definition array of the component.
1066     @param [in] pAppPrivate
1067         pAppPrivate is used to initialize the pAppPrivate member of the
1068         buffer header structure.
1069     @param [in] nSizeBytes
1070         size of the buffer to allocate.  Used when bAllocateNew is true.
1071     @return OMX_ERRORTYPE
1072         If the command successfully executes, the return code will be
1073         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1074     @ingroup comp buf
1075  */
1076 #define OMX_AllocateBuffer(                                 \
1077         hComponent,                                         \
1078         ppBuffer,                                           \
1079         nPortIndex,                                         \
1080         pAppPrivate,                                        \
1081         nSizeBytes)                                         \
1082     ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer(       \
1083         hComponent,                                         \
1084         ppBuffer,                                           \
1085         nPortIndex,                                         \
1086         pAppPrivate,                                        \
1087         nSizeBytes)                     /* Macro End */
1088 
1089 
1090 /** The OMX_FreeBuffer macro will release a buffer header from the component
1091     which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If
1092     the component allocated the buffer (see the OMX_UseBuffer macro) then
1093     the component shall free the buffer and buffer header. This is a
1094     blocking call.
1095 
1096     The component should return from this call within 20 msec.
1097 
1098     @param [in] hComponent
1099         Handle of the component to be accessed.  This is the component
1100         handle returned by the call to the OMX_GetHandle function.
1101     @param [in] nPortIndex
1102         nPortIndex is used to select the port on the component the buffer will
1103         be used with.
1104     @param [in] pBuffer
1105         pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
1106         or AllocateBuffer.
1107     @return OMX_ERRORTYPE
1108         If the command successfully executes, the return code will be
1109         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1110     @ingroup comp buf
1111  */
1112 #define OMX_FreeBuffer(                                     \
1113         hComponent,                                         \
1114         nPortIndex,                                         \
1115         pBuffer)                                            \
1116     ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer(           \
1117         hComponent,                                         \
1118         nPortIndex,                                         \
1119         pBuffer)                        /* Macro End */
1120 
1121 
1122 /** The OMX_EmptyThisBuffer macro will send a buffer full of data to an
1123     input port of a component.  The buffer will be emptied by the component
1124     and returned to the application via the EmptyBufferDone call back.
1125     This is a non-blocking call in that the component will record the buffer
1126     and return immediately and then empty the buffer, later, at the proper
1127     time.  As expected, this macro may be invoked only while the component
1128     is in the OMX_StateExecuting.  If nPortIndex does not specify an input
1129     port, the component shall return an error.
1130 
1131     The component should return from this call within 5 msec.
1132 
1133     @param [in] hComponent
1134         Handle of the component to be accessed.  This is the component
1135         handle returned by the call to the OMX_GetHandle function.
1136     @param [in] pBuffer
1137         pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
1138         or AllocateBuffer.
1139     @return OMX_ERRORTYPE
1140         If the command successfully executes, the return code will be
1141         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1142     @ingroup comp buf
1143  */
1144 #define OMX_EmptyThisBuffer(                                \
1145         hComponent,                                         \
1146         pBuffer)                                            \
1147     ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer(      \
1148         hComponent,                                         \
1149         pBuffer)                        /* Macro End */
1150 
1151 
1152 /** The OMX_FillThisBuffer macro will send an empty buffer to an
1153     output port of a component.  The buffer will be filled by the component
1154     and returned to the application via the FillBufferDone call back.
1155     This is a non-blocking call in that the component will record the buffer
1156     and return immediately and then fill the buffer, later, at the proper
1157     time.  As expected, this macro may be invoked only while the component
1158     is in the OMX_ExecutingState.  If nPortIndex does not specify an output
1159     port, the component shall return an error.
1160 
1161     The component should return from this call within 5 msec.
1162 
1163     @param [in] hComponent
1164         Handle of the component to be accessed.  This is the component
1165         handle returned by the call to the OMX_GetHandle function.
1166     @param [in] pBuffer
1167         pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
1168         or AllocateBuffer.
1169     @return OMX_ERRORTYPE
1170         If the command successfully executes, the return code will be
1171         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1172     @ingroup comp buf
1173  */
1174 #define OMX_FillThisBuffer(                                 \
1175         hComponent,                                         \
1176         pBuffer)                                            \
1177     ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer(       \
1178         hComponent,                                         \
1179         pBuffer)                        /* Macro End */
1180 
1181 
1182 
1183 /** The OMX_UseEGLImage macro will request that the component use
1184     a EGLImage provided by EGL (and allocate its own buffer header)
1185     This is a blocking call.
1186 
1187     The component should return from this call within 20 msec.
1188 
1189     @param [in] hComponent
1190         Handle of the component to be accessed.  This is the component
1191         handle returned by the call to the OMX_GetHandle function.
1192     @param [out] ppBuffer
1193         pointer to an OMX_BUFFERHEADERTYPE structure used to receive the
1194         pointer to the buffer header.  Note that the memory location used
1195         for this buffer is NOT visible to the IL Client.
1196     @param [in] nPortIndex
1197         nPortIndex is used to select the port on the component the buffer will
1198         be used with.  The port can be found by using the nPortIndex
1199         value as an index into the Port Definition array of the component.
1200     @param [in] pAppPrivate
1201         pAppPrivate is used to initialize the pAppPrivate member of the
1202         buffer header structure.
1203     @param [in] eglImage
1204         eglImage contains the handle of the EGLImage to use as a buffer on the
1205         specified port.  The component is expected to validate properties of
1206         the EGLImage against the configuration of the port to ensure the component
1207         can use the EGLImage as a buffer.
1208     @return OMX_ERRORTYPE
1209         If the command successfully executes, the return code will be
1210         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1211     @ingroup comp buf
1212  */
1213 #define OMX_UseEGLImage(                                    \
1214            hComponent,                                      \
1215            ppBufferHdr,                                     \
1216            nPortIndex,                                      \
1217            pAppPrivate,                                     \
1218            eglImage)                                        \
1219     ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage(          \
1220            hComponent,                                      \
1221            ppBufferHdr,                                     \
1222            nPortIndex,                                      \
1223            pAppPrivate,                                     \
1224            eglImage)
1225 
1226 /** The OMX_Init method is used to initialize the OMX core.  It shall be the
1227     first call made into OMX and it should only be executed one time without
1228     an interviening OMX_Deinit call.
1229 
1230     The core should return from this call within 20 msec.
1231 
1232     @return OMX_ERRORTYPE
1233         If the command successfully executes, the return code will be
1234         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1235     @ingroup core
1236  */
1237 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void);
1238 
1239 
1240 /** The OMX_Deinit method is used to deinitialize the OMX core.  It shall be
1241     the last call made into OMX. In the event that the core determines that
1242     thare are components loaded when this call is made, the core may return
1243     with an error rather than try to unload the components.
1244 
1245     The core should return from this call within 20 msec.
1246 
1247     @return OMX_ERRORTYPE
1248         If the command successfully executes, the return code will be
1249         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1250     @ingroup core
1251  */
1252 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void);
1253 
1254 
1255 /** The OMX_ComponentNameEnum method will enumerate through all the names of
1256     recognised valid components in the system. This function is provided
1257     as a means to detect all the components in the system run-time. There is
1258     no strict ordering to the enumeration order of component names, although
1259     each name will only be enumerated once.  If the OMX core supports run-time
1260     installation of new components, it is only requried to detect newly
1261     installed components when the first call to enumerate component names
1262     is made (i.e. when nIndex is 0x0).
1263 
1264     The core should return from this call in 20 msec.
1265 
1266     @param [out] cComponentName
1267         pointer to a null terminated string with the component name.  The
1268         names of the components are strings less than 127 bytes in length
1269         plus the trailing null for a maximum size of 128 bytes.  An example
1270         of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0".  Names are
1271         assigned by the vendor, but shall start with "OMX." and then have
1272         the Vendor designation next.
1273     @param [in] nNameLength
1274         number of characters in the cComponentName string.  With all
1275         component name strings restricted to less than 128 characters
1276         (including the trailing null) it is recomended that the caller
1277         provide a input string for the cComponentName of 128 characters.
1278     @param [in] nIndex
1279         number containing the enumeration index for the component.
1280         Multiple calls to OMX_ComponentNameEnum with increasing values
1281         of nIndex will enumerate through the component names in the
1282         system until OMX_ErrorNoMore is returned.  The value of nIndex
1283         is 0 to (N-1), where N is the number of valid installed components
1284         in the system.
1285     @return OMX_ERRORTYPE
1286         If the command successfully executes, the return code will be
1287         OMX_ErrorNone.  When the value of nIndex exceeds the number of
1288         components in the system minus 1, OMX_ErrorNoMore will be
1289         returned. Otherwise the appropriate OMX error will be returned.
1290     @ingroup core
1291  */
1292 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum(
1293     OMX_OUT OMX_STRING cComponentName,
1294     OMX_IN  OMX_U32 nNameLength,
1295     OMX_IN  OMX_U32 nIndex);
1296 
1297 
1298 /** The OMX_GetHandle method will locate the component specified by the
1299     component name given, load that component into memory and then invoke
1300     the component's methods to create an instance of the component.
1301 
1302     The core should return from this call within 20 msec.
1303 
1304     @param [out] pHandle
1305         pointer to an OMX_HANDLETYPE pointer to be filled in by this method.
1306     @param [in] cComponentName
1307         pointer to a null terminated string with the component name.  The
1308         names of the components are strings less than 127 bytes in length
1309         plus the trailing null for a maximum size of 128 bytes.  An example
1310         of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0".  Names are
1311         assigned by the vendor, but shall start with "OMX." and then have
1312         the Vendor designation next.
1313     @param [in] pAppData
1314         pointer to an application defined value that will be returned
1315         during callbacks so that the application can identify the source
1316         of the callback.
1317     @param [in] pCallBacks
1318         pointer to a OMX_CALLBACKTYPE structure that will be passed to the
1319         component to initialize it with.
1320     @return OMX_ERRORTYPE
1321         If the command successfully executes, the return code will be
1322         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1323     @ingroup core
1324  */
1325 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(
1326     OMX_OUT OMX_HANDLETYPE* pHandle,
1327     OMX_IN  OMX_STRING cComponentName,
1328     OMX_IN  OMX_PTR pAppData,
1329     OMX_IN  OMX_CALLBACKTYPE* pCallBacks);
1330 
1331 
1332 /** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle
1333     method.  If the component reference count goes to zero, the component will
1334     be unloaded from memory.
1335 
1336     The core should return from this call within 20 msec when the component is
1337     in the OMX_StateLoaded state.
1338 
1339     @param [in] hComponent
1340         Handle of the component to be accessed.  This is the component
1341         handle returned by the call to the GetHandle function.
1342     @return OMX_ERRORTYPE
1343         If the command successfully executes, the return code will be
1344         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1345     @ingroup core
1346  */
1347 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle(
1348     OMX_IN  OMX_HANDLETYPE hComponent);
1349 
1350 
1351 
1352 /** The OMX_SetupTunnel method will handle the necessary calls to the components
1353     to setup the specified tunnel the two components.  NOTE: This is
1354     an actual method (not a #define macro).  This method will make calls into
1355     the component ComponentTunnelRequest method to do the actual tunnel
1356     connection.
1357 
1358     The ComponentTunnelRequest method on both components will be called.
1359     This method shall not be called unless the component is in the
1360     OMX_StateLoaded state except when the ports used for the tunnel are
1361     disabled. In this case, the component may be in the OMX_StateExecuting,
1362     OMX_StatePause, or OMX_StateIdle states.
1363 
1364     The core should return from this call within 20 msec.
1365 
1366     @param [in] hOutput
1367         Handle of the component to be accessed.  Also this is the handle
1368         of the component whose port, specified in the nPortOutput parameter
1369         will be used the source for the tunnel. This is the component handle
1370         returned by the call to the OMX_GetHandle function.  There is a
1371         requirement that hOutput be the source for the data when
1372         tunelling (i.e. nPortOutput is an output port).  If 0x0, the component
1373         specified in hInput will have it's port specified in nPortInput
1374         setup for communication with the application / IL client.
1375     @param [in] nPortOutput
1376         nPortOutput is used to select the source port on component to be
1377         used in the tunnel.
1378     @param [in] hInput
1379         This is the component to setup the tunnel with. This is the handle
1380         of the component whose port, specified in the nPortInput parameter
1381         will be used the destination for the tunnel. This is the component handle
1382         returned by the call to the OMX_GetHandle function.  There is a
1383         requirement that hInput be the destination for the data when
1384         tunelling (i.e. nPortInut is an input port).   If 0x0, the component
1385         specified in hOutput will have it's port specified in nPortPOutput
1386         setup for communication with the application / IL client.
1387     @param [in] nPortInput
1388         nPortInput is used to select the destination port on component to be
1389         used in the tunnel.
1390     @return OMX_ERRORTYPE
1391         If the command successfully executes, the return code will be
1392         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1393         When OMX_ErrorNotImplemented is returned, one or both components is
1394         a non-interop component and does not support tunneling.
1395 
1396         On failure, the ports of both components are setup for communication
1397         with the application / IL Client.
1398     @ingroup core tun
1399  */
1400 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel(
1401     OMX_IN  OMX_HANDLETYPE hOutput,
1402     OMX_IN  OMX_U32 nPortOutput,
1403     OMX_IN  OMX_HANDLETYPE hInput,
1404     OMX_IN  OMX_U32 nPortInput);
1405 
1406 /** @ingroup cp */
1407 OMX_API OMX_ERRORTYPE   OMX_GetContentPipe(
1408     OMX_OUT OMX_HANDLETYPE *hPipe,
1409     OMX_IN OMX_STRING szURI);
1410 
1411 /** The OMX_GetComponentsOfRole method will return the number of components that support the given
1412     role and (if the compNames field is non-NULL) the names of those components. The call will fail if
1413     an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
1414     client should:
1415         * first call this function with the compNames field NULL to determine the number of component names
1416         * second call this function with the compNames field pointing to an array of names allocated
1417           according to the number returned by the first call.
1418 
1419     The core should return from this call within 5 msec.
1420 
1421     @param [in] role
1422         This is generic standard component name consisting only of component class
1423         name and the type within that class (e.g. 'audio_decoder.aac').
1424     @param [inout] pNumComps
1425         This is used both as input and output.
1426 
1427         If compNames is NULL, the input is ignored and the output specifies how many components support
1428         the given role.
1429 
1430         If compNames is not NULL, on input it bounds the size of the input structure and
1431         on output, it specifies the number of components string names listed within the compNames parameter.
1432     @param [inout] compNames
1433         If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts
1434         a list of the names of all physical components that implement the specified standard component name.
1435         Each name is NULL terminated. numComps indicates the number of names.
1436     @ingroup core
1437  */
1438 OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole (
1439     OMX_IN      OMX_STRING role,
1440     OMX_INOUT   OMX_U32 *pNumComps,
1441     OMX_INOUT   OMX_U8  **compNames);
1442 
1443 /** The OMX_GetRolesOfComponent method will return the number of roles supported by the given
1444     component and (if the roles field is non-NULL) the names of those roles. The call will fail if
1445     an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
1446     client should:
1447         * first call this function with the roles field NULL to determine the number of role names
1448         * second call this function with the roles field pointing to an array of names allocated
1449           according to the number returned by the first call.
1450 
1451     The core should return from this call within 5 msec.
1452 
1453     @param [in] compName
1454         This is the name of the component being queried about.
1455     @param [inout] pNumRoles
1456         This is used both as input and output.
1457 
1458         If roles is NULL, the input is ignored and the output specifies how many roles the component supports.
1459 
1460         If compNames is not NULL, on input it bounds the size of the input structure and
1461         on output, it specifies the number of roles string names listed within the roles parameter.
1462     @param [out] roles
1463         If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings
1464         which accepts a list of the names of all standard components roles implemented on the
1465         specified component name. numComps indicates the number of names.
1466     @ingroup core
1467  */
1468 OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent (
1469     OMX_IN      OMX_STRING compName,
1470     OMX_INOUT   OMX_U32 *pNumRoles,
1471     OMX_OUT     OMX_U8 **roles);
1472 
1473 #ifdef __cplusplus
1474 }
1475 #endif /* __cplusplus */
1476 
1477 #endif
1478 /* File EOF */
1479 
1480