comparison src/format_canon.c @ 48:6948407f52a5

Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net> * bar_exif.c: Set a default size for the EXIF data column in the advanced view, and allow resizing of that column to allow more data to be visible when needed. * format_canon.c: Fix data type for Canon MakerNote Serial Number. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Fri, 03 Jun 2005 22:48:37 +0000
parents aa4c0e1b54b0
children ae627d150a6b
comparison
equal deleted inserted replaced
47:aa4c0e1b54b0 48:6948407f52a5
752 { 4, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings2", NULL, NULL }, 752 { 4, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings2", NULL, NULL },
753 { 6, EXIF_FORMAT_STRING, -1, "MkN.Canon.ImageType", "Image type", NULL }, 753 { 6, EXIF_FORMAT_STRING, -1, "MkN.Canon.ImageType", "Image type", NULL },
754 { 7, EXIF_FORMAT_STRING, -1, "MkN.Canon.FirmwareVersion", "Firmware version", NULL }, 754 { 7, EXIF_FORMAT_STRING, -1, "MkN.Canon.FirmwareVersion", "Firmware version", NULL },
755 { 8, EXIF_FORMAT_LONG_UNSIGNED, 1, "MkN.Canon.ImageNumber", "Image number", NULL }, 755 { 8, EXIF_FORMAT_LONG_UNSIGNED, 1, "MkN.Canon.ImageNumber", "Image number", NULL },
756 { 9, EXIF_FORMAT_STRING, -1, "MkN.Canon.OwnerName", "Owner name", NULL }, 756 { 9, EXIF_FORMAT_STRING, -1, "MkN.Canon.OwnerName", "Owner name", NULL },
757 { 12, EXIF_FORMAT_BYTE_UNSIGNED, -1, "MkN.Canon.SerialNumber", "Camera serial number", NULL }, 757 { 12, EXIF_FORMAT_LONG_UNSIGNED, -1, "MkN.Canon.SerialNumber", "Camera serial number", NULL },
758 { 15, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.CustomFunctions", NULL, NULL }, 758 { 15, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.CustomFunctions", NULL, NULL },
759 EXIF_MARKER_LIST_END 759 EXIF_MARKER_LIST_END
760 }; 760 };
761 761
762 static void canon_mknote_parse_settings(ExifData *exif, 762 static void canon_mknote_parse_settings(ExifData *exif,
783 783
784 #if 0 784 #if 0
785 static void canon_mknote_parse_convert(ExifData *exif) 785 static void canon_mknote_parse_convert(ExifData *exif)
786 { 786 {
787 gint value; 787 gint value;
788 ExifItem *result;
788 789
789 /* seems we need more than only this value for distance */ 790 /* seems we need more than only this value for distance */
790 if (exif_get_integer(exif, "MkN.Canon.SubjectDistance", &value)) 791 if (exif_get_integer(exif, "MkN.Canon.SubjectDistance", &value))
791 { 792 {
792 static ExifMarker marker= { 0x9206, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, 793 static ExifMarker marker= { 0x9206, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,
800 rational->den = 100; 801 rational->den = 100;
801 802
802 exif->items = g_list_prepend(exif->items, item); 803 exif->items = g_list_prepend(exif->items, item);
803 } 804 }
804 805
805 /* Serial Number untested */ 806 result = exif_get_item(exif, "MkN.Canon.SerialNumber");
806 if (exif_get_integer(exif, "MkN.Canon.SerialNumber", &value)) 807 if (result && result->format == EXIF_FORMAT_LONG_UNSIGNED && result->data_len == 4)
807 { 808 {
808 static ExifMarker marker= { 12, EXIF_FORMAT_STRING, -1, 809 static ExifMarker marker= { 12, EXIF_FORMAT_STRING, -1,
809 "SerialNumber", "Camera serial number", NULL }; 810 "SerialNumber", "Camera serial number", NULL };
810 ExifItem *item; 811 ExifItem *item;
811 gchar *text; 812 gchar *text;
812 gint l; 813 gint l;
813 814 guint32 n;
814 text = g_strdup_printf("%04X%05d", value & 0xff00 >> 8, value & 0x00ff); 815
816 n = (guint32)result->data;
817 text = g_strdup_printf("%04X%05d", n & 0xffff0000 >> 8, n & 0x0000ffff);
815 l = strlen(text); 818 l = strlen(text);
816 item = exif_item_new(marker.format, marker.tag, l, &marker); 819 item = exif_item_new(marker.format, marker.tag, l, &marker);
817 memcpy(item->data, text, l); 820 memcpy(item->data, text, l);
818 g_free(text); 821 g_free(text);
819 822