merge with dev

This commit is contained in:
Desmis
2019-07-18 13:41:26 +02:00
52 changed files with 1853 additions and 463 deletions

View File

@@ -69,37 +69,40 @@ FramesMetaData* FramesMetaData::fromFile(const Glib::ustring& fname, std::unique
return new FramesData(fname, std::move(rml), firstFrameOnly);
}
FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* rootDir, rtexif::TagDirectory* firstRootDir)
: frameRootDir(frameRootDir_), iptc(nullptr), time(), timeStamp(), iso_speed(0), aperture(0.), focal_len(0.), focal_len35mm(0.), focus_dist(0.f),
shutter(0.), expcomp(0.), make("Unknown"), model("Unknown"), orientation("Unknown"), lens("Unknown"),
sampleFormat(IIOSF_UNKNOWN), isPixelShift(false), isHDR(false)
FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* rootDir, rtexif::TagDirectory* firstRootDir) :
frameRootDir(frameRootDir_),
iptc(nullptr),
time{},
timeStamp{},
iso_speed(0),
aperture(0.),
focal_len(0.),
focal_len35mm(0.),
focus_dist(0.f),
shutter(0.),
expcomp(0.),
make("Unknown"),
model("Unknown"),
orientation("Unknown"),
rating(0),
lens("Unknown"),
sampleFormat(IIOSF_UNKNOWN),
isPixelShift(false),
isHDR(false)
{
memset(&time, 0, sizeof(time));
if (!frameRootDir) {
return;
}
rtexif::Tag* tag;
rtexif::TagDirectory* newFrameRootDir = frameRootDir;
memset(&time, 0, sizeof(time));
timeStamp = 0;
iso_speed = 0;
aperture = 0.0;
focal_len = 0.0;
focal_len35mm = 0.0;
focus_dist = 0.0f;
shutter = 0.0;
expcomp = 0.0;
make.clear();
model.clear();
serial.clear();
orientation.clear();
lens.clear();
tag = newFrameRootDir->findTag("Make");
rtexif::TagDirectory* newFrameRootDir = frameRootDir;
rtexif::Tag* tag = newFrameRootDir->findTag("Make");
if (!tag) {
newFrameRootDir = rootDir;
tag = newFrameRootDir->findTag("Make");
@@ -193,6 +196,23 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
orientation = tag->valueToString();
}
// Look for Rating metadata in the following order:
// 1. EXIF
// 2. XMP
// 3. pp3 sidecar file
tag = newFrameRootDir->findTagUpward("Rating");
if (tag && tag->toInt() != 0) {
rating = tag->toInt();
}
char sXMPRating[64];
if (newFrameRootDir->getXMPTagValue("xmp:Rating", sXMPRating)) {
// Guard against out-of-range values (<0, >5)
rating = rtengine::max(0, rtengine::min(5, atoi(sXMPRating)));
// Currently, Rating=-1 is not supported. A value of -1 should mean
// "Rejected" according to the specification. Maybe in the future, Rating=-1
// sets InTrash=true?
}
tag = newFrameRootDir->findTagUpward("MakerNote");
rtexif::TagDirectory* mnote = nullptr;
@@ -892,6 +912,11 @@ std::string FrameData::getOrientation() const
return orientation;
}
int FrameData::getRating () const
{
return rating;
}
void FramesData::setDCRawFrameCount(unsigned int frameCount)
@@ -1190,10 +1215,20 @@ std::string FramesData::getOrientation(unsigned int frame) const
);
}
int FramesData::getRating(unsigned int frame) const
{
return getFromFrame<int>(
frames,
frame,
[](const FrameData& frame_data)
{
return frame_data.getRating();
}
);
}
//------inherited functions--------------//
std::string FramesMetaData::apertureToString(double aperture)
{