Image-EXIF

 view release on metacpan or  search on metacpan

fuji.c  view on Meta::CPAN

static struct descrip fuji_picture[] = {
	{ 0,	"Auto" },
	{ 1,	"Portrait" },
	{ 2,	"Landscape" },
	{ 4,	"Sports Scene" },
	{ 5,	"Night Scene" },
	{ 6,	"Program AE" },
	{ 256,	"Aperture Prior AE" },
	{ 512,	"Shutter Prior AE" },
	{ 768,	"Manual Exposure" },
	{ -1,	"Unknown" },
};


/* Blur warning. */

static struct descrip fuji_blurw[] = {
	{ 0,	"OK" },
	{ 1,	"Blur Warning" },
	{ -1,	"Unknown" },
};


/* Focus warning. */

static struct descrip fuji_focusw[] = {
	{ 0,	"OK" },
	{ 1,	"Out of Focus" },
	{ -1,	"Unknown" },
};


/* Auto exposure warning. */

static struct descrip fuji_aew[] = {
	{ 0,	"OK" },
	{ 1,	"Over Exposed" },
	{ -1,	"Unknown" },
};


/* Maker note IFD tags. */

static struct exiftag fuji_tags[] = {
	{ 0x0000, TIFF_UNDEF, 4, ED_CAM, "FujiVersion",
	  "Maker Note Version", NULL },
	{ 0x1000, TIFF_ASCII, 8, ED_UNK, "FujiQuality",
	  "Quality Setting", NULL },
	{ 0x1001, TIFF_SHORT, 1, ED_IMG, "FujiSharpness",
	  "Sharpness", fuji_sharp },
	{ 0x1002, TIFF_SHORT, 1, ED_IMG, "FujiWhiteBal",
	  "White Balance", fuji_white },
	{ 0x1003, TIFF_SHORT, 1, ED_IMG, "FujiColor",
	  "Chroma Saturation", fuji_color },
	{ 0x1004, TIFF_SHORT, 1, ED_IMG, "FujiTone",
	  "Contrast", fuji_color },
	{ 0x1010, TIFF_SHORT, 1, ED_IMG, "FujiFlashMode",
	  "Flash Mode", fuji_flmode },
	{ 0x1011, TIFF_SRTNL, 1, ED_UNK, "FujiFlashStrength",
	  "Flash Strength", NULL },
	{ 0x1020, TIFF_SHORT, 1, ED_IMG, "FujiMacro",
	  "Macro Mode", fuji_bool },
	{ 0x1021, TIFF_SHORT, 1, ED_IMG, "FujiFocusMode",
	  "Focus Mode", fuji_focus },
	{ 0x1030, TIFF_SHORT, 1, ED_IMG, "FujiSlowSync",
	  "Slow Synchro Mode", fuji_bool },
	{ 0x1031, TIFF_SHORT, 1, ED_IMG, "FujiPicMode",
	  "Picture Mode", fuji_picture },
	{ 0x1100, TIFF_SHORT, 1, ED_IMG, "FujiBracket",
	  "Continuous/Bracketing Mode", fuji_bool },
	{ 0x1300, TIFF_SHORT, 1, ED_IMG, "FujiBlurWarn",
	  "Blur Status", fuji_blurw },
	{ 0x1301, TIFF_SHORT, 1, ED_IMG, "FujiFocusWarn",
	  "Focus Status", fuji_focusw },
	{ 0x1302, TIFF_SHORT, 1, ED_IMG, "FujiAEWarn",
	  "Auto Exposure Status", fuji_aew },
	{ 0xffff, TIFF_UNKN, 0, ED_UNK, "FujiUnknown",
	  "Fuji Unknown", NULL },
};


/*
 * Process Fuji maker note tags.
 */
void
fuji_prop(struct exifprop *prop, struct exiftags *t)
{

	switch (prop->tag) {

	/* Maker note version. */

	case 0x0000:
		if (prop->count != 4)
			break;
		exifstralloc(&prop->str, prop->count + 1);
		byte4exif(prop->value, (unsigned char *)prop->str, LITTLE);
		break;
	}
}


/*
 * Try to read a Fuji maker note IFD.
 */
struct ifd *
fuji_ifd(u_int32_t offset, struct tiffmeta *md)
{
	struct ifd *myifd;
	int fujilen, fujioff;

	fujilen = strlen("FUJIFILM");

	/*
	 * The Fuji maker note appears to be in Intel byte order
	 * regardless of the rest of the file (!).  Also, it seems that
	 * Fuji maker notes start with an ID string, followed by an IFD
	 * offset relative to the MakerNote tag.
	 */

	if (!strncmp((const char *)(md->btiff + offset), "FUJIFILM", fujilen)) {
		fujioff = exif2byte(md->btiff + offset + fujilen, LITTLE);



( run in 0.439 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )