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