support rating tag from EXIF/XMP
This commit is contained in:
parent
351f8f4e12
commit
105517c561
@ -71,7 +71,7 @@ FramesMetaData* FramesMetaData::fromFile (const Glib::ustring& fname, std::uniqu
|
|||||||
|
|
||||||
FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* rootDir, rtexif::TagDirectory* firstRootDir)
|
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),
|
: 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)
|
sampleFormat(IIOSF_UNKNOWN), isPixelShift(false), isHDR(false)
|
||||||
{
|
{
|
||||||
memset (&time, 0, sizeof(time));
|
memset (&time, 0, sizeof(time));
|
||||||
@ -97,6 +97,7 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
|||||||
serial.clear();
|
serial.clear();
|
||||||
orientation.clear();
|
orientation.clear();
|
||||||
lens.clear();
|
lens.clear();
|
||||||
|
rating = 0;
|
||||||
|
|
||||||
tag = newFrameRootDir->findTag("Make");
|
tag = newFrameRootDir->findTag("Make");
|
||||||
if (!tag) {
|
if (!tag) {
|
||||||
@ -187,6 +188,11 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
|||||||
orientation = tag->valueToString ();
|
orientation = tag->valueToString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tag = newFrameRootDir->findTagUpward("Rating");
|
||||||
|
if (tag) {
|
||||||
|
rating = tag->toInt();
|
||||||
|
}
|
||||||
|
|
||||||
tag = newFrameRootDir->findTagUpward("MakerNote");
|
tag = newFrameRootDir->findTagUpward("MakerNote");
|
||||||
rtexif::TagDirectory* mnote = nullptr;
|
rtexif::TagDirectory* mnote = nullptr;
|
||||||
if (tag) {
|
if (tag) {
|
||||||
@ -876,6 +882,11 @@ std::string FrameData::getOrientation () const
|
|||||||
return orientation;
|
return orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FrameData::getRating () const
|
||||||
|
{
|
||||||
|
return rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FramesData::setDCRawFrameCount (unsigned int frameCount)
|
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--------------//
|
//------inherited functions--------------//
|
||||||
|
@ -49,6 +49,7 @@ protected:
|
|||||||
std::string make, model, serial;
|
std::string make, model, serial;
|
||||||
std::string orientation;
|
std::string orientation;
|
||||||
std::string lens;
|
std::string lens;
|
||||||
|
int rating;
|
||||||
IIOSampleFormat sampleFormat;
|
IIOSampleFormat sampleFormat;
|
||||||
|
|
||||||
// each frame has the knowledge of "being an"
|
// each frame has the knowledge of "being an"
|
||||||
@ -84,6 +85,7 @@ public:
|
|||||||
std::string getLens () const;
|
std::string getLens () const;
|
||||||
std::string getSerialNumber () const;
|
std::string getSerialNumber () const;
|
||||||
std::string getOrientation () const;
|
std::string getOrientation () const;
|
||||||
|
int getRating () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FramesData : public FramesMetaData {
|
class FramesData : public FramesMetaData {
|
||||||
@ -125,7 +127,8 @@ public:
|
|||||||
std::string getModel (unsigned int frame = 0) const override;
|
std::string getModel (unsigned int frame = 0) const override;
|
||||||
std::string getLens (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 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;
|
virtual std::string getLens (unsigned int frame = 0) const = 0;
|
||||||
/** @return the orientation of the image */
|
/** @return the orientation of the image */
|
||||||
virtual std::string getOrientation (unsigned int frame = 0) const = 0;
|
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) */
|
/** @return true if the file is a PixelShift shot (Pentax and Sony bodies) */
|
||||||
virtual bool getPixelShift () const = 0;
|
virtual bool getPixelShift () const = 0;
|
||||||
|
@ -3037,6 +3037,12 @@ void ExifManager::parse (bool isRaw, bool skipIgnored)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!root->getTag ("Rating")) {
|
||||||
|
Tag *t = new Tag (root, root->getAttrib("Rating"));
|
||||||
|
t->initInt (0, LONG);
|
||||||
|
root->addTag (t);
|
||||||
|
}
|
||||||
|
|
||||||
// --- detecting image root IFD based on SubFileType, or if not provided, on PhotometricInterpretation
|
// --- detecting image root IFD based on SubFileType, or if not provided, on PhotometricInterpretation
|
||||||
|
|
||||||
bool frameRootDetected = false;
|
bool frameRootDetected = false;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
CacheImageData::CacheImageData ()
|
CacheImageData::CacheImageData ()
|
||||||
: md5(""), supported(false), format(FT_Invalid), rankOld(-1), inTrashOld(false), recentlySaved(false),
|
: md5(""), supported(false), format(FT_Invalid), rankOld(-1), inTrashOld(false), recentlySaved(false),
|
||||||
timeValid(false), year(0), month(0), day(0), hour(0), min(0), sec(0), exifValid(false), frameCount(1),
|
timeValid(false), year(0), month(0), day(0), hour(0), min(0), sec(0), exifValid(false), frameCount(1),
|
||||||
fnumber(0.0), shutter(0.0), focalLen(0.0), focalLen35mm(0.0), focusDist(0.f), iso(0), isHDR (false),
|
fnumber(0.0), shutter(0.0), focalLen(0.0), focalLen35mm(0.0), focusDist(0.f), iso(0), rating(0), isHDR (false),
|
||||||
isPixelShift (false), sensortype(rtengine::ST_NONE), sampleFormat(rtengine::IIOSF_UNKNOWN),
|
isPixelShift (false), sensortype(rtengine::ST_NONE), sampleFormat(rtengine::IIOSF_UNKNOWN),
|
||||||
redAWBMul(-1.0), greenAWBMul(-1.0), blueAWBMul(-1.0), rotate(0), thumbImgType(0)
|
redAWBMul(-1.0), greenAWBMul(-1.0), blueAWBMul(-1.0), rotate(0), thumbImgType(0)
|
||||||
{
|
{
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
double focalLen, focalLen35mm;
|
double focalLen, focalLen35mm;
|
||||||
float focusDist;
|
float focusDist;
|
||||||
unsigned iso;
|
unsigned iso;
|
||||||
|
int rating;
|
||||||
bool isHDR;
|
bool isHDR;
|
||||||
bool isPixelShift;
|
bool isPixelShift;
|
||||||
int sensortype;
|
int sensortype;
|
||||||
@ -108,6 +109,7 @@ public:
|
|||||||
std::string getModel (unsigned int frame = 0) const override { return camModel; }
|
std::string getModel (unsigned int frame = 0) const override { return camModel; }
|
||||||
std::string getLens (unsigned int frame = 0) const override { return lens; }
|
std::string getLens (unsigned int frame = 0) const override { return lens; }
|
||||||
std::string getOrientation (unsigned int frame = 0) const override { return ""; } // TODO
|
std::string getOrientation (unsigned int frame = 0) const override { return ""; } // TODO
|
||||||
|
int getRating (unsigned int frame = 0) const override { return rating; } // FIXME-piotr : missing rating
|
||||||
bool getPixelShift () const override { return isPixelShift; }
|
bool getPixelShift () const override { return isPixelShift; }
|
||||||
bool getHDR (unsigned int frame = 0) const override { return isHDR; }
|
bool getHDR (unsigned int frame = 0) const override { return isHDR; }
|
||||||
std::string getImageType (unsigned int frame) const override { return isPixelShift ? "PS" : isHDR ? "HDR" : "STD"; }
|
std::string getImageType (unsigned int frame) const override { return isPixelShift ? "PS" : isHDR ? "HDR" : "STD"; }
|
||||||
|
@ -813,6 +813,7 @@ int Thumbnail::infoFromImage (const Glib::ustring& fname, std::unique_ptr<rtengi
|
|||||||
cfs.lens = idata->getLens();
|
cfs.lens = idata->getLens();
|
||||||
cfs.camMake = idata->getMake();
|
cfs.camMake = idata->getMake();
|
||||||
cfs.camModel = idata->getModel();
|
cfs.camModel = idata->getModel();
|
||||||
|
cfs.rating = idata->getRating();
|
||||||
|
|
||||||
if (idata->getOrientation() == "Rotate 90 CW") {
|
if (idata->getOrientation() == "Rotate 90 CW") {
|
||||||
deg = 90;
|
deg = 90;
|
||||||
|
@ -164,7 +164,10 @@ public:
|
|||||||
return cfs.md5;
|
return cfs.md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRank () const;
|
int getRank () const
|
||||||
|
{
|
||||||
|
return cfs.rating;
|
||||||
|
}
|
||||||
void setRank (int rank);
|
void setRank (int rank);
|
||||||
|
|
||||||
int getColorLabel () const;
|
int getColorLabel () const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user