diff --git a/src/Makefile b/src/Makefile index 61f479cf..f1a3d5d7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -69,6 +69,7 @@ CCSRC = basicio.cpp \ makernote.cpp \ makernote2.cpp \ metadatum.cpp \ + minoltamn.cpp \ nikonmn.cpp \ olympusmn.cpp \ panasonicmn.cpp \ diff --git a/src/minoltamn.cpp b/src/minoltamn.cpp new file mode 100644 index 00000000..bbfa4252 --- /dev/null +++ b/src/minoltamn.cpp @@ -0,0 +1,121 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2006 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: minoltamn.cpp + Version: $Rev$ + Author(s): Gilles Caulier (gc) + Andreas Huggel (ahu) + History: 06-May-06, gc: submitted + Credits: See header file. + */ + +// ***************************************************************************** +#include "rcsid.hpp" +EXIV2_RCSID("@(#) $Id$"); + +// ***************************************************************************** +// included header files +#include "types.hpp" +#include "minoltamn.hpp" +#include "makernote.hpp" +#include "value.hpp" + +// + standard includes +#include +#include +#include +#include + +// ***************************************************************************** +// class member definitions +namespace Exiv2 { + + //! @cond IGNORE + MinoltaMakerNote::RegisterMn::RegisterMn() + { + MakerNoteFactory::registerMakerNote( + "KONICA MINOLTA*", "*", createMinoltaMakerNote); + MakerNoteFactory::registerMakerNote( + minoltaIfdId, MakerNote::AutoPtr(new MinoltaMakerNote)); + + ExifTags::registerMakerTagInfo(minoltaIfdId, tagInfo_); + } + //! @endcond + + // Minolta Tag Info + const TagInfo MinoltaMakerNote::tagInfo_[] = { + TagInfo(0x0000, "Version", "Makernote Version", "String 'MLT0' (not null terminated)", minoltaIfdId, makerTags, undefined, printValue), + TagInfo(0x0001, "CameraSettingsOld", "Camera Settings (Old)", "Camera settings (old)", minoltaIfdId, makerTags, undefined, printValue), + TagInfo(0x0003, "CameraSettingsNew", "Camera Settings (New)", "Camera settings (old)", minoltaIfdId, makerTags, undefined, printValue), + TagInfo(0x0040, "CompressedImageSize", "Compressed Image Size", "Compressed image size", minoltaIfdId, makerTags, unsignedLong, printValue), + TagInfo(0x0081, "Thumbnail", "Thumbnail", "Jpeg thumbnail 640x480 pixels", minoltaIfdId, makerTags, undefined, printValue), + TagInfo(0x0088, "ThumbnailOffset", "Thumbnail Offset", "Offset of the thumbnail", minoltaIfdId, makerTags, unsignedLong, printValue), + TagInfo(0x0089, "ThumbnailLength", "Thumbnail Length", "Size of the thumbnail", minoltaIfdId, makerTags, unsignedLong, printValue), + TagInfo(0x0101, "ColorMode", "Color Mode", "Color mode", minoltaIfdId, makerTags, unsignedLong, printValue), + TagInfo(0x0102, "ImageQuality", "Image Quality", "Image quality", minoltaIfdId, makerTags, unsignedLong, printValue), + TagInfo(0x0e00, "PIM_IFD", "PIM IFD", "PIM information", minoltaIfdId, makerTags, undefined, printValue), + // End of list marker + TagInfo(0xffff, "(UnknownMinoltaMakerNoteTag)", "(UnknownMinoltaMakerNoteTag)", "Unknown MinoltaMakerNote tag", minoltaIfdId, makerTags, invalidTypeId, printValue) + }; + + MinoltaMakerNote::MinoltaMakerNote(bool alloc) + : IfdMakerNote(minoltaIfdId, alloc) + { + } + + MinoltaMakerNote::MinoltaMakerNote(const MinoltaMakerNote& rhs) + : IfdMakerNote(rhs) + { + } + + MinoltaMakerNote::AutoPtr MinoltaMakerNote::create(bool alloc) const + { + return AutoPtr(create_(alloc)); + } + + MinoltaMakerNote* MinoltaMakerNote::create_(bool alloc) const + { + return new MinoltaMakerNote(alloc); + } + + MinoltaMakerNote::AutoPtr MinoltaMakerNote::clone() const + { + return AutoPtr(clone_()); + } + + MinoltaMakerNote* MinoltaMakerNote::clone_() const + { + return new MinoltaMakerNote(*this); + } + +// ***************************************************************************** +// free functions + + MakerNote::AutoPtr createMinoltaMakerNote(bool alloc, + const byte* /*buf*/, + long /*len*/, + ByteOrder /*byteOrder*/, + long /*offset*/) + { + return MakerNote::AutoPtr(new MinoltaMakerNote(alloc)); + } + +} // namespace Exiv2 diff --git a/src/minoltamn.hpp b/src/minoltamn.hpp new file mode 100644 index 00000000..5dcbf323 --- /dev/null +++ b/src/minoltamn.hpp @@ -0,0 +1,133 @@ +// ***************************************************************** -*- C++ -*- +/* + * Copyright (C) 2006 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 minoltamn.hpp + @brief Minolta MakerNote + @version $Rev$ + @author Andreas Huggel (ahu) + ahuggel@gmx.net + @author Gilles Caulier (gc) + caulier.gilles@kdemail.net + @date 06-May-06, gc: submitted + */ +#ifndef MINOLTAMN_HPP_ +#define MINOLTAMN_HPP_ + +// ***************************************************************************** +// included header files +#include "types.hpp" +#include "makernote.hpp" +#include "tags.hpp" + +// + standard includes +#include +#include +#include + +// ***************************************************************************** +// namespace extensions +namespace Exiv2 { + +// ***************************************************************************** +// class declarations + class Value; + +// ***************************************************************************** +// free functions + + /*! + @brief Return an auto-pointer to a newly created empty MakerNote + initialized to operate in the memory management model indicated. + The caller owns this copy and the auto-pointer ensures that it + will be deleted. + + @param alloc Memory management model for the new MakerNote. Determines if + memory required to store data should be allocated and deallocated + (true) or not (false). If false, only pointers to the buffer + provided to read() will be kept. See Ifd for more background on + this concept. + @param buf Pointer to the makernote character buffer (not used). + @param len Length of the makernote character buffer (not used). + @param byteOrder Byte order in which the Exif data (and possibly the + makernote) is encoded (not used). + @param offset Offset from the start of the TIFF header of the makernote + buffer (not used). + + @return An auto-pointer to a newly created empty MakerNote. The caller + owns this copy and the auto-pointer ensures that it will be + deleted. + */ + MakerNote::AutoPtr createMinoltaMakerNote(bool alloc, + const byte* buf, + long len, + ByteOrder byteOrder, + long offset); + +// ***************************************************************************** +// class definitions + + //! MakerNote for Minolta cameras + class MinoltaMakerNote : public IfdMakerNote { + public: + //! Shortcut for a %MinoltaMakerNote auto pointer. + typedef std::auto_ptr AutoPtr; + + //! @name Creators + //@{ + /*! + @brief Constructor. Allows to choose whether or not memory management + is required for the makernote entries. + */ + MinoltaMakerNote(bool alloc =true); + //! Copy constructor + MinoltaMakerNote(const MinoltaMakerNote& rhs); + //! Virtual destructor + virtual ~MinoltaMakerNote() {} + //@} + + //! @name Accessors + //@{ + AutoPtr create(bool alloc =true) const; + AutoPtr clone() const; + //@} + + //! @cond IGNORE + // Public only so that we can create a static instance + struct RegisterMn { + RegisterMn(); + }; + //! @endcond + + private: + //! Internal virtual create function. + MinoltaMakerNote* create_(bool alloc =true) const; + //! Internal virtual copy constructor. + MinoltaMakerNote* clone_() const; + + //! Tag information + static const TagInfo tagInfo_[]; + + }; // class MinoltaMakerNote + + static MinoltaMakerNote::RegisterMn registerMinoltaMakerNote; +} // namespace Exiv2 + +#endif // #ifndef MINOLTAMN_HPP_ diff --git a/src/mn.hpp b/src/mn.hpp index 8ff60f7b..0783e1a6 100644 --- a/src/mn.hpp +++ b/src/mn.hpp @@ -34,6 +34,7 @@ // included header files #include "canonmn.hpp" #include "fujimn.hpp" +#include "minoltamn.hpp" #include "nikonmn.hpp" #include "olympusmn.hpp" #include "panasonicmn.hpp" diff --git a/src/tags.cpp b/src/tags.cpp index d1171424..0defd662 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -70,6 +70,7 @@ namespace Exiv2 { IfdInfo(canonCs2IfdId, "Makernote", "CanonCs2"), IfdInfo(canonCfIfdId, "Makernote", "CanonCf"), IfdInfo(fujiIfdId, "Makernote", "Fujifilm"), + IfdInfo(minoltaIfdId, "Makernote", "Minolta"), IfdInfo(nikon1IfdId, "Makernote", "Nikon1"), IfdInfo(nikon2IfdId, "Makernote", "Nikon2"), IfdInfo(nikon3IfdId, "Makernote", "Nikon3"), diff --git a/src/types.hpp b/src/types.hpp index 272e0b1e..836b80ca 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -97,7 +97,7 @@ namespace Exiv2 { enum IfdId { ifdIdNotSet, ifd0Id, exifIfdId, gpsIfdId, iopIfdId, ifd1Id, canonIfdId, canonCs1IfdId, canonCs2IfdId, canonCfIfdId, - fujiIfdId, nikon1IfdId, nikon2IfdId, nikon3IfdId, + fujiIfdId, minoltaIfdId, nikon1IfdId, nikon2IfdId, nikon3IfdId, olympusIfdId, panasonicIfdId, sigmaIfdId, sonyIfdId, lastIfdId };