diff --git a/src/nikonmn.cpp b/src/nikonmn.cpp index 3333f7b7..fd373f21 100644 --- a/src/nikonmn.cpp +++ b/src/nikonmn.cpp @@ -1081,7 +1081,7 @@ namespace Exiv2 { TagInfo( 4, "ExitPupilPosition", N_("Exit Pupil Position"), N_("Exit pupil position"), nikonLd2IfdId, makerTags, unsignedByte, printValue), TagInfo( 5, "AFAperture", N_("AF Aperture"), N_("AF aperture"), nikonLd2IfdId, makerTags, unsignedByte, printValue), TagInfo( 8, "FocusPosition", N_("Focus Position"), N_("Focus position"), nikonLd2IfdId, makerTags, unsignedByte, printValue), - TagInfo( 9, "FocusDistance", N_("Focus Distance"), N_("Focus distance"), nikonLd2IfdId, makerTags, unsignedByte, printValue), + TagInfo( 9, "FocusDistance", N_("Focus Distance"), N_("Focus distance"), nikonLd2IfdId, makerTags, unsignedByte, printFocusDistance), TagInfo(10, "FocalLength", N_("Focal Length"), N_("Focal length"), nikonLd2IfdId, makerTags, unsignedByte, printValue), TagInfo(11, "LensIDNumber", N_("Lens ID Number"), N_("Lens ID number"), nikonLd2IfdId, makerTags, unsignedByte, printLensId2), TagInfo(12, "LensFStops", N_("Lens F-Stops"), N_("Lens F-stops"), nikonLd2IfdId, makerTags, unsignedByte, printValue), @@ -1106,7 +1106,7 @@ namespace Exiv2 { TagInfo( 4, "ExitPupilPosition", N_("Exit Pupil Position"), N_("Exit pupil position"), nikonLd3IfdId, makerTags, unsignedByte, printValue), TagInfo( 5, "AFAperture", N_("AF Aperture"), N_("AF aperture"), nikonLd3IfdId, makerTags, unsignedByte, printValue), TagInfo( 8, "FocusPosition", N_("Focus Position"), N_("Focus position"), nikonLd3IfdId, makerTags, unsignedByte, printValue), - TagInfo(10, "FocusDistance", N_("Focus Distance"), N_("Focus distance"), nikonLd3IfdId, makerTags, unsignedByte, printValue), + TagInfo(10, "FocusDistance", N_("Focus Distance"), N_("Focus distance"), nikonLd3IfdId, makerTags, unsignedByte, printFocusDistance), TagInfo(11, "FocalLength", N_("Focal Length"), N_("Focal length"), nikonLd3IfdId, makerTags, unsignedByte, printValue), TagInfo(12, "LensIDNumber", N_("Lens ID Number"), N_("Lens ID number"), nikonLd3IfdId, makerTags, unsignedByte, printLensId3), TagInfo(13, "LensFStops", N_("Lens F-Stops"), N_("Lens F-stops"), nikonLd3IfdId, makerTags, unsignedByte, printValue), @@ -2062,6 +2062,21 @@ fmountlens[] = { #endif // EXV_HAVE_LENSDATA } + std::ostream& Nikon3MakerNote::printFocusDistance(std::ostream& os, + const Value& value, + const ExifData*) + { + if (value.count() != 1 || value.typeId() != unsignedByte) { + return os << "(" << value << ")"; + } + double dist = 0.01 * pow(10.0, value.toLong()/40.0); + std::ostringstream oss; + oss.copyfmt(os); + os << std::fixed << std::setprecision(2) << dist << " m"; + os.copyfmt(oss); + return os; + } + std::ostream& Nikon3MakerNote::print0x009a(std::ostream& os, const Value& value, const ExifData*) diff --git a/src/nikonmn.hpp b/src/nikonmn.hpp index 11946c96..901fbf69 100644 --- a/src/nikonmn.hpp +++ b/src/nikonmn.hpp @@ -171,13 +171,13 @@ namespace Exiv2 { static std::ostream& print0x008b(std::ostream& os, const Value& value, const ExifData*); //! Print AF Points In Focus static std::ostream& printAfPointsInFocus(std::ostream& os, const Value& value, const ExifData* metadata); - //! Print lens name static std::ostream& printLensId(std::ostream& os, const Value& value, const ExifData* metadata, const std::string& group); static std::ostream& printLensId1(std::ostream& os, const Value& value, const ExifData* metadata); static std::ostream& printLensId2(std::ostream& os, const Value& value, const ExifData* metadata); static std::ostream& printLensId3(std::ostream& os, const Value& value, const ExifData* metadata); - + //! Print focus distance + static std::ostream& printFocusDistance(std::ostream& os, const Value& value, const ExifData*); //! Print sensor pixel size static std::ostream& print0x009a(std::ostream& os, const Value& value, const ExifData*); //! Print retouch history diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out index a00ae302..14d977f3 100644 --- a/test/data/exiv2-test.out +++ b/test/data/exiv2-test.out @@ -885,7 +885,7 @@ File 4/15: 20040329_224245.jpg 20040329_224245.jpg Exif.NikonLd2.0x0006 Byte 1 7 20040329_224245.jpg Exif.NikonLd2.0x0007 Byte 1 0 20040329_224245.jpg Exif.NikonLd2.FocusPosition Byte 1 161 -20040329_224245.jpg Exif.NikonLd2.FocusDistance Byte 1 109 +20040329_224245.jpg Exif.NikonLd2.FocusDistance Byte 1 5.31 m 20040329_224245.jpg Exif.NikonLd2.FocalLength Byte 1 80 20040329_224245.jpg Exif.NikonLd2.LensIDNumber Byte 1 Nikon AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED 20040329_224245.jpg Exif.NikonLd2.LensFStops Byte 1 64 @@ -2473,7 +2473,7 @@ Compare image data and extracted data ------------------------------------ < 20040329_224245.jpg Exif.NikonLd2.0x0006 Byte 1 7 < 20040329_224245.jpg Exif.NikonLd2.0x0007 Byte 1 0 < 20040329_224245.jpg Exif.NikonLd2.FocusPosition Byte 1 161 -< 20040329_224245.jpg Exif.NikonLd2.FocusDistance Byte 1 109 +< 20040329_224245.jpg Exif.NikonLd2.FocusDistance Byte 1 5.31 m < 20040329_224245.jpg Exif.NikonLd2.FocalLength Byte 1 80 < 20040329_224245.jpg Exif.NikonLd2.LensIDNumber Byte 1 Nikon AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED < 20040329_224245.jpg Exif.NikonLd2.LensFStops Byte 1 64 @@ -3989,7 +3989,7 @@ Compare image data and extracted data ------------------------------------ > 20040329_224245.exv Exif.NikonLd2.0x0006 Byte 1 7 > 20040329_224245.exv Exif.NikonLd2.0x0007 Byte 1 0 > 20040329_224245.exv Exif.NikonLd2.FocusPosition Byte 1 161 -> 20040329_224245.exv Exif.NikonLd2.FocusDistance Byte 1 109 +> 20040329_224245.exv Exif.NikonLd2.FocusDistance Byte 1 5.31 m > 20040329_224245.exv Exif.NikonLd2.FocalLength Byte 1 80 > 20040329_224245.exv Exif.NikonLd2.LensIDNumber Byte 1 Nikon AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED > 20040329_224245.exv Exif.NikonLd2.LensFStops Byte 1 64 @@ -5725,7 +5725,7 @@ Compare original and inserted image data --------------------------------- < 20040329_224245.jpg Exif.NikonLd2.0x0006 Byte 1 7 < 20040329_224245.jpg Exif.NikonLd2.0x0007 Byte 1 0 < 20040329_224245.jpg Exif.NikonLd2.FocusPosition Byte 1 161 -< 20040329_224245.jpg Exif.NikonLd2.FocusDistance Byte 1 109 +< 20040329_224245.jpg Exif.NikonLd2.FocusDistance Byte 1 5.31 m < 20040329_224245.jpg Exif.NikonLd2.FocalLength Byte 1 80 < 20040329_224245.jpg Exif.NikonLd2.LensIDNumber Byte 1 Nikon AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED < 20040329_224245.jpg Exif.NikonLd2.LensFStops Byte 1 64 @@ -7241,7 +7241,7 @@ Compare original and inserted image data --------------------------------- > 20040329_224245.exv Exif.NikonLd2.0x0006 Byte 1 7 > 20040329_224245.exv Exif.NikonLd2.0x0007 Byte 1 0 > 20040329_224245.exv Exif.NikonLd2.FocusPosition Byte 1 161 -> 20040329_224245.exv Exif.NikonLd2.FocusDistance Byte 1 109 +> 20040329_224245.exv Exif.NikonLd2.FocusDistance Byte 1 5.31 m > 20040329_224245.exv Exif.NikonLd2.FocalLength Byte 1 80 > 20040329_224245.exv Exif.NikonLd2.LensIDNumber Byte 1 Nikon AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED > 20040329_224245.exv Exif.NikonLd2.LensFStops Byte 1 64