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