• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 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 INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_LIB_SERVICE_CONST_H_
17 #define INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_LIB_SERVICE_CONST_H_
18 
19 #include <unordered_set>
20 
21 #include "userfile_manager_types.h"
22 
23 namespace OHOS {
24 namespace Media {
25 enum {
26     MEDIA_GET_MEDIA_ASSETS = 0,
27     MEDIA_GET_IMAGE_ASSETS = 1,
28     MEDIA_GET_AUDIO_ASSETS = 2,
29     MEDIA_GET_VIDEO_ASSETS = 3,
30     MEDIA_GET_IMAGEALBUM_ASSETS = 4,
31     MEDIA_GET_VIDEOALBUM_ASSETS = 5,
32     MEDIA_CREATE_MEDIA_ASSET = 6,
33     MEDIA_DELETE_MEDIA_ASSET = 7,
34     MEDIA_MODIFY_MEDIA_ASSET = 8,
35     MEDIA_COPY_MEDIA_ASSET   = 9,
36     MEDIA_CREATE_MEDIA_ALBUM_ASSET  = 10,
37     MEDIA_DELETE_MEDIA_ALBUM_ASSET  = 11,
38     MEDIA_MODIFY_MEDIA_ALBUM_ASSET  = 12,
39 };
40 
41 /* ENUM Asset types */
42 enum AssetType {
43     ASSET_MEDIA = 0,
44     ASSET_IMAGE,
45     ASSET_AUDIO,
46     ASSET_VIDEO,
47     ASSET_GENERIC_ALBUM,
48     ASSET_IMAGEALBUM,
49     ASSET_VIDEOALBUM,
50     ASSET_NONE
51 };
52 
53 enum DirType {
54     DIR_CAMERA = 0,
55     DIR_VIDEO,
56     DIR_IMAGE,
57     DIR_AUDIOS,
58     DIR_DOCUMENTS,
59     DIR_DOWNLOAD,
60     DIR_TYPE_MAX
61 };
62 
63 enum PrivateAlbumType {
64     TYPE_FAVORITE = 0,
65     TYPE_TRASH,
66     TYPE_HIDE,
67     TYPE_SMART,
68     TYPE_SEARCH
69 };
70 
71 enum class DataType : int32_t {
72     TYPE_NULL = 0,
73     TYPE_INT,
74     TYPE_LONG,
75     TYPE_DOUBLE,
76     TYPE_STRING,
77     TYPE_BOOL
78 };
79 
80 enum class FetchResType : int32_t {
81     TYPE_FILE = 1,
82     TYPE_ALBUM,
83     TYPE_SMARTALBUM,
84     TYPE_PHOTOALBUM
85 };
86 
87 enum class DirtyType : int32_t {
88     TYPE_SYNCED,
89     TYPE_NEW,
90     TYPE_MDIRTY,
91     TYPE_FDIRTY,
92     TYPE_DELETED,
93     TYPE_RETRY
94 };
95 
96 enum class SyncStatusType : int32_t {
97     TYPE_VISIBLE = 0,
98     TYPE_DOWNLOAD,
99     TYPE_UPLOAD,
100 };
101 
102 enum class TableType : int32_t {
103     TYPE_FILES = 0,
104     TYPE_PHOTOS,
105     TYPE_AUDIOS,
106 };
107 
108 const int32_t SUCCESS = 0;
109 
110 constexpr int32_t DEFAULT_INT32 = 0;
111 constexpr int64_t DEFAULT_INT64 = 0;
112 const std::string DEFAULT_STR = "";
113 const bool DEFAULT_BOOL = false;
114 const int32_t DEFAULT_MEDIA_ID = 0;
115 const int32_t DEFAULT_PARENT_ID = 0;
116 const uint64_t DEFAULT_MEDIA_SIZE = 0;
117 const uint64_t DEFAULT_MEDIA_DATE_ADDED = 0;
118 const uint64_t DEFAULT_MEDIA_DATE_MODIFIED = 0;
119 const std::string DEFAULT_MEDIA_URI = "";
120 const MediaType DEFAULT_MEDIA_TYPE = MEDIA_TYPE_FILE;
121 const std::string DEFAULT_MEDIA_NAME = "Unknown";
122 const std::string DEFAULT_MEDIA_PATH = "";
123 const std::string DEFAULT_MEDIA_MIMETYPE = "";
124 const std::string DEFAULT_MEDIA_RELATIVE_PATH = "";
125 
126 const std::string DEFAULT_MEDIA_TITLE = "";
127 const std::string DEFAULT_MEDIA_ARTIST = "";
128 const std::string DEFAULT_MEDIA_ALBUM = "";
129 const int32_t DEFAULT_MEDIA_WIDTH = 0;
130 const int32_t DEFAULT_MEDIA_HEIGHT = 0;
131 const int32_t DEFAULT_MEDIA_DURATION = 0;
132 const int32_t DEFAULT_MEDIA_ORIENTATION = 0;
133 
134 const int32_t DEFAULT_ALBUM_ID = 0;
135 const std::string DEFAULT_ALBUM_NAME = "Unknown";
136 const std::string DEFAULT_ALBUM_PATH = "";
137 const std::string DEFAULT_ALBUM_URI = "";
138 const std::string DEFAULT_SMART_ALBUM_TAG = "";
139 const PrivateAlbumType DEFAULT_SMART_ALBUM_PRIVATE_TYPE = TYPE_SMART;
140 const int32_t DEFAULT_SMART_ALBUM_ALBUMCAPACITY = 0;
141 const int32_t DEFAULT_SMART_ALBUM_CATEGORYID = 0;
142 const int64_t DEFAULT_SMART_ALBUM_DATE_MODIFIED = 0;
143 const std::string DEFAULT_SMART_ALBUM_CATEGORYNAME = "";
144 const int64_t DEFAULT_ALBUM_DATE_MODIFIED = 0;
145 const int32_t DEFAULT_COUNT = 0;
146 const std::string DEFAULT_ALBUM_RELATIVE_PATH = "";
147 const std::string DEFAULT_COVERURI = "";
148 const int32_t DEFAULT_MEDIA_PARENT = 0;
149 const std::string DEFAULT_DESCRIPTION;
150 constexpr int32_t DEFAULT_EXPIREDTIME = 0;
151 const bool DEFAULT_ALBUM_VIRTUAL = false;
152 const uint64_t DEFAULT_MEDIA_DATE_TAKEN = 0;
153 const std::string DEFAULT_MEDIA_ALBUM_URI = "";
154 const bool DEFAULT_MEDIA_IS_PENDING = false;
155 const int32_t DEFAULT_DIR_TYPE = -1;
156 const std::string DEFAULT_DIRECTORY = "";
157 const std::string DEFAULT_STRING_MEDIA_TYPE = "";
158 const std::string DEFAULT_EXTENSION = "";
159 const int32_t DEFAULT_MEDIAVOLUME = 0;
160 const std::string ROOT_MEDIA_DIR = "/storage/cloud/files/";
161 const std::string ROOT_SANDBOX_DIR = "/storage/Share/";
162 const std::string FS_TYPE_EPFS = "epfs";
163 const std::string EPFS_MOUNT_POINT = "/storage/cloud/epfs";
164 const char SLASH_CHAR = '/';
165 const std::string SLASH_STR = "/";
166 
167 const std::string SKIPLIST_FILE_PATH = "/data/SkipScanFile.txt";
168 
169 /** Supported audio container types */
170 const std::string AUDIO_CONTAINER_TYPE_AAC = "aac";
171 const std::string AUDIO_CONTAINER_TYPE_MP3 = "mp3";
172 const std::string AUDIO_CONTAINER_TYPE_FLAC = "flac";
173 const std::string AUDIO_CONTAINER_TYPE_WAV = "wav";
174 const std::string AUDIO_CONTAINER_TYPE_OGG = "ogg";
175 const std::string AUDIO_CONTAINER_TYPE_M4A = "m4a";
176 
177 const std::string DIR_ALL_AUDIO_CONTAINER_TYPE = "." + AUDIO_CONTAINER_TYPE_AAC + "?" +
178                                                  "." + AUDIO_CONTAINER_TYPE_MP3 + "?" +
179                                                  "." + AUDIO_CONTAINER_TYPE_FLAC + "?" +
180                                                  "." + AUDIO_CONTAINER_TYPE_WAV + "?" +
181                                                  "." + AUDIO_CONTAINER_TYPE_OGG + "?" +
182                                                  "." + AUDIO_CONTAINER_TYPE_M4A + "?";
183 
184 /** Supported video container types */
185 const std::string VIDEO_CONTAINER_TYPE_MP4 = "mp4";
186 const std::string VIDEO_CONTAINER_TYPE_3GP = "3gp";
187 const std::string VIDEO_CONTAINER_TYPE_MPG = "mpg";
188 const std::string VIDEO_CONTAINER_TYPE_MOV = "mov";
189 const std::string VIDEO_CONTAINER_TYPE_WEBM = "webm";
190 const std::string VIDEO_CONTAINER_TYPE_MKV = "mkv";
191 const std::string VIDEO_CONTAINER_TYPE_H264 = "h264";
192 const std::string VIDEO_CONTAINER_TYPE_MPEG = "mpeg";
193 const std::string VIDEO_CONTAINER_TYPE_TS = "ts";
194 const std::string VIDEO_CONTAINER_TYPE_M4V = "m4v";
195 const std::string VIDEO_CONTAINER_TYPE_3G2 = "3g2";
196 
197 const std::string DIR_ALL_VIDEO_CONTAINER_TYPE = "." + VIDEO_CONTAINER_TYPE_MP4 + "?" +
198                                                  "." + VIDEO_CONTAINER_TYPE_3GP + "?" +
199                                                  "." + VIDEO_CONTAINER_TYPE_MPG + "?" +
200                                                  "." + VIDEO_CONTAINER_TYPE_MOV + "?" +
201                                                  "." + VIDEO_CONTAINER_TYPE_WEBM + "?" +
202                                                  "." + VIDEO_CONTAINER_TYPE_MKV + "?" +
203                                                  "." + VIDEO_CONTAINER_TYPE_H264 + "?" +
204                                                  "." + VIDEO_CONTAINER_TYPE_MPEG + "?" +
205                                                  "." + VIDEO_CONTAINER_TYPE_TS + "?" +
206                                                  "." + VIDEO_CONTAINER_TYPE_M4V + "?" +
207                                                  "." + VIDEO_CONTAINER_TYPE_3G2 + "?";
208 
209 /** Supported image types */
210 const std::string IMAGE_CONTAINER_TYPE_BMP = "bmp";
211 const std::string IMAGE_CONTAINER_TYPE_BM = "bm";
212 const std::string IMAGE_CONTAINER_TYPE_GIF = "gif";
213 const std::string IMAGE_CONTAINER_TYPE_JPG = "jpg";
214 const std::string IMAGE_CONTAINER_TYPE_JPEG = "jpeg";
215 const std::string IMAGE_CONTAINER_TYPE_JPE = "jpe";
216 const std::string IMAGE_CONTAINER_TYPE_PNG = "png";
217 const std::string IMAGE_CONTAINER_TYPE_WEBP = "webp";
218 const std::string IMAGE_CONTAINER_TYPE_RAW = "raw";
219 const std::string IMAGE_CONTAINER_TYPE_SVG = "svg";
220 const std::string IMAGE_CONTAINER_TYPE_HEIF = "heif";
221 const std::string DIR_ALL_CONTAINER_TYPE = ".ALLTYPE";
222 const std::string DIR_ALL_TYPE_VALUES = "ALLTYPE";
223 const std::string DIR_ALL_IMAGE_CONTAINER_TYPE = "." + IMAGE_CONTAINER_TYPE_BMP + "?" +
224                                                  "." + IMAGE_CONTAINER_TYPE_BM + "?" +
225                                                  "." + IMAGE_CONTAINER_TYPE_GIF + "?" +
226                                                  "." + IMAGE_CONTAINER_TYPE_JPG + "?" +
227                                                  "." + IMAGE_CONTAINER_TYPE_JPEG + "?" +
228                                                  "." + IMAGE_CONTAINER_TYPE_JPE + "?" +
229                                                  "." + IMAGE_CONTAINER_TYPE_PNG + "?" +
230                                                  "." + IMAGE_CONTAINER_TYPE_WEBP + "?" +
231                                                  "." + IMAGE_CONTAINER_TYPE_RAW + "?" +
232                                                  "." + IMAGE_CONTAINER_TYPE_SVG + "?" +
233                                                  "." + IMAGE_CONTAINER_TYPE_HEIF + "?";
234 
235 const int CAMERA_DIRECTORY_TYPE_VALUES = DIR_CAMERA;
236 const std::string CAMERA_DIR_VALUES = "Camera/";
237 const std::string CAMERA_EXTENSION_VALUES = DIR_ALL_IMAGE_CONTAINER_TYPE + DIR_ALL_VIDEO_CONTAINER_TYPE;
238 const std::string CAMERA_TYPE_VALUES = std::to_string(MEDIA_TYPE_IMAGE) + "?" + std::to_string(MEDIA_TYPE_VIDEO);
239 const int VIDEO_DIRECTORY_TYPE_VALUES = DIR_VIDEO;
240 const std::string VIDEO_DIR_VALUES = "Videos/";
241 const std::string VIDEO_EXTENSION_VALUES = DIR_ALL_VIDEO_CONTAINER_TYPE;
242 const std::string VIDEO_TYPE_VALUES = std::to_string(MEDIA_TYPE_VIDEO);
243 const int PIC_DIRECTORY_TYPE_VALUES = DIR_IMAGE;
244 const std::string PIC_DIR_VALUES = "Pictures/";
245 const std::string PIC_EXTENSION_VALUES = DIR_ALL_IMAGE_CONTAINER_TYPE;
246 const std::string PIC_TYPE_VALUES = std::to_string(MEDIA_TYPE_IMAGE);
247 const int AUDIO_DIRECTORY_TYPE_VALUES = DIR_AUDIOS;
248 const std::string AUDIO_DIR_VALUES = "Audios/";
249 const std::string AUDIO_EXTENSION_VALUES = DIR_ALL_AUDIO_CONTAINER_TYPE;
250 const std::string AUDIO_TYPE_VALUES = std::to_string(MEDIA_TYPE_AUDIO);
251 const int DOC_DIRECTORY_TYPE_VALUES = DIR_DOCUMENTS;
252 const std::string DOC_DIR_VALUES = "Documents/";
253 const std::string DOC_EXTENSION_VALUES = DIR_ALL_CONTAINER_TYPE;
254 const std::string DOC_TYPE_VALUES = DIR_ALL_TYPE_VALUES;
255 const int DOWNLOAD_DIRECTORY_TYPE_VALUES = DIR_DOWNLOAD;
256 const std::string DOWNLOAD_DIR_VALUES = "Download/";
257 const std::string DOWNLOAD_EXTENSION_VALUES = DIR_ALL_CONTAINER_TYPE;
258 const std::string DOWNLOAD_TYPE_VALUES = DIR_ALL_TYPE_VALUES;
259 const std::string DOCUMENT_BUCKET = "Document";
260 const std::string PHOTO_BUCKET = "Photo";
261 const std::string AUDIO_BUCKET = "Audio";
262 const std::string PRE_PATH_VALUES = "/storage/cloud/";
263 
264 const std::vector<std::string> PRESET_ROOT_DIRS = {
265     CAMERA_DIR_VALUES, VIDEO_DIR_VALUES, PIC_DIR_VALUES, AUDIO_DIR_VALUES, DOC_DIR_VALUES, DOWNLOAD_DIR_VALUES,
266     PHOTO_BUCKET + "/", AUDIO_BUCKET + "/"
267 };
268 
269 const int TRASH_ALBUM_ID_VALUES = 2;
270 const int FAVOURITE_ALBUM_ID_VALUES = 1;
271 const int TRASH_ALBUM_TYPE_VALUES = 2;
272 const int FAVOURITE_ALBUM_TYPE_VALUES = 1;
273 const std::string TRASH_ALBUM_NAME_VALUES = "TrashAlbum";
274 const std::string FAVOURTIE_ALBUM_NAME_VALUES = "FavoritAlbum";
275 
276 
277 // Unordered set contains list supported audio formats
278 const std::unordered_set<std::string> SUPPORTED_AUDIO_FORMATS_SET {
279                                                 AUDIO_CONTAINER_TYPE_AAC,
280                                                 AUDIO_CONTAINER_TYPE_MP3,
281                                                 AUDIO_CONTAINER_TYPE_FLAC,
282                                                 AUDIO_CONTAINER_TYPE_WAV,
283                                                 AUDIO_CONTAINER_TYPE_OGG,
284                                                 AUDIO_CONTAINER_TYPE_M4A
285                                                 };
286 
287 // Unordered set contains list supported video formats
288 const std::unordered_set<std::string> SUPPORTED_VIDEO_FORMATS_SET {
289                                                 VIDEO_CONTAINER_TYPE_MP4,
290                                                 VIDEO_CONTAINER_TYPE_3GP,
291                                                 VIDEO_CONTAINER_TYPE_MPG,
292                                                 VIDEO_CONTAINER_TYPE_MOV,
293                                                 VIDEO_CONTAINER_TYPE_WEBM,
294                                                 VIDEO_CONTAINER_TYPE_MKV,
295                                                 VIDEO_CONTAINER_TYPE_H264,
296                                                 VIDEO_CONTAINER_TYPE_MPEG,
297                                                 VIDEO_CONTAINER_TYPE_TS,
298                                                 VIDEO_CONTAINER_TYPE_M4V,
299                                                 VIDEO_CONTAINER_TYPE_3G2
300                                                 };
301 
302 // Unordered set contains list supported image formats
303 const std::unordered_set<std::string> SUPPORTED_IMAGE_FORMATS_SET {
304                                                 IMAGE_CONTAINER_TYPE_BMP,
305                                                 IMAGE_CONTAINER_TYPE_BM,
306                                                 IMAGE_CONTAINER_TYPE_GIF,
307                                                 IMAGE_CONTAINER_TYPE_JPG,
308                                                 IMAGE_CONTAINER_TYPE_JPEG,
309                                                 IMAGE_CONTAINER_TYPE_JPE,
310                                                 IMAGE_CONTAINER_TYPE_PNG,
311                                                 IMAGE_CONTAINER_TYPE_WEBP,
312                                                 IMAGE_CONTAINER_TYPE_RAW,
313                                                 IMAGE_CONTAINER_TYPE_SVG,
314                                                 IMAGE_CONTAINER_TYPE_HEIF
315                                                 };
316 } // namespace OHOS
317 } // namespace Media
318 
319 #endif  // INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_LIB_SERVICE_CONST_H_
320