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