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
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     OMX_EventOutputRendered = 0x7F000001,
523     OMX_EventMax = 0x7FFFFFFF
524 } OMX_EVENTTYPE;
525 
526 typedef struct OMX_CALLBACKTYPE
527 {
528     /** The EventHandler method is used to notify the application when an
529         event of interest occurs.  Events are defined in the OMX_EVENTTYPE
530         enumeration.  Please see that enumeration for details of what will
531         be returned for each type of event. Callbacks should not return
532         an error to the component, so if an error occurs, the application
533         shall handle it internally.  This is a blocking call.
534 
535         The application should return from this call within 5 msec to avoid
536         blocking the component for an excessively long period of time.
537 
538         @param hComponent
539             handle of the component to access.  This is the component
540             handle returned by the call to the GetHandle function.
541         @param pAppData
542             pointer to an application defined value that was provided in the
543             pAppData parameter to the OMX_GetHandle method for the component.
544             This application defined value is provided so that the application
545             can have a component specific context when receiving the callback.
546         @param eEvent
547             Event that the component wants to notify the application about.
548         @param nData1
549             nData will be the OMX_ERRORTYPE for an error event and will be
550             an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event.
551          @param nData2
552             nData2 will hold further information related to the event. Can be OMX_STATETYPE for
553             a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event.
554             Default value is 0 if not used. )
555         @param pEventData
556             Pointer to additional event-specific data (see spec for meaning).
557       */
558 
559    OMX_ERRORTYPE (*EventHandler)(
560         OMX_IN OMX_HANDLETYPE hComponent,
561         OMX_IN OMX_PTR pAppData,
562         OMX_IN OMX_EVENTTYPE eEvent,
563         OMX_IN OMX_U32 nData1,
564         OMX_IN OMX_U32 nData2,
565         OMX_IN OMX_PTR pEventData);
566 
567     /** The EmptyBufferDone method is used to return emptied buffers from an
568         input port back to the application for reuse.  This is a blocking call
569         so the application should not attempt to refill the buffers during this
570         call, but should queue them and refill them in another thread.  There
571         is no error return, so the application shall handle any errors generated
572         internally.
573 
574         The application should return from this call within 5 msec.
575 
576         @param hComponent
577             handle of the component to access.  This is the component
578             handle returned by the call to the GetHandle function.
579         @param pAppData
580             pointer to an application defined value that was provided in the
581             pAppData parameter to the OMX_GetHandle method for the component.
582             This application defined value is provided so that the application
583             can have a component specific context when receiving the callback.
584         @param pBuffer
585             pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
586             or AllocateBuffer indicating the buffer that was emptied.
587         @ingroup buf
588      */
589     OMX_ERRORTYPE (*EmptyBufferDone)(
590         OMX_IN OMX_HANDLETYPE hComponent,
591         OMX_IN OMX_PTR pAppData,
592         OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
593 
594     /** The FillBufferDone method is used to return filled buffers from an
595         output port back to the application for emptying and then reuse.
596         This is a blocking call so the application should not attempt to
597         empty the buffers during this call, but should queue the buffers
598         and empty them in another thread.  There is no error return, so
599         the application shall handle any errors generated internally.  The
600         application shall also update the buffer header to indicate the
601         number of bytes placed into the buffer.
602 
603         The application should return from this call within 5 msec.
604 
605         @param hComponent
606             handle of the component to access.  This is the component
607             handle returned by the call to the GetHandle function.
608         @param pAppData
609             pointer to an application defined value that was provided in the
610             pAppData parameter to the OMX_GetHandle method for the component.
611             This application defined value is provided so that the application
612             can have a component specific context when receiving the callback.
613         @param pBuffer
614             pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
615             or AllocateBuffer indicating the buffer that was filled.
616         @ingroup buf
617      */
618     OMX_ERRORTYPE (*FillBufferDone)(
619         OMX_OUT OMX_HANDLETYPE hComponent,
620         OMX_OUT OMX_PTR pAppData,
621         OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
622 
623 } OMX_CALLBACKTYPE;
624 
625 /** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier
626     preference when tunneling between two ports.
627     @ingroup tun buf
628 */
629 typedef enum OMX_BUFFERSUPPLIERTYPE
630 {
631     OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified,
632                                               or don't care */
633     OMX_BufferSupplyInput,             /**< input port supplies the buffers */
634     OMX_BufferSupplyOutput,            /**< output port supplies the buffers */
635     OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
636     OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
637     OMX_BufferSupplyMax = 0x7FFFFFFF
638 } OMX_BUFFERSUPPLIERTYPE;
639 
640 
641 /** buffer supplier parameter
642  * @ingroup tun
643  */
644 typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE {
645     OMX_U32 nSize; /**< size of the structure in bytes */
646     OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
647     OMX_U32 nPortIndex; /**< port that this structure applies to */
648     OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */
649 } OMX_PARAM_BUFFERSUPPLIERTYPE;
650 
651 
652 /**< indicates that buffers received by an input port of a tunnel
653      may not modify the data in the buffers
654      @ingroup tun
655  */
656 #define OMX_PORTTUNNELFLAG_READONLY 0x00000001
657 
658 
659 /** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output
660     port to an input port as part the two ComponentTunnelRequest calls
661     resulting from a OMX_SetupTunnel call from the IL Client.
662     @ingroup tun
663  */
664 typedef struct OMX_TUNNELSETUPTYPE
665 {
666     OMX_U32 nTunnelFlags;             /**< bit flags for tunneling */
667     OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */
668 } OMX_TUNNELSETUPTYPE;
669 
670 /* OMX Component headers is included to enable the core to use
671    macros for functions into the component for OMX release 1.0.
672    Developers should not access any structures or data from within
673    the component header directly */
674 /* TO BE REMOVED - #include <OMX_Component.h> */
675 
676 /** GetComponentVersion will return information about the component.
677     This is a blocking call.  This macro will go directly from the
678     application to the component (via a core macro).  The
679     component will return from this call within 5 msec.
680     @param [in] hComponent
681         handle of component to execute the command
682     @param [out] pComponentName
683         pointer to an empty string of length 128 bytes.  The component
684         will write its name into this string.  The name will be
685         terminated by a single zero byte.  The name of a component will
686         be 127 bytes or less to leave room for the trailing zero byte.
687         An example of a valid component name is "OMX.ABC.ChannelMixer\0".
688     @param [out] pComponentVersion
689         pointer to an OMX Version structure that the component will fill
690         in.  The component will fill in a value that indicates the
691         component version.  NOTE: the component version is NOT the same
692         as the OMX Specification version (found in all structures).  The
693         component version is defined by the vendor of the component and
694         its value is entirely up to the component vendor.
695     @param [out] pSpecVersion
696         pointer to an OMX Version structure that the component will fill
697         in.  The SpecVersion is the version of the specification that the
698         component was built against.  Please note that this value may or
699         may not match the structure's version.  For example, if the
700         component was built against the 2.0 specification, but the
701         application (which creates the structure is built against the
702         1.0 specification the versions would be different.
703     @param [out] pComponentUUID
704         pointer to the UUID of the component which will be filled in by
705         the component.  The UUID is a unique identifier that is set at
706         RUN time for the component and is unique to each instantion of
707         the component.
708     @return OMX_ERRORTYPE
709         If the command successfully executes, the return code will be
710         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
711     @ingroup comp
712  */
713 #define OMX_GetComponentVersion(                            \
714         hComponent,                                         \
715         pComponentName,                                     \
716         pComponentVersion,                                  \
717         pSpecVersion,                                       \
718         pComponentUUID)                                     \
719     ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion(  \
720         hComponent,                                         \
721         pComponentName,                                     \
722         pComponentVersion,                                  \
723         pSpecVersion,                                       \
724         pComponentUUID)                 /* Macro End */
725 
726 
727 /** Send a command to the component.  This call is a non-blocking call.
728     The component should check the parameters and then queue the command
729     to the component thread to be executed.  The component thread shall
730     send the EventHandler() callback at the conclusion of the command.
731     This macro will go directly from the application to the component (via
732     a core macro).  The component will return from this call within 5 msec.
733 
734     When the command is "OMX_CommandStateSet" the component will queue a
735     state transition to the new state idenfied in nParam.
736 
737     When the command is "OMX_CommandFlush", to flush a port's buffer queues,
738     the command will force the component to return all buffers NOT CURRENTLY
739     BEING PROCESSED to the application, in the order in which the buffers
740     were received.
741 
742     When the command is "OMX_CommandPortDisable" or
743     "OMX_CommandPortEnable", the component's port (given by the value of
744     nParam) will be stopped or restarted.
745 
746     When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the
747     pCmdData will point to a OMX_MARKTYPE structure containing the component
748     handle of the component to examine the buffer chain for the mark.  nParam1
749     contains the index of the port on which the buffer mark is applied.
750 
751     Specification text for more details.
752 
753     @param [in] hComponent
754         handle of component to execute the command
755     @param [in] Cmd
756         Command for the component to execute
757     @param [in] nParam
758         Parameter for the command to be executed.  When Cmd has the value
759         OMX_CommandStateSet, value is a member of OMX_STATETYPE.  When Cmd has
760         the value OMX_CommandFlush, value of nParam indicates which port(s)
761         to flush. -1 is used to flush all ports a single port index will
762         only flush that port.  When Cmd has the value "OMX_CommandPortDisable"
763         or "OMX_CommandPortEnable", the component's port is given by
764         the value of nParam.  When Cmd has the value "OMX_CommandMarkBuffer"
765         the components pot is given by the value of nParam.
766     @param [in] pCmdData
767         Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value
768         "OMX_CommandMarkBuffer".
769     @return OMX_ERRORTYPE
770         If the command successfully executes, the return code will be
771         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
772     @ingroup comp
773  */
774 #define OMX_SendCommand(                                    \
775          hComponent,                                        \
776          Cmd,                                               \
777          nParam,                                            \
778          pCmdData)                                          \
779      ((OMX_COMPONENTTYPE*)hComponent)->SendCommand(         \
780          hComponent,                                        \
781          Cmd,                                               \
782          nParam,                                            \
783          pCmdData)                          /* Macro End */
784 
785 
786 /** The OMX_GetParameter macro will get one of the current parameter
787     settings from the component.  This macro cannot only be invoked when
788     the component is in the OMX_StateInvalid state.  The nParamIndex
789     parameter is used to indicate which structure is being requested from
790     the component.  The application shall allocate the correct structure
791     and shall fill in the structure size and version information before
792     invoking this macro.  When the parameter applies to a port, the
793     caller shall fill in the appropriate nPortIndex value indicating the
794     port on which the parameter applies. If the component has not had
795     any settings changed, then the component should return a set of
796     valid DEFAULT  parameters for the component.  This is a blocking
797     call.
798 
799     The component should return from this call within 20 msec.
800 
801     @param [in] hComponent
802         Handle of the component to be accessed.  This is the component
803         handle returned by the call to the OMX_GetHandle function.
804     @param [in] nParamIndex
805         Index of the structure to be filled.  This value is from the
806         OMX_INDEXTYPE enumeration.
807     @param [in,out] pComponentParameterStructure
808         Pointer to application allocated structure to be filled by the
809         component.
810     @return OMX_ERRORTYPE
811         If the command successfully executes, the return code will be
812         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
813     @ingroup comp
814  */
815 #define OMX_GetParameter(                                   \
816         hComponent,                                         \
817         nParamIndex,                                        \
818         pComponentParameterStructure)                        \
819     ((OMX_COMPONENTTYPE*)hComponent)->GetParameter(         \
820         hComponent,                                         \
821         nParamIndex,                                        \
822         pComponentParameterStructure)    /* Macro End */
823 
824 
825 /** The OMX_SetParameter macro will send an initialization parameter
826     structure to a component.  Each structure shall be sent one at a time,
827     in a separate invocation of the macro.  This macro can only be
828     invoked when the component is in the OMX_StateLoaded state, or the
829     port is disabled (when the parameter applies to a port). The
830     nParamIndex parameter is used to indicate which structure is being
831     passed to the component.  The application shall allocate the
832     correct structure and shall fill in the structure size and version
833     information (as well as the actual data) before invoking this macro.
834     The application is free to dispose of this structure after the call
835     as the component is required to copy any data it shall retain.  This
836     is a blocking call.
837 
838     The component should return from this call within 20 msec.
839 
840     @param [in] hComponent
841         Handle of the component to be accessed.  This is the component
842         handle returned by the call to the OMX_GetHandle function.
843     @param [in] nIndex
844         Index of the structure to be sent.  This value is from the
845         OMX_INDEXTYPE enumeration.
846     @param [in] pComponentParameterStructure
847         pointer to application allocated structure to be used for
848         initialization by the component.
849     @return OMX_ERRORTYPE
850         If the command successfully executes, the return code will be
851         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
852     @ingroup comp
853  */
854 #define OMX_SetParameter(                                   \
855         hComponent,                                         \
856         nParamIndex,                                        \
857         pComponentParameterStructure)                        \
858     ((OMX_COMPONENTTYPE*)hComponent)->SetParameter(         \
859         hComponent,                                         \
860         nParamIndex,                                        \
861         pComponentParameterStructure)    /* Macro End */
862 
863 
864 /** The OMX_GetConfig macro will get one of the configuration structures
865     from a component.  This macro can be invoked anytime after the
866     component has been loaded.  The nParamIndex call parameter is used to
867     indicate which structure is being requested from the component.  The
868     application shall allocate the correct structure and shall fill in the
869     structure size and version information before invoking this macro.
870     If the component has not had this configuration parameter sent before,
871     then the component should return a set of valid DEFAULT values for the
872     component.  This is a blocking call.
873 
874     The component should return from this call within 5 msec.
875 
876     @param [in] hComponent
877         Handle of the component to be accessed.  This is the component
878         handle returned by the call to the OMX_GetHandle function.
879     @param [in] nIndex
880         Index of the structure to be filled.  This value is from the
881         OMX_INDEXTYPE enumeration.
882     @param [in,out] pComponentConfigStructure
883         pointer to application allocated structure to be filled by the
884         component.
885     @return OMX_ERRORTYPE
886         If the command successfully executes, the return code will be
887         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
888     @ingroup comp
889 */
890 #define OMX_GetConfig(                                      \
891         hComponent,                                         \
892         nConfigIndex,                                       \
893         pComponentConfigStructure)                           \
894     ((OMX_COMPONENTTYPE*)hComponent)->GetConfig(            \
895         hComponent,                                         \
896         nConfigIndex,                                       \
897         pComponentConfigStructure)       /* Macro End */
898 
899 
900 /** The OMX_SetConfig macro will send one of the configuration
901     structures to a component.  Each structure shall be sent one at a time,
902     each in a separate invocation of the macro.  This macro can be invoked
903     anytime after the component has been loaded.  The application shall
904     allocate the correct structure and shall fill in the structure size
905     and version information (as well as the actual data) before invoking
906     this macro.  The application is free to dispose of this structure after
907     the call as the component is required to copy any data it shall retain.
908     This is a blocking call.
909 
910     The component should return from this call within 5 msec.
911 
912     @param [in] hComponent
913         Handle of the component to be accessed.  This is the component
914         handle returned by the call to the OMX_GetHandle function.
915     @param [in] nConfigIndex
916         Index of the structure to be sent.  This value is from the
917         OMX_INDEXTYPE enumeration above.
918     @param [in] pComponentConfigStructure
919         pointer to application allocated structure to be used for
920         initialization by the component.
921     @return OMX_ERRORTYPE
922         If the command successfully executes, the return code will be
923         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
924     @ingroup comp
925  */
926 #define OMX_SetConfig(                                      \
927         hComponent,                                         \
928         nConfigIndex,                                       \
929         pComponentConfigStructure)                           \
930     ((OMX_COMPONENTTYPE*)hComponent)->SetConfig(            \
931         hComponent,                                         \
932         nConfigIndex,                                       \
933         pComponentConfigStructure)       /* Macro End */
934 
935 
936 /** The OMX_GetExtensionIndex macro will invoke a component to translate
937     a vendor specific configuration or parameter string into an OMX
938     structure index.  There is no requirement for the vendor to support
939     this command for the indexes already found in the OMX_INDEXTYPE
940     enumeration (this is done to save space in small components).  The
941     component shall support all vendor supplied extension indexes not found
942     in the master OMX_INDEXTYPE enumeration.  This is a blocking call.
943 
944     The component should return from this call within 5 msec.
945 
946     @param [in] hComponent
947         Handle of the component to be accessed.  This is the component
948         handle returned by the call to the GetHandle function.
949     @param [in] cParameterName
950         OMX_STRING that shall be less than 128 characters long including
951         the trailing null byte.  This is the string that will get
952         translated by the component into a configuration index.
953     @param [out] pIndexType
954         a pointer to a OMX_INDEXTYPE to receive the index value.
955     @return OMX_ERRORTYPE
956         If the command successfully executes, the return code will be
957         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
958     @ingroup comp
959  */
960 #define OMX_GetExtensionIndex(                              \
961         hComponent,                                         \
962         cParameterName,                                     \
963         pIndexType)                                         \
964     ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex(    \
965         hComponent,                                         \
966         cParameterName,                                     \
967         pIndexType)                     /* Macro End */
968 
969 
970 /** The OMX_GetState macro will invoke the component to get the current
971     state of the component and place the state value into the location
972     pointed to by pState.
973 
974     The component should return from this call within 5 msec.
975 
976     @param [in] hComponent
977         Handle of the component to be accessed.  This is the component
978         handle returned by the call to the OMX_GetHandle function.
979     @param [out] pState
980         pointer to the location to receive the state.  The value returned
981         is one of the OMX_STATETYPE members
982     @return OMX_ERRORTYPE
983         If the command successfully executes, the return code will be
984         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
985     @ingroup comp
986  */
987 #define OMX_GetState(                                       \
988         hComponent,                                         \
989         pState)                                             \
990     ((OMX_COMPONENTTYPE*)hComponent)->GetState(             \
991         hComponent,                                         \
992         pState)                         /* Macro End */
993 
994 
995 /** The OMX_UseBuffer macro will request that the component use
996     a buffer (and allocate its own buffer header) already allocated
997     by another component, or by the IL Client. This is a blocking
998     call.
999 
1000     The component should return from this call within 20 msec.
1001 
1002     @param [in] hComponent
1003         Handle of the component to be accessed.  This is the component
1004         handle returned by the call to the OMX_GetHandle function.
1005     @param [out] ppBuffer
1006         pointer to an OMX_BUFFERHEADERTYPE structure used to receive the
1007         pointer to the buffer header
1008     @return OMX_ERRORTYPE
1009         If the command successfully executes, the return code will be
1010         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1011     @ingroup comp buf
1012  */
1013 
1014 #define OMX_UseBuffer(                                      \
1015            hComponent,                                      \
1016            ppBufferHdr,                                     \
1017            nPortIndex,                                      \
1018            pAppPrivate,                                     \
1019            nSizeBytes,                                      \
1020            pBuffer)                                         \
1021     ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer(            \
1022            hComponent,                                      \
1023            ppBufferHdr,                                     \
1024            nPortIndex,                                      \
1025            pAppPrivate,                                     \
1026            nSizeBytes,                                      \
1027            pBuffer)
1028 
1029 
1030 /** The OMX_AllocateBuffer macro will request that the component allocate
1031     a new buffer and buffer header.  The component will allocate the
1032     buffer and the buffer header and return a pointer to the buffer
1033     header.  This is a blocking call.
1034 
1035     The component should return from this call within 5 msec.
1036 
1037     @param [in] hComponent
1038         Handle of the component to be accessed.  This is the component
1039         handle returned by the call to the OMX_GetHandle function.
1040     @param [out] ppBuffer
1041         pointer to an OMX_BUFFERHEADERTYPE structure used to receive
1042         the pointer to the buffer header
1043     @param [in] nPortIndex
1044         nPortIndex is used to select the port on the component the buffer will
1045         be used with.  The port can be found by using the nPortIndex
1046         value as an index into the Port Definition array of the component.
1047     @param [in] pAppPrivate
1048         pAppPrivate is used to initialize the pAppPrivate member of the
1049         buffer header structure.
1050     @param [in] nSizeBytes
1051         size of the buffer to allocate.  Used when bAllocateNew is true.
1052     @return OMX_ERRORTYPE
1053         If the command successfully executes, the return code will be
1054         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1055     @ingroup comp buf
1056  */
1057 #define OMX_AllocateBuffer(                                 \
1058         hComponent,                                         \
1059         ppBuffer,                                           \
1060         nPortIndex,                                         \
1061         pAppPrivate,                                        \
1062         nSizeBytes)                                         \
1063     ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer(       \
1064         hComponent,                                         \
1065         ppBuffer,                                           \
1066         nPortIndex,                                         \
1067         pAppPrivate,                                        \
1068         nSizeBytes)                     /* Macro End */
1069 
1070 
1071 /** The OMX_FreeBuffer macro will release a buffer header from the component
1072     which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If
1073     the component allocated the buffer (see the OMX_UseBuffer macro) then
1074     the component shall free the buffer and buffer header. This is a
1075     blocking call.
1076 
1077     The component should return from this call within 20 msec.
1078 
1079     @param [in] hComponent
1080         Handle of the component to be accessed.  This is the component
1081         handle returned by the call to the OMX_GetHandle function.
1082     @param [in] nPortIndex
1083         nPortIndex is used to select the port on the component the buffer will
1084         be used with.
1085     @param [in] pBuffer
1086         pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
1087         or AllocateBuffer.
1088     @return OMX_ERRORTYPE
1089         If the command successfully executes, the return code will be
1090         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1091     @ingroup comp buf
1092  */
1093 #define OMX_FreeBuffer(                                     \
1094         hComponent,                                         \
1095         nPortIndex,                                         \
1096         pBuffer)                                            \
1097     ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer(           \
1098         hComponent,                                         \
1099         nPortIndex,                                         \
1100         pBuffer)                        /* Macro End */
1101 
1102 
1103 /** The OMX_EmptyThisBuffer macro will send a buffer full of data to an
1104     input port of a component.  The buffer will be emptied by the component
1105     and returned to the application via the EmptyBufferDone call back.
1106     This is a non-blocking call in that the component will record the buffer
1107     and return immediately and then empty the buffer, later, at the proper
1108     time.  As expected, this macro may be invoked only while the component
1109     is in the OMX_StateExecuting.  If nPortIndex does not specify an input
1110     port, the component shall return an error.
1111 
1112     The component should return from this call within 5 msec.
1113 
1114     @param [in] hComponent
1115         Handle of the component to be accessed.  This is the component
1116         handle returned by the call to the OMX_GetHandle function.
1117     @param [in] pBuffer
1118         pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
1119         or AllocateBuffer.
1120     @return OMX_ERRORTYPE
1121         If the command successfully executes, the return code will be
1122         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1123     @ingroup comp buf
1124  */
1125 #define OMX_EmptyThisBuffer(                                \
1126         hComponent,                                         \
1127         pBuffer)                                            \
1128     ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer(      \
1129         hComponent,                                         \
1130         pBuffer)                        /* Macro End */
1131 
1132 
1133 /** The OMX_FillThisBuffer macro will send an empty buffer to an
1134     output port of a component.  The buffer will be filled by the component
1135     and returned to the application via the FillBufferDone call back.
1136     This is a non-blocking call in that the component will record the buffer
1137     and return immediately and then fill the buffer, later, at the proper
1138     time.  As expected, this macro may be invoked only while the component
1139     is in the OMX_ExecutingState.  If nPortIndex does not specify an output
1140     port, the component shall return an error.
1141 
1142     The component should return from this call within 5 msec.
1143 
1144     @param [in] hComponent
1145         Handle of the component to be accessed.  This is the component
1146         handle returned by the call to the OMX_GetHandle function.
1147     @param [in] pBuffer
1148         pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
1149         or AllocateBuffer.
1150     @return OMX_ERRORTYPE
1151         If the command successfully executes, the return code will be
1152         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1153     @ingroup comp buf
1154  */
1155 #define OMX_FillThisBuffer(                                 \
1156         hComponent,                                         \
1157         pBuffer)                                            \
1158     ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer(       \
1159         hComponent,                                         \
1160         pBuffer)                        /* Macro End */
1161 
1162 
1163 
1164 /** The OMX_UseEGLImage macro will request that the component use
1165     a EGLImage provided by EGL (and allocate its own buffer header)
1166     This is a blocking call.
1167 
1168     The component should return from this call within 20 msec.
1169 
1170     @param [in] hComponent
1171         Handle of the component to be accessed.  This is the component
1172         handle returned by the call to the OMX_GetHandle function.
1173     @param [out] ppBuffer
1174         pointer to an OMX_BUFFERHEADERTYPE structure used to receive the
1175         pointer to the buffer header.  Note that the memory location used
1176         for this buffer is NOT visible to the IL Client.
1177     @param [in] nPortIndex
1178         nPortIndex is used to select the port on the component the buffer will
1179         be used with.  The port can be found by using the nPortIndex
1180         value as an index into the Port Definition array of the component.
1181     @param [in] pAppPrivate
1182         pAppPrivate is used to initialize the pAppPrivate member of the
1183         buffer header structure.
1184     @param [in] eglImage
1185         eglImage contains the handle of the EGLImage to use as a buffer on the
1186         specified port.  The component is expected to validate properties of
1187         the EGLImage against the configuration of the port to ensure the component
1188         can use the EGLImage as a buffer.
1189     @return OMX_ERRORTYPE
1190         If the command successfully executes, the return code will be
1191         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1192     @ingroup comp buf
1193  */
1194 #define OMX_UseEGLImage(                                    \
1195            hComponent,                                      \
1196            ppBufferHdr,                                     \
1197            nPortIndex,                                      \
1198            pAppPrivate,                                     \
1199            eglImage)                                        \
1200     ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage(          \
1201            hComponent,                                      \
1202            ppBufferHdr,                                     \
1203            nPortIndex,                                      \
1204            pAppPrivate,                                     \
1205            eglImage)
1206 
1207 /** The OMX_Init method is used to initialize the OMX core.  It shall be the
1208     first call made into OMX and it should only be executed one time without
1209     an interviening OMX_Deinit call.
1210 
1211     The core should return from this call within 20 msec.
1212 
1213     @return OMX_ERRORTYPE
1214         If the command successfully executes, the return code will be
1215         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1216     @ingroup core
1217  */
1218 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void);
1219 
1220 
1221 /** The OMX_Deinit method is used to deinitialize the OMX core.  It shall be
1222     the last call made into OMX. In the event that the core determines that
1223     thare are components loaded when this call is made, the core may return
1224     with an error rather than try to unload the components.
1225 
1226     The core should return from this call within 20 msec.
1227 
1228     @return OMX_ERRORTYPE
1229         If the command successfully executes, the return code will be
1230         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1231     @ingroup core
1232  */
1233 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void);
1234 
1235 
1236 /** The OMX_ComponentNameEnum method will enumerate through all the names of
1237     recognised valid components in the system. This function is provided
1238     as a means to detect all the components in the system run-time. There is
1239     no strict ordering to the enumeration order of component names, although
1240     each name will only be enumerated once.  If the OMX core supports run-time
1241     installation of new components, it is only requried to detect newly
1242     installed components when the first call to enumerate component names
1243     is made (i.e. when nIndex is 0x0).
1244 
1245     The core should return from this call in 20 msec.
1246 
1247     @param [out] cComponentName
1248         pointer to a null terminated string with the component name.  The
1249         names of the components are strings less than 127 bytes in length
1250         plus the trailing null for a maximum size of 128 bytes.  An example
1251         of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0".  Names are
1252         assigned by the vendor, but shall start with "OMX." and then have
1253         the Vendor designation next.
1254     @param [in] nNameLength
1255         number of characters in the cComponentName string.  With all
1256         component name strings restricted to less than 128 characters
1257         (including the trailing null) it is recomended that the caller
1258         provide a input string for the cComponentName of 128 characters.
1259     @param [in] nIndex
1260         number containing the enumeration index for the component.
1261         Multiple calls to OMX_ComponentNameEnum with increasing values
1262         of nIndex will enumerate through the component names in the
1263         system until OMX_ErrorNoMore is returned.  The value of nIndex
1264         is 0 to (N-1), where N is the number of valid installed components
1265         in the system.
1266     @return OMX_ERRORTYPE
1267         If the command successfully executes, the return code will be
1268         OMX_ErrorNone.  When the value of nIndex exceeds the number of
1269         components in the system minus 1, OMX_ErrorNoMore will be
1270         returned. Otherwise the appropriate OMX error will be returned.
1271     @ingroup core
1272  */
1273 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum(
1274     OMX_OUT OMX_STRING cComponentName,
1275     OMX_IN  OMX_U32 nNameLength,
1276     OMX_IN  OMX_U32 nIndex);
1277 
1278 
1279 /** The OMX_GetHandle method will locate the component specified by the
1280     component name given, load that component into memory and then invoke
1281     the component's methods to create an instance of the component.
1282 
1283     The core should return from this call within 20 msec.
1284 
1285     @param [out] pHandle
1286         pointer to an OMX_HANDLETYPE pointer to be filled in by this method.
1287     @param [in] cComponentName
1288         pointer to a null terminated string with the component name.  The
1289         names of the components are strings less than 127 bytes in length
1290         plus the trailing null for a maximum size of 128 bytes.  An example
1291         of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0".  Names are
1292         assigned by the vendor, but shall start with "OMX." and then have
1293         the Vendor designation next.
1294     @param [in] pAppData
1295         pointer to an application defined value that will be returned
1296         during callbacks so that the application can identify the source
1297         of the callback.
1298     @param [in] pCallBacks
1299         pointer to a OMX_CALLBACKTYPE structure that will be passed to the
1300         component to initialize it with.
1301     @return OMX_ERRORTYPE
1302         If the command successfully executes, the return code will be
1303         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1304     @ingroup core
1305  */
1306 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(
1307     OMX_OUT OMX_HANDLETYPE* pHandle,
1308     OMX_IN  OMX_STRING cComponentName,
1309     OMX_IN  OMX_PTR pAppData,
1310     OMX_IN  OMX_CALLBACKTYPE* pCallBacks);
1311 
1312 
1313 /** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle
1314     method.  If the component reference count goes to zero, the component will
1315     be unloaded from memory.
1316 
1317     The core should return from this call within 20 msec when the component is
1318     in the OMX_StateLoaded state.
1319 
1320     @param [in] hComponent
1321         Handle of the component to be accessed.  This is the component
1322         handle returned by the call to the GetHandle function.
1323     @return OMX_ERRORTYPE
1324         If the command successfully executes, the return code will be
1325         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1326     @ingroup core
1327  */
1328 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle(
1329     OMX_IN  OMX_HANDLETYPE hComponent);
1330 
1331 
1332 
1333 /** The OMX_SetupTunnel method will handle the necessary calls to the components
1334     to setup the specified tunnel the two components.  NOTE: This is
1335     an actual method (not a #define macro).  This method will make calls into
1336     the component ComponentTunnelRequest method to do the actual tunnel
1337     connection.
1338 
1339     The ComponentTunnelRequest method on both components will be called.
1340     This method shall not be called unless the component is in the
1341     OMX_StateLoaded state except when the ports used for the tunnel are
1342     disabled. In this case, the component may be in the OMX_StateExecuting,
1343     OMX_StatePause, or OMX_StateIdle states.
1344 
1345     The core should return from this call within 20 msec.
1346 
1347     @param [in] hOutput
1348         Handle of the component to be accessed.  Also this is the handle
1349         of the component whose port, specified in the nPortOutput parameter
1350         will be used the source for the tunnel. This is the component handle
1351         returned by the call to the OMX_GetHandle function.  There is a
1352         requirement that hOutput be the source for the data when
1353         tunelling (i.e. nPortOutput is an output port).  If 0x0, the component
1354         specified in hInput will have it's port specified in nPortInput
1355         setup for communication with the application / IL client.
1356     @param [in] nPortOutput
1357         nPortOutput is used to select the source port on component to be
1358         used in the tunnel.
1359     @param [in] hInput
1360         This is the component to setup the tunnel with. This is the handle
1361         of the component whose port, specified in the nPortInput parameter
1362         will be used the destination for the tunnel. This is the component handle
1363         returned by the call to the OMX_GetHandle function.  There is a
1364         requirement that hInput be the destination for the data when
1365         tunelling (i.e. nPortInut is an input port).   If 0x0, the component
1366         specified in hOutput will have it's port specified in nPortPOutput
1367         setup for communication with the application / IL client.
1368     @param [in] nPortInput
1369         nPortInput is used to select the destination port on component to be
1370         used in the tunnel.
1371     @return OMX_ERRORTYPE
1372         If the command successfully executes, the return code will be
1373         OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
1374         When OMX_ErrorNotImplemented is returned, one or both components is
1375         a non-interop component and does not support tunneling.
1376 
1377         On failure, the ports of both components are setup for communication
1378         with the application / IL Client.
1379     @ingroup core tun
1380  */
1381 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel(
1382     OMX_IN  OMX_HANDLETYPE hOutput,
1383     OMX_IN  OMX_U32 nPortOutput,
1384     OMX_IN  OMX_HANDLETYPE hInput,
1385     OMX_IN  OMX_U32 nPortInput);
1386 
1387 /** @ingroup cp */
1388 OMX_API OMX_ERRORTYPE   OMX_GetContentPipe(
1389     OMX_OUT OMX_HANDLETYPE *hPipe,
1390     OMX_IN OMX_STRING szURI);
1391 
1392 /** The OMX_GetComponentsOfRole method will return the number of components that support the given
1393     role and (if the compNames field is non-NULL) the names of those components. The call will fail if
1394     an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
1395     client should:
1396         * first call this function with the compNames field NULL to determine the number of component names
1397         * second call this function with the compNames field pointing to an array of names allocated
1398           according to the number returned by the first call.
1399 
1400     The core should return from this call within 5 msec.
1401 
1402     @param [in] role
1403         This is generic standard component name consisting only of component class
1404         name and the type within that class (e.g. 'audio_decoder.aac').
1405     @param [inout] pNumComps
1406         This is used both as input and output.
1407 
1408         If compNames is NULL, the input is ignored and the output specifies how many components support
1409         the given role.
1410 
1411         If compNames is not NULL, on input it bounds the size of the input structure and
1412         on output, it specifies the number of components string names listed within the compNames parameter.
1413     @param [inout] compNames
1414         If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts
1415         a list of the names of all physical components that implement the specified standard component name.
1416         Each name is NULL terminated. numComps indicates the number of names.
1417     @ingroup core
1418  */
1419 OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole (
1420     OMX_IN      OMX_STRING role,
1421     OMX_INOUT   OMX_U32 *pNumComps,
1422     OMX_INOUT   OMX_U8  **compNames);
1423 
1424 /** The OMX_GetRolesOfComponent method will return the number of roles supported by the given
1425     component and (if the roles field is non-NULL) the names of those roles. The call will fail if
1426     an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
1427     client should:
1428         * first call this function with the roles field NULL to determine the number of role names
1429         * second call this function with the roles field pointing to an array of names allocated
1430           according to the number returned by the first call.
1431 
1432     The core should return from this call within 5 msec.
1433 
1434     @param [in] compName
1435         This is the name of the component being queried about.
1436     @param [inout] pNumRoles
1437         This is used both as input and output.
1438 
1439         If roles is NULL, the input is ignored and the output specifies how many roles the component supports.
1440 
1441         If compNames is not NULL, on input it bounds the size of the input structure and
1442         on output, it specifies the number of roles string names listed within the roles parameter.
1443     @param [out] roles
1444         If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings
1445         which accepts a list of the names of all standard components roles implemented on the
1446         specified component name. numComps indicates the number of names.
1447     @ingroup core
1448  */
1449 OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent (
1450     OMX_IN      OMX_STRING compName,
1451     OMX_INOUT   OMX_U32 *pNumRoles,
1452     OMX_OUT     OMX_U8 **roles);
1453 
1454 #ifdef __cplusplus
1455 }
1456 #endif /* __cplusplus */
1457 
1458 #endif
1459 /* File EOF */
1460 
1461