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 ThumbStatus : int32_t { 103 DOWNLOADED, 104 TO_DOWNLOAD, 105 }; 106 107 enum class TableType : int32_t { 108 TYPE_FILES = 0, 109 TYPE_PHOTOS, 110 TYPE_AUDIOS, 111 }; 112 113 enum ResultSetDataType { 114 TYPE_NULL = 0, 115 TYPE_STRING, 116 TYPE_INT32, 117 TYPE_INT64, 118 TYPE_DOUBLE 119 }; 120 121 enum class CleanType : int32_t { 122 TYPE_NOT_CLEAN = 0, 123 TYPE_NEED_CLEAN 124 }; 125 126 enum class MultiStagesPhotoQuality : int32_t { 127 FULL = 0, 128 LOW, 129 }; 130 131 const int32_t SUCCESS = 0; 132 133 constexpr int32_t DEFAULT_INT32 = 0; 134 constexpr int64_t DEFAULT_INT64 = 0; 135 const std::string DEFAULT_STR = ""; 136 const bool DEFAULT_BOOL = false; 137 const int32_t DEFAULT_MEDIA_ID = 0; 138 const int32_t DEFAULT_PARENT_ID = 0; 139 const uint64_t DEFAULT_MEDIA_SIZE = 0; 140 const uint64_t DEFAULT_MEDIA_DATE_ADDED = 0; 141 const uint64_t DEFAULT_MEDIA_DATE_MODIFIED = 0; 142 const std::string DEFAULT_MEDIA_URI = ""; 143 const MediaType DEFAULT_MEDIA_TYPE = MEDIA_TYPE_FILE; 144 const std::string DEFAULT_MEDIA_NAME = "Unknown"; 145 const std::string DEFAULT_MEDIA_PATH = ""; 146 const std::string DEFAULT_MEDIA_MIMETYPE = ""; 147 const std::string DEFAULT_MEDIA_RELATIVE_PATH = ""; 148 149 const std::string DEFAULT_MEDIA_TITLE = ""; 150 const std::string DEFAULT_MEDIA_ARTIST = ""; 151 const std::string DEFAULT_MEDIA_ALBUM = ""; 152 const int32_t DEFAULT_MEDIA_WIDTH = 0; 153 const int32_t DEFAULT_MEDIA_HEIGHT = 0; 154 const int32_t DEFAULT_MEDIA_DURATION = 0; 155 const int32_t DEFAULT_MEDIA_ORIENTATION = 0; 156 157 const int32_t DEFAULT_ALBUM_ID = 0; 158 const std::string DEFAULT_ALBUM_NAME = "Unknown"; 159 const std::string DEFAULT_ALBUM_PATH = ""; 160 const std::string DEFAULT_ALBUM_URI = ""; 161 const std::string DEFAULT_SMART_ALBUM_TAG = ""; 162 const PrivateAlbumType DEFAULT_SMART_ALBUM_PRIVATE_TYPE = TYPE_SMART; 163 const int32_t DEFAULT_SMART_ALBUM_ALBUMCAPACITY = 0; 164 const int32_t DEFAULT_SMART_ALBUM_CATEGORYID = 0; 165 const int64_t DEFAULT_SMART_ALBUM_DATE_MODIFIED = 0; 166 const std::string DEFAULT_SMART_ALBUM_CATEGORYNAME = ""; 167 const int64_t DEFAULT_ALBUM_DATE_MODIFIED = 0; 168 const int32_t DEFAULT_COUNT = 0; 169 const std::string DEFAULT_ALBUM_RELATIVE_PATH = ""; 170 const std::string DEFAULT_COVERURI = ""; 171 const int32_t DEFAULT_MEDIA_PARENT = 0; 172 const std::string DEFAULT_DESCRIPTION; 173 constexpr int32_t DEFAULT_EXPIREDTIME = 0; 174 const bool DEFAULT_ALBUM_VIRTUAL = false; 175 const uint64_t DEFAULT_MEDIA_DATE_TAKEN = 0; 176 const std::string DEFAULT_MEDIA_ALBUM_URI = ""; 177 const bool DEFAULT_MEDIA_IS_PENDING = false; 178 const int32_t DEFAULT_DIR_TYPE = -1; 179 const std::string DEFAULT_DIRECTORY = ""; 180 const std::string DEFAULT_STRING_MEDIA_TYPE = ""; 181 const std::string DEFAULT_EXTENSION = ""; 182 const int32_t DEFAULT_MEDIAVOLUME = 0; 183 const std::string ROOT_MEDIA_DIR = "/storage/cloud/files/"; 184 const std::string ROOT_SANDBOX_DIR = "/storage/Share/"; 185 const std::string FS_TYPE_EPFS = "epfs"; 186 const std::string EPFS_MOUNT_POINT = "/storage/cloud/epfs"; 187 const std::string MEDIA_CACHE_DIR = ROOT_MEDIA_DIR + ".cache/"; 188 const char SLASH_CHAR = '/'; 189 const std::string SLASH_STR = "/"; 190 191 const std::string SKIPLIST_FILE_PATH = "/data/SkipScanFile.txt"; 192 193 /** Supported audio container types */ 194 const std::string AUDIO_CONTAINER_TYPE_AAC = "aac"; 195 const std::string AUDIO_CONTAINER_TYPE_MP3 = "mp3"; 196 const std::string AUDIO_CONTAINER_TYPE_FLAC = "flac"; 197 const std::string AUDIO_CONTAINER_TYPE_WAV = "wav"; 198 const std::string AUDIO_CONTAINER_TYPE_OGG = "ogg"; 199 const std::string AUDIO_CONTAINER_TYPE_M4A = "m4a"; 200 201 const std::string DIR_ALL_AUDIO_CONTAINER_TYPE = "." + AUDIO_CONTAINER_TYPE_AAC + "?" + 202 "." + AUDIO_CONTAINER_TYPE_MP3 + "?" + 203 "." + AUDIO_CONTAINER_TYPE_FLAC + "?" + 204 "." + AUDIO_CONTAINER_TYPE_WAV + "?" + 205 "." + AUDIO_CONTAINER_TYPE_OGG + "?" + 206 "." + AUDIO_CONTAINER_TYPE_M4A + "?"; 207 208 /** Supported video container types */ 209 const std::string VIDEO_CONTAINER_TYPE_MP4 = "mp4"; 210 const std::string VIDEO_CONTAINER_TYPE_3GP = "3gp"; 211 const std::string VIDEO_CONTAINER_TYPE_MPG = "mpg"; 212 const std::string VIDEO_CONTAINER_TYPE_MOV = "mov"; 213 const std::string VIDEO_CONTAINER_TYPE_WEBM = "webm"; 214 const std::string VIDEO_CONTAINER_TYPE_MKV = "mkv"; 215 const std::string VIDEO_CONTAINER_TYPE_H264 = "h264"; 216 const std::string VIDEO_CONTAINER_TYPE_MPEG = "mpeg"; 217 const std::string VIDEO_CONTAINER_TYPE_TS = "ts"; 218 const std::string VIDEO_CONTAINER_TYPE_M4V = "m4v"; 219 const std::string VIDEO_CONTAINER_TYPE_3G2 = "3g2"; 220 221 const std::string DIR_ALL_VIDEO_CONTAINER_TYPE = "." + VIDEO_CONTAINER_TYPE_MP4 + "?" + 222 "." + VIDEO_CONTAINER_TYPE_3GP + "?" + 223 "." + VIDEO_CONTAINER_TYPE_MPG + "?" + 224 "." + VIDEO_CONTAINER_TYPE_MOV + "?" + 225 "." + VIDEO_CONTAINER_TYPE_WEBM + "?" + 226 "." + VIDEO_CONTAINER_TYPE_MKV + "?" + 227 "." + VIDEO_CONTAINER_TYPE_H264 + "?" + 228 "." + VIDEO_CONTAINER_TYPE_MPEG + "?" + 229 "." + VIDEO_CONTAINER_TYPE_TS + "?" + 230 "." + VIDEO_CONTAINER_TYPE_M4V + "?" + 231 "." + VIDEO_CONTAINER_TYPE_3G2 + "?"; 232 233 /** Supported image types */ 234 const std::string IMAGE_CONTAINER_TYPE_BMP = "bmp"; 235 const std::string IMAGE_CONTAINER_TYPE_BM = "bm"; 236 const std::string IMAGE_CONTAINER_TYPE_GIF = "gif"; 237 const std::string IMAGE_CONTAINER_TYPE_JPG = "jpg"; 238 const std::string IMAGE_CONTAINER_TYPE_JPEG = "jpeg"; 239 const std::string IMAGE_CONTAINER_TYPE_JPE = "jpe"; 240 const std::string IMAGE_CONTAINER_TYPE_PNG = "png"; 241 const std::string IMAGE_CONTAINER_TYPE_WEBP = "webp"; 242 const std::string IMAGE_CONTAINER_TYPE_RAW = "raw"; 243 const std::string IMAGE_CONTAINER_TYPE_SVG = "svg"; 244 const std::string IMAGE_CONTAINER_TYPE_HEIF = "heif"; 245 const std::string DIR_ALL_CONTAINER_TYPE = ".ALLTYPE"; 246 const std::string DIR_ALL_TYPE_VALUES = "ALLTYPE"; 247 const std::string DIR_ALL_IMAGE_CONTAINER_TYPE = "." + IMAGE_CONTAINER_TYPE_BMP + "?" + 248 "." + IMAGE_CONTAINER_TYPE_BM + "?" + 249 "." + IMAGE_CONTAINER_TYPE_GIF + "?" + 250 "." + IMAGE_CONTAINER_TYPE_JPG + "?" + 251 "." + IMAGE_CONTAINER_TYPE_JPEG + "?" + 252 "." + IMAGE_CONTAINER_TYPE_JPE + "?" + 253 "." + IMAGE_CONTAINER_TYPE_PNG + "?" + 254 "." + IMAGE_CONTAINER_TYPE_WEBP + "?" + 255 "." + IMAGE_CONTAINER_TYPE_RAW + "?" + 256 "." + IMAGE_CONTAINER_TYPE_SVG + "?" + 257 "." + IMAGE_CONTAINER_TYPE_HEIF + "?"; 258 const std::string DOCS_PATH = "Docs/"; 259 const int CAMERA_DIRECTORY_TYPE_VALUES = DIR_CAMERA; 260 const std::string CAMERA_DIR_VALUES = "Camera/"; 261 const std::string CAMERA_EXTENSION_VALUES = DIR_ALL_IMAGE_CONTAINER_TYPE + DIR_ALL_VIDEO_CONTAINER_TYPE; 262 const std::string CAMERA_TYPE_VALUES = std::to_string(MEDIA_TYPE_IMAGE) + "?" + std::to_string(MEDIA_TYPE_VIDEO); 263 const int VIDEO_DIRECTORY_TYPE_VALUES = DIR_VIDEO; 264 const std::string VIDEO_DIR_VALUES = "Videos/"; 265 const std::string VIDEO_EXTENSION_VALUES = DIR_ALL_VIDEO_CONTAINER_TYPE; 266 const std::string VIDEO_TYPE_VALUES = std::to_string(MEDIA_TYPE_VIDEO); 267 const int PIC_DIRECTORY_TYPE_VALUES = DIR_IMAGE; 268 const std::string PIC_DIR_VALUES = "Pictures/"; 269 const std::string PIC_EXTENSION_VALUES = DIR_ALL_IMAGE_CONTAINER_TYPE; 270 const std::string PIC_TYPE_VALUES = std::to_string(MEDIA_TYPE_IMAGE); 271 const int AUDIO_DIRECTORY_TYPE_VALUES = DIR_AUDIOS; 272 const std::string AUDIO_DIR_VALUES = "Audios/"; 273 const std::string AUDIO_EXTENSION_VALUES = DIR_ALL_AUDIO_CONTAINER_TYPE; 274 const std::string AUDIO_TYPE_VALUES = std::to_string(MEDIA_TYPE_AUDIO); 275 const int DOC_DIRECTORY_TYPE_VALUES = DIR_DOCUMENTS; 276 const std::string DOC_DIR_VALUES = "Documents/"; 277 const std::string DOC_EXTENSION_VALUES = DIR_ALL_CONTAINER_TYPE; 278 const std::string DOC_TYPE_VALUES = DIR_ALL_TYPE_VALUES; 279 const int DOWNLOAD_DIRECTORY_TYPE_VALUES = DIR_DOWNLOAD; 280 const std::string DOWNLOAD_DIR_VALUES = "Download/"; 281 const std::string DOWNLOAD_EXTENSION_VALUES = DIR_ALL_CONTAINER_TYPE; 282 const std::string DOWNLOAD_TYPE_VALUES = DIR_ALL_TYPE_VALUES; 283 const std::string DOCUMENT_BUCKET = "Document"; 284 const std::string PHOTO_BUCKET = "Photo"; 285 const std::string AUDIO_BUCKET = "Audio"; 286 const std::string PRE_PATH_VALUES = "/storage/cloud/"; 287 const std::string DOCUMENT_URI_AUTHORITY = "docs"; 288 289 const std::vector<std::string> PRESET_ROOT_DIRS = { 290 CAMERA_DIR_VALUES, VIDEO_DIR_VALUES, PIC_DIR_VALUES, AUDIO_DIR_VALUES, 291 PHOTO_BUCKET + "/", AUDIO_BUCKET + "/" 292 }; 293 294 const int TRASH_ALBUM_ID_VALUES = 2; 295 const int FAVOURITE_ALBUM_ID_VALUES = 1; 296 const int TRASH_ALBUM_TYPE_VALUES = 2; 297 const int FAVOURITE_ALBUM_TYPE_VALUES = 1; 298 const std::string TRASH_ALBUM_NAME_VALUES = "TrashAlbum"; 299 const std::string FAVOURTIE_ALBUM_NAME_VALUES = "FavoritAlbum"; 300 301 static constexpr int UNCREATE_FILE_TIMEPENDING = -1; 302 static constexpr int UNCLOSE_FILE_TIMEPENDING = -2; 303 static constexpr int UNOPEN_FILE_COMPONENT_TIMEPENDING = -3; 304 305 // Unordered set contains list supported audio formats 306 const std::unordered_set<std::string> SUPPORTED_AUDIO_FORMATS_SET { 307 AUDIO_CONTAINER_TYPE_AAC, 308 AUDIO_CONTAINER_TYPE_MP3, 309 AUDIO_CONTAINER_TYPE_FLAC, 310 AUDIO_CONTAINER_TYPE_WAV, 311 AUDIO_CONTAINER_TYPE_OGG, 312 AUDIO_CONTAINER_TYPE_M4A 313 }; 314 315 // Unordered set contains list supported video formats 316 const std::unordered_set<std::string> SUPPORTED_VIDEO_FORMATS_SET { 317 VIDEO_CONTAINER_TYPE_MP4, 318 VIDEO_CONTAINER_TYPE_3GP, 319 VIDEO_CONTAINER_TYPE_MPG, 320 VIDEO_CONTAINER_TYPE_MOV, 321 VIDEO_CONTAINER_TYPE_WEBM, 322 VIDEO_CONTAINER_TYPE_MKV, 323 VIDEO_CONTAINER_TYPE_H264, 324 VIDEO_CONTAINER_TYPE_MPEG, 325 VIDEO_CONTAINER_TYPE_TS, 326 VIDEO_CONTAINER_TYPE_M4V, 327 VIDEO_CONTAINER_TYPE_3G2 328 }; 329 330 // Unordered set contains list supported image formats 331 const std::unordered_set<std::string> SUPPORTED_IMAGE_FORMATS_SET { 332 IMAGE_CONTAINER_TYPE_BMP, 333 IMAGE_CONTAINER_TYPE_BM, 334 IMAGE_CONTAINER_TYPE_GIF, 335 IMAGE_CONTAINER_TYPE_JPG, 336 IMAGE_CONTAINER_TYPE_JPEG, 337 IMAGE_CONTAINER_TYPE_JPE, 338 IMAGE_CONTAINER_TYPE_PNG, 339 IMAGE_CONTAINER_TYPE_WEBP, 340 IMAGE_CONTAINER_TYPE_RAW, 341 IMAGE_CONTAINER_TYPE_SVG, 342 IMAGE_CONTAINER_TYPE_HEIF 343 }; 344 } // namespace OHOS 345 } // namespace Media 346 347 #endif // INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_LIB_SERVICE_CONST_H_ 348