Reordered and updated canon EXIF

This commit is contained in:
ffsup2
2010-12-18 12:41:24 +01:00
parent 8c90df8cc1
commit a37bd7dd1f
3 changed files with 952 additions and 507 deletions

View File

@@ -219,39 +219,23 @@ void ImageData::extractInfo () {
} }
} }
else if (mnote && !make.compare (0, 5, "Canon")) { else if (mnote && !make.compare (0, 5, "Canon")) {
bool lensOk = false; int found=false;
if (mnote->getTag ("LensType")) { // canon EXIF have a string for lens model
std::string ldata = mnote->getTag ("LensType")->valueToString (); rtexif::Tag *lt = mnote->getTag("LensType");
if ( lt ) {
std::string ldata = lt->valueToString ();
if (ldata.size()>1) { if (ldata.size()>1) {
lens = ldata; found=true;
lensOk = true; lens = "Canon " + ldata;
} }
} }
if (!lensOk && mnote->getTag ("CanonCameraSettings")) { if( !found ){
std::string ccs = mnote->getTag ("CanonCameraSettings")->valueToString (); lt = mnote->findTag("LensID");
int i = ccs.find ("LongFocal = "); if ( lt ) {
double a = 0; std::string ldata = lt->valueToString ();
if (i!=ccs.npos) { if (ldata.size()>1) {
i += 12; lens = ldata;
int j = i; }
while (j!=ccs.npos && ccs[j]!='\n' && ccs[j]!=' ') j++;
a = atof (ccs.substr (i, j-i).c_str());
}
i = ccs.find ("ShortFocal = ");
double b = 0;
if (i!=ccs.npos) {
i += 13;
int j = i;
while (j!=ccs.npos && ccs[j]!='\n' && ccs[j]!=' ') j++;
b = atof (ccs.substr (i, j-i).c_str());
}
if (a>0 && b>0) {
std::ostringstream str;
if (a==b)
str << "Unknown " << a << "mm";
else
str << "Unknown " << b << "-" << a << "mm";
lens = str.str();
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -580,6 +580,30 @@ Tag::Tag (TagDirectory* p, FILE* f, int base)
default: default:
goto defsubdirs; goto defsubdirs;
} }
}else if (!strncmp(make, "Canon", 5)) {
switch( tag ){
case 0x0001:
case 0x0002:
case 0x0004:
case 0x0005:
case 0x0093:
case 0x0098:
case 0x00a0:
directory = new TagDirectory*[2];
directory[1] = NULL;
directory[0] = new TagDirectoryTable (parent, f, valuesize,0,SSHORT , attrib->subdirAttribs, getOrder());
makerNoteKind = TABLESUBDIR;
break;
case 0x009a:
case 0x4013:
directory = new TagDirectory*[2];
directory[1] = NULL;
directory[0] = new TagDirectoryTable (parent, f, valuesize,0,LONG , attrib->subdirAttribs, getOrder());
makerNoteKind = TABLESUBDIR;
break;
default:
goto defsubdirs;
}
}else if(type==UNDEFINED){ }else if(type==UNDEFINED){
count = 1; count = 1;
type = LONG; type = LONG;