Merge branch 'dev' into metadata-exiv2
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "../rtengine/procparams.h"
|
||||
#include "../rtengine/rtthumbnail.h"
|
||||
#include <glib/gstdio.h>
|
||||
#include <glibmm/timezone.h>
|
||||
|
||||
#include "../rtengine/dynamicprofile.h"
|
||||
#include "../rtengine/metadata.h"
|
||||
@@ -259,7 +260,7 @@ void Thumbnail::_generateThumbnailImage ()
|
||||
}
|
||||
}
|
||||
|
||||
bool Thumbnail::isSupported ()
|
||||
bool Thumbnail::isSupported () const
|
||||
{
|
||||
return cfs.supported;
|
||||
}
|
||||
@@ -331,7 +332,7 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
|
||||
const std::unique_ptr<const rtengine::FramesMetaData> imageMetaData(rtengine::FramesMetaData::fromFile(fname));
|
||||
const std::unique_ptr<PartialProfile, decltype(pp_deleter)> pp(
|
||||
imageMetaData
|
||||
? ProfileStore::getInstance()->loadDynamicProfile(imageMetaData.get())
|
||||
? ProfileStore::getInstance()->loadDynamicProfile(imageMetaData.get(), fname)
|
||||
: nullptr,
|
||||
pp_deleter
|
||||
);
|
||||
@@ -702,7 +703,7 @@ void Thumbnail::getFinalSize (const rtengine::procparams::ProcParams& pparams, i
|
||||
}
|
||||
}
|
||||
|
||||
void Thumbnail::getOriginalSize (int& w, int& h)
|
||||
void Thumbnail::getOriginalSize (int& w, int& h) const
|
||||
{
|
||||
w = tw;
|
||||
h = th;
|
||||
@@ -765,11 +766,44 @@ rtengine::IImage8* Thumbnail::upgradeThumbImage (const rtengine::procparams::Pro
|
||||
|
||||
void Thumbnail::generateExifDateTimeStrings ()
|
||||
{
|
||||
if (cfs.timeValid) {
|
||||
std::string dateFormat = options.dateFormat;
|
||||
std::ostringstream ostr;
|
||||
bool spec = false;
|
||||
|
||||
exifString = "";
|
||||
dateTimeString = "";
|
||||
for (size_t i = 0; i < dateFormat.size(); i++)
|
||||
if (spec && dateFormat[i] == 'y') {
|
||||
ostr << cfs.year;
|
||||
spec = false;
|
||||
} else if (spec && dateFormat[i] == 'm') {
|
||||
ostr << (int)cfs.month;
|
||||
spec = false;
|
||||
} else if (spec && dateFormat[i] == 'd') {
|
||||
ostr << (int)cfs.day;
|
||||
spec = false;
|
||||
} else if (dateFormat[i] == '%') {
|
||||
spec = true;
|
||||
} else {
|
||||
ostr << (char)dateFormat[i];
|
||||
spec = false;
|
||||
}
|
||||
|
||||
ostr << " " << (int)cfs.hour;
|
||||
ostr << ":" << std::setw(2) << std::setfill('0') << (int)cfs.min;
|
||||
ostr << ":" << std::setw(2) << std::setfill('0') << (int)cfs.sec;
|
||||
|
||||
dateTimeString = ostr.str ();
|
||||
dateTime = Glib::DateTime::create_local(cfs.year, cfs.month, cfs.day,
|
||||
cfs.hour, cfs.min, cfs.sec);
|
||||
}
|
||||
|
||||
if (!dateTime.gobj() || !cfs.timeValid) {
|
||||
dateTimeString = "";
|
||||
dateTime = Glib::DateTime::create_now_utc(0);
|
||||
}
|
||||
|
||||
if (!cfs.exifValid) {
|
||||
exifString = "";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -778,33 +812,6 @@ void Thumbnail::generateExifDateTimeStrings ()
|
||||
if (options.fbShowExpComp && cfs.expcomp != "0.00" && !cfs.expcomp.empty()) { // don't show exposure compensation if it is 0.00EV;old cache files do not have ExpComp, so value will not be displayed.
|
||||
exifString = Glib::ustring::compose ("%1 %2EV", exifString, cfs.expcomp); // append exposure compensation to exifString
|
||||
}
|
||||
|
||||
std::string dateFormat = options.dateFormat;
|
||||
std::ostringstream ostr;
|
||||
bool spec = false;
|
||||
|
||||
for (size_t i = 0; i < dateFormat.size(); i++)
|
||||
if (spec && dateFormat[i] == 'y') {
|
||||
ostr << cfs.year;
|
||||
spec = false;
|
||||
} else if (spec && dateFormat[i] == 'm') {
|
||||
ostr << (int)cfs.month;
|
||||
spec = false;
|
||||
} else if (spec && dateFormat[i] == 'd') {
|
||||
ostr << (int)cfs.day;
|
||||
spec = false;
|
||||
} else if (dateFormat[i] == '%') {
|
||||
spec = true;
|
||||
} else {
|
||||
ostr << (char)dateFormat[i];
|
||||
spec = false;
|
||||
}
|
||||
|
||||
ostr << " " << (int)cfs.hour;
|
||||
ostr << ":" << std::setw(2) << std::setfill('0') << (int)cfs.min;
|
||||
ostr << ":" << std::setw(2) << std::setfill('0') << (int)cfs.sec;
|
||||
|
||||
dateTimeString = ostr.str ();
|
||||
}
|
||||
|
||||
const Glib::ustring& Thumbnail::getExifString () const
|
||||
@@ -819,6 +826,12 @@ const Glib::ustring& Thumbnail::getDateTimeString () const
|
||||
return dateTimeString;
|
||||
}
|
||||
|
||||
const Glib::DateTime& Thumbnail::getDateTime () const
|
||||
{
|
||||
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
void Thumbnail::getAutoWB (double& temp, double& green, double equal, double tempBias)
|
||||
{
|
||||
if (cfs.redAWBMul != -1.0) {
|
||||
@@ -831,7 +844,7 @@ void Thumbnail::getAutoWB (double& temp, double& green, double equal, double tem
|
||||
}
|
||||
|
||||
|
||||
ThFileType Thumbnail::getType ()
|
||||
ThFileType Thumbnail::getType () const
|
||||
{
|
||||
|
||||
return (ThFileType) cfs.format;
|
||||
@@ -849,6 +862,16 @@ int Thumbnail::infoFromImage (const Glib::ustring& fname)
|
||||
cfs.timeValid = false;
|
||||
cfs.exifValid = false;
|
||||
|
||||
if (idata->getDateTimeAsTS() > 0) {
|
||||
cfs.year = 1900 + idata->getDateTime().tm_year;
|
||||
cfs.month = idata->getDateTime().tm_mon + 1;
|
||||
cfs.day = idata->getDateTime().tm_mday;
|
||||
cfs.hour = idata->getDateTime().tm_hour;
|
||||
cfs.min = idata->getDateTime().tm_min;
|
||||
cfs.sec = idata->getDateTime().tm_sec;
|
||||
cfs.timeValid = true;
|
||||
}
|
||||
|
||||
if (idata->hasExif()) {
|
||||
cfs.shutter = idata->getShutterSpeed ();
|
||||
cfs.fnumber = idata->getFNumber ();
|
||||
@@ -861,18 +884,11 @@ int Thumbnail::infoFromImage (const Glib::ustring& fname)
|
||||
cfs.isPixelShift = idata->getPixelShift ();
|
||||
cfs.frameCount = idata->getFrameCount ();
|
||||
cfs.sampleFormat = idata->getSampleFormat ();
|
||||
cfs.year = 1900 + idata->getDateTime().tm_year;
|
||||
cfs.month = idata->getDateTime().tm_mon + 1;
|
||||
cfs.day = idata->getDateTime().tm_mday;
|
||||
cfs.hour = idata->getDateTime().tm_hour;
|
||||
cfs.min = idata->getDateTime().tm_min;
|
||||
cfs.sec = idata->getDateTime().tm_sec;
|
||||
cfs.timeValid = true;
|
||||
cfs.exifValid = true;
|
||||
cfs.lens = idata->getLens();
|
||||
cfs.camMake = idata->getMake();
|
||||
cfs.camModel = idata->getModel();
|
||||
cfs.rating = idata->getRating();
|
||||
cfs.exifValid = true;
|
||||
|
||||
if (idata->getOrientation() == "Rotate 90 CW") {
|
||||
deg = 90;
|
||||
@@ -958,20 +974,6 @@ void Thumbnail::_loadThumbnail(bool firstTrial)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Read all thumbnail's data from the cache; build and save them if doesn't exist - MUTEX PROTECTED
|
||||
* This includes:
|
||||
* - image's bitmap (*.rtti)
|
||||
* - auto exposure's histogram (full thumbnail only)
|
||||
* - embedded profile (full thumbnail only)
|
||||
* - LiveThumbData section of the data file
|
||||
*/
|
||||
void Thumbnail::loadThumbnail (bool firstTrial)
|
||||
{
|
||||
MyMutex::MyLock lock(mutex);
|
||||
_loadThumbnail(firstTrial);
|
||||
}
|
||||
|
||||
/*
|
||||
* Save thumbnail's data to the cache - NON PROTECTED
|
||||
* This includes:
|
||||
@@ -1258,7 +1260,7 @@ void Thumbnail::applyAutoExp (rtengine::procparams::ProcParams& pparams)
|
||||
}
|
||||
}
|
||||
|
||||
const CacheImageData* Thumbnail::getCacheImageData()
|
||||
const CacheImageData* Thumbnail::getCacheImageData() const
|
||||
{
|
||||
return &cfs;
|
||||
}
|
||||
|
Reference in New Issue
Block a user