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 16 #ifndef FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_SOURCE_TYPE_UTILS_H_ 17 #define FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_SOURCE_TYPE_UTILS_H_ 18 #include <string> 19 20 namespace OHOS { 21 namespace Media { 22 enum class ImageResourceType : int32_t { 23 IMAGE_RESOURCE_INVAILD = 0, 24 IMAGE_RESOURCE_FD = 1, 25 IMAGE_RESOURCE_PATH = 2, 26 IMAGE_RESOURCE_BUFFER = 3, 27 IMAGE_RESOURCE_RAW_FILE = 4 28 }; 29 30 struct ImageResource { 31 ImageResourceType type = ImageResourceType::IMAGE_RESOURCE_INVAILD; 32 int32_t fd = -1; 33 std::string path; 34 uint8_t* buffer = nullptr; 35 size_t bufferSize = 0; 36 long fileStart = 0; 37 long fileLength = 0; 38 }; 39 } // namespace Media 40 } // namespace OHOS 41 #endif // FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_SOURCE_TYPE_UTILS_H_