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