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