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