From d89364fcc0adf2734fa12c5559745e5e65b0a534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Sun, 10 Mar 2019 11:40:05 +0100 Subject: [PATCH] Fix Exif parsing for old Canons (ported by @Beep6581, fixes #4843) --- rtengine/imagedata.cc | 48 ++++++++++++++++++++----------------------- rtexif/rtexif.cc | 1 + 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index d47bcccb4..bb43acd67 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -1293,35 +1293,31 @@ FramesData::FramesData (const Glib::ustring& fname, std::unique_ptrexifBase >= 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(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(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)) { diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index f8ec3e5db..82f5e5525 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -2116,6 +2116,7 @@ void ExifManager::parseCIFF () } parseCIFF (rml->ciffLength, root); root->sort (); + parse(true); } Tag* ExifManager::saveCIFFMNTag (TagDirectory* root, int len, const char* name)