// ***************************************************************** -*- C++ -*- /* * Copyright (C) 2004-2009 Andreas Huggel * * 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 Internal Makernote TIFF composite class TiffIfdMakernote and classes for various makernote headers. @version $Rev$ @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 "tiffcomposite_int.hpp" #include "types.hpp" // + standard includes #include // ***************************************************************************** // namespace extensions namespace Exiv2 { namespace Internal { namespace Group { const uint16_t olympmn = 257; //!< any Olympus makernote const uint16_t fujimn = 258; //!< Fujifilm makernote const uint16_t canonmn = 259; //!< Canon makernote const uint16_t canoncs = 260; //!< Canon camera settings const uint16_t canonsi = 261; //!< Canon shot info const uint16_t canoncf = 262; //!< Canon custom functions const uint16_t nikonmn = 263; //!< Any Nikon makernote (pseudo group) const uint16_t nikon1mn = 264; //!< Nikon1 makernote const uint16_t nikon2mn = 265; //!< Nikon2 makernote const uint16_t nikon3mn = 266; //!< Nikon3 makernote const uint16_t panamn = 267; //!< Panasonic makernote const uint16_t sigmamn = 268; //!< Sigma makernote const uint16_t sonymn = 269; //!< Any Sony makernote (pseudo group) const uint16_t sony1mn = 270; //!< Sony1 makernote const uint16_t sony2mn = 271; //!< Sony2 makernote const uint16_t minoltamn = 272; //!< Minolta makernote const uint16_t minocso = 273; //!< Minolta camera settings (old) const uint16_t minocsn = 274; //!< Minolta camera settings (new) const uint16_t minocs5 = 275; //!< Minolta camera settings (D5) const uint16_t minocs7 = 276; //!< Minolta camera settings (D7) const uint16_t canonpi = 277; //!< Canon picture info const uint16_t canonpa = 278; //!< Canon panorama const uint16_t pentaxmn = 279; //!< Pentax makernote const uint16_t nikonpv = 280; //!< Nikon preview sub-IFD const uint16_t olymp1mn = 281; //!< Olympus makernote const uint16_t olymp2mn = 282; //!< Olympus II makernote const uint16_t olympcs = 283; //!< Olympus camera settings const uint16_t olympeq = 284; //!< Olympus equipment tags const uint16_t olymprd = 285; //!< Olympus raw development tags const uint16_t olymprd2 = 286; //!< Olympus raw development 2 tags const uint16_t olympip = 287; //!< Olympus image processing tags const uint16_t olympfi = 288; //!< Olympus focus info tags const uint16_t olympfe1 = 289; //!< Olympus FE 1 tags const uint16_t olympfe2 = 290; //!< Olympus FE 2 tags const uint16_t olympfe3 = 291; //!< Olympus FE 3 tags const uint16_t olympfe4 = 292; //!< Olympus FE 4 tags const uint16_t olympfe5 = 293; //!< Olympus FE 5 tags const uint16_t olympfe6 = 294; //!< Olympus FE 6 tags const uint16_t olympfe7 = 295; //!< Olympus FE 7 tags const uint16_t olympfe8 = 296; //!< Olympus FE 8 tags const uint16_t olympfe9 = 297; //!< Olympus FE 9 tags const uint16_t olympri = 298; //!< Olympus raw info tags } // ***************************************************************************** // class definitions //! Type for a pointer to a function creating a makernote (image) typedef TiffComponent* (*NewMnFct)(uint16_t tag, uint16_t group, uint16_t 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, uint16_t group, uint16_t 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==(const uint16_t& key) const; // DATA const char* make_; //!< Camera make uint16_t 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, uint16_t 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, uint16_t group, uint16_t mnGroup); protected: //! Prevent destruction (needed if used as a policy class) ~TiffMnCreator() {} private: static const TiffMnRegistry registry_[]; //