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 16 #ifndef MEDIA_LIB_SERVICE_CONST_H 17 #define MEDIA_LIB_SERVICE_CONST_H 18 19 #include <unordered_set> 20 21 namespace OHOS { 22 namespace Media { 23 enum { 24 MEDIA_GET_MEDIA_ASSETS = 0, 25 MEDIA_GET_IMAGE_ASSETS = 1, 26 MEDIA_GET_AUDIO_ASSETS = 2, 27 MEDIA_GET_VIDEO_ASSETS = 3, 28 MEDIA_GET_IMAGEALBUM_ASSETS = 4, 29 MEDIA_GET_VIDEOALBUM_ASSETS = 5, 30 MEDIA_CREATE_MEDIA_ASSET = 6, 31 MEDIA_DELETE_MEDIA_ASSET = 7, 32 MEDIA_MODIFY_MEDIA_ASSET = 8, 33 MEDIA_COPY_MEDIA_ASSET = 9, 34 MEDIA_CREATE_MEDIA_ALBUM_ASSET = 10, 35 MEDIA_DELETE_MEDIA_ALBUM_ASSET = 11, 36 MEDIA_MODIFY_MEDIA_ALBUM_ASSET = 12, 37 }; 38 39 enum MediaType { 40 MEDIA_TYPE_DEFAULT = 0, 41 MEDIA_TYPE_FILE, 42 MEDIA_TYPE_MEDIA, 43 MEDIA_TYPE_IMAGE, 44 MEDIA_TYPE_VIDEO, 45 MEDIA_TYPE_AUDIO, 46 MEDIA_TYPE_ALBUM_LIST, 47 MEDIA_TYPE_ALBUM_LIST_INFO, 48 MEDIA_TYPE_ALBUM, 49 MEDIA_TYPE_SMARTALBUM, 50 MEDIA_TYPE_DEVICE, 51 MEDIA_TYPE_REMOTEFILE, 52 MEDIA_TYPE_ALL 53 }; 54 55 /* ENUM Asset types */ 56 enum AssetType { 57 ASSET_MEDIA = 0, 58 ASSET_IMAGE, 59 ASSET_AUDIO, 60 ASSET_VIDEO, 61 ASSET_GENERIC_ALBUM, 62 ASSET_IMAGEALBUM, 63 ASSET_VIDEOALBUM, 64 ASSET_NONE 65 }; 66 67 enum class DataType : int32_t { 68 TYPE_NULL = 0, 69 TYPE_INT, 70 TYPE_LONG, 71 TYPE_DOUBLE, 72 TYPE_STRING, 73 TYPE_BOOL 74 }; 75 76 const int32_t SUCCESS = 0; 77 const int32_t FAIL = -1; 78 79 const int32_t MEDIA_ASSET_READ_FAIL = 1; 80 const int32_t IMAGE_ASSET_READ_FAIL = 2; 81 const int32_t AUDIO_ASSET_READ_FAIL = 3; 82 const int32_t VIDEO_ASSET_READ_FAIL = 4; 83 const int32_t IMAGEALBUM_ASSET_READ_FAIL = 5; 84 const int32_t VIDEOALBUM_ASSET_READ_FAIL = 6; 85 86 const int32_t MEDIA_ASSET_WRITE_FAIL = 7; 87 const int32_t IMAGE_ASSET_WRITE_FAIL = 8; 88 const int32_t AUDIO_ASSET_WRITE_FAIL = 9; 89 const int32_t VIDEO_ASSET_WRITE_FAIL = 10; 90 const int32_t IMAGEALBUM_ASSET_WRITE_FAIL = 11; 91 const int32_t VIDEOALBUM_ASSET_WRITE_FAIL = 12; 92 const int32_t ALBUM_ASSET_WRITE_FAIL = 13; 93 const int32_t COMMON_DATA_WRITE_FAIL = 14; 94 const int32_t COMMON_DATA_READ_FAIL = 15; 95 const int32_t IPC_INTERFACE_TOKEN_FAIL = 16; 96 97 const int32_t DEFAULT_MEDIA_ID = 0; 98 const int32_t DEFAULT_PARENT_ID = 0; 99 const uint64_t DEFAULT_MEDIA_SIZE = 0; 100 const uint64_t DEFAULT_MEDIA_DATE_ADDED = 0; 101 const uint64_t DEFAULT_MEDIA_DATE_MODIFIED = 0; 102 const std::string DEFAULT_MEDIA_URI = ""; 103 const MediaType DEFAULT_MEDIA_TYPE = MEDIA_TYPE_FILE; 104 const std::string DEFAULT_MEDIA_NAME = "Unknown"; 105 const std::string DEFAULT_MEDIA_PATH = ""; 106 const std::string DEFAULT_MEDIA_MIMETYPE = ""; 107 const std::string DEFAULT_MEDIA_RELATIVE_PATH = ""; 108 109 const std::string DEFAULT_MEDIA_TITLE = ""; 110 const std::string DEFAULT_MEDIA_ARTIST = ""; 111 const std::string DEFAULT_MEDIA_ALBUM = ""; 112 const int32_t DEFAULT_MEDIA_WIDTH = 0; 113 const int32_t DEFAULT_MEDIA_HEIGHT = 0; 114 const int32_t DEFAULT_MEDIA_DURATION = 0; 115 const int32_t DEFAULT_MEDIA_ORIENTATION = 0; 116 117 const int32_t DEFAULT_ALBUM_ID = 0; 118 const std::string DEFAULT_ALBUM_NAME = "Unknown"; 119 const std::string DEFAULT_ALBUM_PATH = ""; 120 const std::string DEFAULT_ALBUM_URI = ""; 121 const std::string DEFAULT_SMART_ALBUM_TAG = ""; 122 const int32_t DEFAULT_SMART_ALBUM_PRIVATE_TYPE = 2; 123 const int32_t DEFAULT_SMART_ALBUM_ALBUMCAPACITY = 0; 124 const int32_t DEFAULT_SMART_ALBUM_CATEGORYID = 0; 125 const std::string DEFAULT_SMART_ALBUM_CATEGORYNAME = ""; 126 const int64_t DEFAULT_ALBUM_DATE_MODIFIED = 0; 127 const int32_t DEFAULT_COUNT = 0; 128 const std::string DEFAULT_ALBUM_RELATIVE_PATH = ""; 129 const std::string DEFAULT_COVERURI = ""; 130 const int32_t DEFAULT_MEDIA_PARENT = 0; 131 const bool DEFAULT_ALBUM_VIRTUAL = false; 132 const uint64_t DEFAULT_MEDIA_DATE_TAKEN = 0; 133 const std::string DEFAULT_MEDIA_ALBUM_URI = ""; 134 const std::string ROOT_MEDIA_DIR = "/storage/media/local/files/"; 135 const char SLASH_CHAR = '/'; 136 const int32_t OPEN_FDS = 64; 137 const int32_t MILLISECONDS = 1000; 138 const char DOT_CHAR = '.'; 139 const int32_t DISPLAYNAME_MAX = 128; 140 const int32_t TIMEPENDING_MIN = 30 * 60; 141 142 const std::string SKIPLIST_FILE_PATH = "/data/SkipScanFile.txt"; 143 144 /** Supported audio container types */ 145 const std::string AUDIO_CONTAINER_TYPE_AAC = "aac"; 146 const std::string AUDIO_CONTAINER_TYPE_MP3 = "mp3"; 147 const std::string AUDIO_CONTAINER_TYPE_FLAC = "flac"; 148 const std::string AUDIO_CONTAINER_TYPE_WAV = "wav"; 149 const std::string AUDIO_CONTAINER_TYPE_OGG = "ogg"; 150 151 /** Supported video container types */ 152 const std::string VIDEO_CONTAINER_TYPE_MP4 = "mp4"; 153 const std::string VIDEO_CONTAINER_TYPE_3GP = "3gp"; 154 const std::string VIDEO_CONTAINER_TYPE_MPG = "mpg"; 155 const std::string VIDEO_CONTAINER_TYPE_MOV = "mov"; 156 const std::string VIDEO_CONTAINER_TYPE_WEBM = "webm"; 157 const std::string VIDEO_CONTAINER_TYPE_MKV = "mkv"; 158 159 /** Supported image types */ 160 const std::string IMAGE_CONTAINER_TYPE_BMP = "bmp"; 161 const std::string IMAGE_CONTAINER_TYPE_BM = "bm"; 162 const std::string IMAGE_CONTAINER_TYPE_GIF = "gif"; 163 const std::string IMAGE_CONTAINER_TYPE_JPG = "jpg"; 164 const std::string IMAGE_CONTAINER_TYPE_JPEG = "jpeg"; 165 const std::string IMAGE_CONTAINER_TYPE_JPE = "jpe"; 166 const std::string IMAGE_CONTAINER_TYPE_PNG = "png"; 167 const std::string IMAGE_CONTAINER_TYPE_WEBP = "webp"; 168 const std::string IMAGE_CONTAINER_TYPE_RAW = "raw"; 169 const std::string IMAGE_CONTAINER_TYPE_SVG = "svg"; 170 const std::string IMAGE_CONTAINER_TYPE_HEIF = "heif"; 171 172 // Unordered set contains list supported audio formats 173 const std::unordered_set<std::string> SUPPORTED_AUDIO_FORMATS_SET { 174 AUDIO_CONTAINER_TYPE_AAC, 175 AUDIO_CONTAINER_TYPE_MP3, 176 AUDIO_CONTAINER_TYPE_FLAC, 177 AUDIO_CONTAINER_TYPE_WAV, 178 AUDIO_CONTAINER_TYPE_OGG 179 }; 180 181 // Unordered set contains list supported video formats 182 const std::unordered_set<std::string> SUPPORTED_VIDEO_FORMATS_SET { 183 VIDEO_CONTAINER_TYPE_MP4, 184 VIDEO_CONTAINER_TYPE_3GP, 185 VIDEO_CONTAINER_TYPE_MPG, 186 VIDEO_CONTAINER_TYPE_MOV, 187 VIDEO_CONTAINER_TYPE_WEBM, 188 VIDEO_CONTAINER_TYPE_MKV 189 }; 190 191 // Unordered set contains list supported image formats 192 const std::unordered_set<std::string> SUPPORTED_IMAGE_FORMATS_SET { 193 IMAGE_CONTAINER_TYPE_BMP, 194 IMAGE_CONTAINER_TYPE_GIF, 195 IMAGE_CONTAINER_TYPE_JPG, 196 IMAGE_CONTAINER_TYPE_PNG, 197 IMAGE_CONTAINER_TYPE_WEBP, 198 IMAGE_CONTAINER_TYPE_RAW, 199 IMAGE_CONTAINER_TYPE_SVG, 200 IMAGE_CONTAINER_TYPE_HEIF 201 }; 202 } // namespace OHOS 203 } // namespace Media 204 #endif // MEDIA_LIB_SERVICE_CONST_H 205