1 /* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 #ifndef MEDIA_CODEC_CONSTANTS_H_ 19 #define MEDIA_CODEC_CONSTANTS_H_ 20 21 namespace { 22 23 // from MediaCodecInfo.java 24 inline constexpr int32_t AVCProfileBaseline = 0x01; 25 inline constexpr int32_t AVCProfileMain = 0x02; 26 inline constexpr int32_t AVCProfileExtended = 0x04; 27 inline constexpr int32_t AVCProfileHigh = 0x08; 28 inline constexpr int32_t AVCProfileHigh10 = 0x10; 29 inline constexpr int32_t AVCProfileHigh422 = 0x20; 30 inline constexpr int32_t AVCProfileHigh444 = 0x40; 31 inline constexpr int32_t AVCProfileConstrainedBaseline = 0x10000; 32 inline constexpr int32_t AVCProfileConstrainedHigh = 0x80000; 33 34 inline static const char *asString_AVCProfile(int32_t i, const char *def = "??") { 35 switch (i) { 36 case AVCProfileBaseline: return "Baseline"; 37 case AVCProfileMain: return "Main"; 38 case AVCProfileExtended: return "Extended"; 39 case AVCProfileHigh: return "High"; 40 case AVCProfileHigh10: return "High10"; 41 case AVCProfileHigh422: return "High422"; 42 case AVCProfileHigh444: return "High444"; 43 case AVCProfileConstrainedBaseline: return "ConstrainedBaseline"; 44 case AVCProfileConstrainedHigh: return "ConstrainedHigh"; 45 default: return def; 46 } 47 } 48 49 inline constexpr int32_t AVCLevel1 = 0x01; 50 inline constexpr int32_t AVCLevel1b = 0x02; 51 inline constexpr int32_t AVCLevel11 = 0x04; 52 inline constexpr int32_t AVCLevel12 = 0x08; 53 inline constexpr int32_t AVCLevel13 = 0x10; 54 inline constexpr int32_t AVCLevel2 = 0x20; 55 inline constexpr int32_t AVCLevel21 = 0x40; 56 inline constexpr int32_t AVCLevel22 = 0x80; 57 inline constexpr int32_t AVCLevel3 = 0x100; 58 inline constexpr int32_t AVCLevel31 = 0x200; 59 inline constexpr int32_t AVCLevel32 = 0x400; 60 inline constexpr int32_t AVCLevel4 = 0x800; 61 inline constexpr int32_t AVCLevel41 = 0x1000; 62 inline constexpr int32_t AVCLevel42 = 0x2000; 63 inline constexpr int32_t AVCLevel5 = 0x4000; 64 inline constexpr int32_t AVCLevel51 = 0x8000; 65 inline constexpr int32_t AVCLevel52 = 0x10000; 66 inline constexpr int32_t AVCLevel6 = 0x20000; 67 inline constexpr int32_t AVCLevel61 = 0x40000; 68 inline constexpr int32_t AVCLevel62 = 0x80000; 69 70 inline static const char *asString_AVCLevel(int32_t i, const char *def = "??") { 71 switch (i) { 72 case AVCLevel1: return "1"; 73 case AVCLevel1b: return "1b"; 74 case AVCLevel11: return "1.1"; 75 case AVCLevel12: return "1.2"; 76 case AVCLevel13: return "1.3"; 77 case AVCLevel2: return "2"; 78 case AVCLevel21: return "2.1"; 79 case AVCLevel22: return "2.2"; 80 case AVCLevel3: return "3"; 81 case AVCLevel31: return "3.1"; 82 case AVCLevel32: return "3.2"; 83 case AVCLevel4: return "4"; 84 case AVCLevel41: return "4.1"; 85 case AVCLevel42: return "4.2"; 86 case AVCLevel5: return "5"; 87 case AVCLevel51: return "5.1"; 88 case AVCLevel52: return "5.2"; 89 case AVCLevel6: return "6"; 90 case AVCLevel61: return "6.1"; 91 case AVCLevel62: return "6.2"; 92 default: return def; 93 } 94 } 95 96 inline constexpr int32_t H263ProfileBaseline = 0x01; 97 inline constexpr int32_t H263ProfileH320Coding = 0x02; 98 inline constexpr int32_t H263ProfileBackwardCompatible = 0x04; 99 inline constexpr int32_t H263ProfileISWV2 = 0x08; 100 inline constexpr int32_t H263ProfileISWV3 = 0x10; 101 inline constexpr int32_t H263ProfileHighCompression = 0x20; 102 inline constexpr int32_t H263ProfileInternet = 0x40; 103 inline constexpr int32_t H263ProfileInterlace = 0x80; 104 inline constexpr int32_t H263ProfileHighLatency = 0x100; 105 106 inline static const char *asString_H263Profile(int32_t i, const char *def = "??") { 107 switch (i) { 108 case H263ProfileBaseline: return "Baseline"; 109 case H263ProfileH320Coding: return "H320Coding"; 110 case H263ProfileBackwardCompatible: return "BackwardCompatible"; 111 case H263ProfileISWV2: return "ISWV2"; 112 case H263ProfileISWV3: return "ISWV3"; 113 case H263ProfileHighCompression: return "HighCompression"; 114 case H263ProfileInternet: return "Internet"; 115 case H263ProfileInterlace: return "Interlace"; 116 case H263ProfileHighLatency: return "HighLatency"; 117 default: return def; 118 } 119 } 120 121 inline constexpr int32_t H263Level10 = 0x01; 122 inline constexpr int32_t H263Level20 = 0x02; 123 inline constexpr int32_t H263Level30 = 0x04; 124 inline constexpr int32_t H263Level40 = 0x08; 125 inline constexpr int32_t H263Level45 = 0x10; 126 inline constexpr int32_t H263Level50 = 0x20; 127 inline constexpr int32_t H263Level60 = 0x40; 128 inline constexpr int32_t H263Level70 = 0x80; 129 130 inline static const char *asString_H263Level(int32_t i, const char *def = "??") { 131 switch (i) { 132 case H263Level10: return "10"; 133 case H263Level20: return "20"; 134 case H263Level30: return "30"; 135 case H263Level40: return "40"; 136 case H263Level45: return "45"; 137 case H263Level50: return "50"; 138 case H263Level60: return "60"; 139 case H263Level70: return "70"; 140 default: return def; 141 } 142 } 143 144 inline constexpr int32_t MPEG4ProfileSimple = 0x01; 145 inline constexpr int32_t MPEG4ProfileSimpleScalable = 0x02; 146 inline constexpr int32_t MPEG4ProfileCore = 0x04; 147 inline constexpr int32_t MPEG4ProfileMain = 0x08; 148 inline constexpr int32_t MPEG4ProfileNbit = 0x10; 149 inline constexpr int32_t MPEG4ProfileScalableTexture = 0x20; 150 inline constexpr int32_t MPEG4ProfileSimpleFace = 0x40; 151 inline constexpr int32_t MPEG4ProfileSimpleFBA = 0x80; 152 inline constexpr int32_t MPEG4ProfileBasicAnimated = 0x100; 153 inline constexpr int32_t MPEG4ProfileHybrid = 0x200; 154 inline constexpr int32_t MPEG4ProfileAdvancedRealTime = 0x400; 155 inline constexpr int32_t MPEG4ProfileCoreScalable = 0x800; 156 inline constexpr int32_t MPEG4ProfileAdvancedCoding = 0x1000; 157 inline constexpr int32_t MPEG4ProfileAdvancedCore = 0x2000; 158 inline constexpr int32_t MPEG4ProfileAdvancedScalable = 0x4000; 159 inline constexpr int32_t MPEG4ProfileAdvancedSimple = 0x8000; 160 161 inline static const char *asString_MPEG4Profile(int32_t i, const char *def = "??") { 162 switch (i) { 163 case MPEG4ProfileSimple: return "Simple"; 164 case MPEG4ProfileSimpleScalable: return "SimpleScalable"; 165 case MPEG4ProfileCore: return "Core"; 166 case MPEG4ProfileMain: return "Main"; 167 case MPEG4ProfileNbit: return "Nbit"; 168 case MPEG4ProfileScalableTexture: return "ScalableTexture"; 169 case MPEG4ProfileSimpleFace: return "SimpleFace"; 170 case MPEG4ProfileSimpleFBA: return "SimpleFBA"; 171 case MPEG4ProfileBasicAnimated: return "BasicAnimated"; 172 case MPEG4ProfileHybrid: return "Hybrid"; 173 case MPEG4ProfileAdvancedRealTime: return "AdvancedRealTime"; 174 case MPEG4ProfileCoreScalable: return "CoreScalable"; 175 case MPEG4ProfileAdvancedCoding: return "AdvancedCoding"; 176 case MPEG4ProfileAdvancedCore: return "AdvancedCore"; 177 case MPEG4ProfileAdvancedScalable: return "AdvancedScalable"; 178 case MPEG4ProfileAdvancedSimple: return "AdvancedSimple"; 179 default: return def; 180 } 181 } 182 183 inline constexpr int32_t MPEG4Level0 = 0x01; 184 inline constexpr int32_t MPEG4Level0b = 0x02; 185 inline constexpr int32_t MPEG4Level1 = 0x04; 186 inline constexpr int32_t MPEG4Level2 = 0x08; 187 inline constexpr int32_t MPEG4Level3 = 0x10; 188 inline constexpr int32_t MPEG4Level3b = 0x18; 189 inline constexpr int32_t MPEG4Level4 = 0x20; 190 inline constexpr int32_t MPEG4Level4a = 0x40; 191 inline constexpr int32_t MPEG4Level5 = 0x80; 192 inline constexpr int32_t MPEG4Level6 = 0x100; 193 194 inline static const char *asString_MPEG4Level(int32_t i, const char *def = "??") { 195 switch (i) { 196 case MPEG4Level0: return "0"; 197 case MPEG4Level0b: return "0b"; 198 case MPEG4Level1: return "1"; 199 case MPEG4Level2: return "2"; 200 case MPEG4Level3: return "3"; 201 case MPEG4Level3b: return "3b"; 202 case MPEG4Level4: return "4"; 203 case MPEG4Level4a: return "4a"; 204 case MPEG4Level5: return "5"; 205 case MPEG4Level6: return "6"; 206 default: return def; 207 } 208 } 209 210 inline constexpr int32_t MPEG2ProfileSimple = 0x00; 211 inline constexpr int32_t MPEG2ProfileMain = 0x01; 212 inline constexpr int32_t MPEG2Profile422 = 0x02; 213 inline constexpr int32_t MPEG2ProfileSNR = 0x03; 214 inline constexpr int32_t MPEG2ProfileSpatial = 0x04; 215 inline constexpr int32_t MPEG2ProfileHigh = 0x05; 216 217 inline static const char *asString_MPEG2Profile(int32_t i, const char *def = "??") { 218 switch (i) { 219 case MPEG2ProfileSimple: return "Simple"; 220 case MPEG2ProfileMain: return "Main"; 221 case MPEG2Profile422: return "422"; 222 case MPEG2ProfileSNR: return "SNR"; 223 case MPEG2ProfileSpatial: return "Spatial"; 224 case MPEG2ProfileHigh: return "High"; 225 default: return def; 226 } 227 } 228 229 inline constexpr int32_t MPEG2LevelLL = 0x00; 230 inline constexpr int32_t MPEG2LevelML = 0x01; 231 inline constexpr int32_t MPEG2LevelH14 = 0x02; 232 inline constexpr int32_t MPEG2LevelHL = 0x03; 233 inline constexpr int32_t MPEG2LevelHP = 0x04; 234 235 inline static const char *asString_MPEG2Level(int32_t i, const char *def = "??") { 236 switch (i) { 237 case MPEG2LevelLL: return "LL"; 238 case MPEG2LevelML: return "ML"; 239 case MPEG2LevelH14: return "H14"; 240 case MPEG2LevelHL: return "HL"; 241 case MPEG2LevelHP: return "HP"; 242 default: return def; 243 } 244 } 245 246 inline constexpr int32_t AACObjectMain = 1; 247 inline constexpr int32_t AACObjectLC = 2; 248 inline constexpr int32_t AACObjectSSR = 3; 249 inline constexpr int32_t AACObjectLTP = 4; 250 inline constexpr int32_t AACObjectHE = 5; 251 inline constexpr int32_t AACObjectScalable = 6; 252 inline constexpr int32_t AACObjectERLC = 17; 253 inline constexpr int32_t AACObjectERScalable = 20; 254 inline constexpr int32_t AACObjectLD = 23; 255 inline constexpr int32_t AACObjectHE_PS = 29; 256 inline constexpr int32_t AACObjectELD = 39; 257 inline constexpr int32_t AACObjectXHE = 42; 258 259 inline static const char *asString_AACObject(int32_t i, const char *def = "??") { 260 switch (i) { 261 case AACObjectMain: return "Main"; 262 case AACObjectLC: return "LC"; 263 case AACObjectSSR: return "SSR"; 264 case AACObjectLTP: return "LTP"; 265 case AACObjectHE: return "HE"; 266 case AACObjectScalable: return "Scalable"; 267 case AACObjectERLC: return "ERLC"; 268 case AACObjectERScalable: return "ERScalable"; 269 case AACObjectLD: return "LD"; 270 case AACObjectHE_PS: return "HE_PS"; 271 case AACObjectELD: return "ELD"; 272 case AACObjectXHE: return "XHE"; 273 default: return def; 274 } 275 } 276 277 inline constexpr int32_t VP8Level_Version0 = 0x01; 278 inline constexpr int32_t VP8Level_Version1 = 0x02; 279 inline constexpr int32_t VP8Level_Version2 = 0x04; 280 inline constexpr int32_t VP8Level_Version3 = 0x08; 281 282 inline static const char *asString_VP8Level(int32_t i, const char *def = "??") { 283 switch (i) { 284 case VP8Level_Version0: return "V0"; 285 case VP8Level_Version1: return "V1"; 286 case VP8Level_Version2: return "V2"; 287 case VP8Level_Version3: return "V3"; 288 default: return def; 289 } 290 } 291 292 inline constexpr int32_t VP8ProfileMain = 0x01; 293 294 inline static const char *asString_VP8Profile(int32_t i, const char *def = "??") { 295 switch (i) { 296 case VP8ProfileMain: return "Main"; 297 default: return def; 298 } 299 } 300 301 inline constexpr int32_t VP9Profile0 = 0x01; 302 inline constexpr int32_t VP9Profile1 = 0x02; 303 inline constexpr int32_t VP9Profile2 = 0x04; 304 inline constexpr int32_t VP9Profile3 = 0x08; 305 inline constexpr int32_t VP9Profile2HDR = 0x1000; 306 inline constexpr int32_t VP9Profile3HDR = 0x2000; 307 inline constexpr int32_t VP9Profile2HDR10Plus = 0x4000; 308 inline constexpr int32_t VP9Profile3HDR10Plus = 0x8000; 309 310 inline static const char *asString_VP9Profile(int32_t i, const char *def = "??") { 311 switch (i) { 312 case VP9Profile0: return "0"; 313 case VP9Profile1: return "1"; 314 case VP9Profile2: return "2"; 315 case VP9Profile3: return "3"; 316 case VP9Profile2HDR: return "2HDR"; 317 case VP9Profile3HDR: return "3HDR"; 318 case VP9Profile2HDR10Plus: return "2HDRPlus"; 319 case VP9Profile3HDR10Plus: return "3HDRPlus"; 320 default: return def; 321 } 322 } 323 324 inline constexpr int32_t VP9Level1 = 0x1; 325 inline constexpr int32_t VP9Level11 = 0x2; 326 inline constexpr int32_t VP9Level2 = 0x4; 327 inline constexpr int32_t VP9Level21 = 0x8; 328 inline constexpr int32_t VP9Level3 = 0x10; 329 inline constexpr int32_t VP9Level31 = 0x20; 330 inline constexpr int32_t VP9Level4 = 0x40; 331 inline constexpr int32_t VP9Level41 = 0x80; 332 inline constexpr int32_t VP9Level5 = 0x100; 333 inline constexpr int32_t VP9Level51 = 0x200; 334 inline constexpr int32_t VP9Level52 = 0x400; 335 inline constexpr int32_t VP9Level6 = 0x800; 336 inline constexpr int32_t VP9Level61 = 0x1000; 337 inline constexpr int32_t VP9Level62 = 0x2000; 338 339 inline static const char *asString_VP9Level(int32_t i, const char *def = "??") { 340 switch (i) { 341 case VP9Level1: return "1"; 342 case VP9Level11: return "1.1"; 343 case VP9Level2: return "2"; 344 case VP9Level21: return "2.1"; 345 case VP9Level3: return "3"; 346 case VP9Level31: return "3.1"; 347 case VP9Level4: return "4"; 348 case VP9Level41: return "4.1"; 349 case VP9Level5: return "5"; 350 case VP9Level51: return "5.1"; 351 case VP9Level52: return "5.2"; 352 case VP9Level6: return "6"; 353 case VP9Level61: return "6.1"; 354 case VP9Level62: return "6.2"; 355 default: return def; 356 } 357 } 358 359 inline constexpr int32_t AV1ProfileMain8 = 0x1; 360 inline constexpr int32_t AV1ProfileMain10 = 0x2; 361 inline constexpr int32_t AV1ProfileMain10HDR10 = 0x1000; 362 inline constexpr int32_t AV1ProfileMain10HDR10Plus = 0x2000; 363 364 inline static const char *asString_AV1Profile(int32_t i, const char *def = "??") { 365 switch (i) { 366 case AV1ProfileMain8: return "Main8"; 367 case AV1ProfileMain10: return "Main10"; 368 case AV1ProfileMain10HDR10: return "Main10HDR10"; 369 case AV1ProfileMain10HDR10Plus: return "Main10HDRPlus"; 370 default: return def; 371 } 372 } 373 374 inline constexpr int32_t AV1Level2 = 0x1; 375 inline constexpr int32_t AV1Level21 = 0x2; 376 inline constexpr int32_t AV1Level22 = 0x4; 377 inline constexpr int32_t AV1Level23 = 0x8; 378 inline constexpr int32_t AV1Level3 = 0x10; 379 inline constexpr int32_t AV1Level31 = 0x20; 380 inline constexpr int32_t AV1Level32 = 0x40; 381 inline constexpr int32_t AV1Level33 = 0x80; 382 inline constexpr int32_t AV1Level4 = 0x100; 383 inline constexpr int32_t AV1Level41 = 0x200; 384 inline constexpr int32_t AV1Level42 = 0x400; 385 inline constexpr int32_t AV1Level43 = 0x800; 386 inline constexpr int32_t AV1Level5 = 0x1000; 387 inline constexpr int32_t AV1Level51 = 0x2000; 388 inline constexpr int32_t AV1Level52 = 0x4000; 389 inline constexpr int32_t AV1Level53 = 0x8000; 390 inline constexpr int32_t AV1Level6 = 0x10000; 391 inline constexpr int32_t AV1Level61 = 0x20000; 392 inline constexpr int32_t AV1Level62 = 0x40000; 393 inline constexpr int32_t AV1Level63 = 0x80000; 394 inline constexpr int32_t AV1Level7 = 0x100000; 395 inline constexpr int32_t AV1Level71 = 0x200000; 396 inline constexpr int32_t AV1Level72 = 0x400000; 397 inline constexpr int32_t AV1Level73 = 0x800000; 398 399 inline static const char *asString_AV1Level(int32_t i, const char *def = "??") { 400 switch (i) { 401 case AV1Level2: return "2"; 402 case AV1Level21: return "2.1"; 403 case AV1Level22: return "2.2"; 404 case AV1Level23: return "2.3"; 405 case AV1Level3: return "3"; 406 case AV1Level31: return "3.1"; 407 case AV1Level32: return "3.2"; 408 case AV1Level33: return "3.3"; 409 case AV1Level4: return "4"; 410 case AV1Level41: return "4.1"; 411 case AV1Level42: return "4.2"; 412 case AV1Level43: return "4.3"; 413 case AV1Level5: return "5"; 414 case AV1Level51: return "5.1"; 415 case AV1Level52: return "5.2"; 416 case AV1Level53: return "5.3"; 417 case AV1Level6: return "6"; 418 case AV1Level61: return "6.1"; 419 case AV1Level62: return "6.2"; 420 case AV1Level63: return "6.3"; 421 case AV1Level7: return "7"; 422 case AV1Level71: return "7.1"; 423 case AV1Level72: return "7.2"; 424 case AV1Level73: return "7.3"; 425 default: return def; 426 } 427 } 428 429 inline constexpr int32_t HEVCProfileMain = 0x01; 430 inline constexpr int32_t HEVCProfileMain10 = 0x02; 431 inline constexpr int32_t HEVCProfileMainStill = 0x04; 432 inline constexpr int32_t HEVCProfileMain10HDR10 = 0x1000; 433 inline constexpr int32_t HEVCProfileMain10HDR10Plus = 0x2000; 434 435 inline static const char *asString_HEVCProfile(int32_t i, const char *def = "??") { 436 switch (i) { 437 case HEVCProfileMain: return "Main"; 438 case HEVCProfileMain10: return "Main10"; 439 case HEVCProfileMainStill: return "MainStill"; 440 case HEVCProfileMain10HDR10: return "Main10HDR10"; 441 case HEVCProfileMain10HDR10Plus: return "Main10HDR10Plus"; 442 default: return def; 443 } 444 } 445 446 inline constexpr int32_t HEVCMainTierLevel1 = 0x1; 447 inline constexpr int32_t HEVCHighTierLevel1 = 0x2; 448 inline constexpr int32_t HEVCMainTierLevel2 = 0x4; 449 inline constexpr int32_t HEVCHighTierLevel2 = 0x8; 450 inline constexpr int32_t HEVCMainTierLevel21 = 0x10; 451 inline constexpr int32_t HEVCHighTierLevel21 = 0x20; 452 inline constexpr int32_t HEVCMainTierLevel3 = 0x40; 453 inline constexpr int32_t HEVCHighTierLevel3 = 0x80; 454 inline constexpr int32_t HEVCMainTierLevel31 = 0x100; 455 inline constexpr int32_t HEVCHighTierLevel31 = 0x200; 456 inline constexpr int32_t HEVCMainTierLevel4 = 0x400; 457 inline constexpr int32_t HEVCHighTierLevel4 = 0x800; 458 inline constexpr int32_t HEVCMainTierLevel41 = 0x1000; 459 inline constexpr int32_t HEVCHighTierLevel41 = 0x2000; 460 inline constexpr int32_t HEVCMainTierLevel5 = 0x4000; 461 inline constexpr int32_t HEVCHighTierLevel5 = 0x8000; 462 inline constexpr int32_t HEVCMainTierLevel51 = 0x10000; 463 inline constexpr int32_t HEVCHighTierLevel51 = 0x20000; 464 inline constexpr int32_t HEVCMainTierLevel52 = 0x40000; 465 inline constexpr int32_t HEVCHighTierLevel52 = 0x80000; 466 inline constexpr int32_t HEVCMainTierLevel6 = 0x100000; 467 inline constexpr int32_t HEVCHighTierLevel6 = 0x200000; 468 inline constexpr int32_t HEVCMainTierLevel61 = 0x400000; 469 inline constexpr int32_t HEVCHighTierLevel61 = 0x800000; 470 inline constexpr int32_t HEVCMainTierLevel62 = 0x1000000; 471 inline constexpr int32_t HEVCHighTierLevel62 = 0x2000000; 472 473 inline static const char *asString_HEVCTierLevel(int32_t i, const char *def = "??") { 474 switch (i) { 475 case HEVCMainTierLevel1: return "Main 1"; 476 case HEVCHighTierLevel1: return "High 1"; 477 case HEVCMainTierLevel2: return "Main 2"; 478 case HEVCHighTierLevel2: return "High 2"; 479 case HEVCMainTierLevel21: return "Main 2.1"; 480 case HEVCHighTierLevel21: return "High 2.1"; 481 case HEVCMainTierLevel3: return "Main 3"; 482 case HEVCHighTierLevel3: return "High 3"; 483 case HEVCMainTierLevel31: return "Main 3.1"; 484 case HEVCHighTierLevel31: return "High 3.1"; 485 case HEVCMainTierLevel4: return "Main 4"; 486 case HEVCHighTierLevel4: return "High 4"; 487 case HEVCMainTierLevel41: return "Main 4.1"; 488 case HEVCHighTierLevel41: return "High 4.1"; 489 case HEVCMainTierLevel5: return "Main 5"; 490 case HEVCHighTierLevel5: return "High 5"; 491 case HEVCMainTierLevel51: return "Main 5.1"; 492 case HEVCHighTierLevel51: return "High 5.1"; 493 case HEVCMainTierLevel52: return "Main 5.2"; 494 case HEVCHighTierLevel52: return "High 5.2"; 495 case HEVCMainTierLevel6: return "Main 6"; 496 case HEVCHighTierLevel6: return "High 6"; 497 case HEVCMainTierLevel61: return "Main 6.1"; 498 case HEVCHighTierLevel61: return "High 6.1"; 499 case HEVCMainTierLevel62: return "Main 6.2"; 500 case HEVCHighTierLevel62: return "High 6.2"; 501 default: return def; 502 } 503 } 504 505 inline constexpr int32_t DolbyVisionProfileDvavPer = 0x1; 506 inline constexpr int32_t DolbyVisionProfileDvavPen = 0x2; 507 inline constexpr int32_t DolbyVisionProfileDvheDer = 0x4; 508 inline constexpr int32_t DolbyVisionProfileDvheDen = 0x8; 509 inline constexpr int32_t DolbyVisionProfileDvheDtr = 0x10; 510 inline constexpr int32_t DolbyVisionProfileDvheStn = 0x20; 511 inline constexpr int32_t DolbyVisionProfileDvheDth = 0x40; 512 inline constexpr int32_t DolbyVisionProfileDvheDtb = 0x80; 513 inline constexpr int32_t DolbyVisionProfileDvheSt = 0x100; 514 inline constexpr int32_t DolbyVisionProfileDvavSe = 0x200; 515 inline constexpr int32_t DolbyVisionProfileDvav110 = 0x400; 516 517 inline static const char *asString_DolbyVisionProfile(int32_t i, const char *def = "??") { 518 switch (i) { 519 case DolbyVisionProfileDvavPer: return "DvavPer"; 520 case DolbyVisionProfileDvavPen: return "DvavPen"; 521 case DolbyVisionProfileDvheDer: return "DvheDer"; 522 case DolbyVisionProfileDvheDen: return "DvheDen"; 523 case DolbyVisionProfileDvheDtr: return "DvheDtr"; 524 case DolbyVisionProfileDvheStn: return "DvheStn"; 525 case DolbyVisionProfileDvheDth: return "DvheDth"; 526 case DolbyVisionProfileDvheDtb: return "DvheDtb"; 527 case DolbyVisionProfileDvheSt: return "DvheSt"; 528 case DolbyVisionProfileDvavSe: return "DvavSe"; 529 case DolbyVisionProfileDvav110: return "Dav110"; 530 default: return def; 531 } 532 } 533 534 inline constexpr int32_t DolbyVisionLevelHd24 = 0x1; 535 inline constexpr int32_t DolbyVisionLevelHd30 = 0x2; 536 inline constexpr int32_t DolbyVisionLevelFhd24 = 0x4; 537 inline constexpr int32_t DolbyVisionLevelFhd30 = 0x8; 538 inline constexpr int32_t DolbyVisionLevelFhd60 = 0x10; 539 inline constexpr int32_t DolbyVisionLevelUhd24 = 0x20; 540 inline constexpr int32_t DolbyVisionLevelUhd30 = 0x40; 541 inline constexpr int32_t DolbyVisionLevelUhd48 = 0x80; 542 inline constexpr int32_t DolbyVisionLevelUhd60 = 0x100; 543 inline constexpr int32_t DolbyVisionLevelUhd120 = 0x200; 544 inline constexpr int32_t DolbyVisionLevel8k30 = 0x400; 545 inline constexpr int32_t DolbyVisionLevel8k60 = 0x800; 546 547 inline static const char *asString_DolbyVisionLevel(int32_t i, const char *def = "??") { 548 switch (i) { 549 case DolbyVisionLevelHd24: return "Hd24"; 550 case DolbyVisionLevelHd30: return "Hd30"; 551 case DolbyVisionLevelFhd24: return "Fhd24"; 552 case DolbyVisionLevelFhd30: return "Fhd30"; 553 case DolbyVisionLevelFhd60: return "Fhd60"; 554 case DolbyVisionLevelUhd24: return "Uhd24"; 555 case DolbyVisionLevelUhd30: return "Uhd30"; 556 case DolbyVisionLevelUhd48: return "Uhd48"; 557 case DolbyVisionLevelUhd60: return "Uhd60"; 558 case DolbyVisionLevelUhd120: return "Uhd120"; 559 case DolbyVisionLevel8k30: return "8k30"; 560 case DolbyVisionLevel8k60: return "8k60"; 561 default: return def; 562 } 563 } 564 565 inline constexpr int32_t DTS_HDProfileHRA = 0x1; 566 inline constexpr int32_t DTS_HDProfileLBR = 0x2; 567 inline constexpr int32_t DTS_HDProfileMA = 0x4; 568 569 inline static const char *asString_Dts_HDProfile(int32_t i, const char *def = "??") { 570 switch (i) { 571 case DTS_HDProfileHRA: return "HRA"; 572 case DTS_HDProfileLBR: return "LBR"; 573 case DTS_HDProfileMA: return "MA"; 574 default: return def; 575 } 576 } 577 578 inline constexpr int32_t DTS_UHDProfileP1 = 0x1; 579 inline constexpr int32_t DTS_UHDProfileP2 = 0x2; 580 581 inline static const char *asString_Dts_UHDProfile(int32_t i, const char *def = "??") { 582 switch (i) { 583 case DTS_UHDProfileP1: return "P1"; 584 case DTS_UHDProfileP2: return "P2"; 585 default: return def; 586 } 587 } 588 589 // APV ProfileLevel 590 inline constexpr int32_t APVProfile422_10 = 0x01; 591 inline constexpr int32_t APVProfile422_10HDR10 = 0x1000; 592 inline constexpr int32_t APVProfile422_10HDR10Plus = 0x2000; 593 594 inline static const char *asString_APVProfile(int32_t i, const char *def = "??") { 595 switch (i) { 596 case APVProfile422_10: return "422_10"; 597 case APVProfile422_10HDR10: return "422_10HDR10"; 598 case APVProfile422_10HDR10Plus: return "422_10HDR10Plus"; 599 default: return def; 600 } 601 } 602 603 inline constexpr int32_t APVLevel1Band0 = 0x101; 604 inline constexpr int32_t APVLevel1Band1 = 0x102; 605 inline constexpr int32_t APVLevel1Band2 = 0x104; 606 inline constexpr int32_t APVLevel1Band3 = 0x108; 607 inline constexpr int32_t APVLevel11Band0 = 0x201; 608 inline constexpr int32_t APVLevel11Band1 = 0x202; 609 inline constexpr int32_t APVLevel11Band2 = 0x204; 610 inline constexpr int32_t APVLevel11Band3 = 0x208; 611 inline constexpr int32_t APVLevel2Band0 = 0x401; 612 inline constexpr int32_t APVLevel2Band1 = 0x402; 613 inline constexpr int32_t APVLevel2Band2 = 0x404; 614 inline constexpr int32_t APVLevel2Band3 = 0x408; 615 inline constexpr int32_t APVLevel21Band0 = 0x801; 616 inline constexpr int32_t APVLevel21Band1 = 0x802; 617 inline constexpr int32_t APVLevel21Band2 = 0x804; 618 inline constexpr int32_t APVLevel21Band3 = 0x808; 619 inline constexpr int32_t APVLevel3Band0 = 0x1001; 620 inline constexpr int32_t APVLevel3Band1 = 0x1002; 621 inline constexpr int32_t APVLevel3Band2 = 0x1004; 622 inline constexpr int32_t APVLevel3Band3 = 0x1008; 623 inline constexpr int32_t APVLevel31Band0 = 0x2001; 624 inline constexpr int32_t APVLevel31Band1 = 0x2002; 625 inline constexpr int32_t APVLevel31Band2 = 0x2004; 626 inline constexpr int32_t APVLevel31Band3 = 0x2008; 627 inline constexpr int32_t APVLevel4Band0 = 0x4001; 628 inline constexpr int32_t APVLevel4Band1 = 0x4002; 629 inline constexpr int32_t APVLevel4Band2 = 0x4004; 630 inline constexpr int32_t APVLevel4Band3 = 0x4008; 631 inline constexpr int32_t APVLevel41Band0 = 0x8001; 632 inline constexpr int32_t APVLevel41Band1 = 0x8002; 633 inline constexpr int32_t APVLevel41Band2 = 0x8004; 634 inline constexpr int32_t APVLevel41Band3 = 0x8008; 635 inline constexpr int32_t APVLevel5Band0 = 0x10001; 636 inline constexpr int32_t APVLevel5Band1 = 0x10002; 637 inline constexpr int32_t APVLevel5Band2 = 0x10004; 638 inline constexpr int32_t APVLevel5Band3 = 0x10008; 639 inline constexpr int32_t APVLevel51Band0 = 0x20001; 640 inline constexpr int32_t APVLevel51Band1 = 0x20002; 641 inline constexpr int32_t APVLevel51Band2 = 0x20004; 642 inline constexpr int32_t APVLevel51Band3 = 0x20008; 643 inline constexpr int32_t APVLevel6Band0 = 0x40001; 644 inline constexpr int32_t APVLevel6Band1 = 0x40002; 645 inline constexpr int32_t APVLevel6Band2 = 0x40004; 646 inline constexpr int32_t APVLevel6Band3 = 0x40008; 647 inline constexpr int32_t APVLevel61Band0 = 0x80001; 648 inline constexpr int32_t APVLevel61Band1 = 0x80002; 649 inline constexpr int32_t APVLevel61Band2 = 0x80004; 650 inline constexpr int32_t APVLevel61Band3 = 0x80008; 651 inline constexpr int32_t APVLevel7Band0 = 0x100001; 652 inline constexpr int32_t APVLevel7Band1 = 0x100002; 653 inline constexpr int32_t APVLevel7Band2 = 0x100004; 654 inline constexpr int32_t APVLevel7Band3 = 0x100008; 655 inline constexpr int32_t APVLevel71Band0 = 0x200001; 656 inline constexpr int32_t APVLevel71Band1 = 0x200002; 657 inline constexpr int32_t APVLevel71Band2 = 0x200004; 658 inline constexpr int32_t APVLevel71Band3 = 0x200008; 659 660 inline static const char *asString_APVBandLevel(int32_t i, const char *def = "??") { 661 switch (i) { 662 case APVLevel1Band0: return "Level 1, Band 0"; 663 case APVLevel1Band1: return "Level 1, Band 1"; 664 case APVLevel1Band2: return "Level 1, Band 2"; 665 case APVLevel1Band3: return "Level 1, Band 3"; 666 case APVLevel11Band0: return "Level 1.1, Band 0"; 667 case APVLevel11Band1: return "Level 1.1, Band 1"; 668 case APVLevel11Band2: return "Level 1.1, Band 2"; 669 case APVLevel11Band3: return "Level 1.1, Band 3"; 670 case APVLevel2Band0: return "Level 2, Band 0"; 671 case APVLevel2Band1: return "Level 2, Band 1"; 672 case APVLevel2Band2: return "Level 2, Band 2"; 673 case APVLevel2Band3: return "Level 2, Band 3"; 674 case APVLevel21Band0: return "Level 2.1, Band 0"; 675 case APVLevel21Band1: return "Level 2.1, Band 1"; 676 case APVLevel21Band2: return "Level 2.1, Band 2"; 677 case APVLevel21Band3: return "Level 2.1, Band 3"; 678 case APVLevel3Band0: return "Level 3, Band 0"; 679 case APVLevel3Band1: return "Level 3, Band 1"; 680 case APVLevel3Band2: return "Level 3, Band 2"; 681 case APVLevel3Band3: return "Level 3, Band 3"; 682 case APVLevel31Band0: return "Level 3.1, Band 0"; 683 case APVLevel31Band1: return "Level 3.1, Band 1"; 684 case APVLevel31Band2: return "Level 3.1, Band 2"; 685 case APVLevel31Band3: return "Level 3.1, Band 3"; 686 case APVLevel4Band0: return "Level 4, Band 0"; 687 case APVLevel4Band1: return "Level 4, Band 1"; 688 case APVLevel4Band2: return "Level 4, Band 2"; 689 case APVLevel4Band3: return "Level 4, Band 3"; 690 case APVLevel41Band0: return "Level 4.1, Band 0"; 691 case APVLevel41Band1: return "Level 4.1, Band 1"; 692 case APVLevel41Band2: return "Level 4.1, Band 2"; 693 case APVLevel41Band3: return "Level 4.1, Band 3"; 694 case APVLevel5Band0: return "Level 5, Band 0"; 695 case APVLevel5Band1: return "Level 5, Band 1"; 696 case APVLevel5Band2: return "Level 5, Band 2"; 697 case APVLevel5Band3: return "Level 5, Band 3"; 698 case APVLevel51Band0: return "Level 5.1, Band 0"; 699 case APVLevel51Band1: return "Level 5.1, Band 1"; 700 case APVLevel51Band2: return "Level 5.1, Band 2"; 701 case APVLevel51Band3: return "Level 5.1, Band 3"; 702 case APVLevel6Band0: return "Level 6, Band 0"; 703 case APVLevel6Band1: return "Level 6, Band 1"; 704 case APVLevel6Band2: return "Level 6, Band 2"; 705 case APVLevel6Band3: return "Level 6, Band 3"; 706 case APVLevel61Band0: return "Level 6.1, Band 0"; 707 case APVLevel61Band1: return "Level 6.1, Band 1"; 708 case APVLevel61Band2: return "Level 6.1, Band 2"; 709 case APVLevel61Band3: return "Level 6.1, Band 3"; 710 case APVLevel7Band0: return "Level 7, Band 0"; 711 case APVLevel7Band1: return "Level 7, Band 1"; 712 case APVLevel7Band2: return "Level 7, Band 2"; 713 case APVLevel7Band3: return "Level 7, Band 3"; 714 case APVLevel71Band0: return "Level 7.1, Band 0"; 715 case APVLevel71Band1: return "Level 7.1, Band 1"; 716 case APVLevel71Band2: return "Level 7.1, Band 2"; 717 case APVLevel71Band3: return "Level 7.1, Band 3"; 718 default: return def; 719 } 720 } 721 722 // Profiles and levels for AC-4 Codec, corresponding to the definitions in 723 // "The MIME codecs parameter", Annex E.13 724 // found at https://www.etsi.org/deliver/etsi_ts/103100_103199/10319002/01.02.01_60/ts_10319002v010201p.pdf 725 // profile = ((1 << bitstream_version) << 8) | (1 << presentation_version); 726 // level = 1 << mdcompat; 727 728 inline constexpr int32_t AC4BitstreamVersion0 = 0x01; 729 inline constexpr int32_t AC4BitstreamVersion1 = 0x02; 730 inline constexpr int32_t AC4BitstreamVersion2 = 0x04; 731 732 inline constexpr int32_t AC4PresentationVersion0 = 0x01; 733 inline constexpr int32_t AC4PresentationVersion1 = 0x02; 734 inline constexpr int32_t AC4PresentationVersion2 = 0x04; 735 736 inline constexpr int32_t AC4Profile00 = AC4BitstreamVersion0 << 8 | AC4PresentationVersion0; 737 inline constexpr int32_t AC4Profile10 = AC4BitstreamVersion1 << 8 | AC4PresentationVersion0; 738 inline constexpr int32_t AC4Profile11 = AC4BitstreamVersion1 << 8 | AC4PresentationVersion1; 739 inline constexpr int32_t AC4Profile21 = AC4BitstreamVersion2 << 8 | AC4PresentationVersion1; 740 inline constexpr int32_t AC4Profile22 = AC4BitstreamVersion2 << 8 | AC4PresentationVersion2; 741 742 inline static const char *asString_AC4Profile(int32_t profile, const char *def = "??") { 743 switch (profile) { 744 case AC4Profile00: return "00.00"; 745 case AC4Profile10: return "01.00"; 746 case AC4Profile11: return "01.01"; 747 case AC4Profile21: return "02.01"; 748 case AC4Profile22: return "02.02"; 749 default: return def; 750 } 751 } 752 753 inline constexpr int32_t AC4Level0 = 0x01; 754 inline constexpr int32_t AC4Level1 = 0x02; 755 inline constexpr int32_t AC4Level2 = 0x04; 756 inline constexpr int32_t AC4Level3 = 0x08; 757 inline constexpr int32_t AC4Level4 = 0x10; 758 759 inline static const char *asString_AC4Level(int32_t level, const char *def = "??") { 760 switch (level) { 761 case AC4Level0: return "00"; 762 case AC4Level1: return "01"; 763 case AC4Level2: return "02"; 764 case AC4Level3: return "03"; 765 case AC4Level4: return "04"; 766 default: return def; 767 } 768 } 769 770 inline constexpr int32_t BITRATE_MODE_CBR = 2; 771 inline constexpr int32_t BITRATE_MODE_CBR_FD = 3; 772 inline constexpr int32_t BITRATE_MODE_CQ = 0; 773 inline constexpr int32_t BITRATE_MODE_VBR = 1; 774 775 inline static const char *asString_BitrateMode(int32_t i, const char *def = "??") { 776 switch (i) { 777 case BITRATE_MODE_CBR: return "CBR"; 778 case BITRATE_MODE_CBR_FD: return "CBR_FD"; 779 case BITRATE_MODE_CQ: return "CQ"; 780 case BITRATE_MODE_VBR: return "VBR"; 781 default: return def; 782 } 783 } 784 785 inline constexpr int32_t COLOR_Format12bitRGB444 = 3; 786 inline constexpr int32_t COLOR_Format16bitARGB1555 = 5; 787 inline constexpr int32_t COLOR_Format16bitARGB4444 = 4; 788 inline constexpr int32_t COLOR_Format16bitBGR565 = 7; 789 inline constexpr int32_t COLOR_Format16bitRGB565 = 6; 790 inline constexpr int32_t COLOR_Format18bitARGB1665 = 9; 791 inline constexpr int32_t COLOR_Format18BitBGR666 = 41; 792 inline constexpr int32_t COLOR_Format18bitRGB666 = 8; 793 inline constexpr int32_t COLOR_Format19bitARGB1666 = 10; 794 inline constexpr int32_t COLOR_Format24BitABGR6666 = 43; 795 inline constexpr int32_t COLOR_Format24bitARGB1887 = 13; 796 inline constexpr int32_t COLOR_Format24BitARGB6666 = 42; 797 inline constexpr int32_t COLOR_Format24bitBGR888 = 12; 798 inline constexpr int32_t COLOR_Format24bitRGB888 = 11; 799 inline constexpr int32_t COLOR_Format25bitARGB1888 = 14; 800 inline constexpr int32_t COLOR_Format32bitABGR2101010 = 0x7F00AAA2; 801 inline constexpr int32_t COLOR_Format32bitABGR8888 = 0x7F00A000; 802 inline constexpr int32_t COLOR_Format32bitARGB8888 = 16; 803 inline constexpr int32_t COLOR_Format32bitBGRA8888 = 15; 804 inline constexpr int32_t COLOR_Format64bitABGRFloat = 0x7F000F16; 805 inline constexpr int32_t COLOR_Format8bitRGB332 = 2; 806 inline constexpr int32_t COLOR_FormatCbYCrY = 27; 807 inline constexpr int32_t COLOR_FormatCrYCbY = 28; 808 inline constexpr int32_t COLOR_FormatL16 = 36; 809 inline constexpr int32_t COLOR_FormatL2 = 33; 810 inline constexpr int32_t COLOR_FormatL24 = 37; 811 inline constexpr int32_t COLOR_FormatL32 = 38; 812 inline constexpr int32_t COLOR_FormatL4 = 34; 813 inline constexpr int32_t COLOR_FormatL8 = 35; 814 inline constexpr int32_t COLOR_FormatMonochrome = 1; 815 inline constexpr int32_t COLOR_FormatRawBayer10bit = 31; 816 inline constexpr int32_t COLOR_FormatRawBayer8bit = 30; 817 inline constexpr int32_t COLOR_FormatRawBayer8bitcompressed = 32; 818 inline constexpr int32_t COLOR_FormatRGBAFlexible = 0x7F36A888; 819 inline constexpr int32_t COLOR_FormatRGBFlexible = 0x7F36B888; 820 inline constexpr int32_t COLOR_FormatSurface = 0x7F000789; 821 inline constexpr int32_t COLOR_FormatYCbYCr = 25; 822 inline constexpr int32_t COLOR_FormatYCrYCb = 26; 823 inline constexpr int32_t COLOR_FormatYUV411PackedPlanar = 18; 824 inline constexpr int32_t COLOR_FormatYUV411Planar = 17; 825 inline constexpr int32_t COLOR_FormatYUV420Flexible = 0x7F420888; 826 inline constexpr int32_t COLOR_FormatYUV420PackedPlanar = 20; 827 inline constexpr int32_t COLOR_FormatYUV420PackedSemiPlanar = 39; 828 inline constexpr int32_t COLOR_FormatYUV420Planar = 19; 829 inline constexpr int32_t COLOR_FormatYUV420SemiPlanar = 21; 830 inline constexpr int32_t COLOR_FormatYUV422Flexible = 0x7F422888; 831 inline constexpr int32_t COLOR_FormatYUV422PackedPlanar = 23; 832 inline constexpr int32_t COLOR_FormatYUV422PackedSemiPlanar = 40; 833 inline constexpr int32_t COLOR_FormatYUV422Planar = 22; 834 inline constexpr int32_t COLOR_FormatYUV422SemiPlanar = 24; 835 inline constexpr int32_t COLOR_FormatYUV444Flexible = 0x7F444888; 836 inline constexpr int32_t COLOR_FormatYUV444Interleaved = 29; 837 inline constexpr int32_t COLOR_FormatYUVP010 = 54; 838 inline constexpr int32_t COLOR_FormatYUVP210 = 60; 839 inline constexpr int32_t COLOR_QCOM_FormatYUV420SemiPlanar = 0x7fa30c00; 840 inline constexpr int32_t COLOR_TI_FormatYUV420PackedSemiPlanar = 0x7f000100; 841 842 inline static const char *asString_ColorFormat(int32_t i, const char *def = "??") { 843 switch (i) { 844 case COLOR_Format12bitRGB444: return "12bitRGB444"; 845 case COLOR_Format16bitARGB1555: return "16bitARGB1555"; 846 case COLOR_Format16bitARGB4444: return "16bitARGB4444"; 847 case COLOR_Format16bitBGR565: return "16bitBGR565"; 848 case COLOR_Format16bitRGB565: return "16bitRGB565"; 849 case COLOR_Format18bitARGB1665: return "18bitARGB1665"; 850 case COLOR_Format18BitBGR666: return "18BitBGR666"; 851 case COLOR_Format18bitRGB666: return "18bitRGB666"; 852 case COLOR_Format19bitARGB1666: return "19bitARGB1666"; 853 case COLOR_Format24BitABGR6666: return "24BitABGR6666"; 854 case COLOR_Format24bitARGB1887: return "24bitARGB1887"; 855 case COLOR_Format24BitARGB6666: return "24BitARGB6666"; 856 case COLOR_Format24bitBGR888: return "24bitBGR888"; 857 case COLOR_Format24bitRGB888: return "24bitRGB888"; 858 case COLOR_Format25bitARGB1888: return "25bitARGB1888"; 859 case COLOR_Format32bitABGR2101010: return "32bitABGR2101010"; 860 case COLOR_Format32bitABGR8888: return "32bitABGR8888"; 861 case COLOR_Format32bitARGB8888: return "32bitARGB8888"; 862 case COLOR_Format32bitBGRA8888: return "32bitBGRA8888"; 863 case COLOR_Format64bitABGRFloat: return "64bitABGRFloat"; 864 case COLOR_Format8bitRGB332: return "8bitRGB332"; 865 case COLOR_FormatCbYCrY: return "CbYCrY"; 866 case COLOR_FormatCrYCbY: return "CrYCbY"; 867 case COLOR_FormatL16: return "L16"; 868 case COLOR_FormatL2: return "L2"; 869 case COLOR_FormatL24: return "L24"; 870 case COLOR_FormatL32: return "L32"; 871 case COLOR_FormatL4: return "L4"; 872 case COLOR_FormatL8: return "L8"; 873 case COLOR_FormatMonochrome: return "Monochrome"; 874 case COLOR_FormatRawBayer10bit: return "RawBayer10bit"; 875 case COLOR_FormatRawBayer8bit: return "RawBayer8bit"; 876 case COLOR_FormatRawBayer8bitcompressed: return "RawBayer8bitcompressed"; 877 case COLOR_FormatRGBAFlexible: return "RGBAFlexible"; 878 case COLOR_FormatRGBFlexible: return "RGBFlexible"; 879 case COLOR_FormatSurface: return "Surface"; 880 case COLOR_FormatYCbYCr: return "YCbYCr"; 881 case COLOR_FormatYCrYCb: return "YCrYCb"; 882 case COLOR_FormatYUV411PackedPlanar: return "YUV411PackedPlanar"; 883 case COLOR_FormatYUV411Planar: return "YUV411Planar"; 884 case COLOR_FormatYUV420Flexible: return "YUV420Flexible"; 885 case COLOR_FormatYUV420PackedPlanar: return "YUV420PackedPlanar"; 886 case COLOR_FormatYUV420PackedSemiPlanar: return "YUV420PackedSemiPlanar"; 887 case COLOR_FormatYUV420Planar: return "YUV420Planar"; 888 case COLOR_FormatYUV420SemiPlanar: return "YUV420SemiPlanar"; 889 case COLOR_FormatYUV422Flexible: return "YUV422Flexible"; 890 case COLOR_FormatYUV422PackedPlanar: return "YUV422PackedPlanar"; 891 case COLOR_FormatYUV422PackedSemiPlanar: return "YUV422PackedSemiPlanar"; 892 case COLOR_FormatYUV422Planar: return "YUV422Planar"; 893 case COLOR_FormatYUV422SemiPlanar: return "YUV422SemiPlanar"; 894 case COLOR_FormatYUV444Flexible: return "YUV444Flexible"; 895 case COLOR_FormatYUV444Interleaved: return "YUV444Interleaved"; 896 case COLOR_FormatYUVP010: return "YUVP010"; 897 case COLOR_FormatYUVP210: return "YUVP210"; 898 case COLOR_QCOM_FormatYUV420SemiPlanar: return "QCOM_YUV420SemiPlanar"; 899 case COLOR_TI_FormatYUV420PackedSemiPlanar: return "TI_YUV420PackedSemiPlanar"; 900 default: return def; 901 } 902 } 903 904 inline constexpr char FEATURE_AdaptivePlayback[] = "adaptive-playback"; 905 inline constexpr char FEATURE_DetachedSurface[] = "detached-surface"; 906 inline constexpr char FEATURE_DynamicColorAspects[] = "dynamic-color-aspects"; 907 inline constexpr char FEATURE_DynamicTimestamp[] = "dynamic-timestamp"; 908 inline constexpr char FEATURE_EncodingStatistics[] = "encoding-statistics"; 909 inline constexpr char FEATURE_FrameParsing[] = "frame-parsing"; 910 inline constexpr char FEATURE_HdrEditing[] = "hdr-editing"; 911 inline constexpr char FEATURE_HlgEditing[] = "hlg-editing"; 912 inline constexpr char FEATURE_IntraRefresh[] = "intra-refresh"; 913 inline constexpr char FEATURE_LowLatency[] = "low-latency"; 914 inline constexpr char FEATURE_MultipleFrames[] = "multiple-frames"; 915 inline constexpr char FEATURE_PartialFrame[] = "partial-frame"; 916 inline constexpr char FEATURE_QpBounds[] = "qp-bounds"; 917 inline constexpr char FEATURE_Roi[] = "region-of-interest"; 918 inline constexpr char FEATURE_SecurePlayback[] = "secure-playback"; 919 inline constexpr char FEATURE_SpecialCodec[] = "special-codec"; 920 inline constexpr char FEATURE_TunneledPlayback[] = "tunneled-playback"; 921 922 // from MediaFormat.java 923 inline constexpr char MIMETYPE_VIDEO_VP8[] = "video/x-vnd.on2.vp8"; 924 inline constexpr char MIMETYPE_VIDEO_VP9[] = "video/x-vnd.on2.vp9"; 925 inline constexpr char MIMETYPE_VIDEO_AV1[] = "video/av01"; 926 inline constexpr char MIMETYPE_VIDEO_APV[] = "video/apv"; 927 inline constexpr char MIMETYPE_VIDEO_AVC[] = "video/avc"; 928 inline constexpr char MIMETYPE_VIDEO_HEVC[] = "video/hevc"; 929 inline constexpr char MIMETYPE_VIDEO_MPEG4[] = "video/mp4v-es"; 930 inline constexpr char MIMETYPE_VIDEO_H263[] = "video/3gpp"; 931 inline constexpr char MIMETYPE_VIDEO_MPEG2[] = "video/mpeg2"; 932 inline constexpr char MIMETYPE_VIDEO_RAW[] = "video/raw"; 933 inline constexpr char MIMETYPE_VIDEO_DOLBY_VISION[] = "video/dolby-vision"; 934 inline constexpr char MIMETYPE_VIDEO_SCRAMBLED[] = "video/scrambled"; 935 936 inline constexpr char MIMETYPE_AUDIO_AMR_NB[] = "audio/3gpp"; 937 inline constexpr char MIMETYPE_AUDIO_AMR_WB[] = "audio/amr-wb"; 938 inline constexpr char MIMETYPE_AUDIO_MPEG[] = "audio/mpeg"; 939 inline constexpr char MIMETYPE_AUDIO_AAC[] = "audio/mp4a-latm"; 940 inline constexpr char MIMETYPE_AUDIO_QCELP[] = "audio/qcelp"; 941 inline constexpr char MIMETYPE_AUDIO_VORBIS[] = "audio/vorbis"; 942 inline constexpr char MIMETYPE_AUDIO_OPUS[] = "audio/opus"; 943 inline constexpr char MIMETYPE_AUDIO_G711_ALAW[] = "audio/g711-alaw"; 944 inline constexpr char MIMETYPE_AUDIO_G711_MLAW[] = "audio/g711-mlaw"; 945 inline constexpr char MIMETYPE_AUDIO_RAW[] = "audio/raw"; 946 inline constexpr char MIMETYPE_AUDIO_FLAC[] = "audio/flac"; 947 inline constexpr char MIMETYPE_AUDIO_MSGSM[] = "audio/gsm"; 948 inline constexpr char MIMETYPE_AUDIO_AC3[] = "audio/ac3"; 949 inline constexpr char MIMETYPE_AUDIO_AC4[] = "audio/ac4"; 950 inline constexpr char MIMETYPE_AUDIO_EAC3[] = "audio/eac3"; 951 inline constexpr char MIMETYPE_AUDIO_EAC3_JOC[] = "audio/eac3-joc"; 952 inline constexpr char MIMETYPE_AUDIO_SCRAMBLED[] = "audio/scrambled"; 953 inline constexpr char MIMETYPE_AUDIO_DTS[] = "audio/vnd.dts"; 954 inline constexpr char MIMETYPE_AUDIO_DTS_HD[] = "audio/vnd.dts.hd"; 955 inline constexpr char MIMETYPE_AUDIO_DTS_UHD[] = "audio/vnd.dts.uhd"; 956 957 inline constexpr char MIMETYPE_IMAGE_ANDROID_HEIC[] = "image/vnd.android.heic"; 958 959 inline constexpr char MIMETYPE_TEXT_CEA_608[] = "text/cea-608"; 960 inline constexpr char MIMETYPE_TEXT_CEA_708[] = "text/cea-708"; 961 inline constexpr char MIMETYPE_TEXT_SUBRIP[] = "application/x-subrip"; 962 inline constexpr char MIMETYPE_TEXT_VTT[] = "text/vtt"; 963 964 inline constexpr int32_t COLOR_RANGE_FULL = 1; 965 inline constexpr int32_t COLOR_RANGE_LIMITED = 2; 966 inline constexpr int32_t COLOR_STANDARD_BT2020 = 6; 967 inline constexpr int32_t COLOR_STANDARD_BT601_NTSC = 4; 968 inline constexpr int32_t COLOR_STANDARD_BT601_PAL = 2; 969 inline constexpr int32_t COLOR_STANDARD_BT709 = 1; 970 inline constexpr int32_t COLOR_TRANSFER_HLG = 7; 971 inline constexpr int32_t COLOR_TRANSFER_LINEAR = 1; 972 inline constexpr int32_t COLOR_TRANSFER_SDR_VIDEO = 3; 973 inline constexpr int32_t COLOR_TRANSFER_ST2084 = 6; 974 975 inline constexpr int32_t PICTURE_TYPE_I = 1; 976 inline constexpr int32_t PICTURE_TYPE_P = 2; 977 inline constexpr int32_t PICTURE_TYPE_B = 3; 978 inline constexpr int32_t PICTURE_TYPE_UNKNOWN = 0; 979 980 inline constexpr int32_t VIDEO_ENCODING_STATISTICS_LEVEL_1 = 1; 981 inline constexpr int32_t VIDEO_ENCODING_STATISTICS_LEVEL_NONE = 0; 982 983 inline constexpr char KEY_AAC_DRC_ALBUM_MODE[] = "aac-drc-album-mode"; 984 inline constexpr char KEY_AAC_DRC_ATTENUATION_FACTOR[] = "aac-drc-cut-level"; 985 inline constexpr char KEY_AAC_DRC_BOOST_FACTOR[] = "aac-drc-boost-level"; 986 inline constexpr char KEY_AAC_DRC_EFFECT_TYPE[] = "aac-drc-effect-type"; 987 inline constexpr char KEY_AAC_DRC_HEAVY_COMPRESSION[] = "aac-drc-heavy-compression"; 988 inline constexpr char KEY_AAC_DRC_OUTPUT_LOUDNESS[] = "aac-drc-output-loudness"; 989 inline constexpr char KEY_AAC_DRC_TARGET_REFERENCE_LEVEL[] = "aac-target-ref-level"; 990 inline constexpr char KEY_AAC_ENCODED_TARGET_LEVEL[] = "aac-encoded-target-level"; 991 inline constexpr char KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT[] = "aac-max-output-channel_count"; 992 inline constexpr char KEY_AAC_PROFILE[] = "aac-profile"; 993 inline constexpr char KEY_AAC_SBR_MODE[] = "aac-sbr-mode"; 994 inline constexpr char KEY_ALLOW_FRAME_DROP[] = "allow-frame-drop"; 995 inline constexpr char KEY_AUDIO_SESSION_ID[] = "audio-session-id"; 996 inline constexpr char KEY_BIT_RATE[] = "bitrate"; 997 inline constexpr char KEY_BITRATE_MODE[] = "bitrate-mode"; 998 inline constexpr char KEY_CA_SESSION_ID[] = "ca-session-id"; 999 inline constexpr char KEY_CA_SYSTEM_ID[] = "ca-system-id"; 1000 inline constexpr char KEY_CA_PRIVATE_DATA[] = "ca-private-data"; 1001 inline constexpr char KEY_CAPTURE_RATE[] = "capture-rate"; 1002 inline constexpr char KEY_CHANNEL_COUNT[] = "channel-count"; // value N, eq to range 1..N 1003 inline constexpr char KEY_CHANNEL_MASK[] = "channel-mask"; 1004 inline constexpr char KEY_COLOR_FORMAT[] = "color-format"; 1005 inline constexpr char KEY_COLOR_RANGE[] = "color-range"; 1006 inline constexpr char KEY_COLOR_STANDARD[] = "color-standard"; 1007 inline constexpr char KEY_COLOR_TRANSFER[] = "color-transfer"; 1008 inline constexpr char KEY_COMPLEXITY[] = "complexity"; 1009 inline constexpr char KEY_CREATE_INPUT_SURFACE_SUSPENDED[] = "create-input-buffers-suspended"; 1010 inline constexpr char KEY_DURATION[] = "durationUs"; 1011 inline constexpr char KEY_FEATURE_[] = "feature-"; 1012 inline constexpr char KEY_FLAC_COMPRESSION_LEVEL[] = "flac-compression-level"; 1013 inline constexpr char KEY_FRAME_RATE[] = "frame-rate"; 1014 inline constexpr char KEY_GRID_COLUMNS[] = "grid-cols"; 1015 inline constexpr char KEY_GRID_ROWS[] = "grid-rows"; 1016 inline constexpr char KEY_HDR_STATIC_INFO[] = "hdr-static-info"; 1017 inline constexpr char KEY_HDR10_PLUS_INFO[] = "hdr10-plus-info"; 1018 inline constexpr char KEY_HEIGHT[] = "height"; 1019 inline constexpr char KEY_I_FRAME_INTERVAL[] = "i-frame-interval"; 1020 inline constexpr char KEY_IMPORTANCE[] = "importance"; 1021 inline constexpr char KEY_INTRA_REFRESH_PERIOD[] = "intra-refresh-period"; 1022 inline constexpr char KEY_IS_ADTS[] = "is-adts"; 1023 inline constexpr char KEY_IS_AUTOSELECT[] = "is-autoselect"; 1024 inline constexpr char KEY_IS_DEFAULT[] = "is-default"; 1025 inline constexpr char KEY_IS_FORCED_SUBTITLE[] = "is-forced-subtitle"; 1026 inline constexpr char KEY_IS_TIMED_TEXT[] = "is-timed-text"; 1027 inline constexpr char KEY_LANGUAGE[] = "language"; 1028 inline constexpr char KEY_LATENCY[] = "latency"; 1029 inline constexpr char KEY_LEVEL[] = "level"; 1030 inline constexpr char KEY_LOW_LATENCY[] = "low-latency"; 1031 inline constexpr char KEY_MAX_B_FRAMES[] = "max-bframes"; 1032 inline constexpr char KEY_MAX_BIT_RATE[] = "max-bitrate"; 1033 inline constexpr char KEY_MAX_FPS_TO_ENCODER[] = "max-fps-to-encoder"; 1034 inline constexpr char KEY_MAX_HEIGHT[] = "max-height"; 1035 inline constexpr char KEY_MAX_INPUT_SIZE[] = "max-input-size"; 1036 inline constexpr char KEY_BUFFER_BATCH_MAX_OUTPUT_SIZE[] = "buffer-batch-max-output-size"; 1037 inline constexpr char KEY_BUFFER_BATCH_THRESHOLD_OUTPUT_SIZE[] = 1038 "buffer-batch-threshold-output-size"; 1039 inline constexpr char KEY_MAX_OUTPUT_CHANNEL_COUNT[] = "max-output-channel-count"; 1040 inline constexpr char KEY_MAX_PTS_GAP_TO_ENCODER[] = "max-pts-gap-to-encoder"; 1041 inline constexpr char KEY_MAX_WIDTH[] = "max-width"; 1042 inline constexpr char KEY_MIME[] = "mime"; 1043 inline constexpr char KEY_NUM_SLOTS[] = "num-slots"; 1044 inline constexpr char KEY_OPERATING_RATE[] = "operating-rate"; 1045 inline constexpr char KEY_OUTPUT_REORDER_DEPTH[] = "output-reorder-depth"; 1046 inline constexpr char KEY_PCM_ENCODING[] = "pcm-encoding"; 1047 inline constexpr char KEY_PICTURE_TYPE[] = "picture-type"; 1048 inline constexpr char KEY_PIXEL_ASPECT_RATIO_HEIGHT[] = "sar-height"; 1049 inline constexpr char KEY_PIXEL_ASPECT_RATIO_WIDTH[] = "sar-width"; 1050 inline constexpr char KEY_PREPEND_HEADER_TO_SYNC_FRAMES[] = "prepend-sps-pps-to-idr-frames"; 1051 inline constexpr char KEY_PRIORITY[] = "priority"; 1052 inline constexpr char KEY_PROFILE[] = "profile"; 1053 inline constexpr char KEY_PUSH_BLANK_BUFFERS_ON_STOP[] = "push-blank-buffers-on-shutdown"; 1054 inline constexpr char KEY_QUALITY[] = "quality"; 1055 inline constexpr char KEY_REPEAT_PREVIOUS_FRAME_AFTER[] = "repeat-previous-frame-after"; 1056 inline constexpr char KEY_ROTATION[] = "rotation-degrees"; 1057 inline constexpr char KEY_SAMPLE_RATE[] = "sample-rate"; 1058 inline constexpr char KEY_SLICE_HEIGHT[] = "slice-height"; 1059 inline constexpr char KEY_STRIDE[] = "stride"; 1060 inline constexpr char KEY_TEMPORAL_LAYERING[] = "ts-schema"; 1061 inline constexpr char KEY_TILE_HEIGHT[] = "tile-height"; 1062 inline constexpr char KEY_TILE_WIDTH[] = "tile-width"; 1063 inline constexpr char KEY_TRACK_ID[] = "track-id"; 1064 inline constexpr char KEY_VIDEO_ENCODING_STATISTICS_LEVEL[] = "video-encoding-statistics-level"; 1065 inline constexpr char KEY_VIDEO_QP_AVERAGE[] = "video-qp-average"; 1066 inline constexpr char KEY_VIDEO_QP_B_MAX[] = "video-qp-b-max"; 1067 inline constexpr char KEY_VIDEO_QP_B_MIN[] = "video-qp-b-min"; 1068 inline constexpr char KEY_VIDEO_QP_I_MAX[] = "video-qp-i-max"; 1069 inline constexpr char KEY_VIDEO_QP_I_MIN[] = "video-qp-i-min"; 1070 inline constexpr char KEY_VIDEO_QP_MAX[] = "video-qp-max"; 1071 inline constexpr char KEY_VIDEO_QP_MIN[] = "video-qp-min"; 1072 inline constexpr char KEY_VIDEO_QP_P_MAX[] = "video-qp-p-max"; 1073 inline constexpr char KEY_VIDEO_QP_P_MIN[] = "video-qp-p-min"; 1074 inline constexpr char KEY_WIDTH[] = "width"; 1075 inline constexpr char KEY_PICTURE_PROFILE_HANDLE[] = "picture-profile-handle"; 1076 inline constexpr char KEY_PICTURE_PROFILE_ID[] = "picture-profile-id"; 1077 1078 // from MediaCodec.java 1079 inline constexpr int32_t ERROR_INSUFFICIENT_OUTPUT_PROTECTION = 4; 1080 inline constexpr int32_t ERROR_INSUFFICIENT_RESOURCE = 1100; 1081 inline constexpr int32_t ERROR_KEY_EXPIRED = 2; 1082 inline constexpr int32_t ERROR_NO_KEY = 1; 1083 inline constexpr int32_t ERROR_RECLAIMED = 1101; 1084 inline constexpr int32_t ERROR_RESOURCE_BUSY = 3; 1085 inline constexpr int32_t ERROR_SESSION_NOT_OPENED = 5; 1086 inline constexpr int32_t ERROR_UNSUPPORTED_OPERATION = 6; 1087 inline constexpr char CODEC[] = "android.media.mediacodec.codec"; 1088 inline constexpr char ENCODER[] = "android.media.mediacodec.encoder"; 1089 inline constexpr char HEIGHT[] = "android.media.mediacodec.height"; 1090 inline constexpr char MIME_TYPE[] = "android.media.mediacodec.mime"; 1091 inline constexpr char MODE[] = "android.media.mediacodec.mode"; 1092 inline constexpr char MODE_AUDIO[] = "audio"; 1093 inline constexpr char MODE_VIDEO[] = "video"; 1094 inline constexpr char ROTATION[] = "android.media.mediacodec.rotation"; 1095 inline constexpr char SECURE[] = "android.media.mediacodec.secure"; 1096 inline constexpr char WIDTH[] = "android.media.mediacodec.width"; 1097 1098 inline constexpr int32_t BUFFER_FLAG_CODEC_CONFIG = 2; 1099 inline constexpr int32_t BUFFER_FLAG_DECODE_ONLY = 32; 1100 inline constexpr int32_t BUFFER_FLAG_END_OF_STREAM = 4; 1101 inline constexpr int32_t BUFFER_FLAG_KEY_FRAME = 1; 1102 inline constexpr int32_t BUFFER_FLAG_MUXER_DATA = 16; 1103 inline constexpr int32_t BUFFER_FLAG_PARTIAL_FRAME = 8; 1104 inline constexpr int32_t BUFFER_FLAG_SYNC_FRAME = 1; 1105 inline constexpr int32_t CONFIGURE_FLAG_ENCODE = 1; 1106 inline constexpr int32_t CONFIGURE_FLAG_USE_BLOCK_MODEL = 2; 1107 inline constexpr int32_t CRYPTO_MODE_AES_CBC = 2; 1108 inline constexpr int32_t CRYPTO_MODE_AES_CTR = 1; 1109 inline constexpr int32_t CRYPTO_MODE_UNENCRYPTED = 0; 1110 inline constexpr int32_t INFO_OUTPUT_FORMAT_CHANGED = -2; 1111 inline constexpr int32_t INFO_TRY_AGAIN_LATER = -1; 1112 inline constexpr int32_t VIDEO_SCALING_MODE_SCALE_TO_FIT = 1; 1113 inline constexpr int32_t VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = 2; 1114 inline constexpr char PARAMETER_KEY_OFFSET_TIME[] = "time-offset-us"; 1115 inline constexpr char PARAMETER_KEY_REQUEST_SYNC_FRAME[] = "request-sync"; 1116 inline constexpr char PARAMETER_KEY_SUSPEND[] = "drop-input-frames"; 1117 inline constexpr char PARAMETER_KEY_SUSPEND_TIME[] = "drop-start-time-us"; 1118 inline constexpr char PARAMETER_KEY_TUNNEL_PEEK[] = "tunnel-peek"; 1119 inline constexpr char PARAMETER_KEY_VIDEO_BITRATE[] = "video-bitrate"; 1120 inline constexpr char PARAMETER_KEY_QP_OFFSET_MAP[] = "qp-offset-map"; 1121 inline constexpr char PARAMETER_KEY_QP_OFFSET_RECTS[] = "qp-offset-rects"; 1122 1123 } 1124 1125 #endif // MEDIA_CODEC_CONSTANTS_H_ 1126