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