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