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_BASIC_BOX_H 17 #define PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_BASIC_BOX_H 18 19 #include "box/heif_box.h" 20 21 namespace OHOS { 22 namespace ImagePlugin { 23 class HeifFtypBox : public HeifBox { 24 public: HeifFtypBox()25 HeifFtypBox() : HeifBox(BOX_TYPE_FTYP) {} 26 27 heif_error Write(HeifStreamWriter &writer) const override; 28 protected: 29 heif_error ParseContent(HeifStreamReader &reader) override; 30 31 private: 32 uint32_t majorBrand_ = 0; 33 uint32_t minorVersion_ = 0; 34 std::vector<heif_brand> compatibleBrands_; 35 }; 36 37 class HeifMetaBox : public HeifFullBox { 38 public: HeifMetaBox()39 HeifMetaBox() : HeifFullBox(BOX_TYPE_META) {} 40 41 protected: 42 heif_error ParseContentChildren(HeifStreamReader &reader, uint32_t &recursionCount) override; 43 }; 44 45 class HeifHdlrBox : public HeifFullBox { 46 public: HeifHdlrBox()47 HeifHdlrBox() : HeifFullBox(BOX_TYPE_HDLR) {} 48 GetHandlerType()49 uint32_t GetHandlerType() const { return handlerType_; } 50 51 heif_error Write(HeifStreamWriter &writer) const override; 52 53 protected: 54 heif_error ParseContent(HeifStreamReader &reader) override; 55 56 private: 57 uint32_t isPreDefined_ = 0; 58 uint32_t handlerType_ = HANDLER_TYPE_PICT; 59 static const uint8_t HDLR_BOX_RESERVED_SIZE = 3; 60 uint32_t reserved_[HDLR_BOX_RESERVED_SIZE] = {0}; 61 std::string name_; 62 }; 63 } // namespace ImagePlugin 64 } // namespace OHOS 65 66 #endif // PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_BASIC_BOX_H 67