• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 
22 namespace OHOS {
23 namespace Media {
24 /**
25  * @brief Media type
26  *
27  * @since 3.1
28  * @version 3.1
29  */
30 enum MediaType : int32_t {
31     /**
32      * track is audio.
33      */
34     MEDIA_TYPE_AUD = 0,
35     /**
36      * track is video.
37      */
38     MEDIA_TYPE_VID = 1,
39     /**
40      * track is subtitle.
41      */
42     MEDIA_TYPE_SUBTITLE = 2,
43 };
44 
45 /**
46  * @brief
47  *
48  * @since 3.1
49  * @version 3.1
50  */
51 enum VideoPixelFormat {
52     /**
53      * yuv 420 planar.
54      */
55     YUVI420 = 1,
56     /**
57      *  NV12. yuv 420 semiplanar.
58      */
59     NV12 = 2,
60     /**
61      *  NV21. yvu 420 semiplanar.
62      */
63     NV21 = 3,
64     /**
65      * format from surface.
66      */
67     SURFACE_FORMAT = 4,
68     /**
69      * RGBA.
70      */
71     RGBA = 5,
72 };
73 
74 /**
75  * @brief the struct of geolocation
76  *
77  * @param latitude float: latitude in degrees. Its value must be in the range [-90, 90].
78  * @param longitude float: longitude in degrees. Its value must be in the range [-180, 180].
79  * @since  3.1
80  * @version 3.1
81  */
82 struct Location {
83     float latitude = 0;
84     float longitude = 0;
85 };
86 
87 /**
88  * @brief Enumerates the seek mode.
89  */
90 enum AVSeekMode : uint8_t {
91     /**
92      * @brief this mode is used to seek to a key frame that is located right or before at
93      * the given timestamp.
94      */
95     AV_SEEK_PREV_SYNC = 0,
96     /**
97      * @brief this mode is used to seek to a key frame that is located right or after at
98      * the given timestamp.
99      */
100     AV_SEEK_NEXT_SYNC = 1,
101     /**
102      * @brief this mode is used to seek to a key frame that is located right or closest at
103      * the given timestamp.
104      */
105     AV_SEEK_CLOSEST_SYNC = 2,
106     /**
107      * @brief this mode is used to seek to a frame that is located right or closest at
108      * the given timestamp.
109      */
110     AV_SEEK_CLOSEST = 3,
111 };
112 
113 /**
114  * @brief Enumerates the video rotation.
115  *
116  * @since 3.2
117  * @version 3.2
118  */
119 enum VideoRotation : uint32_t {
120     /**
121     * Video without rotation
122     */
123     VIDEO_ROTATION_0 = 0,
124     /**
125     * Video rotated 90 degrees
126     */
127     VIDEO_ROTATION_90 = 90,
128     /**
129     * Video rotated 180 degrees
130     */
131     VIDEO_ROTATION_180 = 180,
132     /**
133     * Video rotated 270 degrees
134     */
135     VIDEO_ROTATION_270 = 270,
136 };
137 
138 /**
139  * @brief Enumerates the state change reason.
140  *
141  * @since 3.2
142  * @version 3.2
143  */
144 enum StateChangeReason {
145     /**
146      * audio/video state change by user
147      */
148     USER = 1,
149     /**
150      * audio/video state change by system
151      */
152     BACKGROUND = 2,
153 };
154 } // namespace Media
155 } // namespace OHOS
156 #endif // AV_COMMOM_H