Image-EXIF

 view release on metacpan or  search on metacpan

exifint.h  view on Meta::CPAN

 * (http://partners.adobe.com/asn/developer/pdfs/tn/TIFF6.pdf)
 * and the EXIF 2.21 standard: (http://tsc.jeita.or.jp/avs/data/cp3451_1.pdf).
 *
 * Definitions internal to the Exif parsing library.
 *
 */

#ifndef _EXIFINT_H
#define _EXIFINT_H

#include "exif.h"


/* Exif IFD tags. */

#define EXIF_T_EXIFIFD		0x8769
#define EXIF_T_GPSIFD		0x8825
#define EXIF_T_MAKERNOTE	0x927c
#define EXIF_T_INTEROP		0xa005


/* IFD field types. */

struct fieldtype {
	u_int16_t type;
	const char *name;
	size_t size;
};


/* A raw Image File Directory (IFD) entry (12 bytes). */
 
struct field {
	unsigned char tag[2];
	unsigned char type[2];
	unsigned char count[4];
	unsigned char value[4];
};


/* IFD entry. */

struct ifd {
	u_int16_t num;		/* Number of fields. */
	struct field *fields;	/* Array of fields. */
	struct exifprop *par;	/* Parent property association. */
	struct exiftag *tagset;	/* Tag definitions. */
	struct tiffmeta md;	/* Metadata. */
	struct ifd *next;
};


/* List of IFD offsets, to detect loops. */

struct ifdoff {
	unsigned char *offset;	/* Offset to IFD. */
	struct ifdoff *next;	/* Next IFD in list. */
};


/* Macro for making sense of a fraction. */

#define fixfract(str, n, d, t)	{ \
	if ((t)) { (n) /= (t); (d) /= (t); } \
	if (!(n)) sprintf((str), "0"); \
	else if (!(d)) sprintf((str), "Infinite"); \
	else if (abs((n)) == abs((d))) sprintf((str), "%d", (n) / (d)); \
	else if (abs((d)) == 1) snprintf((str), 31, "%d", (n) / (d)); \
	else if (abs((n)) > abs((d))) snprintf((str), 31, "%.1f", \
	    (double)(n) / (double)(d)); \
	else if (abs((d)) > 2 && abs((n)) > 1 && \
	    (fabs((double)(n) / (double)(d))) >= 0.1) \
		snprintf((str), 31, "%.1f", (double)(n) / (double)(d)); \
	else snprintf((str), 31, "%d/%d", (n), (d)); \
}


/* The tables from tagdefs.c. */

extern struct fieldtype ftypes[];
extern struct descrip ucomment[];
extern struct descrip flash_fire[];
extern struct descrip flash_return[];
extern struct descrip flash_mode[];
extern struct descrip flash_func[];
extern struct descrip flash_redeye[];
extern struct descrip filesrcs[];


/* Utility functions from exifutil.c. */

extern int offsanity(struct exifprop *prop, u_int16_t size, struct ifd *dir);
extern u_int16_t exif2byte(unsigned char *b, enum byteorder o);
extern int16_t exif2sbyte(unsigned char *b, enum byteorder o);
extern u_int32_t exif4byte(unsigned char *b, enum byteorder o);
extern void byte4exif(u_int32_t n, unsigned char *b, enum byteorder o);
extern int32_t exif4sbyte(unsigned char *b, enum byteorder o);
extern char *finddescr(struct descrip *table, u_int16_t val);
extern int catdescr(char *c, struct descrip *table, u_int16_t val, int len);
extern struct exifprop *newprop(void);
extern struct exifprop *childprop(struct exifprop *parent);
extern void exifstralloc(char **str, int len);
extern void hexprint(unsigned char *b, int len);
extern void dumpprop(struct exifprop *prop, struct field *afield);
extern struct ifd *readifds(u_int32_t offset, struct exiftag *tagset,
    struct tiffmeta *md);
extern u_int32_t readifd(u_int32_t offset, struct ifd **dir,
    struct exiftag *tagset, struct tiffmeta *md);
extern u_int32_t gcd(u_int32_t a, u_int32_t b);

/* Interface to exifgps.c. */

extern struct exiftag gpstags[];
extern void gpsprop(struct exifprop *prop, struct exiftags *t);

#endif



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