Resolve exiv2 merge conflicts and merge with
This commit is contained in:
@@ -35,14 +35,80 @@
|
||||
#include "../rtengine/dynamicprofile.h"
|
||||
#include "../rtengine/profilestore.h"
|
||||
#include "../rtengine/settings.h"
|
||||
#include "../rtexif/rtexif.h"
|
||||
#include "guiutils.h"
|
||||
#include "batchqueue.h"
|
||||
#include "extprog.h"
|
||||
#include "md5helper.h"
|
||||
#include "pathutils.h"
|
||||
#include "paramsedited.h"
|
||||
|
||||
#include "procparamchangers.h"
|
||||
#include "profilestorecombobox.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "../rtengine/dynamicprofile.h"
|
||||
#include "../rtengine/imagedata.h"
|
||||
#include "../rtengine/mytime.h"
|
||||
#include "../rtengine/procparams.h"
|
||||
|
||||
namespace {
|
||||
|
||||
bool CPBDump(
|
||||
const Glib::ustring& commFName,
|
||||
const Glib::ustring& imageFName,
|
||||
const Glib::ustring& profileFName,
|
||||
const Glib::ustring& defaultPParams,
|
||||
const CacheImageData* cfs,
|
||||
bool flagMode
|
||||
)
|
||||
{
|
||||
const std::unique_ptr<Glib::KeyFile> kf(new Glib::KeyFile);
|
||||
|
||||
if (!kf) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// open the file in write mode
|
||||
const std::unique_ptr<FILE, decltype(&std::fclose)> f(g_fopen(commFName.c_str (), "wt"), &std::fclose);
|
||||
|
||||
if (!f) {
|
||||
printf ("CPBDump(\"%s\") >>> Error: unable to open file with write access!\n", commFName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
kf->set_string ("RT General", "CachePath", options.cacheBaseDir);
|
||||
kf->set_string ("RT General", "AppVersion", RTVERSION);
|
||||
kf->set_integer ("RT General", "ProcParamsVersion", PPVERSION);
|
||||
kf->set_string ("RT General", "ImageFileName", imageFName);
|
||||
kf->set_string ("RT General", "OutputProfileFileName", profileFName);
|
||||
kf->set_string ("RT General", "DefaultProcParams", defaultPParams);
|
||||
kf->set_boolean ("RT General", "FlaggingMode", flagMode);
|
||||
|
||||
kf->set_integer ("Common Data", "FrameCount", cfs->frameCount);
|
||||
kf->set_integer ("Common Data", "SampleFormat", cfs->sampleFormat);
|
||||
kf->set_boolean ("Common Data", "IsHDR", cfs->isHDR);
|
||||
kf->set_boolean ("Common Data", "IsPixelShift", cfs->isPixelShift);
|
||||
kf->set_double ("Common Data", "FNumber", cfs->fnumber);
|
||||
kf->set_double ("Common Data", "Shutter", cfs->shutter);
|
||||
kf->set_double ("Common Data", "FocalLength", cfs->focalLen);
|
||||
kf->set_integer ("Common Data", "ISO", cfs->iso);
|
||||
kf->set_string ("Common Data", "Lens", cfs->lens);
|
||||
kf->set_string ("Common Data", "Make", cfs->camMake);
|
||||
kf->set_string ("Common Data", "Model", cfs->camModel);
|
||||
|
||||
} catch (const Glib::KeyFileError&) {
|
||||
}
|
||||
|
||||
try {
|
||||
fprintf (f.get(), "%s", kf->to_data().c_str());
|
||||
} catch (const Glib::KeyFileError&) {
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
@@ -162,24 +228,23 @@ void Thumbnail::_generateThumbnailImage ()
|
||||
// image out of the RAW. Mark as "quick".
|
||||
// 2. if we don't find that then just grab the real image.
|
||||
bool quick = false;
|
||||
rtengine::RawMetaDataLocation ri;
|
||||
|
||||
rtengine::eSensorType sensorType = rtengine::ST_NONE;
|
||||
if ( initial_ && options.internalThumbIfUntouched) {
|
||||
quick = true;
|
||||
tpp = rtengine::Thumbnail::loadQuickFromRaw (fname, ri, sensorType, tw, th, 1, TRUE);
|
||||
tpp = rtengine::Thumbnail::loadQuickFromRaw (fname, sensorType, tw, th, 1, TRUE);
|
||||
}
|
||||
|
||||
if ( tpp == nullptr ) {
|
||||
quick = false;
|
||||
tpp = rtengine::Thumbnail::loadFromRaw (fname, ri, sensorType, tw, th, 1, pparams->wb.equal, TRUE);
|
||||
tpp = rtengine::Thumbnail::loadFromRaw (fname, sensorType, tw, th, 1, pparams->wb.equal, TRUE);
|
||||
}
|
||||
|
||||
cfs.sensortype = sensorType;
|
||||
if (tpp) {
|
||||
cfs.format = FT_Raw;
|
||||
cfs.thumbImgType = quick ? CacheImageData::QUICK_THUMBNAIL : CacheImageData::FULL_THUMBNAIL;
|
||||
infoFromImage (fname, std::unique_ptr<rtengine::RawMetaDataLocation>(new rtengine::RawMetaDataLocation(ri)));
|
||||
infoFromImage (fname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +305,6 @@ const ProcParams& Thumbnail::getProcParamsU ()
|
||||
*/
|
||||
rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool returnParams, bool force, bool flaggingMode)
|
||||
{
|
||||
|
||||
// try to load the last saved parameters from the cache or from the paramfile file
|
||||
ProcParams* ldprof = nullptr;
|
||||
|
||||
@@ -258,52 +322,35 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
|
||||
|
||||
if (!run_cpb) {
|
||||
if (defProf == DEFPROFILE_DYNAMIC && create && cfs && cfs->exifValid) {
|
||||
rtengine::FramesMetaData* imageMetaData;
|
||||
if (getType() == FT_Raw) {
|
||||
// Should we ask all frame's MetaData ?
|
||||
imageMetaData = rtengine::FramesMetaData::fromFile (fname, std::unique_ptr<rtengine::RawMetaDataLocation>(new rtengine::RawMetaDataLocation(rtengine::Thumbnail::loadMetaDataFromRaw(fname))), true);
|
||||
} else {
|
||||
// Should we ask all frame's MetaData ?
|
||||
imageMetaData = rtengine::FramesMetaData::fromFile (fname, nullptr, true);
|
||||
}
|
||||
PartialProfile *pp = ProfileStore::getInstance()->loadDynamicProfile(imageMetaData);
|
||||
delete imageMetaData;
|
||||
int err = pp->pparams->save(outFName);
|
||||
pp->deleteInstance();
|
||||
delete pp;
|
||||
if (!err) {
|
||||
const auto pp_deleter =
|
||||
[](PartialProfile* pp)
|
||||
{
|
||||
pp->deleteInstance();
|
||||
delete pp;
|
||||
};
|
||||
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())
|
||||
: nullptr,
|
||||
pp_deleter
|
||||
);
|
||||
if (pp && !pp->pparams->save(outFName)) {
|
||||
loadProcParams();
|
||||
}
|
||||
} else if (create && defProf != DEFPROFILE_DYNAMIC) {
|
||||
const PartialProfile *p = ProfileStore::getInstance()->getProfile(defProf);
|
||||
const PartialProfile* const p = ProfileStore::getInstance()->getProfile(defProf);
|
||||
if (p && !p->pparams->save(outFName)) {
|
||||
loadProcParams();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// First generate the communication file, with general values and EXIF metadata
|
||||
rtengine::FramesMetaData* imageMetaData;
|
||||
|
||||
if (getType() == FT_Raw) {
|
||||
// Should we ask all frame's MetaData ?
|
||||
imageMetaData = rtengine::FramesMetaData::fromFile (fname, std::unique_ptr<rtengine::RawMetaDataLocation>(new rtengine::RawMetaDataLocation(rtengine::Thumbnail::loadMetaDataFromRaw(fname))), true);
|
||||
} else {
|
||||
// Should we ask all frame's MetaData ?
|
||||
imageMetaData = rtengine::FramesMetaData::fromFile (fname, nullptr, true);
|
||||
}
|
||||
|
||||
static int index = 0; // Will act as unique identifier during the session
|
||||
Glib::ustring tmpFileName( Glib::build_filename(options.cacheBaseDir, Glib::ustring::compose("CPB_temp_%1.txt", index++)) );
|
||||
|
||||
const rtexif::TagDirectory* exifDir = nullptr;
|
||||
|
||||
if (imageMetaData && (exifDir = imageMetaData->getRootExifData())) {
|
||||
exifDir->CPBDump(tmpFileName, fname, outFName,
|
||||
defaultPparamsPath == DEFPROFILE_INTERNAL ? DEFPROFILE_INTERNAL : Glib::build_filename(defaultPparamsPath, Glib::path_get_basename(defProf) + paramFileExtension),
|
||||
cfs,
|
||||
flaggingMode);
|
||||
}
|
||||
delete imageMetaData;
|
||||
CPBDump(tmpFileName, fname, outFName,
|
||||
defaultPparamsPath == DEFPROFILE_INTERNAL ? DEFPROFILE_INTERNAL : Glib::build_filename(defaultPparamsPath, Glib::path_get_basename(defProf) + paramFileExtension), cfs, flaggingMode);
|
||||
|
||||
// For the filename etc. do NOT use streams, since they are not UTF8 safe
|
||||
Glib::ustring cmdLine = options.CPBPath + Glib::ustring(" \"") + tmpFileName + Glib::ustring("\"");
|
||||
@@ -781,9 +828,9 @@ ThFileType Thumbnail::getType ()
|
||||
return (ThFileType) cfs.format;
|
||||
}
|
||||
|
||||
int Thumbnail::infoFromImage (const Glib::ustring& fname, std::unique_ptr<rtengine::RawMetaDataLocation> rml)
|
||||
int Thumbnail::infoFromImage (const Glib::ustring& fname)
|
||||
{
|
||||
rtengine::FramesMetaData* idata = rtengine::FramesMetaData::fromFile (fname, std::move(rml));
|
||||
rtengine::FramesMetaData* idata = rtengine::FramesMetaData::fromFile (fname);
|
||||
|
||||
if (!idata) {
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user