diff src/format_fuji.c @ 51:276ea4c98d33

Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net> * exif.[ch]: Use glib provided data types and byte order functions for consistency with rest of application. Made several more functions available in the header. Use MakerNote parsing from format_raw.c. * format_canon.[ch]: Changes to match exif.h and format_raw.h. * format_fuji.[ch]: Add support for Fuji EXIF MakerNote. * format_nikon.[ch]: New files, add support for Nikon EXIF MakerNote. * format_raw.[ch]: Add EXIF MakerNote parser functions to gather all camera formats here (similar to existing raw format list). * src/Makefile.am: Add format_nikon.[ch]. ##### 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 Sun, 05 Jun 2005 02:48:54 +0000
parents 7cfa60beda76
children 00843150f7c8
line wrap: on
line diff
--- a/src/format_fuji.c	Sat Jun 04 08:06:47 2005 +0000
+++ b/src/format_fuji.c	Sun Jun 05 02:48:54 2005 +0000
@@ -26,9 +26,11 @@
 #include "format_fuji.h"
 #include "format_raw.h"
 
+#include "exif.h"
 
-gint format_raw_test_fuji(const void *data, const guint len,
-			  guint *image_offset, guint *exif_offset)
+
+gint format_fuji_raw(const void *data, const guint len,
+		     guint *image_offset, guint *exif_offset)
 {
 	guint io;
 	guint eo;
@@ -57,3 +59,130 @@
 }
 
 
+/*
+ *-----------------------------------------------------------------------------
+ * EXIF Makernote for Fujifilm
+ *-----------------------------------------------------------------------------
+ */
+
+static ExifTextList FujiTagSharpness[] = {
+	{ 1,	"soft" },
+	{ 2,	"soft" },
+	{ 3,	"normal" },
+	{ 4,	"hard" },
+	{ 5,	"hard" },
+	EXIF_TEXT_LIST_END
+};
+
+static ExifTextList FujiTagWhiteBalance[]= {
+	{ 0,	"auto" },
+	{ 256,	"daylight" },
+	{ 512,	"cloudy" },
+	{ 768,	"daylight color-fluorescence" },
+	{ 769,	"daywhite color-fluorescence" },
+	{ 770,	"white-fluorescence" },
+	{ 1024,	"incandescent" },
+	{ 3840,	"custom" },
+	EXIF_TEXT_LIST_END
+};
+
+static ExifTextList FujiTagColorTone[]= {
+	{ 0,	"normal" },
+	{ 256,	"high" },
+	{ 512,	"low" },
+	EXIF_TEXT_LIST_END
+};
+
+static ExifTextList FujiTagFlashMode[]= {
+	{ 0,	"auto" },
+	{ 1,	"on" },
+	{ 2,	"off" },
+	{ 3,	"red-eye reduction" },
+	EXIF_TEXT_LIST_END
+};
+
+static ExifTextList FujiTagOffOn[]= {
+	{ 0,	"off" },
+	{ 1,	"on" },
+	EXIF_TEXT_LIST_END
+};
+
+static ExifTextList FujiTagFocusMode[]= {
+	{ 0,	"auto" },
+	{ 1,	"manual" },
+	EXIF_TEXT_LIST_END
+};
+
+static ExifTextList FujiTagPictureMode[]= {
+	{ 0,	"auto" },
+	{ 1,	"portrait" },
+	{ 2,	"landscape" },
+	{ 4,	"sports" },
+	{ 5,	"night" },
+	{ 6,	"program AE" },
+	{ 256,	"aperture priority AE" },
+	{ 512,	"shutter priority AE" },
+	{ 768,	"manual" },
+	EXIF_TEXT_LIST_END
+};
+
+static ExifTextList FujiTagNoYes[]= {
+	{ 0,	"no" },
+	{ 1,	"yes" },
+	EXIF_TEXT_LIST_END
+};
+
+#if 0
+static ExifTextList FujiTag[]= {
+	{ ,	"" },
+	{ ,	"" },
+	EXIF_TEXT_LIST_END
+};
+#endif
+
+
+static ExifMarker FujiExifMarkersList[] = {
+{ 0x1000,	EXIF_FORMAT_STRING, 8,		"MkN.Fuji.Quality",	"Quality",	NULL },
+{ 0x1001,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.Sharpness",	"Sharpness",	FujiTagSharpness },
+{ 0x1002,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.WhiteBalance","White balance",FujiTagWhiteBalance },
+{ 0x1003,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.Color",	"Color",	FujiTagColorTone },
+{ 0x1004,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.Tone",	"Tone",		FujiTagColorTone },
+{ 0x1010,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.FlashMode",	"Flash mode",	FujiTagFlashMode },
+{ 0x1011,	EXIF_FORMAT_RATIONAL, 1,	"MkN.Fuji.FlashStrength", "Flash strength", NULL },
+{ 0x1020,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.Macro",	"Macro",	FujiTagOffOn },
+{ 0x1021,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.FocusMode",	"Focus mode",	FujiTagFocusMode },
+{ 0x1030,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.SlowSync",	"Slow synchro",	FujiTagOffOn },
+{ 0x1031,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.PictureMode",	"Picture mode",	FujiTagPictureMode },
+{ 0x1100,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.ContTake/Bracket",
+							"Continuous / Auto bracket",	FujiTagOffOn },
+{ 0x1300,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.BlurWarning",	"Blue warning",	FujiTagNoYes },
+{ 0x1301,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.FocusWarning","Focus warning",FujiTagNoYes },
+{ 0x1302,	EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MkN.Fuji.AEWarning",	"AE warning",	FujiTagNoYes },
+EXIF_MARKER_LIST_END
+};
+
+
+
+gint format_fuji_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+			   guint size, ExifByteOrder byte_order)
+{
+	unsigned char *data;
+	guint ifdstart;
+
+	if (offset + 8 + 4 >= size) return FALSE;
+
+	data = tiff + offset;
+	if (memcmp(data, "FUJIFILM", 8) != 0) return FALSE;
+
+	ifdstart = exif_byte_get_int32(data + 8, EXIF_BYTE_ORDER_INTEL);
+	if (offset + ifdstart >= size) return FALSE;
+
+	if (exif_parse_IFD_table(exif, tiff + offset, ifdstart, size - offset,
+				 EXIF_BYTE_ORDER_INTEL, FujiExifMarkersList) != 0)
+		{
+		return FALSE;
+		}
+
+	return TRUE;
+}
+