• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef AV_COMMOM_H
16 #define AV_COMMOM_H
17 
18 #include <vector>
19 #include <string>
20 #include "format.h"
21 #include "avsharedmemory.h"
22 
23 namespace OHOS {
24 namespace MediaAVCodec {
25 /**
26  * @brief Media type
27  *
28  * @since 3.1
29  * @version 3.1
30  */
31 enum MediaType : int32_t {
32     /**
33      * track is audio.
34      */
35     MEDIA_TYPE_AUD = 0,
36     /**
37      * track is video.
38      */
39     MEDIA_TYPE_VID = 1,
40     /**
41      * track is subtitle.
42      */
43     MEDIA_TYPE_SUBTITLE = 2,
44 };
45 
46 /**
47  * @brief
48  *
49  * @since 3.1
50  * @version 3.1
51  */
52 enum VideoPixelFormat {
53     YUV420P = 0,
54     /**
55      * yuv 420 planar.
56      */
57     YUVI420 = 1,
58     /**
59      *  NV12. yuv 420 semiplanar.
60      */
61     NV12 = 2,
62     /**
63      *  NV21. yvu 420 semiplanar.
64      */
65     NV21 = 3,
66     /**
67      * format from surface.
68      */
69     SURFACE_FORMAT = 4,
70     /**
71      * RGBA.
72      */
73     RGBA = 5,
74     UNKNOWN_FORMAT = 6,
75 };
76 
77 /**
78  * @brief the struct of geolocation
79  *
80  * @param latitude float: latitude in degrees. Its value must be in the range [-90, 90].
81  * @param longitude float: longitude in degrees. Its value must be in the range [-180, 180].
82  * @since  3.1
83  * @version 3.1
84  */
85 struct Location {
86     float latitude = 0;
87     float longitude = 0;
88 };
89 
90 /**
91  * @brief Enumerates the seek mode.
92  */
93 enum AVSeekMode : uint8_t {
94     /* seek to sync sample after the time */
95     SEEK_MODE_NEXT_SYNC = 0,
96     /* seek to sync sample before the time */
97     SEEK_MODE_PREVIOUS_SYNC,
98     /* seek to sync sample closest to time */
99     SEEK_MODE_CLOSEST_SYNC,
100 };
101 
102 /**
103  * @brief Enumerates the video rotation.
104  *
105  * @since 3.2
106  * @version 3.2
107  */
108 enum VideoRotation : uint32_t {
109     /**
110      * Video without rotation
111      */
112     VIDEO_ROTATION_0 = 0,
113     /**
114      * Video rotated 90 degrees
115      */
116     VIDEO_ROTATION_90 = 90,
117     /**
118      * Video rotated 180 degrees
119      */
120     VIDEO_ROTATION_180 = 180,
121     /**
122      * Video rotated 270 degrees
123      */
124     VIDEO_ROTATION_270 = 270,
125 };
126 
127 /**
128  * @brief Enumerates the state change reason.
129  *
130  * @since 3.2
131  * @version 3.2
132  */
133 enum StateChangeReason {
134     /**
135      * audio/video state change by user
136      */
137     USER = 1,
138     /**
139      * audio/video state change by system
140      */
141     BACKGROUND = 2,
142 };
143 
144 /**
145  * @brief Enumerates the output format.
146  *
147  * @since 10
148  * @version 4.0
149  */
150 enum OutputFormat : uint32_t {
151     /**
152      * output format default mp4
153     */
154     OUTPUT_FORMAT_DEFAULT = 0,
155     /**
156      * output format mp4
157     */
158     OUTPUT_FORMAT_MPEG_4 = 2,
159     /**
160      * output format m4a
161     */
162     OUTPUT_FORMAT_M4A = 6,
163 };
164 } // namespace MediaAVCodec
165 } // namespace OHOS
166 #endif // AV_COMMOM_H