add ExposureProgram, LightSource and SubjectArea tags

This commit is contained in:
cDc
2017-07-17 13:41:10 +03:00
parent 4504e8b66c
commit 725c623d11
2 changed files with 97 additions and 12 deletions

View File

@@ -148,6 +148,8 @@ public:
uint32_t GetData() const { return parse32(buf + offs + 8, alignIntel); }
uint32_t GetSubIFD() const { return tiff_header_start + GetData(); }
bool IsShort() const { return format == 3; }
bool IsLong() const { return format == 4; }
bool IsRational() const { return format == 5 || format == 10; }
bool Fetch(std::string& val) const {
@@ -163,13 +165,19 @@ public:
return true;
}
bool Fetch(uint16_t& val) const {
if (format != 3)
if (!IsShort())
return false;
val = parse16(buf + offs + 8, alignIntel);
return true;
}
bool Fetch(uint16_t& val, uint32_t idx) const {
if (!IsShort() || length <= idx)
return false;
val = parse16(buf + GetSubIFD() + idx*2, alignIntel);
return true;
}
bool Fetch(uint32_t& val) const {
if (format != 4)
if (!IsLong())
return false;
val = parse32(buf + offs + 8, alignIntel);
return true;
@@ -528,6 +536,11 @@ int EXIFInfo::parseFromEXIFSegment(const uint8_t* buf, unsigned len) {
parser.Fetch(FNumber);
break;
case 0x8822:
// Exposure Program
parser.Fetch(ExposureProgram);
break;
case 0x8827:
// ISO Speed Rating
parser.Fetch(ISOSpeedRatings);
@@ -568,8 +581,18 @@ int EXIFInfo::parseFromEXIFSegment(const uint8_t* buf, unsigned len) {
parser.Fetch(SubjectDistance);
break;
case 0x9207:
// Metering mode
parser.Fetch(MeteringMode);
break;
case 0x9208:
// Light source
parser.Fetch(LightSource);
break;
case 0x9209:
// Flash used
// Flash info
parser.Fetch(Flash);
break;
@@ -578,9 +601,13 @@ int EXIFInfo::parseFromEXIFSegment(const uint8_t* buf, unsigned len) {
parser.Fetch(FocalLength);
break;
case 0x9207:
// Metering mode
parser.Fetch(MeteringMode);
case 0x9214:
// Subject area
if (parser.IsShort() && parser.GetLength() > 1) {
SubjectArea.resize(parser.GetLength());
for (uint32_t i=0; i<parser.GetLength(); ++i)
parser.Fetch(SubjectArea[i], i);
}
break;
case 0x9291:
@@ -883,6 +910,7 @@ void EXIFInfo::clear() {
BitsPerSample = 0;
ExposureTime = 0;
FNumber = 0;
ExposureProgram = 0;
ISOSpeedRatings = 0;
ShutterSpeedValue = 0;
ApertureValue = 0;
@@ -892,7 +920,9 @@ void EXIFInfo::clear() {
FocalLength = 0;
Flash = 0;
MeteringMode = 0;
LightSource = 0;
ProjectionType = 0;
SubjectArea.clear();
// LensInfo
LensInfo.FocalLengthMax = 0;