1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef MEDIA_AVCODEC_INFO_H 17 #define MEDIA_AVCODEC_INFO_H 18 19 #include <cstdint> 20 #include <memory> 21 #include <vector> 22 #include "av_common.h" 23 #include "nocopyable.h" 24 #include "avcodec_audio_common.h" 25 26 namespace OHOS { 27 namespace MediaAVCodec { 28 /** 29 * @brief AVCodec Type 30 * 31 * @since 3.1 32 * @version 4.0 33 */ 34 enum AVCodecType : int32_t { 35 AVCODEC_TYPE_NONE = -1, 36 AVCODEC_TYPE_VIDEO_ENCODER = 0, 37 AVCODEC_TYPE_VIDEO_DECODER, 38 AVCODEC_TYPE_AUDIO_ENCODER, 39 AVCODEC_TYPE_AUDIO_DECODER, 40 }; 41 42 /** 43 * @brief AVCodec Category 44 * 45 * @since 3.1 46 * @version 4.0 47 */ 48 enum class AVCodecCategory : int32_t { 49 AVCODEC_NONE = -1, 50 AVCODEC_HARDWARE = 0, 51 AVCODEC_SOFTWARE, 52 }; 53 54 /** 55 * @brief The enum of optional features that can be used in specific codec seenarios. 56 * 57 * @since 5.0 58 * @version 5.0 59 */ 60 enum class AVCapabilityFeature : int32_t { 61 VIDEO_ENCODER_TEMPORAL_SCALABILITY = 0, 62 VIDEO_ENCODER_LONG_TERM_REFERENCE = 1, 63 VIDEO_LOW_LATENCY = 2, 64 VIDEO_WATERMARK = 3, 65 VIDEO_RPR = 4, 66 VIDEO_ENCODER_QP_MAP = 5, 67 VIDEO_DECODER_SEEK_WITHOUT_FLUSH = 6, 68 VIDEO_ENCODER_B_FRAME = 7, 69 MAX_VALUE 70 }; 71 72 /** 73 * @brief Range contain min and max value 74 * 75 * @since 3.1 76 * @version 5.0 77 */ 78 struct Range { 79 int32_t minVal; 80 int32_t maxVal; RangeRange81 Range() : minVal(0), maxVal(0) {} RangeRange82 Range(const int32_t &min, const int32_t &max) 83 { 84 if (min <= max) { 85 this->minVal = min; 86 this->maxVal = max; 87 } else { 88 this->minVal = 0; 89 this->maxVal = 0; 90 } 91 } 92 CreateRange93 Range Create(const int32_t &min, const int32_t &max) 94 { 95 return Range(min, max); 96 } 97 IntersectRange98 Range Intersect(const int32_t &min, const int32_t &max) 99 { 100 int32_t minCmp = this->minVal > min ? this->minVal : min; 101 int32_t maxCmp = this->maxVal < max ? this->maxVal : max; 102 return this->Create(minCmp, maxCmp); 103 } 104 IntersectRange105 Range Intersect(const Range &range) 106 { 107 int32_t minCmp = this->minVal > range.minVal ? this->minVal : range.minVal; 108 int32_t maxCmp = this->maxVal < range.maxVal ? this->maxVal : range.maxVal; 109 return this->Create(minCmp, maxCmp); 110 } 111 InRangeRange112 bool InRange(int32_t value) 113 { 114 return (value >= minVal && value <= maxVal); 115 } 116 UnionRange117 Range Union(const Range &range) 118 { 119 int32_t minCmp = this->minVal < range.minVal ? this->minVal : range.minVal; 120 int32_t maxCmp = this->maxVal > range.maxVal ? this->maxVal : range.maxVal; 121 return this->Create(minCmp, maxCmp); 122 } 123 }; 124 125 /** 126 * @brief ImgSize contain width and height 127 * 128 * @since 3.1 129 * @version 4.0 130 */ 131 struct ImgSize { 132 int32_t width; 133 int32_t height; 134 ImgSizeImgSize135 ImgSize() : width(0), height(0) {} 136 ImgSizeImgSize137 ImgSize(const int32_t &width, const int32_t &height) 138 { 139 this->width = width; 140 this->height = height; 141 } 142 143 bool operator<(const ImgSize &p) const 144 { 145 return (width < p.width) || (width == p.width && height < p.height); 146 } 147 }; 148 149 /** 150 * @brief Capability Data struct of Codec, parser from config file 151 * 152 * @since 3.1 153 * @version 4.0 154 */ 155 struct CapabilityData { 156 std::string codecName = ""; 157 int32_t codecType = AVCODEC_TYPE_NONE; 158 std::string mimeType = ""; 159 bool isVendor = false; 160 int32_t maxInstance = 0; 161 Range bitrate; 162 Range channels; 163 Range complexity; 164 ImgSize alignment; 165 Range width; 166 Range height; 167 Range frameRate; 168 Range encodeQuality; 169 Range blockPerFrame; 170 Range blockPerSecond; 171 ImgSize blockSize; 172 std::vector<int32_t> sampleRate; 173 std::vector<int32_t> pixFormat; 174 std::vector<int32_t> bitDepth; 175 std::vector<int32_t> profiles; 176 std::vector<int32_t> bitrateMode; 177 std::map<int32_t, std::vector<int32_t>> profileLevelsMap; 178 std::map<ImgSize, Range> measuredFrameRate; 179 bool supportSwapWidthHeight = false; 180 std::map<int32_t, Format> featuresMap; 181 int32_t rank = 0; 182 Range maxBitrate; 183 Range sqrFactor; 184 int32_t maxVersion = 0; 185 std::vector<Range> sampleRateRanges; 186 }; 187 188 struct LevelParams { 189 int32_t maxBlockPerFrame = 0; 190 int32_t maxBlockPerSecond = 0; 191 int32_t maxFrameRate = 0; 192 int32_t maxWidth = 0; 193 int32_t maxHeight = 0; LevelParamsLevelParams194 LevelParams(const int32_t &blockPerSecond, const int32_t &blockPerFrame, const int32_t &frameRate, 195 const int32_t &width, const int32_t height) 196 { 197 this->maxBlockPerFrame = blockPerFrame; 198 this->maxBlockPerSecond = blockPerSecond; 199 this->maxFrameRate = frameRate; 200 this->maxWidth = width; 201 this->maxHeight = height; 202 } LevelParamsLevelParams203 LevelParams(const int32_t &blockPerSecond, const int32_t &blockPerFrame) 204 { 205 this->maxBlockPerFrame = blockPerFrame; 206 this->maxBlockPerSecond = blockPerSecond; 207 } 208 }; 209 210 class __attribute__((visibility("default"))) AVCodecInfo { 211 public: 212 explicit AVCodecInfo(CapabilityData *capabilityData); 213 ~AVCodecInfo(); 214 static bool isEncoder(int32_t codecType); 215 static bool isAudio(int32_t codecType); 216 static bool isVideo(int32_t codecType); 217 218 /** 219 * @brief Get name of this codec, used to create the codec instance. 220 * @return Returns codec name. 221 * @since 3.1 222 * @version 4.0 223 */ 224 std::string GetName(); 225 226 /** 227 * @brief Get type of this codec 228 * @return Returns codec type, see {@link AVCodecType} 229 * @since 3.1 230 * @version 4.0 231 */ 232 AVCodecType GetType(); 233 234 /** 235 * @brief Get mime type of this codec 236 * @return Returns codec mime type, see {@link CodecMimeType} 237 * @since 3.1 238 * @version 4.0 239 */ 240 std::string GetMimeType(); 241 242 /** 243 * @brief Check whether the codec is accelerated by hardware. 244 * @return Returns true if the codec is hardware accelerated; false otherwise. 245 * @since 3.1 246 * @version 4.0 247 */ 248 bool IsHardwareAccelerated(); 249 250 /** 251 * @brief Check whether the codec is accelerated by hardware. 252 * @return Returns true if the codec is hardware accelerated; false otherwise. 253 * @since 3.1 254 * @version 4.0 255 */ 256 int32_t GetMaxSupportedInstances(); 257 258 /** 259 * @brief Check whether the codec is software implemented only. 260 * @return Returns true if the codec is software implemented only; false otherwise. 261 * @since 3.1 262 * @version 4.0 263 */ 264 bool IsSoftwareOnly(); 265 266 /** 267 * @brief Check whether the codec is provided by vendor. 268 * @return Returns true if the codec is provided by vendor; false otherwise. 269 * @since 3.1 270 * @version 4.0 271 */ 272 bool IsVendor(); 273 274 /** 275 * @brief Get supported codec profile number. 276 * @return Returns an array of supported codec profile number. For details, see {@link AACProfile}. 277 * @since 3.1 278 * @version 4.0 279 */ 280 std::map<int32_t, std::vector<int32_t>> GetSupportedLevelsForProfile(); 281 282 /** 283 * @brief Check if the codec supports a specified feature. 284 * @param feature Feature enum, refer to {@link AVCapabilityFeature} for details 285 * @return Returns true if the feature is supported, false if it is not supported 286 * @since 5.0 287 * @version 5.0 288 */ 289 bool IsFeatureSupported(AVCapabilityFeature feature); 290 291 /** 292 * @brief Get the properties of a specified feature. 293 * @param feature Feature enum, refer to {@link AVCapabilityFeature} for details 294 * @param format Output parameter, get parametr of specified feature 295 * @return Returns {@link AVCS_ERR_OK} if success, returns an error code otherwise 296 * @since 5.0 297 * @version 5.0 298 */ 299 int32_t GetFeatureProperties(AVCapabilityFeature feature, Format &format); 300 301 /** 302 * @brief Get codec max supported version 303 * @return Returns codec max supported version. 304 */ 305 int32_t GetMaxSupportedVersion(); 306 307 private: 308 bool IsFeatureValid(AVCapabilityFeature feature); 309 CapabilityData *data_; 310 }; 311 312 class __attribute__((visibility("default"))) VideoCaps { 313 public: 314 explicit VideoCaps(CapabilityData *capabilityData); 315 ~VideoCaps(); 316 317 /** 318 * @brief Get codec information, such as the codec name, codec type, 319 * whether hardware acceleration is supported, whether only software is supported, 320 * and whether the codec is provided by the vendor. 321 * @return Returns the pointer of {@link AVCodecInfo}. 322 * @since 3.1 323 * @version 4.0 324 */ 325 std::shared_ptr<AVCodecInfo> GetCodecInfo(); 326 327 /** 328 * @brief Get supported bitrate range. 329 * @return Returns the range of supported bitrates. 330 * @since 3.1 331 * @version 4.0 332 */ 333 Range GetSupportedBitrate(); 334 335 /** 336 * @brief Get supported video raw formats. 337 * @return Returns an array of supported formats. For Details, see {@link VideoPixelFormat}. 338 * @since 3.1 339 * @version 4.0 340 */ 341 std::vector<int32_t> GetSupportedFormats(); 342 343 /** 344 * @brief Get supported alignment of video height, only used for video codecs. 345 * @return Returns the supported alignment of video height (in pixels). 346 * @since 3.1 347 * @version 4.0 348 */ 349 int32_t GetSupportedHeightAlignment(); 350 351 /** 352 * @brief Get supported alignment of video width, only used for video codecs. 353 * @return Returns the supported alignment of video width (in pixels). 354 * @since 3.1 355 * @version 4.0 356 */ 357 int32_t GetSupportedWidthAlignment(); 358 359 /** 360 * @brief Get supported width range of video. 361 * @return Returns the supported width range of video. 362 * @since 3.1 363 * @version 4.0 364 */ 365 Range GetSupportedWidth(); 366 367 /** 368 * @brief Get supported height range of video. 369 * @return Returns the supported height range of video. 370 * @since 3.1 371 * @version 4.0 372 */ 373 Range GetSupportedHeight(); 374 375 /** 376 * @brief Get supported profiles of this codec. 377 * @return Returns an array of supported profiles: 378 * returns {@link H263Profile} array if codec is h263, 379 * returns {@link AVCProfile} array if codec is h264, 380 * returns {@link HEVCProfile} array if codec is h265, 381 * returns {@link MPEG2Profile} array if codec is mpeg2, 382 * returns {@link MPEG4Profile} array if codec is mpeg4, 383 * returns {@link VP8Profile} array if codec is vp8. 384 * @since 3.1 385 * @version 4.0 386 */ 387 std::vector<int32_t> GetSupportedProfiles(); 388 389 /** 390 * @brief Get supported codec level array. 391 * @return Returns an array of supported codec level number. 392 * @since 3.1 393 * @version 4.0 394 */ 395 std::vector<int32_t> GetSupportedLevels(); 396 397 /** 398 * @brief Get supported video encode quality Range. 399 * @return Returns an array of supported video encode quality Range. 400 * @since 3.1 401 * @version 4.0 402 */ 403 Range GetSupportedEncodeQuality(); 404 405 /** 406 * @brief Check whether the width and height is supported. 407 * @param width Indicates the specified video width (in pixels). 408 * @param height Indicates the specified video height (in pixels). 409 * @return Returns true if the codec supports {@link width} * {@link height} size video, false otherwise. 410 * @since 3.1 411 * @version 4.0 412 */ 413 bool IsSizeSupported(int32_t width, int32_t height); 414 415 /** 416 * @brief Get supported frameRate. 417 * @return Returns the supported frameRate range of video. 418 * @since 3.1 419 * @version 4.0 420 */ 421 Range GetSupportedFrameRate(); 422 423 /** 424 * @brief Get supported frameRate range for the specified width and height. 425 * @param width Indicates the specified video width (in pixels). 426 * @param height Indicates the specified video height (in pixels). 427 * @return Returns the supported frameRate range for the specified width and height. 428 * @since 3.1 429 * @version 4.0 430 */ 431 Range GetSupportedFrameRatesFor(int32_t width, int32_t height); 432 433 /** 434 * @brief Check whether the size and frameRate is supported. 435 * @param width Indicates the specified video width (in pixels). 436 * @param height Indicates the specified video height (in pixels). 437 * @param frameRate Indicates the specified video frameRate. 438 * @return Returns true if the codec supports the specified size and frameRate; false otherwise. 439 * @since 3.1 440 * @version 4.0 441 */ 442 bool IsSizeAndRateSupported(int32_t width, int32_t height, double frameRate); 443 444 /** 445 * @brief Get preferred frameRate range for the specified width and height, 446 * these framerates can be reach the performance. 447 * @param width Indicates the specified video width (in pixels). 448 * @param height Indicates the specified video height (in pixels). 449 * @return Returns preferred frameRate range for the specified width and height. 450 * @since 3.1 451 * @version 4.0 452 */ 453 Range GetPreferredFrameRate(int32_t width, int32_t height); 454 455 /** 456 * @brief Get supported encode bitrate mode. 457 * @return Returns an array of supported encode bitrate mode. For details, see {@link VideoEncodeBitrateMode}. 458 * @since 3.1 459 * @version 4.0 460 */ 461 std::vector<int32_t> GetSupportedBitrateMode(); 462 463 /** 464 * @brief Get supported encode qualit range. 465 * @return Returns supported encode qualit range. 466 * @since 3.1 467 * @version 4.0 468 */ 469 Range GetSupportedQuality(); 470 471 /** 472 * @brief Get supported encode complexity range. 473 * @return Returns supported encode complexity range. 474 * @since 3.1 475 * @version 4.0 476 */ 477 Range GetSupportedComplexity(); 478 479 /** 480 * @brief Check video encoder wether support request key frame dynamicly. 481 * @return Returns true if support, false not support. 482 * @since 3.1 483 * @version 4.0 484 */ 485 bool IsSupportDynamicIframe(); 486 487 Range GetVideoHeightRangeForWidth(int32_t width); 488 Range GetVideoWidthRangeForHeight(int32_t height); 489 Range GetSupportedMaxBitrate(); 490 Range GetSupportedSqrFactor(); 491 492 private: 493 CapabilityData *data_; 494 int32_t blockWidth_ = 0; 495 int32_t blockHeight_ = 0; 496 Range blockPerFrameRange_; 497 Range blockPerSecondRange_; 498 Range widthRange_; 499 Range heightRange_; 500 Range frameRateRange_; 501 bool isUpdateParam_ = false; 502 void InitParams(); 503 void UpdateParams(); 504 void LoadLevelParams(); 505 void LoadAVCLevelParams(); 506 void LoadMPEGLevelParams(const std::string &mime); 507 ImgSize MatchClosestSize(const ImgSize &imgSize); 508 int32_t DivCeil(const int32_t ÷nd, const int32_t &divisor); 509 Range DivRange(const Range &range, const int32_t &divisor); 510 void UpdateBlockParams(const int32_t &blockWidth, const int32_t &blockHeight, Range &blockPerFrameRange, 511 Range &blockPerSecondRange); 512 Range GetRangeForOtherSide(int32_t side); 513 }; 514 515 constexpr uint32_t MAX_MAP_SIZE = 20; 516 517 class __attribute__((visibility("default"))) AudioCaps { 518 public: 519 explicit AudioCaps(CapabilityData *capabilityData); 520 ~AudioCaps(); 521 522 /** 523 * @brief Get codec information, such as the codec name, codec type, 524 * whether hardware acceleration is supported, whether only software is supported, 525 * and whether the codec is provided by the vendor. 526 * @return Returns the pointer of {@link AVCodecInfo} 527 * @since 3.1 528 * @version 4.0 529 */ 530 std::shared_ptr<AVCodecInfo> GetCodecInfo(); 531 532 /** 533 * @brief Get supported bitrate range. 534 * @return Returns the range of supported bitrates. 535 * @since 3.1 536 * @version 4.0 537 */ 538 Range GetSupportedBitrate(); 539 540 /** 541 * @brief Get supported channel range. 542 * @return Returns the range of supported channel. 543 * @since 3.1 544 * @version 4.0 545 */ 546 Range GetSupportedChannel(); 547 548 /** 549 * @brief Get supported audio raw format range. 550 * @return Returns the range of supported audio raw format. For details, see {@link AudioSampleFormat}. 551 * @since 3.1 552 * @version 4.0 553 */ 554 std::vector<int32_t> GetSupportedFormats(); 555 556 /** 557 * @brief Get supported audio samplerates. 558 * @return Returns an array of supported samplerates. 559 * @since 3.1 560 * @version 4.0 561 */ 562 std::vector<int32_t> GetSupportedSampleRates(); 563 564 /** 565 * @brief Get supported audio sample rate ranges. 566 * @return Returns an array of supported sample rate ranges. 567 * @since 6.0 568 */ 569 std::vector<Range> GetSupportedSampleRateRanges(); 570 571 /** 572 * @brief Get supported codec profile number. 573 * @return Returns an array of supported codec profile number. For details, see {@link AACProfile}. 574 * @since 3.1 575 * @version 4.0 576 */ 577 std::vector<int32_t> GetSupportedProfiles(); 578 579 /** 580 * @brief Get supported codec level array. 581 * @return Returns an array of supported codec level number. 582 * @since 3.1 583 * @version 4.0 584 */ 585 std::vector<int32_t> GetSupportedLevels(); 586 587 /** 588 * @brief Get supported encode complexity range. 589 * @return Returns supported encode complexity range. 590 * @since 3.1 591 * @version 4.0 592 */ 593 Range GetSupportedComplexity(); 594 595 private: 596 CapabilityData *data_; 597 }; 598 599 /** 600 * @brief Enumerates the codec mime type. 601 */ 602 class CodecMimeType { 603 public: 604 static constexpr std::string_view VIDEO_H263 = "video/h263"; 605 static constexpr std::string_view VIDEO_AVC = "video/avc"; 606 static constexpr std::string_view VIDEO_MPEG2 = "video/mpeg2"; 607 static constexpr std::string_view VIDEO_HEVC = "video/hevc"; 608 static constexpr std::string_view VIDEO_MPEG4 = "video/mp4v-es"; 609 static constexpr std::string_view VIDEO_VP8 = "video/x-vnd.on2.vp8"; 610 static constexpr std::string_view VIDEO_VP9 = "video/x-vnd.on2.vp9"; 611 static constexpr std::string_view VIDEO_RV30 = "video/rv30"; 612 static constexpr std::string_view VIDEO_RV40 = "video/rv40"; 613 static constexpr std::string_view VIDEO_VVC = "video/vvc"; 614 static constexpr std::string_view AUDIO_MIMETYPE_L2HC = "audio/l2hc"; 615 static constexpr std::string_view AUDIO_AMR_NB = "audio/3gpp"; 616 static constexpr std::string_view AUDIO_AMR_WB = "audio/amr-wb"; 617 static constexpr std::string_view AUDIO_MPEG = "audio/mpeg"; 618 static constexpr std::string_view AUDIO_AAC = "audio/mp4a-latm"; 619 static constexpr std::string_view AUDIO_VORBIS = "audio/vorbis"; 620 static constexpr std::string_view AUDIO_OPUS = "audio/opus"; 621 static constexpr std::string_view AUDIO_FLAC = "audio/flac"; 622 static constexpr std::string_view AUDIO_RAW = "audio/raw"; 623 static constexpr std::string_view AUDIO_G711MU = "audio/g711mu"; 624 static constexpr std::string_view AUDIO_G711A = "audio/g711a"; 625 static constexpr std::string_view AUDIO_COOK = "audio/cook"; 626 static constexpr std::string_view AUDIO_AC3 = "audio/ac3"; 627 static constexpr std::string_view AUDIO_VIVID = "audio/av3a"; 628 static constexpr std::string_view AUDIO_AVS3DA = "audio/av3a"; 629 static constexpr std::string_view AUDIO_APE = "audio/x-ape"; 630 static constexpr std::string_view AUDIO_LBVC = "audio/lbvc"; 631 static constexpr std::string_view IMAGE_JPG = "image/jpeg"; 632 static constexpr std::string_view IMAGE_PNG = "image/png"; 633 static constexpr std::string_view IMAGE_BMP = "image/bmp"; 634 }; 635 636 /** 637 * @brief AVC Profile 638 * 639 * @since 3.1 640 * @version 4.0 641 */ 642 enum AVCProfile : int32_t { 643 AVC_PROFILE_BASELINE = 0, 644 AVC_PROFILE_CONSTRAINED_BASELINE = 1, 645 AVC_PROFILE_CONSTRAINED_HIGH = 2, 646 AVC_PROFILE_EXTENDED = 3, 647 AVC_PROFILE_HIGH = 4, 648 AVC_PROFILE_HIGH_10 = 5, 649 AVC_PROFILE_HIGH_422 = 6, 650 AVC_PROFILE_HIGH_444 = 7, 651 AVC_PROFILE_MAIN = 8, 652 }; 653 654 /** 655 * @brief HEVC Profile 656 * 657 * @since 3.1 658 * @version 4.0 659 */ 660 enum HEVCProfile : int32_t { 661 HEVC_PROFILE_MAIN = 0, 662 HEVC_PROFILE_MAIN_10 = 1, 663 HEVC_PROFILE_MAIN_STILL = 2, 664 HEVC_PROFILE_MAIN_10_HDR10 = 3, 665 HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4, 666 HEVC_PROFILE_UNKNOW = -1, 667 }; 668 669 /** 670 * @brief VVC Profile 671 * 672 * @since 5.1 673 */ 674 enum VVCProfile : int32_t { 675 VVC_PROFILE_MAIN_10 = 1, 676 VVC_PROFILE_MAIN_12 = 2, 677 VVC_PROFILE_MAIN_12_INTRA = 10, 678 VVC_PROFILE_MULTI_MAIN_10 = 17, 679 VVC_PROFILE_MAIN_10_444 = 33, 680 VVC_PROFILE_MAIN_12_444 = 34, 681 VVC_PROFILE_MAIN_16_444 = 36, 682 VVC_PROFILE_MAIN_12_444_INTRA = 42, 683 VVC_PROFILE_MAIN_16_444_INTRA = 44, 684 VVC_PROFILE_MULTI_MAIN_10_444 = 49, 685 VVC_PROFILE_MAIN_10_STILL = 65, 686 VVC_PROFILE_MAIN_12_STILL = 66, 687 VVC_PROFILE_MAIN_10_444_STILL = 97, 688 VVC_PROFILE_MAIN_12_444_STILL = 98, 689 VVC_PROFILE_MAIN_16_444_STILL = 100, 690 VVC_PROFILE_UNKNOW = -1, 691 }; 692 693 /** 694 * @brief MPEG2 Profile 695 * 696 * @since 3.1 697 * @version 4.0 698 */ 699 enum MPEG2Profile : int32_t { 700 MPEG2_PROFILE_SIMPLE = 0, 701 MPEG2_PROFILE_MAIN = 1, 702 MPEG2_PROFILE_SNR = 2, 703 MPEG2_PROFILE_SPATIAL = 3, 704 MPEG2_PROFILE_HIGH = 4, 705 MPEG2_PROFILE_422 = 5, 706 }; 707 708 /** 709 * @brief MPEG4 Profile 710 * 711 * @since 3.1 712 * @version 4.0 713 */ 714 enum MPEG4Profile : int32_t { 715 MPEG4_PROFILE_SIMPLE = 0, 716 MPEG4_PROFILE_SIMPLE_SCALABLE = 1, 717 MPEG4_PROFILE_CORE = 2, 718 MPEG4_PROFILE_MAIN = 3, 719 MPEG4_PROFILE_NBIT = 4, 720 MPEG4_PROFILE_HYBRID = 5, 721 MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE = 6, 722 MPEG4_PROFILE_SCALABLE_TEXTURE = 7, 723 MPEG4_PROFILE_SIMPLE_FA = 8, 724 MPEG4_PROFILE_ADVANCED_REAL_TIME_SIMPLE = 9, 725 MPEG4_PROFILE_CORE_SCALABLE = 10, 726 MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 11, 727 MPEG4_PROFILE_ADVANCED_CORE = 12, 728 MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE = 13, 729 MPEG4_PROFILE_SIMPLE_FBA = 14, 730 MPEG4_PROFILE_SIMPLE_STUDIO = 15, 731 MPEG4_PROFILE_CORE_STUDIO = 16, 732 MPEG4_PROFILE_ADVANCED_SIMPLE = 17, 733 MPEG4_PROFILE_FINE_GRANULARITY_SCALABLE = 18, 734 }; 735 736 /** 737 * @brief H263 Profile 738 * 739 * @since 3.1 740 * @version 4.0 741 */ 742 enum H263Profile : int32_t { 743 H263_PROFILE_BASELINE = 0, 744 H263_PROFILE_H320_CODING_EFFICIENCY_VERSION2_BACKWARD_COMPATIBILITY = 1, // ffmpeg not support 745 H263_PROFILE_VERSION_1_BACKWARD_COMPATIBILITY = 2, 746 H263_PROFILE_VERSION_2_INTERACTIVE_AND_STREAMING_WIRELESS = 3, // ffmpeg not support 747 H263_PROFILE_VERSION_3_INTERACTIVE_AND_STREAMING_WIRELESS = 4, // ffmpeg not support 748 H263_PROFILE_CONVERSATIONAL_HIGH_COMPRESSION = 5, // ffmpeg not support 749 H263_PROFILE_CONVERSATIONAL_INTERNET = 6, // ffmpeg not support 750 H263_PROFILE_CONVERSATIONAL_PLUS_INTERLACE = 7, // ffmpeg not support 751 H263_PROFILE_HIGH_LATENCY = 8 // ffmpeg not support 752 }; 753 754 /** 755 * @brief 756 * 757 * @since 3.1 758 * @version 4.0 759 */ 760 enum VP8Profile : int32_t { 761 VP8_PROFILE_MAIN = 0, 762 }; 763 764 /** 765 * @brief 766 * 767 * @since 3.1 768 * @version 4.0 769 */ 770 enum AVCLevel : int32_t { 771 AVC_LEVEL_1 = 0, 772 AVC_LEVEL_1b = 1, 773 AVC_LEVEL_11 = 2, 774 AVC_LEVEL_12 = 3, 775 AVC_LEVEL_13 = 4, 776 AVC_LEVEL_2 = 5, 777 AVC_LEVEL_21 = 6, 778 AVC_LEVEL_22 = 7, 779 AVC_LEVEL_3 = 8, 780 AVC_LEVEL_31 = 9, 781 AVC_LEVEL_32 = 10, 782 AVC_LEVEL_4 = 11, 783 AVC_LEVEL_41 = 12, 784 AVC_LEVEL_42 = 13, 785 AVC_LEVEL_5 = 14, 786 AVC_LEVEL_51 = 15, 787 AVC_LEVEL_52 = 16, 788 AVC_LEVEL_6 = 17, 789 AVC_LEVEL_61 = 18, 790 AVC_LEVEL_62 = 19, 791 }; 792 793 /** 794 * @brief 795 * 796 * @since 3.1 797 * @version 4.0 798 */ 799 enum HEVCLevel : int32_t { 800 HEVC_LEVEL_1 = 0, 801 HEVC_LEVEL_2 = 1, 802 HEVC_LEVEL_21 = 2, 803 HEVC_LEVEL_3 = 3, 804 HEVC_LEVEL_31 = 4, 805 HEVC_LEVEL_4 = 5, 806 HEVC_LEVEL_41 = 6, 807 HEVC_LEVEL_5 = 7, 808 HEVC_LEVEL_51 = 8, 809 HEVC_LEVEL_52 = 9, 810 HEVC_LEVEL_6 = 10, 811 HEVC_LEVEL_61 = 11, 812 HEVC_LEVEL_62 = 12, 813 HEVC_LEVEL_UNKNOW = -1, 814 }; 815 816 /** 817 * @brief 818 * 819 * @since 5.1 820 */ 821 enum VVCLevel : int32_t { 822 VVC_LEVEL_1 = 16, 823 VVC_LEVEL_2 = 32, 824 VVC_LEVEL_21 = 35, 825 VVC_LEVEL_3 = 48, 826 VVC_LEVEL_31 = 51, 827 VVC_LEVEL_4 = 64, 828 VVC_LEVEL_41 = 67, 829 VVC_LEVEL_5 = 80, 830 VVC_LEVEL_51 = 83, 831 VVC_LEVEL_52 = 86, 832 VVC_LEVEL_6 = 96, 833 VVC_LEVEL_61 = 99, 834 VVC_LEVEL_62 = 102, 835 VVC_LEVEL_63 = 105, 836 VVC_LEVEL_155 = 255, 837 VVC_LEVEL_UNKNOW = -1, 838 }; 839 840 /** 841 * @brief 842 * 843 * @since 3.1 844 * @version 4.0 845 */ 846 enum MPEG2Level : int32_t { 847 MPEG2_LEVEL_LL = 0, 848 MPEG2_LEVEL_ML = 1, 849 MPEG2_LEVEL_H14 = 2, 850 MPEG2_LEVEL_HL = 3, 851 }; 852 853 /** 854 * @brief 855 * 856 * @since 3.1 857 * @version 4.0 858 */ 859 enum MPEG4Level : int32_t { 860 MPEG4_LEVEL_0 = 0, 861 MPEG4_LEVEL_0B = 1, 862 MPEG4_LEVEL_1 = 2, 863 MPEG4_LEVEL_2 = 3, 864 MPEG4_LEVEL_3 = 4, 865 MPEG4_LEVEL_3B = 5, 866 MPEG4_LEVEL_4 = 6, 867 MPEG4_LEVEL_4A = 7, 868 MPEG4_LEVEL_5 = 8, 869 MPEG4_LEVEL_6 = 9, 870 }; 871 872 /** 873 * @brief H263 Level. 874 * 875 * @since 16 876 */ 877 enum H263Level : int32_t { 878 /** 10 level */ 879 H263_LEVEL_10 = 0, 880 /** 20 level */ 881 H263_LEVEL_20 = 1, 882 /** 30 level */ 883 H263_LEVEL_30 = 2, 884 /** 40 level */ 885 H263_LEVEL_40 = 3, 886 /** 45 level */ 887 H263_LEVEL_45 = 4, 888 /** 50 level */ 889 H263_LEVEL_50 = 5, 890 /** 60 level */ 891 H263_LEVEL_60 = 6, 892 /** 70 level */ 893 H263_LEVEL_70 = 7 894 }; 895 896 /** 897 * @brief 898 * 899 * @since 3.1 900 * @version 4.0 901 */ 902 enum VideoEncodeBitrateMode : int32_t { 903 /** 904 * constant bit rate mode. 905 */ 906 CBR = 0, 907 /** 908 * variable bit rate mode. 909 */ 910 VBR = 1, 911 /** 912 * constant quality mode. 913 */ 914 CQ = 2, 915 /** 916 * stable quality rate control mode. 917 */ 918 SQR = 3, 919 /** 920 * constant bit rate mode for video call or meeting scene 921 */ 922 CBR_VIDEOCALL = 10, 923 /** 924 * constant rate factor mode 925 */ 926 CRF = 11, 927 }; 928 929 /** 930 * @brief File type 931 * 932 * @since 4.0 933 * @version 4.0 934 */ 935 enum FileType : int32_t { 936 FILE_TYPE_UNKNOW = 0, 937 FILE_TYPE_MP4 = 101, 938 FILE_TYPE_MPEGTS = 102, 939 FILE_TYPE_MKV = 103, 940 FILE_TYPE_AMR = 201, 941 FILE_TYPE_AAC = 202, 942 FILE_TYPE_MP3 = 203, 943 FILE_TYPE_FLAC = 204, 944 FILE_TYPE_OGG = 205, 945 FILE_TYPE_M4A = 206, 946 FILE_TYPE_WAV = 207, 947 }; 948 } // namespace MediaAVCodec 949 } // namespace OHOS 950 #endif // MEDIA_AVCODEC_INFO_H 951