From bf17786a045210e7fb9f01270fa28a2303725eec Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Tue, 20 Apr 2010 15:56:04 +0000 Subject: [PATCH] Added basic config to support SonyMinolta and SonyCs groups. (Patches from Gilles Caulier) --- src/makernote_int.hpp | 2 ++ src/sonymn.cpp | 70 +++++++++++++++++++++++++++---------------- src/sonymn.hpp | 3 ++ src/tags.cpp | 2 ++ src/tiffcomposite.cpp | 4 ++- src/tiffimage.cpp | 30 ++++++++++++++++++- src/types.hpp | 2 ++ 7 files changed, 86 insertions(+), 27 deletions(-) diff --git a/src/makernote_int.hpp b/src/makernote_int.hpp index 4af005e8..269cdade 100644 --- a/src/makernote_int.hpp +++ b/src/makernote_int.hpp @@ -109,6 +109,8 @@ namespace Exiv2 { const uint16_t nikonsi5 = 317; //!< Nikon Shot Info v2.* Tags const uint16_t nikonsi6 = 318; //!< Nikon Shot Info v1.* Tags const uint16_t canonfi = 320; //!< Canon File Info + const uint16_t sonymltmn = 330; //!< Sony Minolta Makernotes + const uint16_t sonycs = 331; //!< Sony Camera Settings } // ***************************************************************************** diff --git a/src/sonymn.cpp b/src/sonymn.cpp index 9e0eb4cc..53c4e44a 100644 --- a/src/sonymn.cpp +++ b/src/sonymn.cpp @@ -207,6 +207,35 @@ namespace Exiv2 { { 14, N_("Incandescent") } }; + std::ostream& SonyMakerNote::print0xb000(std::ostream& os, const Value& value, const ExifData*) + { + if (value.count() != 4) + { + os << "(" << value << ")"; + } + else + { + std::string val = value.toString(0) + value.toString(1) + value.toString(2) + value.toString(3); + if (val == "0002") os << "JPEG"; + else if (val == "1000") os << "SR2"; + else if (val == "2000") os << "ARW 1.0"; + else if (val == "3000") os << "ARW 2.0"; + else if (val == "3100") os << "ARW 2.1"; + else os << "(" << value << ")"; + } + return os; + } + + std::ostream& SonyMakerNote::printImageSize(std::ostream& os, const Value& value, const ExifData*) + { + if (value.count() == 2) + os << value.toString(0) << " x " << value.toString(1); + else + os << "(" << value << ")"; + + return os; + } + // Sony MakerNote Tag Info const TagInfo SonyMakerNote::tagInfo_[] = { @@ -351,33 +380,24 @@ namespace Exiv2 { return tagInfo_; } - std::ostream& SonyMakerNote::print0xb000(std::ostream& os, const Value& value, const ExifData*) - { - if (value.count() != 4) - { - os << "(" << value << ")"; - } - else - { - std::string val = value.toString(0) + value.toString(1) + value.toString(2) + value.toString(3); - if (val == "0002") os << "JPEG"; - else if (val == "1000") os << "SR2"; - else if (val == "2000") os << "ARW 1.0"; - else if (val == "3000") os << "ARW 2.0"; - else if (val == "3100") os << "ARW 2.1"; - else os << "(" << value << ")"; - } - return os; - } + // -- Sony camera settings --------------------------------------------------------------- - std::ostream& SonyMakerNote::printImageSize(std::ostream& os, const Value& value, const ExifData*) - { - if (value.count() == 2) - os << value.toString(0) << " x " << value.toString(1); - else - os << "(" << value << ")"; + // Sony Camera Settings Tag Info + const TagInfo SonyMakerNote::tagInfoCs_[] = { - return os; + TagInfo(0x0016, "ISOSetting", N_("ISO Setting"), + N_("ISO Setting"), + sonyCsIfdId, makerTags, unsignedShort, printValue), + + // End of list marker + TagInfo(0xffff, "(UnknownSonyCsTag)", "(UnknownSonyCsTag)", + N_("Unknown Sony Camera Settings tag"), + sonyCsIfdId, makerTags, invalidTypeId, printValue) + }; + + const TagInfo* SonyMakerNote::tagListCs() + { + return tagInfoCs_; } } // namespace Exiv2 diff --git a/src/sonymn.hpp b/src/sonymn.hpp index 8c3e9c8f..56480fc5 100644 --- a/src/sonymn.hpp +++ b/src/sonymn.hpp @@ -55,6 +55,8 @@ namespace Exiv2 { public: //! Return read-only list of built-in Sony tags static const TagInfo* tagList(); + //! Return read-only list of built-in Sony Standard Camera Settings tags + static const TagInfo* tagListCs(); //! @name Print functions for Sony %MakerNote tags //@{ @@ -66,6 +68,7 @@ namespace Exiv2 { private: //! Tag information static const TagInfo tagInfo_[]; + static const TagInfo tagInfoCs_[]; }; // class SonyMakerNote } // namespace Exiv2 diff --git a/src/tags.cpp b/src/tags.cpp index dadb1de7..6acf2dcd 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -171,6 +171,8 @@ namespace Exiv2 { { pentaxIfdId, "Makernote", "Pentax", PentaxMakerNote::tagList }, { sigmaIfdId, "Makernote", "Sigma", SigmaMakerNote::tagList }, { sonyIfdId, "Makernote", "Sony", SonyMakerNote::tagList }, + { sonyMltIfdId, "Makernote", "SonyMinolta", MinoltaMakerNote::tagList }, + { sonyCsIfdId, "Makernote", "SonyCs", SonyMakerNote::tagListCs }, { lastIfdId, "(Last IFD info)", "(Last IFD item)", 0 } }; diff --git a/src/tiffcomposite.cpp b/src/tiffcomposite.cpp index 1b303c15..75f83f1a 100644 --- a/src/tiffcomposite.cpp +++ b/src/tiffcomposite.cpp @@ -156,7 +156,9 @@ namespace Exiv2 { { 316, "NikonSiD300b" }, { 317, "NikonSi02xx" }, { 318, "NikonSi01xx" }, - { 320, "CanonFi" } + { 320, "CanonFi" }, + { 330, "SonyMinolta" }, + { 331, "SonyCs" } }; bool TiffGroupInfo::operator==(const uint16_t& group) const diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index 3a3b07f1..1e27858a 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -794,6 +794,23 @@ namespace Exiv2 { { 146, ttSignedShort, 1 } // Exif.MinoltaCs5D.ColorTemperature }; + //! Sony Camera Settings binary array - configuration + extern const ArrayCfg sonyCsCfg = { + Group::sonycs, // Group for the elements + bigEndian, // Big endian + ttUndefined, // Type for array entry and size element + notEncrypted, // Not encrypted + false, // No size element + false, // No fillers + false, // Don't concatenate gaps + { 0, ttUnsignedShort, 1 } + }; + //! Sony Camera Settings binary array - definition + extern const ArrayDef sonyCsDef[] = { + { 6, ttUnsignedShort, 1 }, // Exif.SonyCs.DriveMode + { 10, ttSignedShort, 1 } // Exif.SonyCs.WhiteBalanceFineTune + }; + /* This table lists for each group in a tree, its parent group and tag. Root identifies the root of a TIFF tree, as there is a need for multiple @@ -877,6 +894,8 @@ namespace Exiv2 { { Tag::root, Group::pentaxmn, Group::exif, 0x927c }, { Tag::root, Group::sigmamn, Group::exif, 0x927c }, { Tag::root, Group::sony1mn, Group::exif, 0x927c }, + { Tag::root, Group::sonycs, Group::sony1mn, 0x0114 }, + { Tag::root, Group::sonymltmn, Group::sony1mn, 0xb028 }, { Tag::root, Group::sony2mn, Group::exif, 0x927c }, { Tag::root, Group::minoltamn, Group::exif, 0x927c }, { Tag::root, Group::minocso, Group::minoltamn, 0x0001 }, @@ -1235,12 +1254,21 @@ namespace Exiv2 { // Sony1 makernote { Tag::next, Group::sony1mn, newTiffDirectory }, + { 0x0114, Group::sony1mn, EXV_BINARY_ARRAY(sonyCsCfg, sonyCsDef) }, + { 0xb028, Group::sony1mn, newTiffSubIfd }, { Tag::all, Group::sony1mn, newTiffEntry }, + // Sony1 camera settings + { Tag::all, Group::sonycs, newTiffBinaryElement }, + // Sony2 makernote { Tag::next, Group::sony2mn, newTiffDirectory }, { Tag::all, Group::sony2mn, newTiffEntry }, + // Sony Minolta makernote + { Tag::next, Group::sonymltmn, newTiffDirectory }, + { Tag::all, Group::sonymltmn, newTiffEntry }, + // Minolta makernote { 0x0001, Group::minoltamn, EXV_SIMPLE_BINARY_ARRAY(minoCsoCfg) }, { 0x0003, Group::minoltamn, EXV_SIMPLE_BINARY_ARRAY(minoCsnCfg) }, @@ -1662,7 +1690,7 @@ namespace Exiv2 { { 0x010a, Group::ifd0 }, // Exif.Image.FillOrder { 0x0111, Group::ifd0 }, // Exif.Image.StripOffsets { 0x0115, Group::ifd0 }, // Exif.Image.SamplesPerPixel - { 0x0116, Group::ifd0 }, // Exif.Image.RowsPerStrip + { 0x0116, Group::ifd0 }, // Exif.Image.RowsPerStrip { 0x0117, Group::ifd0 }, // Exif.Image.StripByteCounts { 0x011a, Group::ifd0 }, // Exif.Image.XResolution { 0x011b, Group::ifd0 }, // Exif.Image.YResolution diff --git a/src/types.hpp b/src/types.hpp index 271f3ec0..1b562e2c 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -224,6 +224,8 @@ namespace Exiv2 { pentaxIfdId, sigmaIfdId, sonyIfdId, + sonyMltIfdId, + sonyCsIfdId, lastIfdId };