tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

OMX_Core.h (68983B)


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