Merge branch 'dev' into relax-procparam-dependency
This commit is contained in:
@@ -300,6 +300,38 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
}
|
||||
|
||||
if (lens == "Unknown") {
|
||||
const auto lens_from_make_and_model =
|
||||
[this, exif]() -> bool
|
||||
{
|
||||
if (!exif) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const rtexif::Tag* const lens_model = exif->getTag(0xA434);
|
||||
|
||||
if (lens_model) {
|
||||
const rtexif::Tag* const lens_make = exif->getTag(0xA433);
|
||||
const std::string make =
|
||||
lens_make
|
||||
? lens_make->valueToString()
|
||||
: std::string();
|
||||
const std::string model = lens_model->valueToString();
|
||||
|
||||
if (!model.empty()) {
|
||||
lens = make;
|
||||
|
||||
if (!lens.empty()) {
|
||||
lens += ' ';
|
||||
}
|
||||
|
||||
lens += model;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
if (mnote) {
|
||||
|
||||
@@ -341,6 +373,11 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
}
|
||||
}
|
||||
}
|
||||
// If MakeNotes are vague, fall back to Exif LensMake and LensModel if set
|
||||
// https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#LensType
|
||||
if (lens == "Manual Lens No CPU") {
|
||||
lens_from_make_and_model();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,11 +443,15 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
rtexif::Tag *lt = mnote->getTag("LensType");
|
||||
|
||||
if ( lt ) {
|
||||
std::string ldata = lt->valueToString ();
|
||||
if (lt->toInt()) {
|
||||
std::string ldata = lt->valueToString ();
|
||||
|
||||
if (ldata.size() > 1) {
|
||||
found = true;
|
||||
lens = "Canon " + ldata;
|
||||
if (ldata.size() > 1) {
|
||||
found = true;
|
||||
lens = "Canon " + ldata;
|
||||
}
|
||||
} else {
|
||||
found = lens_from_make_and_model();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +478,14 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
}
|
||||
}
|
||||
if (mnote->getTag ("LensType")) {
|
||||
lens = mnote->getTag ("LensType")->valueToString ();
|
||||
lens = mnote->getTag ("LensType")->valueToString();
|
||||
// If MakeNotes are vague, fall back to Exif LensMake and LensModel if set
|
||||
// https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html#LensType
|
||||
if (lens == "M-42 or No Lens" || lens == "K or M Lens" || lens == "A Series Lens" || lens == "Sigma") {
|
||||
lens_from_make_and_model();
|
||||
}
|
||||
} else {
|
||||
lens_from_make_and_model();
|
||||
}
|
||||
|
||||
// Try to get the FocalLength from the LensInfo structure, where length below 10mm will be correctly set
|
||||
@@ -459,6 +507,9 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
} else if (mnote && (!make.compare (0, 4, "SONY") || !make.compare (0, 6, "KONICA"))) {
|
||||
if (mnote->getTag ("LensID")) {
|
||||
lens = mnote->getTag ("LensID")->valueToString ();
|
||||
if (lens == "Unknown") {
|
||||
lens_from_make_and_model();
|
||||
}
|
||||
}
|
||||
} else if (!make.compare (0, 7, "OLYMPUS")) {
|
||||
if (mnote->getTag ("Equipment")) {
|
||||
@@ -468,6 +519,9 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
lens = eq->getTag ("LensType")->valueToString ();
|
||||
}
|
||||
}
|
||||
if (lens == "Unknown") {
|
||||
lens_from_make_and_model();
|
||||
}
|
||||
} else if (mnote && !make.compare (0, 9, "Panasonic")) {
|
||||
if (mnote->getTag ("LensType")) {
|
||||
std::string panalens = mnote->getTag("LensType")->valueToString();
|
||||
@@ -482,9 +536,7 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
}
|
||||
} else if (exif->getTag ("DNGLensInfo")) {
|
||||
lens = exif->getTag ("DNGLensInfo")->valueToString ();
|
||||
} else if (exif->getTag ("LensModel")) {
|
||||
lens = exif->getTag ("LensModel")->valueToString ();
|
||||
} else if (exif->getTag ("LensInfo")) {
|
||||
} else if (!lens_from_make_and_model() && exif->getTag ("LensInfo")) {
|
||||
lens = exif->getTag ("LensInfo")->valueToString ();
|
||||
}
|
||||
}
|
||||
@@ -1243,35 +1295,31 @@ FramesData::FramesData (const Glib::ustring& fname, std::unique_ptr<RawMetaDataL
|
||||
FILE* f = g_fopen (fname.c_str (), "rb");
|
||||
|
||||
if (f) {
|
||||
const bool has_rml_exif_base = rml->exifBase >= 0;
|
||||
rtexif::ExifManager exifManager (f, std::move(rml), firstFrameOnly);
|
||||
|
||||
if (has_rml_exif_base) {
|
||||
if (exifManager.f && exifManager.rml) {
|
||||
if (exifManager.rml->exifBase >= 0) {
|
||||
exifManager.parseRaw ();
|
||||
|
||||
} else if (exifManager.rml->ciffBase >= 0) {
|
||||
exifManager.parseCIFF ();
|
||||
}
|
||||
}
|
||||
|
||||
// copying roots
|
||||
roots = exifManager.roots;
|
||||
|
||||
// creating FrameData
|
||||
for (auto currFrame : exifManager.frames) {
|
||||
frames.push_back(std::unique_ptr<FrameData>(new FrameData(currFrame, currFrame->getRoot(), roots.at(0))));
|
||||
}
|
||||
for (auto currRoot : roots) {
|
||||
rtexif::Tag* t = currRoot->getTag(0x83BB);
|
||||
|
||||
if (t && !iptc) {
|
||||
iptc = iptc_data_new_from_data ((unsigned char*)t->getValue (), (unsigned)t->getValueSize ());
|
||||
break;
|
||||
}
|
||||
if (exifManager.f && exifManager.rml) {
|
||||
if (exifManager.rml->exifBase >= 0) {
|
||||
exifManager.parseRaw ();
|
||||
} else if (exifManager.rml->ciffBase >= 0) {
|
||||
exifManager.parseCIFF ();
|
||||
}
|
||||
}
|
||||
|
||||
// copying roots
|
||||
roots = exifManager.roots;
|
||||
|
||||
// creating FrameData
|
||||
for (auto currFrame : exifManager.frames) {
|
||||
frames.push_back(std::unique_ptr<FrameData>(new FrameData(currFrame, currFrame->getRoot(), roots.at(0))));
|
||||
}
|
||||
for (auto currRoot : roots) {
|
||||
rtexif::Tag* t = currRoot->getTag(0x83BB);
|
||||
|
||||
if (t && !iptc) {
|
||||
iptc = iptc_data_new_from_data ((unsigned char*)t->getValue (), (unsigned)t->getValueSize ());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
}
|
||||
} else if (hasJpegExtension(fname)) {
|
||||
|
Reference in New Issue
Block a user