support rating tag from EXIF/XMP
This commit is contained in:
@@ -71,7 +71,7 @@ FramesMetaData* FramesMetaData::fromFile (const Glib::ustring& fname, std::uniqu
|
||||
|
||||
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"),
|
||||
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));
|
||||
@@ -97,6 +97,7 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
serial.clear();
|
||||
orientation.clear();
|
||||
lens.clear();
|
||||
rating = 0;
|
||||
|
||||
tag = newFrameRootDir->findTag("Make");
|
||||
if (!tag) {
|
||||
@@ -187,6 +188,11 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
||||
orientation = tag->valueToString ();
|
||||
}
|
||||
|
||||
tag = newFrameRootDir->findTagUpward("Rating");
|
||||
if (tag) {
|
||||
rating = tag->toInt();
|
||||
}
|
||||
|
||||
tag = newFrameRootDir->findTagUpward("MakerNote");
|
||||
rtexif::TagDirectory* mnote = nullptr;
|
||||
if (tag) {
|
||||
@@ -876,6 +882,11 @@ std::string FrameData::getOrientation () const
|
||||
return orientation;
|
||||
}
|
||||
|
||||
int FrameData::getRating () const
|
||||
{
|
||||
return rating;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FramesData::setDCRawFrameCount (unsigned int frameCount)
|
||||
@@ -1168,6 +1179,10 @@ std::string FramesData::getOrientation(unsigned int frame) const
|
||||
}
|
||||
);
|
||||
}
|
||||
int FramesData::getRating (unsigned int frame) const
|
||||
{
|
||||
return frames.empty() || frame >= frames.size() ? 0 : frames.at(frame)->getRating ();
|
||||
}
|
||||
|
||||
|
||||
//------inherited functions--------------//
|
||||
|
||||
@@ -49,6 +49,7 @@ protected:
|
||||
std::string make, model, serial;
|
||||
std::string orientation;
|
||||
std::string lens;
|
||||
int rating;
|
||||
IIOSampleFormat sampleFormat;
|
||||
|
||||
// each frame has the knowledge of "being an"
|
||||
@@ -84,6 +85,7 @@ public:
|
||||
std::string getLens () const;
|
||||
std::string getSerialNumber () const;
|
||||
std::string getOrientation () const;
|
||||
int getRating () const;
|
||||
};
|
||||
|
||||
class FramesData : public FramesMetaData {
|
||||
@@ -125,7 +127,8 @@ public:
|
||||
std::string getModel (unsigned int frame = 0) const override;
|
||||
std::string getLens (unsigned int frame = 0) const override;
|
||||
std::string getSerialNumber (unsigned int frame = 0) const;
|
||||
std::string getOrientation (unsigned int frame = 0) const override;
|
||||
std::string getOrientation (unsigned int frame = 0) const;
|
||||
int getRating (unsigned int frame = 0) const override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -133,6 +133,8 @@ public:
|
||||
virtual std::string getLens (unsigned int frame = 0) const = 0;
|
||||
/** @return the orientation of the image */
|
||||
virtual std::string getOrientation (unsigned int frame = 0) const = 0;
|
||||
/** @return the rating of the image */
|
||||
virtual int getRating (unsigned int frame = 0) const = 0;
|
||||
|
||||
/** @return true if the file is a PixelShift shot (Pentax and Sony bodies) */
|
||||
virtual bool getPixelShift () const = 0;
|
||||
|
||||
Reference in New Issue
Block a user