1 /* 2 * Copyright (c) 2010 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_VideoExt.h - OpenMax IL version 1.1.2 25 * The OMX_VideoExt header file contains extensions to the 26 * definitions used by both the application and the component to 27 * access video items. 28 */ 29 30 #ifndef OMX_VideoExt_h 31 #define OMX_VideoExt_h 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif /* __cplusplus */ 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 #include <OMX_Core.h> 42 43 /** NALU Formats */ 44 typedef enum OMX_NALUFORMATSTYPE { 45 OMX_NaluFormatStartCodes = 1, 46 OMX_NaluFormatOneNaluPerBuffer = 2, 47 OMX_NaluFormatOneByteInterleaveLength = 4, 48 OMX_NaluFormatTwoByteInterleaveLength = 8, 49 OMX_NaluFormatFourByteInterleaveLength = 16, 50 OMX_NaluFormatCodingMax = 0x7FFFFFFF 51 } OMX_NALUFORMATSTYPE; 52 53 /** NAL Stream Format */ 54 typedef struct OMX_NALSTREAMFORMATTYPE{ 55 OMX_U32 nSize; 56 OMX_VERSIONTYPE nVersion; 57 OMX_U32 nPortIndex; 58 OMX_NALUFORMATSTYPE eNaluFormat; 59 } OMX_NALSTREAMFORMATTYPE; 60 61 /** VP8 profiles */ 62 typedef enum OMX_VIDEO_VP8PROFILETYPE { 63 OMX_VIDEO_VP8ProfileMain = 0x01, 64 OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF, 65 OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF 66 } OMX_VIDEO_VP8PROFILETYPE; 67 68 /** VP8 levels */ 69 typedef enum OMX_VIDEO_VP8LEVELTYPE { 70 OMX_VIDEO_VP8Level_Version0 = 0x01, 71 OMX_VIDEO_VP8Level_Version1 = 0x02, 72 OMX_VIDEO_VP8Level_Version2 = 0x04, 73 OMX_VIDEO_VP8Level_Version3 = 0x08, 74 OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF, 75 OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF 76 } OMX_VIDEO_VP8LEVELTYPE; 77 78 /** VP8 Param */ 79 typedef struct OMX_VIDEO_PARAM_VP8TYPE { 80 OMX_U32 nSize; 81 OMX_VERSIONTYPE nVersion; 82 OMX_U32 nPortIndex; 83 OMX_VIDEO_VP8PROFILETYPE eProfile; 84 OMX_VIDEO_VP8LEVELTYPE eLevel; 85 OMX_U32 nDCTPartitions; 86 OMX_BOOL bErrorResilientMode; 87 } OMX_VIDEO_PARAM_VP8TYPE; 88 89 /** Structure for configuring VP8 reference frames */ 90 typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE { 91 OMX_U32 nSize; 92 OMX_VERSIONTYPE nVersion; 93 OMX_U32 nPortIndex; 94 OMX_BOOL bPreviousFrameRefresh; 95 OMX_BOOL bGoldenFrameRefresh; 96 OMX_BOOL bAlternateFrameRefresh; 97 OMX_BOOL bUsePreviousFrame; 98 OMX_BOOL bUseGoldenFrame; 99 OMX_BOOL bUseAlternateFrame; 100 } OMX_VIDEO_VP8REFERENCEFRAMETYPE; 101 102 /** Structure for querying VP8 reference frame type */ 103 typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE { 104 OMX_U32 nSize; 105 OMX_VERSIONTYPE nVersion; 106 OMX_U32 nPortIndex; 107 OMX_BOOL bIsIntraFrame; 108 OMX_BOOL bIsGoldenOrAlternateFrame; 109 } OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE; 110 111 /** Maximum number of VP8 temporal layers */ 112 #define OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS 3 113 114 /** VP8 temporal layer patterns */ 115 typedef enum OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE { 116 OMX_VIDEO_VPXTemporalLayerPatternNone = 0, 117 OMX_VIDEO_VPXTemporalLayerPatternWebRTC = 1, 118 OMX_VIDEO_VPXTemporalLayerPatternMax = 0x7FFFFFFF 119 } OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE; 120 121 /** 122 * Android specific VP8/VP9 encoder params 123 * 124 * STRUCT MEMBERS: 125 * nSize : Size of the structure in bytes 126 * nVersion : OMX specification version information 127 * nPortIndex : Port that this structure applies to 128 * nKeyFrameInterval : Key frame interval in frames 129 * eTemporalPattern : Type of temporal layer pattern 130 * nTemporalLayerCount : Number of temporal coding layers 131 * nTemporalLayerBitrateRatio : Bitrate ratio allocation between temporal 132 * streams in percentage 133 * nMinQuantizer : Minimum (best quality) quantizer 134 * nMaxQuantizer : Maximum (worst quality) quantizer 135 */ 136 typedef struct OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE { 137 OMX_U32 nSize; 138 OMX_VERSIONTYPE nVersion; 139 OMX_U32 nPortIndex; 140 OMX_U32 nKeyFrameInterval; // distance between consecutive key_frames (including one 141 // of the key_frames). 0 means interval is unspecified and 142 // can be freely chosen by the codec. 1 means a stream of 143 // only key_frames. 144 145 OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE eTemporalPattern; 146 OMX_U32 nTemporalLayerCount; 147 OMX_U32 nTemporalLayerBitrateRatio[OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS]; 148 OMX_U32 nMinQuantizer; 149 OMX_U32 nMaxQuantizer; 150 } OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE; 151 152 /** VP9 profiles */ 153 typedef enum OMX_VIDEO_VP9PROFILETYPE { 154 OMX_VIDEO_VP9Profile0 = 0x1, 155 OMX_VIDEO_VP9Profile1 = 0x2, 156 OMX_VIDEO_VP9Profile2 = 0x4, 157 OMX_VIDEO_VP9Profile3 = 0x8, 158 // HDR profiles also support passing HDR metadata 159 OMX_VIDEO_VP9Profile2HDR = 0x1000, 160 OMX_VIDEO_VP9Profile3HDR = 0x2000, 161 OMX_VIDEO_VP9ProfileUnknown = 0x6EFFFFFF, 162 OMX_VIDEO_VP9ProfileMax = 0x7FFFFFFF 163 } OMX_VIDEO_VP9PROFILETYPE; 164 165 /** VP9 levels */ 166 typedef enum OMX_VIDEO_VP9LEVELTYPE { 167 OMX_VIDEO_VP9Level1 = 0x0, 168 OMX_VIDEO_VP9Level11 = 0x1, 169 OMX_VIDEO_VP9Level2 = 0x2, 170 OMX_VIDEO_VP9Level21 = 0x4, 171 OMX_VIDEO_VP9Level3 = 0x8, 172 OMX_VIDEO_VP9Level31 = 0x10, 173 OMX_VIDEO_VP9Level4 = 0x20, 174 OMX_VIDEO_VP9Level41 = 0x40, 175 OMX_VIDEO_VP9Level5 = 0x80, 176 OMX_VIDEO_VP9Level51 = 0x100, 177 OMX_VIDEO_VP9Level52 = 0x200, 178 OMX_VIDEO_VP9Level6 = 0x400, 179 OMX_VIDEO_VP9Level61 = 0x800, 180 OMX_VIDEO_VP9Level62 = 0x1000, 181 OMX_VIDEO_VP9LevelUnknown = 0x6EFFFFFF, 182 OMX_VIDEO_VP9LevelMax = 0x7FFFFFFF 183 } OMX_VIDEO_VP9LEVELTYPE; 184 185 /** 186 * VP9 Parameters. 187 * Encoder specific parameters (decoders should ignore these fields): 188 * - bErrorResilientMode 189 * - nTileRows 190 * - nTileColumns 191 * - bEnableFrameParallelDecoding 192 */ 193 typedef struct OMX_VIDEO_PARAM_VP9TYPE { 194 OMX_U32 nSize; 195 OMX_VERSIONTYPE nVersion; 196 OMX_U32 nPortIndex; 197 OMX_VIDEO_VP9PROFILETYPE eProfile; 198 OMX_VIDEO_VP9LEVELTYPE eLevel; 199 OMX_BOOL bErrorResilientMode; 200 OMX_U32 nTileRows; 201 OMX_U32 nTileColumns; 202 OMX_BOOL bEnableFrameParallelDecoding; 203 } OMX_VIDEO_PARAM_VP9TYPE; 204 205 /** HEVC Profile enum type */ 206 typedef enum OMX_VIDEO_HEVCPROFILETYPE { 207 OMX_VIDEO_HEVCProfileUnknown = 0x0, 208 OMX_VIDEO_HEVCProfileMain = 0x1, 209 OMX_VIDEO_HEVCProfileMain10 = 0x2, 210 // Main10 profile with HDR SEI support. 211 OMX_VIDEO_HEVCProfileMain10HDR10 = 0x1000, 212 OMX_VIDEO_HEVCProfileMax = 0x7FFFFFFF 213 } OMX_VIDEO_HEVCPROFILETYPE; 214 215 /** HEVC Level enum type */ 216 typedef enum OMX_VIDEO_HEVCLEVELTYPE { 217 OMX_VIDEO_HEVCLevelUnknown = 0x0, 218 OMX_VIDEO_HEVCMainTierLevel1 = 0x1, 219 OMX_VIDEO_HEVCHighTierLevel1 = 0x2, 220 OMX_VIDEO_HEVCMainTierLevel2 = 0x4, 221 OMX_VIDEO_HEVCHighTierLevel2 = 0x8, 222 OMX_VIDEO_HEVCMainTierLevel21 = 0x10, 223 OMX_VIDEO_HEVCHighTierLevel21 = 0x20, 224 OMX_VIDEO_HEVCMainTierLevel3 = 0x40, 225 OMX_VIDEO_HEVCHighTierLevel3 = 0x80, 226 OMX_VIDEO_HEVCMainTierLevel31 = 0x100, 227 OMX_VIDEO_HEVCHighTierLevel31 = 0x200, 228 OMX_VIDEO_HEVCMainTierLevel4 = 0x400, 229 OMX_VIDEO_HEVCHighTierLevel4 = 0x800, 230 OMX_VIDEO_HEVCMainTierLevel41 = 0x1000, 231 OMX_VIDEO_HEVCHighTierLevel41 = 0x2000, 232 OMX_VIDEO_HEVCMainTierLevel5 = 0x4000, 233 OMX_VIDEO_HEVCHighTierLevel5 = 0x8000, 234 OMX_VIDEO_HEVCMainTierLevel51 = 0x10000, 235 OMX_VIDEO_HEVCHighTierLevel51 = 0x20000, 236 OMX_VIDEO_HEVCMainTierLevel52 = 0x40000, 237 OMX_VIDEO_HEVCHighTierLevel52 = 0x80000, 238 OMX_VIDEO_HEVCMainTierLevel6 = 0x100000, 239 OMX_VIDEO_HEVCHighTierLevel6 = 0x200000, 240 OMX_VIDEO_HEVCMainTierLevel61 = 0x400000, 241 OMX_VIDEO_HEVCHighTierLevel61 = 0x800000, 242 OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000, 243 OMX_VIDEO_HEVCHighTierLevel62 = 0x2000000, 244 OMX_VIDEO_HEVCHighTiermax = 0x7FFFFFFF 245 } OMX_VIDEO_HEVCLEVELTYPE; 246 247 /** Structure for controlling HEVC video encoding */ 248 typedef struct OMX_VIDEO_PARAM_HEVCTYPE { 249 OMX_U32 nSize; 250 OMX_VERSIONTYPE nVersion; 251 OMX_U32 nPortIndex; 252 OMX_VIDEO_HEVCPROFILETYPE eProfile; 253 OMX_VIDEO_HEVCLEVELTYPE eLevel; 254 OMX_U32 nKeyFrameInterval; // distance between consecutive I-frames (including one 255 // of the I frames). 0 means interval is unspecified and 256 // can be freely chosen by the codec. 1 means a stream of 257 // only I frames. 258 } OMX_VIDEO_PARAM_HEVCTYPE; 259 260 /** Structure to define if dependent slice segments should be used */ 261 typedef struct OMX_VIDEO_SLICESEGMENTSTYPE { 262 OMX_U32 nSize; 263 OMX_VERSIONTYPE nVersion; 264 OMX_U32 nPortIndex; 265 OMX_BOOL bDepedentSegments; 266 OMX_BOOL bEnableLoopFilterAcrossSlices; 267 } OMX_VIDEO_SLICESEGMENTSTYPE; 268 269 /** Structure to return timestamps of rendered output frames as well as EOS 270 * for tunneled components. 271 */ 272 typedef struct OMX_VIDEO_RENDEREVENTTYPE { 273 OMX_S64 nMediaTimeUs; // timestamp of rendered video frame 274 OMX_S64 nSystemTimeNs; // system monotonic time at the time frame was rendered 275 // Use INT64_MAX for nMediaTimeUs to signal that the EOS 276 // has been reached. In this case, nSystemTimeNs MUST be 277 // the system time when the last frame was rendered. 278 // This MUST be done in addition to returning (and 279 // following) the render information for the last frame. 280 } OMX_VIDEO_RENDEREVENTTYPE; 281 282 /** Dolby Vision Profile enum type */ 283 typedef enum OMX_VIDEO_DOLBYVISIONPROFILETYPE { 284 OMX_VIDEO_DolbyVisionProfileUnknown = 0x0, 285 OMX_VIDEO_DolbyVisionProfileDvavPer = 0x1, 286 OMX_VIDEO_DolbyVisionProfileDvavPen = 0x2, 287 OMX_VIDEO_DolbyVisionProfileDvheDer = 0x4, 288 OMX_VIDEO_DolbyVisionProfileDvheDen = 0x8, 289 OMX_VIDEO_DolbyVisionProfileDvheDtr = 0x10, 290 OMX_VIDEO_DolbyVisionProfileDvheStn = 0x20, 291 OMX_VIDEO_DolbyVisionProfileDvheDth = 0x40, 292 OMX_VIDEO_DolbyVisionProfileDvheDtb = 0x80, 293 OMX_VIDEO_DolbyVisionProfileMax = 0x7FFFFFFF 294 } OMX_VIDEO_DOLBYVISIONPROFILETYPE; 295 296 /** Dolby Vision Level enum type */ 297 typedef enum OMX_VIDEO_DOLBYVISIONLEVELTYPE { 298 OMX_VIDEO_DolbyVisionLevelUnknown = 0x0, 299 OMX_VIDEO_DolbyVisionLevelHd24 = 0x1, 300 OMX_VIDEO_DolbyVisionLevelHd30 = 0x2, 301 OMX_VIDEO_DolbyVisionLevelFhd24 = 0x4, 302 OMX_VIDEO_DolbyVisionLevelFhd30 = 0x8, 303 OMX_VIDEO_DolbyVisionLevelFhd60 = 0x10, 304 OMX_VIDEO_DolbyVisionLevelUhd24 = 0x20, 305 OMX_VIDEO_DolbyVisionLevelUhd30 = 0x40, 306 OMX_VIDEO_DolbyVisionLevelUhd48 = 0x80, 307 OMX_VIDEO_DolbyVisionLevelUhd60 = 0x100, 308 OMX_VIDEO_DolbyVisionLevelmax = 0x7FFFFFFF 309 } OMX_VIDEO_DOLBYVISIONLEVELTYPE; 310 311 /** 312 * Structure for configuring video compression intra refresh period 313 * 314 * STRUCT MEMBERS: 315 * nSize : Size of the structure in bytes 316 * nVersion : OMX specification version information 317 * nPortIndex : Port that this structure applies to 318 * nRefreshPeriod : Intra refreh period in frames. Value 0 means disable intra refresh 319 */ 320 typedef struct OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE { 321 OMX_U32 nSize; 322 OMX_VERSIONTYPE nVersion; 323 OMX_U32 nPortIndex; 324 OMX_U32 nRefreshPeriod; 325 } OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE; 326 327 /** Maximum number of temporal layers supported by AVC/HEVC */ 328 #define OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS 8 329 330 /** temporal layer patterns */ 331 typedef enum OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE { 332 OMX_VIDEO_AndroidTemporalLayeringPatternNone = 0, 333 // pattern as defined by WebRTC 334 OMX_VIDEO_AndroidTemporalLayeringPatternWebRTC = 1 << 0, 335 // pattern where frames in any layer other than the base layer only depend on at most the very 336 // last frame from each preceding layer (other than the base layer.) 337 OMX_VIDEO_AndroidTemporalLayeringPatternAndroid = 1 << 1, 338 } OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE; 339 340 /** 341 * Android specific param for configuration of temporal layering. 342 * Android only supports temporal layering where successive layers each double the 343 * previous layer's framerate. 344 * NOTE: Reading this parameter at run-time SHALL return actual run-time values. 345 * 346 * nSize : Size of the structure in bytes 347 * nVersion : OMX specification version information 348 * nPortIndex : Port that this structure applies to (output port for encoders) 349 * eSupportedPatterns : A bitmask of supported layering patterns 350 * nLayerCountMax : Max number of temporal coding layers supported 351 * by the encoder (must be at least 1, 1 meaning temporal layering 352 * is NOT supported) 353 * nBLayerCountMax : Max number of layers that can contain B frames 354 * (0) to (nLayerCountMax - 1) 355 * ePattern : Layering pattern. 356 * nPLayerCountActual : Number of temporal layers to be coded with non-B frames, 357 * starting from and including the base-layer. 358 * (1 to nLayerCountMax - nBLayerCountActual) 359 * If nPLayerCountActual is 1 and nBLayerCountActual is 0, temporal 360 * layering is disabled. Otherwise, it is enabled. 361 * nBLayerCountActual : Number of temporal layers to be coded with B frames, 362 * starting after non-B layers. 363 * (0 to nBLayerCountMax) 364 * bBitrateRatiosSpecified : Flag to indicate if layer-wise bitrate 365 * distribution is specified. 366 * nBitrateRatios : Bitrate ratio (100 based) per layer (index 0 is base layer). 367 * Honored if bBitrateRatiosSpecified is set. 368 * i.e for 4 layers with desired distribution (25% 25% 25% 25%), 369 * nBitrateRatio = {25, 50, 75, 100, ... } 370 * Values in indices not less than 'the actual number of layers 371 * minus 1' MAY be ignored and assumed to be 100. 372 */ 373 typedef struct OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE { 374 OMX_U32 nSize; 375 OMX_VERSIONTYPE nVersion; 376 OMX_U32 nPortIndex; 377 OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE eSupportedPatterns; 378 OMX_U32 nLayerCountMax; 379 OMX_U32 nBLayerCountMax; 380 OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern; 381 OMX_U32 nPLayerCountActual; 382 OMX_U32 nBLayerCountActual; 383 OMX_BOOL bBitrateRatiosSpecified; 384 OMX_U32 nBitrateRatios[OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS]; 385 } OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE; 386 387 /** 388 * Android specific config for changing the temporal-layer count or 389 * bitrate-distribution at run-time. 390 * 391 * nSize : Size of the structure in bytes 392 * nVersion : OMX specification version information 393 * nPortIndex : Port that this structure applies to (output port for encoders) 394 * ePattern : Layering pattern. 395 * nPLayerCountActual : Number of temporal layers to be coded with non-B frames. 396 * (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.) 397 * nBLayerCountActual : Number of temporal layers to be coded with B frames. 398 * (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.) 399 * bBitrateRatiosSpecified : Flag to indicate if layer-wise bitrate 400 * distribution is specified. 401 * nBitrateRatios : Bitrate ratio (100 based, Q16 values) per layer (0 is base layer). 402 * Honored if bBitrateRatiosSpecified is set. 403 * (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.) 404 */ 405 typedef struct OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE { 406 OMX_U32 nSize; 407 OMX_VERSIONTYPE nVersion; 408 OMX_U32 nPortIndex; 409 OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern; 410 OMX_U32 nPLayerCountActual; 411 OMX_U32 nBLayerCountActual; 412 OMX_BOOL bBitrateRatiosSpecified; 413 OMX_U32 nBitrateRatios[OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS]; 414 } OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE; 415 416 #ifdef __cplusplus 417 } 418 #endif /* __cplusplus */ 419 420 #endif /* OMX_VideoExt_h */ 421 /* File EOF */ 422