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