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_MOOV = fourcc_to_code("moov"); 53 static const uint32_t BOX_TYPE_MVHD = fourcc_to_code("mvhd"); 54 static const uint32_t BOX_TYPE_TRAK = fourcc_to_code("trak"); 55 static const uint32_t BOX_TYPE_TKHD = fourcc_to_code("tkhd"); 56 static const uint32_t BOX_TYPE_MDIA = fourcc_to_code("mdia"); 57 static const uint32_t BOX_TYPE_MDHD = fourcc_to_code("mdhd"); 58 static const uint32_t BOX_TYPE_MINF = fourcc_to_code("minf"); 59 static const uint32_t BOX_TYPE_VMHD = fourcc_to_code("vmhd"); 60 static const uint32_t BOX_TYPE_DINF = fourcc_to_code("dinf"); 61 static const uint32_t BOX_TYPE_DREF = fourcc_to_code("dref"); 62 static const uint32_t BOX_TYPE_STBL = fourcc_to_code("stbl"); 63 static const uint32_t BOX_TYPE_STSD = fourcc_to_code("stsd"); 64 static const uint32_t BOX_TYPE_HVC1 = fourcc_to_code("hvc1"); 65 static const uint32_t BOX_TYPE_STTS = fourcc_to_code("stts"); 66 static const uint32_t BOX_TYPE_STSC = fourcc_to_code("stsc"); 67 static const uint32_t BOX_TYPE_STCO = fourcc_to_code("stco"); 68 static const uint32_t BOX_TYPE_STSZ = fourcc_to_code("stsz"); 69 70 static const uint32_t BOX_TYPE_CLLI = fourcc_to_code("clli"); 71 static const uint32_t BOX_TYPE_MDCV = fourcc_to_code("mdcv"); 72 static const uint32_t BOX_TYPE_IT35 = fourcc_to_code("it35"); 73 74 static const uint32_t BOX_TYPE_RLOC = fourcc_to_code("rloc"); 75 76 static const uint32_t HANDLER_TYPE_PICT = fourcc_to_code("pict"); 77 78 static const uint32_t ITEM_TYPE_MIME = fourcc_to_code("mime"); 79 static const uint32_t ITEM_TYPE_URI = fourcc_to_code("uri "); 80 81 static const uint32_t COLOR_TYPE_PROF = fourcc_to_code("prof"); 82 static const uint32_t COLOR_TYPE_RICC = fourcc_to_code("rICC"); 83 84 typedef uint32_t heif_item_id; 85 86 typedef uint32_t heif_brand; 87 88 enum HeifBoxVersion { 89 HEIF_BOX_VERSION_ZERO = 0, 90 HEIF_BOX_VERSION_ONE = 1, 91 HEIF_BOX_VERSION_TWO = 2, 92 HEIF_BOX_VERSION_THREE = 3, 93 }; 94 95 enum class HeifColorFormat { 96 UNDEDEFINED = 255, 97 YCBCR = 0, 98 RGB = 1, 99 MONOCHROME = 2 100 }; 101 102 enum class HeifPixelFormat { 103 UNDEFINED = 255, 104 MONOCHROME = 0, 105 YUV420 = 1, 106 YUV422 = 2, 107 YUV444 = 3, 108 }; 109 110 enum class HeifTransformMirrorDirection : uint8_t { 111 VERTICAL = 0, 112 HORIZONTAL = 1, 113 INVALID = 2, 114 }; 115 116 typedef uint32_t heif_property_id; 117 118 struct HeifMetadata { 119 heif_item_id itemId; 120 std::string itemType; 121 std::string contentType; 122 std::string itemUriType; 123 std::vector<uint8_t> mData; 124 }; 125 126 struct HeifFragmentMetadata { 127 uint32_t width = 0; 128 uint32_t height = 0; 129 uint32_t horizontalOffset = 0; 130 uint32_t verticalOffset = 0; 131 }; 132 } // namespace ImagePlugin 133 } // namespace OHOS 134 135 #endif // PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_HEIF_TYPE_H 136