• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2025 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 #ifndef AV_COMMOM_H
16 #define AV_COMMOM_H
17 
18 #include <vector>
19 #include <string>
20 #include "meta/format.h"
21 #include "media_core.h"
22 
23 namespace OHOS {
24 namespace Media {
25 /**
26  * @brief
27  *
28  * @since 3.1
29  * @version 3.1
30  */
31 enum VideoPixelFormat {
32     /**
33      * yuv 420 planar.
34      */
35     YUVI420 = 1,
36     /**
37      *  NV12. yuv 420 semiplanar.
38      */
39     NV12 = 2,
40     /**
41      *  NV21. yvu 420 semiplanar.
42      */
43     NV21 = 3,
44     /**
45      * format from surface.
46      */
47     SURFACE_FORMAT = 4,
48     /**
49      * RGBA.
50      */
51     RGBA = 5,
52 };
53 
54 /**
55  * @brief Enumerates the video rotation.
56  *
57  * @since 3.2
58  * @version 3.2
59  */
60 enum VideoRotation : uint32_t {
61     /**
62     * Video without rotation
63     */
64     VIDEO_ROTATION_0 = 0,
65     /**
66     * Video rotated 90 degrees
67     */
68     VIDEO_ROTATION_90 = 90,
69     /**
70     * Video rotated 180 degrees
71     */
72     VIDEO_ROTATION_180 = 180,
73     /**
74     * Video rotated 270 degrees
75     */
76     VIDEO_ROTATION_270 = 270,
77 };
78 
79 /**
80  * @brief Enumerates output format types.
81  *
82  * @since 3.1
83  * @version 3.1
84  */
85 enum OutputFormatType : int32_t {
86     /** Default format */
87     FORMAT_DEFAULT = 0,
88     /** MPEG4 format */
89     FORMAT_MPEG_4 = 2,
90     /** M4A format */
91     FORMAT_M4A = 6,
92     /** AMR format */
93     FORMAT_AMR = 8,
94     /** mp3 format */
95     FORMAT_MP3 = 9,
96     /** WAV format */
97     FORMAT_WAV = 10,
98     /** AAC format */
99     FORMAT_AAC = 11,
100     /** BUTT */
101     FORMAT_BUTT,
102 };
103 
104 /**
105  * @brief Enumerates video codec formats.
106  *
107  * @since 3.1
108  * @version 3.1
109  */
110 enum VideoCodecFormat : int32_t {
111     /** Default format */
112     VIDEO_DEFAULT = 0,
113     /** H.264 */
114     H264 = 2,
115     /** MPEG4 */
116     MPEG4 = 6,
117     /** H.265 */
118     H265 = 8,
119     VIDEO_CODEC_FORMAT_BUTT,
120 };
121 
122 /**
123  * @brief Enumerates audio codec formats.
124  *
125  * @since 3.1
126  * @version 3.1
127  */
128 enum AudioCodecFormat : int32_t {
129     /** Default format */
130     AUDIO_DEFAULT = 0,
131     /** Advanced Audio Coding Low Complexity (AAC-LC) */
132     AAC_LC = 3,
133     /** mp3 format */
134     AUDIO_MPEG = 4,
135     /** G711-mulaw format */
136     AUDIO_G711MU = 5,
137     /** AUDIO_AMR_NB format */
138     AUDIO_AMR_NB = 9,
139     /** AUDIO_AMR_WB format */
140     AUDIO_AMR_WB = 10,
141     /** Invalid value */
142     AUDIO_CODEC_FORMAT_BUTT,
143 };
144 
145 class AVMimeType {
146 public:
147     static constexpr std::string_view APPLICATION_M3U8 = "application/m3u8";
148 };
149 } // namespace Media
150 } // namespace OHOS
151 #endif // AV_COMMOM_H