Author: akv
Date: 2010-01-20 21:38:29 +0100 (Wed, 20 Jan 2010)
New Revision: 3043

Modified:
   branches/rawstudio-ng-color/plugins/meta-tiff/tiff-meta.c
Log:
Fixed reading of LensSerialNumber from Olympus cameras. Some magic value is 
used - found by looking through several files and matching addresses - it works 
for all testfiles.

Modified: branches/rawstudio-ng-color/plugins/meta-tiff/tiff-meta.c
===================================================================
--- branches/rawstudio-ng-color/plugins/meta-tiff/tiff-meta.c   2010-01-20 
16:46:06 UTC (rev 3042)
+++ branches/rawstudio-ng-color/plugins/meta-tiff/tiff-meta.c   2010-01-20 
20:38:29 UTC (rev 3043)
@@ -805,6 +805,8 @@
        struct IFD ifd;
        gushort ushort_temp1;
        gchar *str = NULL;
+       guint temp;
+       gint total;
 
        if(!raw_get_ushort(rawfile, offset, &number_of_entries))
                return FALSE;
@@ -822,8 +824,18 @@
                switch(ifd.tag)
                {
                        case 0x0202: /* LensSerialNumber */
-                               /* FIXME: odd data at this address? */
-                               str = raw_strdup(rawfile, offset, 32);
+                               /* magic spot, but this is the address for 
serial number in all Olympus files where it's present */
+                               raw_get_ushort(rawfile, offset-4, 
&ushort_temp1);
+                               temp = offset+ushort_temp1-212;
+
+                               str = raw_strdup(rawfile, temp, 32);
+
+                               /* Make a number from the string we just got */
+                               gint i = 0;
+                               while(str[i])
+                                       total += str[i++];
+
+                               meta->lens_id = total;
                                break;
                        case 0x0205: /* MinApertureAtMinFocal */
                                raw_get_ushort(rawfile, offset-4, 
&ushort_temp1);


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to