omxil/omxilapi/v1_x/OMX_Other.h
changeset 56 b6488ac24ddc
parent 47 481b3bce574a
child 57 1cbb0d5bf7f2
equal deleted inserted replaced
47:481b3bce574a 56:b6488ac24ddc
     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 /** @file 
       
    25  *  OpenMax IL version 1.1.2
       
    26  *  The structures needed by Other components to exchange
       
    27  *  parameters and configuration data with the components.
       
    28  */
       
    29 
       
    30 #ifndef OMX_Other_h
       
    31 #define OMX_Other_h
       
    32 
       
    33 #ifdef __cplusplus
       
    34 extern "C" {
       
    35 #endif /* __cplusplus */
       
    36 
       
    37 
       
    38 /* Each OMX header must include all required header files to allow the
       
    39  *  header to compile without errors.  The includes below are required
       
    40  *  for this header file to compile successfully 
       
    41  */
       
    42 
       
    43 #include <openmax/il/khronos/v1_x/OMX_Core.h>
       
    44 
       
    45 
       
    46 /** 
       
    47  * Enumeration of possible data types which match to multiple domains or no
       
    48  * domain at all.  For types which are vendor specific, a value above
       
    49  * OMX_OTHER_VENDORTSTART should be used.
       
    50  */
       
    51 typedef enum OMX_OTHER_FORMATTYPE {
       
    52     OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time, 
       
    53                                    time deltas, etc */
       
    54     OMX_OTHER_FormatPower,    /**< Perhaps used for enabling/disabling power 
       
    55                                    management, setting clocks? */
       
    56     OMX_OTHER_FormatStats,    /**< Could be things such as frame rate, frames 
       
    57                                    dropped, etc */
       
    58     OMX_OTHER_FormatBinary,   /**< Arbitrary binary data */
       
    59     OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific 
       
    60                                                 formats */
       
    61 
       
    62     OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
       
    63     OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
       
    64     OMX_OTHER_FormatMax = 0x7FFFFFFF
       
    65 } OMX_OTHER_FORMATTYPE;
       
    66 
       
    67 /** 
       
    68  * Enumeration of seek modes.
       
    69  */
       
    70 typedef enum OMX_TIME_SEEKMODETYPE {
       
    71     OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation
       
    72                                 * of the requested seek position over   
       
    73                                 * the actual seek position if it
       
    74                                 * results in a faster seek. */
       
    75     OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek 
       
    76                                 * position over an approximation
       
    77                                 * of the requested seek position even
       
    78                                 * if it results in a slower seek. */
       
    79     OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
       
    80     OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
       
    81     OMX_TIME_SeekModeMax = 0x7FFFFFFF
       
    82 } OMX_TIME_SEEKMODETYPE;
       
    83 
       
    84 /* Structure representing the seekmode of the component */
       
    85 typedef struct OMX_TIME_CONFIG_SEEKMODETYPE {
       
    86     OMX_U32 nSize;                  /**< size of the structure in bytes */
       
    87     OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
       
    88     OMX_TIME_SEEKMODETYPE eType;    /**< The seek mode */
       
    89 } OMX_TIME_CONFIG_SEEKMODETYPE;
       
    90 
       
    91 /** Structure representing a time stamp used with the following configs 
       
    92  * on the Clock Component (CC):
       
    93  * 
       
    94  * OMX_IndexConfigTimeCurrentWallTime: query of the CC’s current wall  
       
    95  *     time
       
    96  * OMX_IndexConfigTimeCurrentMediaTime: query of the CC’s current media
       
    97  *     time
       
    98  * OMX_IndexConfigTimeCurrentAudioReference and  
       
    99  * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference 
       
   100  *     clock sending SC its reference time
       
   101  * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends 
       
   102  *     this structure to the Clock Component via a SetConfig on its 
       
   103  *     client port when it receives a buffer with
       
   104  *     OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp
       
   105  *     specified by that buffer for nStartTimestamp. 
       
   106  *
       
   107  * It’s also used with the following config on components in general:
       
   108  *
       
   109  * OMX_IndexConfigTimePosition: IL client querying component position 
       
   110  * (GetConfig) or commanding a component to seek to the given location
       
   111  * (SetConfig)
       
   112  */	
       
   113 typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE {
       
   114     OMX_U32 nSize;               /**< size of the structure in bytes */
       
   115     OMX_VERSIONTYPE nVersion;    /**< OMX specification version
       
   116                                   *   information */
       
   117     OMX_U32 nPortIndex;     /**< port that this structure applies to */
       
   118     OMX_TICKS nTimestamp;  	     /**< timestamp .*/ 
       
   119 } OMX_TIME_CONFIG_TIMESTAMPTYPE;  
       
   120 
       
   121 /** Enumeration of possible reference clocks to the media time. */
       
   122 typedef enum OMX_TIME_UPDATETYPE {
       
   123       OMX_TIME_UpdateRequestFulfillment,    /**< Update is the fulfillment of a media time request. */
       
   124       OMX_TIME_UpdateScaleChanged,	        /**< Update was generated because the scale chagned. */
       
   125       OMX_TIME_UpdateClockStateChanged,     /**< Update was generated because the clock state changed. */
       
   126       OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
       
   127       OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
       
   128       OMX_TIME_UpdateMax = 0x7FFFFFFF
       
   129 } OMX_TIME_UPDATETYPE;
       
   130 
       
   131 /** Enumeration of possible reference clocks to the media time. */
       
   132 typedef enum OMX_TIME_REFCLOCKTYPE {
       
   133       OMX_TIME_RefClockNone,    /**< Use no references. */
       
   134       OMX_TIME_RefClockAudio,	/**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */
       
   135       OMX_TIME_RefClockVideo,   /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */
       
   136       OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
       
   137       OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
       
   138       OMX_TIME_RefClockMax = 0x7FFFFFFF
       
   139 } OMX_TIME_REFCLOCKTYPE;
       
   140 
       
   141 /** Enumeration of clock states. */
       
   142 typedef enum OMX_TIME_CLOCKSTATE {
       
   143       OMX_TIME_ClockStateRunning,             /**< Clock running. */
       
   144       OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the 
       
   145                                                *   prescribed clients emit their
       
   146                                                *   start time. */
       
   147       OMX_TIME_ClockStateStopped,             /**< Clock stopped. */
       
   148       OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
       
   149       OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
       
   150       OMX_TIME_ClockStateMax = 0x7FFFFFFF
       
   151 } OMX_TIME_CLOCKSTATE;
       
   152 
       
   153 /** Structure representing a media time request to the clock component.
       
   154  *
       
   155  *  A client component sends this structure to the Clock Component via a SetConfig
       
   156  *  on its client port to specify a media timestamp the Clock Component
       
   157  *  should emit.  The Clock Component should fulfill the request by sending a
       
   158  *  OMX_TIME_MEDIATIMETYPE when its media clock matches the requested 
       
   159  *  timestamp.
       
   160  *
       
   161  *  The client may require a media time request be fulfilled slightly
       
   162  *  earlier than the media time specified. In this case the client specifies 
       
   163  *  an offset which is equal to the difference between wall time corresponding 
       
   164  *  to the requested media time and the wall time when it will be 
       
   165  *  fulfilled. 
       
   166  *
       
   167  *  A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to
       
   168  *  time events according to timestamps. If a client must perform an operation O at
       
   169  *  a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a 
       
   170  *  media time request at T (perhaps specifying an offset to ensure the request fulfillment
       
   171  *  is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE
       
   172  *  structure back to the client component, the client may perform operation O (perhaps having
       
   173  *  to wait a slight amount more time itself as specified by the return values).
       
   174  */
       
   175 
       
   176 typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE {
       
   177     OMX_U32 nSize;              /**< size of the structure in bytes */
       
   178     OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
       
   179     OMX_U32 nPortIndex;         /**< port that this structure applies to */
       
   180     OMX_PTR pClientPrivate;     /**< Client private data to disabiguate this media time 
       
   181                                  *   from others (e.g. the number of the frame to deliver). 
       
   182                                  *   Duplicated in the media time structure that fulfills 
       
   183                                  *   this request. A value of zero is reserved for time scale 
       
   184                                  *   updates. */
       
   185     OMX_TICKS nMediaTimestamp;  /**< Media timestamp requested.*/ 
       
   186     OMX_TICKS nOffset;          /**< Amount of wall clock time by which this
       
   187                                  *   request should be fulfilled early */
       
   188 } OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE;
       
   189 
       
   190 /**< Structure sent from the clock component client either when fulfilling 
       
   191  *   a media time request or when the time scale has changed. 
       
   192  *
       
   193  *   In the former case the Clock Component fills this structure and times its emission 
       
   194  *   to a client component (via the client port) according to the corresponding media 
       
   195  *   time request sent by the client. The Clock Component should time the emission to occur
       
   196  *   when the requested timestamp matches the Clock Component's media time but also the 
       
   197  *   prescribed offset early. 
       
   198  *
       
   199  *   Upon scale changes the clock component clears the nClientPrivate data, sends the current
       
   200  *   media time and sets the nScale to the new scale via the client port. It emits a 
       
   201  *   OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to 
       
   202  *   alter processing to accomodate scaling. For instance a video component might skip inter-frames 
       
   203  *   in the case of extreme fastforward. Likewise an audio component might add or remove samples 
       
   204  *   from an audio frame to scale audio data. 
       
   205  *
       
   206  *   It is expected that some clock components may not be able to fulfill requests
       
   207  *   at exactly the prescribed time. This is acceptable so long as the request is 
       
   208  *   fulfilled at least as early as described and not later. This structure provides 
       
   209  *   fields the client may use to wait for the remaining time.
       
   210  *
       
   211  *   The client may use either the nOffset or nWallTimeAtMedia fields to determine the 
       
   212  *   wall time until the nMediaTimestamp actually occurs. In the latter case the
       
   213  *   client can get a more accurate value for offset by getting the current wall
       
   214  *   from the cloc component and subtracting it from nWallTimeAtMedia. 
       
   215  */
       
   216 
       
   217 typedef struct OMX_TIME_MEDIATIMETYPE {
       
   218     OMX_U32 nSize;                  /**< size of the structure in bytes */
       
   219     OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
       
   220     OMX_U32 nClientPrivate;         /**< Client private data to disabiguate this media time 
       
   221                                      *   from others. Copied from the media time request. 
       
   222                                      *   A value of zero is reserved for time scale updates. */
       
   223     OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */
       
   224     OMX_TICKS nMediaTimestamp;      /**< Media time requested. If no media time was 
       
   225                                      *   requested then this is the current media time. */ 
       
   226     OMX_TICKS nOffset;              /**< Amount of wall clock time by which this
       
   227                                      *   request was actually fulfilled early */
       
   228 
       
   229     OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp.
       
   230                                      *   A client may compare this value to current
       
   231                                      *   media time obtained from the Clock Component to determine
       
   232                                      *   the wall time until the media timestamp is really
       
   233                                      *   current. */
       
   234     OMX_S32 xScale;                 /**< Current media time scale in Q16 format. */
       
   235     OMX_TIME_CLOCKSTATE eState;     /* Seeking Change. Added 7/12.*/
       
   236                                     /**< State of the media time. */
       
   237 } OMX_TIME_MEDIATIMETYPE;  
       
   238 
       
   239 /** Structure representing the current media time scale factor. Applicable only to clock 
       
   240  *  component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via
       
   241  *  the clock component client ports. Upon recieving this config the clock component changes 
       
   242  *  the rate by which the media time increases or decreases effectively implementing trick modes. 
       
   243  */ 
       
   244 typedef struct OMX_TIME_CONFIG_SCALETYPE {
       
   245     OMX_U32 nSize;                  /**< size of the structure in bytes */
       
   246     OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
       
   247     OMX_S32 xScale;                 /**< This is a value in Q16 format which is used for
       
   248                                      * scaling the media time */
       
   249 } OMX_TIME_CONFIG_SCALETYPE;
       
   250  
       
   251 /** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPE’s nWaitMask field */
       
   252 #define OMX_CLOCKPORT0 0x00000001
       
   253 #define OMX_CLOCKPORT1 0x00000002
       
   254 #define OMX_CLOCKPORT2 0x00000004
       
   255 #define OMX_CLOCKPORT3 0x00000008
       
   256 #define OMX_CLOCKPORT4 0x00000010
       
   257 #define OMX_CLOCKPORT5 0x00000020
       
   258 #define OMX_CLOCKPORT6 0x00000040
       
   259 #define OMX_CLOCKPORT7 0x00000080
       
   260 
       
   261 /** Structure representing the current mode of the media clock. 
       
   262  *  IL Client uses this config to change or query the mode of the 
       
   263  *  media clock of the clock component. Applicable only to clock
       
   264  *  component. 
       
   265  *  
       
   266  *  On a SetConfig if eState is OMX_TIME_ClockStateRunning media time
       
   267  *  starts immediately at the prescribed start time. If
       
   268  *  OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores
       
   269  *  the given nStartTime and waits for all clients specified in the 
       
   270  *  nWaitMask to send starttimes (via 
       
   271  *  OMX_IndexConfigTimeClientStartTime). The Clock Component then starts 
       
   272  *  the media clock using the earliest start time supplied. */    
       
   273 typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE {
       
   274     OMX_U32 nSize;              /**< size of the structure in bytes */
       
   275     OMX_VERSIONTYPE nVersion;   /**< OMX specification version 
       
   276                                  *   information */
       
   277     OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */
       
   278     OMX_TICKS nStartTime;       /**< Start time of the media time. */
       
   279     OMX_TICKS nOffset;          /**< Time to offset the media time by 
       
   280                                  * (e.g. preroll). Media time will be
       
   281                                  * reported to be nOffset ticks earlier.     
       
   282                                  */
       
   283     OMX_U32 nWaitMask;          /**< Mask of OMX_CLOCKPORT values. */
       
   284 } OMX_TIME_CONFIG_CLOCKSTATETYPE;
       
   285 
       
   286 /** Structure representing the reference clock currently being used to
       
   287  *  compute media time. IL client uses this config to change or query the 
       
   288  *  clock component's active reference clock */
       
   289 typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE {
       
   290     OMX_U32 nSize;                  /**< size of the structure in bytes */
       
   291     OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
       
   292     OMX_TIME_REFCLOCKTYPE eClock;   /**< Reference clock used to compute media time */                        
       
   293 } OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE;
       
   294 
       
   295 /** Descriptor for setting specifics of power type.
       
   296  *  Note: this structure is listed for backwards compatibility. */
       
   297 typedef struct OMX_OTHER_CONFIG_POWERTYPE {
       
   298     OMX_U32 nSize;            /**< size of the structure in bytes */
       
   299     OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
       
   300     OMX_BOOL bEnablePM;       /**< Flag to enable Power Management */
       
   301 } OMX_OTHER_CONFIG_POWERTYPE;
       
   302 
       
   303 
       
   304 /** Descriptor for setting specifics of stats type.
       
   305  *  Note: this structure is listed for backwards compatibility. */
       
   306 typedef struct OMX_OTHER_CONFIG_STATSTYPE {
       
   307     OMX_U32 nSize;            /**< size of the structure in bytes */
       
   308     OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
       
   309     /* what goes here */
       
   310 } OMX_OTHER_CONFIG_STATSTYPE;
       
   311 
       
   312 
       
   313 /**
       
   314  * The PortDefinition structure is used to define all of the parameters 
       
   315  * necessary for the compliant component to setup an input or an output other 
       
   316  * path.
       
   317  */
       
   318 typedef struct OMX_OTHER_PORTDEFINITIONTYPE {
       
   319     OMX_OTHER_FORMATTYPE eFormat;  /**< Type of data expected for this channel */
       
   320 } OMX_OTHER_PORTDEFINITIONTYPE;
       
   321 
       
   322 /**  Port format parameter.  This structure is used to enumerate
       
   323   *  the various data input/output format supported by the port.
       
   324   */
       
   325 typedef struct OMX_OTHER_PARAM_PORTFORMATTYPE {
       
   326     OMX_U32 nSize; /**< size of the structure in bytes */
       
   327     OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
       
   328     OMX_U32 nPortIndex; /**< Indicates which port to set */
       
   329     OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
       
   330     OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
       
   331 } OMX_OTHER_PARAM_PORTFORMATTYPE; 
       
   332 
       
   333 #ifdef __cplusplus
       
   334 }
       
   335 #endif /* __cplusplus */
       
   336 
       
   337 #endif
       
   338 /* File EOF */