Project

General

Profile

Patch #896 ยป exiv2_olympus_focus_distance.patch

Teemu Rytilahti, 21 Mar 2013 06:47

View differences:

src/olympusmn.cpp (working copy)
1005 1005
        TagInfo(0x0301, "FocusStepCount", N_("Focus Step Count"), N_("Focus step count"), olympusFiId, makerTags, unsignedShort, -1, printValue),
1006 1006
        TagInfo(0x0303, "FocusStepInfinity", N_("Focus Step Infinity"), N_("Focus step infinity"), olympusFiId, makerTags, unsignedShort, -1, printValue),
1007 1007
        TagInfo(0x0304, "FocusStepNear", N_("Focus Step Near"), N_("Focus step near"), olympusFiId, makerTags, unsignedShort, -1, printValue),
1008
        TagInfo(0x0305, "FocusDistance", N_("Focus Distance"), N_("Focus distance"), olympusFiId, makerTags, unsignedRational, -1, printValue),
1008
        TagInfo(0x0305, "FocusDistance", N_("Focus Distance"), N_("Focus distance"), olympusFiId, makerTags, unsignedRational, -1, print0x0305),
1009 1009
        TagInfo(0x0308, "AFPoint", N_("AF Point"), N_("AF point"), olympusFiId, makerTags, unsignedShort, -1, print0x0308),
1010 1010
        TagInfo(0x1201, "ExternalFlash", N_("External Flash"), N_("External flash"), olympusFiId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(olympusOffOn)),
1011 1011
        TagInfo(0x1203, "ExternalFlashGuideNumber", N_("External Flash Guide Number"), N_("External flash guide number"), olympusFiId, makerTags, signedRational, -1, printValue),
......
1513 1513
        return os;
1514 1514
    } // OlympusMakerNote::print0x1209
1515 1515

  
1516
    // Olympus FocusDistance 0x0305
1517
    std::ostream& OlympusMakerNote::print0x0305(std::ostream& os, const Value& value, const ExifData*) {
1518
        if (value.count() != 1 || value.typeId() != unsignedRational) {
1519
            return os << value;
1520
        }
1521
        
1522
        Rational distance = value.toRational();
1523
        if(static_cast<uint32_t>(distance.first) == 0xffffffff) {
1524
            os << _("Infinity");
1525
        }
1526
        else {
1527
            std::ostringstream oss;
1528
            oss.copyfmt(os);
1529
            os << std::fixed << std::setprecision(2);
1530
            os << (float)distance.first/1000 << " m";
1531
            os.copyfmt(oss); 
1532
        }
1533
        return os;
1534
    }
1535
    
1516 1536
    // Olympus FocusInfo tag 0x0308 AFPoint
1517 1537
    std::ostream& OlympusMakerNote::print0x0308(std::ostream& os, const Value&
1518 1538
value, const ExifData* metadata)
src/olympusmn_int.hpp (working copy)
103 103
        static  std::ostream& print0x0529(std::ostream& os, const Value& value, const ExifData*);
104 104
        //! Print Olympus focus info ManualFlash
105 105
        static std::ostream& print0x1209(std::ostream& os, const Value& value, const ExifData*);
106
        //! Print Olympus focus distance
107
        static std::ostream& print0x0305(std::ostream& os, const Value& value, const ExifData*);
106 108
        //! Print Olympus focus info AF Point
107 109
        static std::ostream& print0x0308(std::ostream& os, const Value& value, const ExifData*);
108 110
        //! Print Olympus generic
    (1-1/1)