Project

General

Profile

Bug #494 » exiv2-0.18-crwfl.patch

Artis Rozentāls, 06 Feb 2009 22:44

View differences:

exiv2-0.18-crwfl/src/actions.cpp 2009-01-05 11:53:02.000000000 -0700
348 348
                          << md->print(&exifData) << ")";
349 349
            }
350 350
        }
351
        else {
352
            printTag(exifData, "Exif.Canon.FocalLength");
353
        }
351 354
        std::cout << std::endl;
352 355

  
353 356
        // Subject distance
exiv2-0.18-crwfl/src/canonmn.cpp 2009-01-05 11:31:50.000000000 -0700
165 165
    const TagInfo CanonMakerNote::tagInfo_[] = {
166 166
        TagInfo(0x0000, "0x0000", "0x0000", N_("Unknown"), canonIfdId, makerTags, unsignedShort, printValue),
167 167
        TagInfo(0x0001, "CameraSettings", N_("Camera Settings"), N_("Various camera settings"), canonIfdId, makerTags, unsignedShort, printValue),
168
        TagInfo(0x0002, "0x0002", "0x0002", N_("Unknown"), canonIfdId, makerTags, unsignedShort, printValue),
168
        TagInfo(0x0002, "FocalLength", N_("Focal Length"), N_("Focal length"), canonIfdId, makerTags, unsignedShort, printFocalLength),
169 169
        TagInfo(0x0003, "0x0003", "0x0003", N_("Unknown"), canonIfdId, makerTags, unsignedShort, printValue),
170 170
        TagInfo(0x0004, "ShotInfo", N_("Shot Info"), N_("Shot information"), canonIfdId, makerTags, unsignedShort, printValue),
171 171
        TagInfo(0x0005, "Panorama", N_("Panorama"), N_("Panorama"), canonIfdId, makerTags, unsignedShort, printValue),
......
875 875
        return tagInfoPi_;
876 876
    }
877 877

  
878
    std::ostream& CanonMakerNote::printFocalLength(std::ostream& os,
879
                                                   const Value& value,
880
                                                   const ExifData* metadata)
881
    {
882
        if (   value.count() < 4
883
            || value.typeId() != unsignedShort) {
884
            return os << "(" << value << ")";
885
        }
886

  
887
        ExifKey key("Exif.CanonCs.Lens");
888
        ExifData::const_iterator pos = metadata->findKey(key);
889
        if (   pos != metadata->end()
890
            && pos->value().count() >= 3
891
            && pos->value().typeId() == unsignedShort) {
892
            float fu = pos->value().toFloat(2);
893
            if (fu != 0.0) {
894
                float fl = value.toFloat(1) / fu;
895
                std::ostringstream oss;
896
                oss.copyfmt(os);
897
                os << std::fixed << std::setprecision(1);
898
                os << fl << " mm";
899
                os.copyfmt(oss);
900
                return os;
901
            }
902
        }
903
    }
904

  
878 905
    std::ostream& CanonMakerNote::print0x0008(std::ostream& os,
879 906
                                              const Value& value,
880 907
                                              const ExifData*)
exiv2-0.18-crwfl/src/canonmn.hpp 2009-01-05 10:55:43.000000000 -0700
72 72

  
73 73
        //! @name Print functions for Canon %MakerNote tags
74 74
        //@{
75
        //! Print the focal lenght
76
        static std::ostream& printFocalLength(std::ostream& os, const Value& value, const ExifData*);
75 77
        //! Print the image number
76 78
        static std::ostream& print0x0008(std::ostream& os, const Value& value, const ExifData*);
77 79
        //! Print the serial number of the camera
    (1-1/1)