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

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:
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){
count = 1;
type = LONG;