1 /* 2 * Copyright (C) 2024 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 PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_HEIF_TYPE_H 17 #define PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_HEIF_TYPE_H 18 19 #include <vector> 20 #include "heif_utils.h" 21 22 namespace OHOS { 23 namespace ImagePlugin { 24 static const uint32_t BOX_TYPE_FTYP = fourcc_to_code("ftyp"); 25 static const uint32_t BOX_TYPE_META = fourcc_to_code("meta"); 26 static const uint32_t BOX_TYPE_HDLR = fourcc_to_code("hdlr"); 27 static const uint32_t BOX_TYPE_ILOC = fourcc_to_code("iloc"); 28 static const uint32_t BOX_TYPE_PITM = fourcc_to_code("pitm"); 29 static const uint32_t BOX_TYPE_INFE = fourcc_to_code("infe"); 30 static const uint32_t BOX_TYPE_IINF = fourcc_to_code("iinf"); 31 static const uint32_t BOX_TYPE_PTIM = fourcc_to_code("ptim"); 32 static const uint32_t BOX_TYPE_IPRP = fourcc_to_code("iprp"); 33 static const uint32_t BOX_TYPE_AUXC = fourcc_to_code("auxC"); 34 static const uint32_t BOX_TYPE_AUXL = fourcc_to_code("auxl"); 35 static const uint32_t BOX_TYPE_IPCO = fourcc_to_code("ipco"); 36 static const uint32_t BOX_TYPE_IPMA = fourcc_to_code("ipma"); 37 static const uint32_t BOX_TYPE_ISPE = fourcc_to_code("ispe"); 38 static const uint32_t BOX_TYPE_PIXI = fourcc_to_code("pixi"); 39 static const uint32_t BOX_TYPE_COLR = fourcc_to_code("colr"); 40 static const uint32_t BOX_TYPE_NCLX = fourcc_to_code("nclx"); 41 static const uint32_t BOX_TYPE_HVCC = fourcc_to_code("hvcC"); 42 static const uint32_t BOX_TYPE_IROT = fourcc_to_code("irot"); 43 static const uint32_t BOX_TYPE_IMIR = fourcc_to_code("imir"); 44 static const uint32_t BOX_TYPE_IREF = fourcc_to_code("iref"); 45 static const uint32_t BOX_TYPE_IDAT = fourcc_to_code("idat"); 46 static const uint32_t BOX_TYPE_MDAT = fourcc_to_code("mdat"); 47 static const uint32_t BOX_TYPE_UUID = fourcc_to_code("uuid"); 48 static const uint32_t BOX_TYPE_THMB = fourcc_to_code("thmb"); 49 static const uint32_t BOX_TYPE_DIMG = fourcc_to_code("dimg"); 50 static const uint32_t BOX_TYPE_CDSC = fourcc_to_code("cdsc"); 51 52 static const uint32_t BOX_TYPE_CLLI = fourcc_to_code("clli"); 53 static const uint32_t BOX_TYPE_MDCV = fourcc_to_code("mdcv"); 54 static const uint32_t BOX_TYPE_IT35 = fourcc_to_code("it35"); 55 56 static const uint32_t BOX_TYPE_RLOC = fourcc_to_code("rloc"); 57 58 static const uint32_t HANDLER_TYPE_PICT = fourcc_to_code("pict"); 59 60 static const uint32_t ITEM_TYPE_MIME = fourcc_to_code("mime"); 61 static const uint32_t ITEM_TYPE_URI = fourcc_to_code("uri "); 62 63 static const uint32_t COLOR_TYPE_PROF = fourcc_to_code("prof"); 64 static const uint32_t COLOR_TYPE_RICC = fourcc_to_code("rICC"); 65 66 typedef uint32_t heif_item_id; 67 68 typedef uint32_t heif_brand; 69 70 enum HeifBoxVersion { 71 HEIF_BOX_VERSION_ZERO = 0, 72 HEIF_BOX_VERSION_ONE = 1, 73 HEIF_BOX_VERSION_TWO = 2, 74 HEIF_BOX_VERSION_THREE = 3, 75 }; 76 77 enum class HeifColorFormat { 78 UNDEDEFINED = 255, 79 YCBCR = 0, 80 RGB = 1, 81 MONOCHROME = 2 82 }; 83 84 enum class HeifPixelFormat { 85 UNDEFINED = 255, 86 MONOCHROME = 0, 87 YUV420 = 1, 88 YUV422 = 2, 89 YUV444 = 3, 90 }; 91 92 enum class HeifTransformMirrorDirection : uint8_t { 93 VERTICAL = 0, 94 HORIZONTAL = 1, 95 INVALID = 2, 96 }; 97 98 typedef uint32_t heif_property_id; 99 100 struct HeifMetadata { 101 heif_item_id itemId; 102 std::string itemType; 103 std::string contentType; 104 std::string itemUriType; 105 std::vector<uint8_t> mData; 106 }; 107 108 struct HeifFragmentMetadata { 109 uint32_t width = 0; 110 uint32_t height = 0; 111 uint32_t horizontalOffset = 0; 112 uint32_t verticalOffset = 0; 113 }; 114 } // namespace ImagePlugin 115 } // namespace OHOS 116 117 #endif // PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_HEIF_TYPE_H 118