// ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004-2018 Exiv2 authors * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. */ /*! @file makernote_int.hpp @brief Makernote factory and registry, IFD makernote header, and camera vendor specific makernote implementations.
References:
[1] ExifTool by Phil Harvey
[2] Decoding raw digital photos in Linux by Dave Coffin @author Andreas Huggel (ahu) ahuggel@gmx.net @date 11-Apr-06, ahu: created */ #ifndef MAKERNOTE_INT_HPP_ #define MAKERNOTE_INT_HPP_ // ***************************************************************************** // included header files #include "tifffwd_int.hpp" #include "tags_int.hpp" #include "ini.hpp" #include "types.hpp" // + standard includes #include // ***************************************************************************** // namespace extensions namespace Exiv2 { namespace Internal { // ***************************************************************************** // function prototypes /*! @brief Determine the path to the Exiv2 configuration file */ std::string getExiv2ConfigPath(); /*! @brief Read value from Exiv2 configuration file */ std::string readExiv2Config(const std::string& section,const std::string& value,const std::string& def); // ***************************************************************************** // class definitions //! Type for a pointer to a function creating a makernote (image) typedef TiffComponent* (*NewMnFct)(uint16_t tag, IfdId group, IfdId mnGroup, const byte* pData, uint32_t size, ByteOrder byteOrder); //! Type for a pointer to a function creating a makernote (group) typedef TiffComponent* (*NewMnFct2)(uint16_t tag, IfdId group, IfdId mnGroup); //! Makernote registry structure struct TiffMnRegistry { struct MakeKey; /*! @brief Compare a TiffMnRegistry structure with a key being the make string from the image. The two are equal if TiffMnRegistry::make_ equals a substring of the key of the same size. E.g., registry = "OLYMPUS", key = "OLYMPUS OPTICAL CO.,LTD" (found in the image) match. */ bool operator==(const std::string& key) const; //! Compare a TiffMnRegistry structure with a makernote group bool operator==(IfdId key) const; // DATA const char* make_; //!< Camera make IfdId mnGroup_; //!< Group identifier NewMnFct newMnFct_; //!< Makernote create function (image) NewMnFct2 newMnFct2_; //!< Makernote create function (group) }; /*! @brief TIFF makernote factory for concrete TIFF makernotes. */ class TiffMnCreator { public: /*! @brief Create the Makernote for camera \em make and details from the makernote entry itself if needed. Return a pointer to the newly created TIFF component. Set tag and group of the new component to \em tag and \em group. This method is used when a makernote is parsed from the Exif block. @note Ownership for the component is transferred to the caller, who is responsible to delete the component. No smart pointer is used to indicate this transfer here in order to reduce file dependencies. */ static TiffComponent* create(uint16_t tag, IfdId group, const std::string& make, const byte* pData, uint32_t size, ByteOrder byteOrder); /*! @brief Create the Makernote for a given group. This method is used when a makernote is written back from Exif tags. */ static TiffComponent* create(uint16_t tag, IfdId group, IfdId mnGroup); protected: //! Prevent destruction (needed if used as a policy class) ~TiffMnCreator() {} private: static const TiffMnRegistry registry_[]; //