From 18ed65a25f5d2f4ddc8cecb207216b762fc2dab5 Mon Sep 17 00:00:00 2001 From: clanmills Date: Sun, 29 Mar 2020 17:55:37 +0100 Subject: [PATCH] fix_Sony2010e_0.27 Thanks to @sridharb1 --- src/image.cpp | 4 +-- src/makernote_int.cpp | 15 ++++++++++ src/makernote_int.hpp | 11 +++++++ src/sonymn_int.cpp | 47 ++++++++++++++++++++++++++++++ src/sonymn_int.hpp | 4 ++- src/tags_int.cpp | 4 +++ src/tags_int.hpp | 1 + src/tiffimage_int.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 151 insertions(+), 3 deletions(-) diff --git a/src/image.cpp b/src/image.cpp index 781d84ad..fadc5c4e 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -871,12 +871,12 @@ namespace Exiv2 { BasicIo::AutoPtr ImageFactory::createIo(const std::wstring& wpath, bool useCurl) { Protocol fProt = fileProtocol(wpath); -#if EXV_USE_SSH == 1 +#ifdef EXV_USE_SSH if (fProt == pSsh || fProt == pSftp) { return BasicIo::AutoPtr(new SshIo(wpath)); } #endif -#if EXV_USE_CURL == 1 +#ifdef EXV_USE_CURL if (useCurl && (fProt == pHttp || fProt == pHttps || fProt == pFtp)) { return BasicIo::AutoPtr(new CurlIo(wpath)); } diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index 20cd7629..25bb3d3f 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -1243,6 +1243,21 @@ namespace Exiv2 { } return idx; } + int sony2010eSelector(uint16_t /*tag*/, const byte* /*pData*/, uint32_t /*size*/, TiffComponent* const pRoot) + { + const char* models[] = { "SLT-A58", "SLT-A99", "ILCE-3000", "ILCE-3500", "NEX-3N", "NEX-5R", "NEX-5T", "NEX-6", "VG30E", "VG900", + "DSC-RX100", "DSC-RX1", "DSC-RX1R", "DSC-HX300", "DSC-HX50V", "DSC-TX30", "DSC-WX60", "DSC-WX200", "DSC-WX300" }; + std::set s2010eModels; + for (size_t i = 0; i < EXV_COUNTOF(models); i++) { + s2010eModels.insert(models[i]); + } + std::string model = getExifModel(pRoot); + int idx = -1; + if (s2010eModels.find(model) != s2010eModels.end()) { + idx = 0; + } + return idx; + } }} // namespace Internal, Exiv2 // ***************************************************************************** diff --git a/src/makernote_int.hpp b/src/makernote_int.hpp index 4acd055f..fd2cc844 100644 --- a/src/makernote_int.hpp +++ b/src/makernote_int.hpp @@ -730,6 +730,17 @@ namespace Exiv2 { */ int sonyCsSelector(uint16_t tag, const byte* pData, uint32_t size, TiffComponent* const pRoot); + /*! + @brief Function to select cfg + def of the Sony 2010 Miscellaneous Information complex binary array. + + @param tag Tag number of the binary array + @param pData Pointer to the raw array data. + @param size Size of the array data. + @param pRoot Pointer to the root component of the TIFF tree. + @return An index into the array set, -1 if no match was found. + */ + int sony2010eSelector(uint16_t tag, const byte* pData, uint32_t size, TiffComponent* const pRoot); + /*! @brief Function to select cfg + def of a Nikon complex binary array. diff --git a/src/sonymn_int.cpp b/src/sonymn_int.cpp index 787c01d8..ca082693 100644 --- a/src/sonymn_int.cpp +++ b/src/sonymn_int.cpp @@ -811,6 +811,53 @@ namespace Exiv2 { return tagInfoFp_; } + //! Sony Tag 2010 Sony2010 (Miscellaneous) + const TagInfo SonyMakerNote::tagInfo2010e_[] = { + TagInfo(0, "SequenceImageNumber", N_("Sequence Image Number"), N_("Sequence Image Number"), sony2010eId, makerTags, unsignedLong, 1, printValue), + TagInfo(4, "SequenceFileNumber", N_("SequenceFileNumber"), N_("SequenceFileNumber"), sony2010eId, makerTags, unsignedLong, 1, printValue), + TagInfo(8, "ReleaseMode2", N_("ReleaseMode2"), N_("ReleaseMode2"), sony2010eId, makerTags, unsignedLong, 1, printValue), + TagInfo(540, "DigitalZoomRatio", N_("DigitalZoomRatio"), N_("DigitalZoomRatio"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(556, "SonyDateTime", N_("SonyDateTime"), N_("SonyDateTime"), sony2010eId, makerTags, undefined, 1, printValue), + TagInfo(808, "DynamicRangeOptimizer", N_("DynamicRangeOptimizer"), N_("DynamicRangeOptimizer"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(1208, "MeterInfo", N_("MeterInfo"), N_("MeterInfo"), sony2010eId, makerTags, undefined, 1, printValue), + TagInfo(4444, "ReleaseMode3", N_("ReleaseMode3"), N_("ReleaseMode3"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4448, "ReleaseMode2", N_("ReleaseMode2"), N_("ReleaseMode2"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4456, "SelfTimer", N_("SelfTimer"), N_("SelfTimer"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4460, "FlashMode", N_("FlashMode"), N_("FlashMode"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4466, "StopsAboveBaseISO", N_("StopsAboveBaseISO"), N_("StopsAboveBaseISO"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(4468, "BrightnessValue", N_("BrightnessValue"), N_("BrightnessValue"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(4472, "DynamicRangeOptimizer", N_("DynamicRangeOptimizer"), N_("DynamicRangeOptimizer"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4476, "HDRSetting", N_("HDRSetting"), N_("HDRSetting"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4480, "ExposureCompensation", N_("ExposureCompensation"), N_("ExposureCompensation"), sony2010eId, makerTags, signedShort, 1, printValue), + TagInfo(4502, "PictureProfile", N_("PictureProfile"), N_("PictureProfile"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4503, "PictureProfile2", N_("PictureProfile2"), N_("PictureProfile2"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4507, "PictureEffect2", N_("PictureEffect2"), N_("PictureEffect2"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4520, "Quality2", N_("Quality2"), N_("Quality2"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4524, "MeteringMode", N_("MeteringMode"), N_("MeteringMode"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4525, "ExposureProgram", N_("ExposureProgram"), N_("ExposureProgram"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(4532, "WB_RGBLevels", N_("WB_RGBLevels"), N_("WB_RGBLevels"), sony2010eId, makerTags, unsignedShort, 3, printValue), + TagInfo(4692, "SonyISO", N_("SonyISO"), N_("SonyISO"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(4696, "SonyISO2", N_("SonyISO2"), N_("SonyISO2"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(4728, "FocalLength", N_("FocalLength"), N_("FocalLength"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(4730, "MinFocalLength", N_("MinFocalLength"), N_("MinFocalLength"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(4732, "MaxFocalLength", N_("MaxFocalLength"), N_("MaxFocalLength"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(4736, "SonyISO3", N_("SonyISO3"), N_("SonyISO3"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(6256, "DistortionCorrParams", N_("DistortionCorrParams"), N_("DistortionCorrParams"), sony2010eId, makerTags, signedShort, 16, printValue), + TagInfo(6289, "LensFormat", N_("LensFormat"), N_("LensFormat"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(6290, "LensMount", N_("LensMount"), N_("LensMount"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(6291, "LensType2", N_("LensType2"), N_("LensType2"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(6294, "LensType", N_("LensType"), N_("LensType"), sony2010eId, makerTags, unsignedShort, 1, printValue), + TagInfo(6296, "DistortionCorrParamsPresent", N_("DistortionCorrParamsPresent"), N_("DistortionCorrParamsPresent"), sony2010eId, makerTags, unsignedByte, 1, printValue), + TagInfo(6297, "DistortionCorrParamsNumber", N_("DistortionCorrParamsNumber"), N_("DistortionCorrParamsNumber"), sony2010eId, makerTags, unsignedByte, 1, printValue), + // End of list marker + TagInfo(0xffff, "(UnknownSony2010eTag)", "(UnknownSony2010eTag)" , "(UnknownSony2010eTag)" , sony2010eId, makerTags, unsignedByte, 1, printValue) + }; + + const TagInfo* SonyMakerNote::tagList2010e() + { + return tagInfo2010e_; + } + // https://github.com/Exiv2/exiv2/pull/906#issuecomment-504338797 static DataBuf sonyTagCipher(uint16_t /* tag */, const byte* bytes, uint32_t size, TiffComponent* const /*object*/, bool bDecipher) { diff --git a/src/sonymn_int.hpp b/src/sonymn_int.hpp index 7e4987d1..5eb7103d 100644 --- a/src/sonymn_int.hpp +++ b/src/sonymn_int.hpp @@ -62,6 +62,8 @@ namespace Exiv2 { //! Return read-only list of built-in Sony FocusPosition tags static const TagInfo* tagListFp(); + static const TagInfo* tagList2010e(); + //! @name Print functions for Sony %MakerNote tags //@{ //! Print Sony Camera Model @@ -75,7 +77,7 @@ namespace Exiv2 { static const TagInfo tagInfoCs_[]; static const TagInfo tagInfoCs2_[]; static const TagInfo tagInfoFp_[]; - + static const TagInfo tagInfo2010e_[]; }; // class SonyMakerNote DataBuf sonyTagDecipher(uint16_t, const byte*, uint32_t, TiffComponent* const); diff --git a/src/tags_int.cpp b/src/tags_int.cpp index 8688d26f..239b893a 100644 --- a/src/tags_int.cpp +++ b/src/tags_int.cpp @@ -166,6 +166,7 @@ namespace Exiv2 { { sony2CsId, "Makernote", "Sony2Cs", SonyMakerNote::tagListCs }, { sony2Cs2Id, "Makernote", "Sony2Cs2", SonyMakerNote::tagListCs2 }, { sony2FpId, "Makernote", "Sony2Fp", SonyMakerNote::tagListFp }, + { sony2010eId, "Makernote", "Sony2010e", SonyMakerNote::tagList2010e }, { lastId, "(Last IFD info)", "(Last IFD item)", 0 } }; @@ -1571,6 +1572,9 @@ namespace Exiv2 { TagInfo(0x9292, "SubSecTimeDigitized", N_("Sub-seconds Time Digitized"), N_("A tag used to record fractions of seconds for the tag."), exifId, dateTime, asciiString, 0, printValue), + TagInfo(0x9400, "AmbientTemperature", N_("AmbientTemperature"), + N_("AmbientTemperature"), + exifId, captureCond, signedRational, 0, printValue), TagInfo(0xa000, "FlashpixVersion", N_("FlashPix Version"), N_("The FlashPix format version supported by a FPXR file."), exifId, exifVersion, undefined, 4, printExifVersion), diff --git a/src/tags_int.hpp b/src/tags_int.hpp index 7ff48b22..a37de274 100644 --- a/src/tags_int.hpp +++ b/src/tags_int.hpp @@ -155,6 +155,7 @@ namespace Exiv2 { sony2CsId, sony2Cs2Id, sony2FpId, + sony2010eId, sony1MltCs7DId, sony1MltCsOldId, sony1MltCsNewId, diff --git a/src/tiffimage_int.cpp b/src/tiffimage_int.cpp index 3d5173cd..df771629 100644 --- a/src/tiffimage_int.cpp +++ b/src/tiffimage_int.cpp @@ -786,6 +786,60 @@ namespace Exiv2 { { 0x2d, ttUnsignedByte, 1 } // Exif.Sony2Fp.FocusPosition2 }; + extern const ArrayCfg sony2010eCfg = { + sony2010eId, // Group for the elements + bigEndian, // Big endian + ttUnsignedByte, // Type for array entry and size element + sonyTagDecipher, // (uint16_t, const byte*, uint32_t, TiffComponent* const); + false, // No size element + false, // No fillers + false, // Don't concatenate gaps + { 0, ttUnsignedByte, 1 } + }; + extern const ArrayDef sony2010eDef[] = { + {0, ttUnsignedLong, 1}, // Exif.Sony2010. SequenceImageNumber + {4, ttUnsignedLong, 1}, // Exif.Sony2010. SequenceFileNumber + {8, ttUnsignedLong, 1}, // Exif.Sony2010. ReleaseMode2 + {540, ttUnsignedByte, 1}, // Exif.Sony2010. DigitalZoomRatio + {556, ttUndefined, 1}, // Exif.Sony2010. SonyDateTime + {808, ttUnsignedByte, 1}, // Exif.Sony2010. DynamicRangeOptimizer + {1208, ttUndefined, 1}, // Exif.Sony2010. MeterInfo + {4444, ttUnsignedByte, 1}, // Exif.Sony2010. ReleaseMode3 + {4448, ttUnsignedByte, 1}, // Exif.Sony2010. ReleaseMode2 + {4456, ttUnsignedByte, 1}, // Exif.Sony2010. SelfTimer + {4460, ttUnsignedByte, 1}, // Exif.Sony2010. FlashMode + {4466, ttUnsignedShort, 1}, // Exif.Sony2010. StopsAboveBaseISO + {4468, ttUnsignedShort, 1}, // Exif.Sony2010. BrightnessValue + {4472, ttUnsignedByte, 1}, // Exif.Sony2010. DynamicRangeOptimizer + {4476, ttUnsignedByte, 1}, // Exif.Sony2010. HDRSetting + {4480, ttSignedShort, 1}, // Exif.Sony2010. ExposureCompensation + {4502, ttUnsignedByte, 1}, // Exif.Sony2010. PictureProfile + {4503, ttUnsignedByte, 1}, // Exif.Sony2010. PictureProfile2 + {4507, ttUnsignedByte, 1}, // Exif.Sony2010. PictureEffect2 + {4520, ttUnsignedByte, 1}, // Exif.Sony2010. Quality2 + {4524, ttUnsignedByte, 1}, // Exif.Sony2010. MeteringMode + {4525, ttUnsignedByte, 1}, // Exif.Sony2010. ExposureProgram + {4532, ttUnsignedShort, 3}, // Exif.Sony2010. WB_RGBLevels + {4692, ttUnsignedShort, 1}, // Exif.Sony2010. SonyISO + {4696, ttUnsignedShort, 1}, // Exif.Sony2010. SonyISO2 + {4728, ttUnsignedShort, 1}, // Exif.Sony2010. FocalLength + {4730, ttUnsignedShort, 1}, // Exif.Sony2010. MinFocalLength + {4732, ttUnsignedShort, 1}, // Exif.Sony2010. MaxFocalLength + {4736, ttUnsignedShort, 1}, // Exif.Sony2010. SonyISO3 + {6256, ttSignedShort, 16}, // Exif.Sony2010. DistortionCorrParams + {6289, ttUnsignedByte, 1}, // Exif.Sony2010. LensFormat + {6290, ttUnsignedByte, 1}, // Exif.Sony2010. LensMount + {6291, ttUnsignedShort, 1}, // Exif.Sony2010. LensType2 + {6294, ttUnsignedShort, 1}, // Exif.Sony2010. LensType + {6296, ttUnsignedByte, 1}, // Exif.Sony2010. DistortionCorrParamsPresent + {6297, ttUnsignedByte, 1} // Exif.Sony2010. DistortionCorrParamsNumber + }; + + //! Sony1 Camera Settings configurations and definitions + extern const ArraySet sony2010eSet[] = { + { sony2010eCfg, sony2010eDef, EXV_COUNTOF(sony2010eDef) } + }; + //! Sony[12] Camera Settings binary array - definition extern const ArrayDef sonyCsDef[] = { { 12, ttSignedShort, 1 } // Exif.Sony[12]Cs.WhiteBalanceFineTune @@ -999,6 +1053,8 @@ namespace Exiv2 { { Tag::root, samsungPvId, samsung2Id, 0x0035 }, { Tag::root, sigmaId, exifId, 0x927c }, { Tag::root, sony1Id, exifId, 0x927c }, + { Tag::root, sony2010eId, sony1Id, 0x2010 }, + { Tag::root, sony2FpId, sony1Id, 0x9402 }, { Tag::root, sony1CsId, sony1Id, 0x0114 }, { Tag::root, sony1Cs2Id, sony1Id, 0x0114 }, { Tag::root, sonyMltId, sony1Id, 0xb028 }, @@ -1007,6 +1063,7 @@ namespace Exiv2 { { Tag::root, sony1MltCs7DId, sonyMltId, 0x0004 }, { Tag::root, sony1MltCsA100Id, sonyMltId, 0x0114 }, { Tag::root, sony2Id, exifId, 0x927c }, + { Tag::root, sony2010eId, sony2Id, 0x2010 }, { Tag::root, sony2FpId, sony2Id, 0x9402 }, { Tag::root, sony2CsId, sony2Id, 0x0114 }, { Tag::root, sony2Cs2Id, sony2Id, 0x0114 }, @@ -1428,6 +1485,14 @@ namespace Exiv2 { { Tag::next, sigmaId, ignoreTiffComponent }, { Tag::all, sigmaId, newTiffEntry }, + + { Tag::all, sony2010eId, newTiffBinaryElement }, + { 0x2010, sony1Id, EXV_COMPLEX_BINARY_ARRAY(sony2010eSet, sony2010eSelector) }, + + // Tag 0x9402 Sony2Fp Focus Position + { Tag::all, sony2FpId, newTiffBinaryElement }, + { 0x9402, sony1Id, EXV_BINARY_ARRAY(sony2FpCfg, sony2FpDef) }, + // Sony1 makernote { 0x0114, sony1Id, EXV_COMPLEX_BINARY_ARRAY(sony1CsSet, sonyCsSelector) }, { 0xb028, sony1Id, newTiffSubIfd }, @@ -1438,6 +1503,9 @@ namespace Exiv2 { { Tag::all, sony1CsId, newTiffBinaryElement }, { Tag::all, sony1Cs2Id, newTiffBinaryElement }, + { Tag::all, sony2010eId, newTiffBinaryElement }, + { 0x2010, sony2Id, EXV_COMPLEX_BINARY_ARRAY(sony2010eSet, sony2010eSelector) }, + // Tag 0x9402 Sony2Fp Focus Position { Tag::all, sony2FpId, newTiffBinaryElement }, { 0x9402, sony2Id, EXV_BINARY_ARRAY(sony2FpCfg, sony2FpDef) },