⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exif.c

📁 Gqview,Linux下基于GTK+库写成的轻量级而能丰富的图像浏览程序。
💻 C
📖 第 1 页 / 共 3 页
字号:
/* *  GQView *  (C) 2004 John Ellis * *  Authors: *    Support for Exif file format, originally written by Eric Swalens.     *    Modified by Quy Tonthat * *    Reimplemented with generic data storage by John Ellis (Nov 2003) * *  The tags were added with information from the FREE document: *     http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html * *  For the official Exif Format, please refer to: *     http://www.exif.org *     http://www.exif.org/specifications.html (PDF spec sheets) * *  Notes: *     Additional tag formats should be added to the proper *     location in ExifKnownMarkersList[]. * *     Human readable ouput (that needs additional processing of data to *     be useable) can be defined by adding a key to ExifFormattedList[], *     then handling that tag in the function exif_get_formatted_by_key(). *     The human readable formatted keys must begin with the character 'f'. * *  Unsupported at this time: *     IFD1 (thumbnail) *     MakerNote *     GPSInfo * *  TODO: *     Convert data to useable form in the ??_as_text function for: *        ComponentsConfiguration *        UserComment (convert this to UTF-8?) *    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/#ifdef HAVE_CONFIG_H#  include "config.h"#endif#include <stdio.h>#include <string.h>#include <fcntl.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/mman.h>#include <math.h> #include <glib.h>#include "intl.h"#include "exif.h"#include "format_raw.h"#include "ui_fileops.h"/* *----------------------------------------------------------------------------- * Tag formats *----------------------------------------------------------------------------- */ExifFormatAttrib ExifFormatList[] = {	{ EXIF_FORMAT_UNKNOWN,		1, "unknown",	"unknown" },	{ EXIF_FORMAT_BYTE_UNSIGNED,	1, "ubyte",	"unsigned byte" },	{ EXIF_FORMAT_STRING,		1, "string",	"string" },	{ EXIF_FORMAT_SHORT_UNSIGNED,	2, "ushort",	"unsigned short" },	{ EXIF_FORMAT_LONG_UNSIGNED,	4, "ulong",	"unsigned long" },	{ EXIF_FORMAT_RATIONAL_UNSIGNED,8, "urational",	"unsigned rational" },	{ EXIF_FORMAT_BYTE,		1, "byte",	"byte" },	{ EXIF_FORMAT_UNDEFINED,	1, "undefined",	"undefined" },	{ EXIF_FORMAT_SHORT,		2, "sshort",	"signed short" },	{ EXIF_FORMAT_LONG,		4, "slong",	"signed long" },	{ EXIF_FORMAT_RATIONAL,		8, "srational",	"signed rational" },	{ EXIF_FORMAT_FLOAT,		4, "float",	"float" },	{ EXIF_FORMAT_DOUBLE,		8, "double",	"double" },	{ -1, 0, NULL }};/* tags that are special, or need special treatment */#define TAG_EXIFOFFSET          0x8769#define TAG_EXIFMAKERNOTE	0x927c/* *----------------------------------------------------------------------------- * Data *----------------------------------------------------------------------------- */static ExifTextList ExifOrientationList[] = {	{ EXIF_ORIENTATION_UNKNOWN,	N_("unknown") },	{ EXIF_ORIENTATION_TOP_LEFT,	N_("top left") },	{ EXIF_ORIENTATION_TOP_RIGHT,	N_("top right") },	{ EXIF_ORIENTATION_BOTTOM_RIGHT,N_("bottom right") },	{ EXIF_ORIENTATION_BOTTOM_LEFT,	N_("bottom left") },	{ EXIF_ORIENTATION_LEFT_TOP,	N_("left top") },	{ EXIF_ORIENTATION_RIGHT_TOP,	N_("right top") },	{ EXIF_ORIENTATION_RIGHT_BOTTOM,N_("right bottom") },	{ EXIF_ORIENTATION_LEFT_BOTTOM,	N_("left bottom") },	EXIF_TEXT_LIST_END};static ExifTextList ExifUnitList[] = {	{ EXIF_UNIT_UNKNOWN,	N_("unknown") },	{ EXIF_UNIT_NOUNIT,	"" },	{ EXIF_UNIT_INCH,	N_("inch") },	{ EXIF_UNIT_CENTIMETER,	N_("centimeter") },	EXIF_TEXT_LIST_END};static ExifTextList ExifYCbCrPosList[] = {	{ 1,	"center" },	{ 2,	"datum" },	EXIF_TEXT_LIST_END};static ExifTextList ExifMeteringModeList[] = {	{ 0,	N_("unknown") },	{ 1,	N_("average") },	{ 2,	N_("center weighted") },	{ 3,	N_("spot") },	{ 4,	N_("multi-spot") },	{ 5,	N_("multi-segment") },	{ 6,	N_("partial") },	{ 255,	N_("other") },	EXIF_TEXT_LIST_END};static ExifTextList ExifExposureProgramList[] = {	{ 0,	N_("not defined") },	{ 1,	N_("manual") },	{ 2,	N_("normal") },	{ 3,	N_("aperture") },	{ 4,	N_("shutter") },	{ 5,	N_("creative") },	{ 6,	N_("action") },	{ 7,	N_("portrait") },	{ 8,	N_("landscape") },	EXIF_TEXT_LIST_END};static ExifTextList ExifLightSourceList[] = {	{ 0,	N_("unknown") },	{ 1,	N_("daylight") },	{ 2,	N_("fluorescent") },	{ 3,	N_("tungsten (incandescent)") },	{ 4,	N_("flash") },	{ 9,	"fine weather" },	{ 10,	"cloudy weather" },	{ 11,	"shade" },	{ 12,	"daylight fluorescent" },	{ 13,	"day white fluorescent" },	{ 14,	"cool white fluorescent" },	{ 15,	"while fluorescent" },	{ 17,	"standard light A" },	{ 18,	"standard light B" },	{ 19,	"standard light C" },	{ 20,	"D55" },	{ 21,	"D65" },	{ 22,	"D75" },	{ 23,	"D50" },	{ 24,	"ISO studio tungsten" },	{ 255,	N_("other") },	EXIF_TEXT_LIST_END};static ExifTextList ExifFlashList[] = {	{ 0,	N_("no") },	{ 1,	N_("yes") },	{ 5,	N_("yes, not detected by strobe") },	{ 7,	N_("yes, detected by strobe") },	EXIF_TEXT_LIST_END};static ExifTextList ExifColorSpaceList[] = {	{ 1,	"sRGB" },	{ 65535,"uncalibrated" },	EXIF_TEXT_LIST_END};static ExifTextList ExifSensorList[] = {	{ 1,	"not defined" },	{ 2,	"1 chip color area" },	{ 2,	"2 chip color area" },	{ 4,	"3 chip color area" },	{ 5,	"color sequential area" },	{ 7,	"trilinear" },	{ 8,	"color sequential linear" },	EXIF_TEXT_LIST_END};static ExifTextList ExifSourceList[] = {	{ 3,	"digital still camera" },	EXIF_TEXT_LIST_END};static ExifTextList ExifSceneList[] = {	{ 1,	"direct photo" },	EXIF_TEXT_LIST_END};static ExifTextList ExifCustRenderList[] = {	{ 0,	"normal" },	{ 1,	"custom" },	EXIF_TEXT_LIST_END};static ExifTextList ExifExposureModeList[] = {	{ 0,	"auto" },	{ 1,	"manual" },	{ 2,	"auto bracket" },	EXIF_TEXT_LIST_END};static ExifTextList ExifWhiteBalanceList[] = {	{ 0,	"auto" },	{ 1,	"manual" },	EXIF_TEXT_LIST_END};static ExifTextList ExifSceneCaptureList[] = {	{ 0,	"standard" },	{ 1,	"landscape" },	{ 2,	"portrait" },	{ 3,	"night scene" },	EXIF_TEXT_LIST_END};static ExifTextList ExifGainControlList[] = {	{ 0,	"none" },	{ 1,	"low gain up" },	{ 2,	"high gain up" },	{ 3,	"low gain down" },	{ 4,	"high gain down" },	EXIF_TEXT_LIST_END};static ExifTextList ExifContrastList[] = {	{ 0,	"normal" },	{ 1,	"soft" },	{ 2,	"hard" },	EXIF_TEXT_LIST_END};static ExifTextList ExifSaturationList[] = {	{ 0,	"normal" },	{ 1,	"low" },	{ 2,	"high" },	EXIF_TEXT_LIST_END};static ExifTextList ExifSharpnessList[] = {	{ 0,	"normal" },	{ 1,	"soft" },	{ 2,	"hard" },	EXIF_TEXT_LIST_END};static ExifTextList ExifSubjectRangeList[] = {	{ 0,	"unknown" },	{ 1,	"macro" },	{ 2,	"close" },	{ 3,	"distant" },	EXIF_TEXT_LIST_END};ExifMarker ExifKnownMarkersList[] = {{ 0x010e, EXIF_FORMAT_STRING, -1,		"ImageDescription",	N_("Image description"), NULL },{ 0x010f, EXIF_FORMAT_STRING, -1,		"Make",			"Camera make", NULL },{ 0x0110, EXIF_FORMAT_STRING, -1,		"Model",		"Camera model", NULL },{ 0x0112, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"Orientation",		N_("Orientation"), ExifOrientationList },{ 0x011a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"XResolution",		"X resolution", NULL },{ 0x011b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"YResolution",		"Y Resolution", NULL },{ 0x0128, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"ResolutionUnit",	"Resolution units", ExifUnitList },{ 0x0131, EXIF_FORMAT_STRING, -1, 		"Software",		"Firmware", NULL },{ 0x0132, EXIF_FORMAT_STRING, 20,		"DateTime",		N_("Date"), NULL },{ 0x013e, EXIF_FORMAT_RATIONAL_UNSIGNED, 2,	"WhitePoint",		"White point", NULL },{ 0x013f, EXIF_FORMAT_RATIONAL_UNSIGNED, 6,	"PrimaryChromaticities","Primary chromaticities", NULL },{ 0x0211, EXIF_FORMAT_RATIONAL_UNSIGNED, 3,	"YCbCrCoefficients",	"YCbCy coefficients", NULL },{ 0x0213, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"YCbCrPositioning",	"YCbCr positioning", ExifYCbCrPosList },{ 0x0214, EXIF_FORMAT_RATIONAL_UNSIGNED, 6, 	"ReferenceBlackWhite",	"Black white reference", NULL },{ 0x8298, EXIF_FORMAT_STRING, -1,		"Copyright",		N_("Copyright"), NULL },{ 0x8769, EXIF_FORMAT_LONG_UNSIGNED, 1,		"ExifOffset",		"SubIFD Exif offset", NULL },	/* subIFD follows */{ 0x829a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"ExposureTime",		"Exposure time (seconds)", NULL },{ 0x829d, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"FNumber",		"FNumber", NULL },{ 0x8822, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"ExposureProgram",	N_("Exposure program"), ExifExposureProgramList },{ 0x8824, EXIF_FORMAT_STRING, -1,		"SpectralSensitivity",	"Spectral Sensitivity", NULL },{ 0x8827, EXIF_FORMAT_SHORT_UNSIGNED, -1,	"ISOSpeedRatings",	N_("ISO sensitivity"), NULL },{ 0x8828, EXIF_FORMAT_UNDEFINED, -1,		"OECF",			"Optoelectric conversion factor", NULL },{ 0x9000, EXIF_FORMAT_UNDEFINED, 4,		"ExifVersion",		"Exif version", NULL },{ 0x9003, EXIF_FORMAT_STRING, 20,		"DateTimeOriginal",	N_("Date original"), NULL },{ 0x9004, EXIF_FORMAT_STRING, 20,		"DateTimeDigitized",	N_("Date digitized"), NULL },{ 0x9101, EXIF_FORMAT_UNDEFINED, -1,		"ComponentsConfiguration","Pixel format", NULL },{ 0x9102, EXIF_FORMAT_RATIONAL_UNSIGNED,1,	"CompressedBitsPerPixel","Compression ratio", NULL },{ 0x9201, EXIF_FORMAT_RATIONAL, 1,		"ShutterSpeedValue",	N_("Shutter speed"), NULL },{ 0x9202, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"ApertureValue",	N_("Aperture"), NULL },{ 0x9203, EXIF_FORMAT_RATIONAL, 1,		"BrightnessValue",	"Brightness", NULL },{ 0x9204, EXIF_FORMAT_RATIONAL, 1,		"ExposureBiasValue",	N_("Exposure bias"), NULL },{ 0x9205, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"MaxApertureValue",	"Maximum aperture", NULL },{ 0x9206, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"SubjectDistance",	N_("Subject distance"), NULL },{ 0x9207, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"MeteringMode",		N_("Metering mode"), ExifMeteringModeList },{ 0x9208, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"LightSource",		N_("Light source"), ExifLightSourceList },{ 0x9209, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"Flash",		N_("Flash"), ExifFlashList },{ 0x920a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, 	"FocalLength",		N_("Focal length"), NULL },{ 0x9214, EXIF_FORMAT_SHORT_UNSIGNED, -1,	"SubjectArea",		"Subject area", NULL },{ 0x927c, EXIF_FORMAT_UNDEFINED, -1,		"MakerNote",		"MakerNote", NULL },{ 0x9286, EXIF_FORMAT_UNDEFINED, -1, 		"UserComment",		"UserComment", NULL },{ 0x9290, EXIF_FORMAT_STRING, -1,		"SubsecTime",		"Subsecond time", NULL },{ 0x9291, EXIF_FORMAT_STRING, -1,		"SubsecTimeOriginal",	"Subsecond time original", NULL },{ 0x9292, EXIF_FORMAT_STRING, -1,		"SubsecTimeDigitized",	"Subsecond time digitized", NULL },{ 0xa000, EXIF_FORMAT_UNDEFINED, 4,		"FlashPixVersion",	"FlashPix version", NULL },{ 0xa001, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"ColorSpace",		"Colorspace", ExifColorSpaceList },	/* ExifImageWidth, ExifImageHeight can also be unsigned short */{ 0xa002, EXIF_FORMAT_LONG_UNSIGNED, 1,		"ExifImageWidth",	N_("Width"), NULL },{ 0xa003, EXIF_FORMAT_LONG_UNSIGNED, 1,		"ExifImageHeight",	N_("Height"), NULL },{ 0xa004, EXIF_FORMAT_STRING, -1,		"RelatedSoundFile",	"Audio data", NULL },{ 0xa005, EXIF_FORMAT_LONG_UNSIGNED, 1,		"ExifInteroperabilityOffset", "ExifR98 extension", NULL },{ 0xa20b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"FlashEnergy",		"Flash strength", NULL },{ 0xa20c, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"SpatialFrequencyResponse","Spatial frequency response", NULL },{ 0xa20e, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"FocalPlaneXResolution", "X Pixel density", NULL },{ 0xa20f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"FocalPlaneYResolution", "Y Pixel density", NULL },{ 0xa210, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"FocalPlaneResolutionUnit", "Pixel density units", ExifUnitList },{ 0x0214, EXIF_FORMAT_SHORT_UNSIGNED, 2,	"SubjectLocation",	"Subject location", NULL },{ 0xa215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"ExposureIndex",	N_("ISO sensitivity"), NULL },{ 0xa217, EXIF_FORMAT_SHORT_UNSIGNED, -1,	"SensingMethod",	"Sensor type", ExifSensorList },{ 0xa300, EXIF_FORMAT_UNDEFINED, 1,		"FileSource",		"Source type", ExifSourceList },{ 0xa301, EXIF_FORMAT_UNDEFINED, 1,		"SceneType",		"Scene type", ExifSceneList },{ 0xa302, EXIF_FORMAT_UNDEFINED, -1,		"CFAPattern",		"Color filter array pattern", NULL },	/* tags a4xx were added for Exif 2.2 (not just these - some above, as well) */{ 0xa401, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"CustomRendered",	"Render process", ExifCustRenderList },{ 0xa402, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"ExposureMode",		"Exposure mode", ExifExposureModeList },{ 0xa403, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"WhiteBalance",		"White balance", ExifWhiteBalanceList },{ 0xa404, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"DigitalZoomRatio",	"Digital zoom ratio", NULL },{ 0xa405, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"FocalLength35mmFilm",	"Focal length (35mm)", NULL },{ 0xa406, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"SceneCapturetype",	"Scene capture type", ExifSceneCaptureList },{ 0xa407, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"GainControl",		"Gain control", ExifGainControlList },{ 0xa408, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"Contrast",		"Contrast", ExifContrastList },{ 0xa409, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"Saturation",		"Saturation", ExifSaturationList },{ 0xa40a, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"Sharpness",		"Sharpness", ExifSharpnessList },{ 0xa40b, EXIF_FORMAT_UNDEFINED, -1,		"DeviceSettingDescription","Device setting", NULL },{ 0xa40c, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"SubjectDistanceRange",	"Subject range", ExifSubjectRangeList },{ 0xa420, EXIF_FORMAT_STRING, -1,		"ImageUniqueID",	"Image serial number", NULL },	/* place known, but undocumented or lesser used tags here */{ 0x00fe, EXIF_FORMAT_LONG_UNSIGNED, 1,		"NewSubfileType",	NULL, NULL },{ 0x00ff, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"SubfileType",		NULL, NULL },{ 0x012d, EXIF_FORMAT_SHORT_UNSIGNED, 3,	"TransferFunction",	NULL, NULL },{ 0x013b, EXIF_FORMAT_STRING, -1,		"Artist",		"Artist", NULL },{ 0x013d, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"Predictor",		NULL, NULL },{ 0x0142, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"TileWidth",		NULL, NULL },{ 0x0143, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"TileLength",		NULL, NULL },{ 0x0144, EXIF_FORMAT_LONG_UNSIGNED, -1,	"TileOffsets",		NULL, NULL },{ 0x0145, EXIF_FORMAT_SHORT_UNSIGNED, -1,	"TileByteCounts",	NULL, NULL },{ 0x014a, EXIF_FORMAT_LONG_UNSIGNED, -1,	"SubIFDs",		NULL, NULL },{ 0x015b, EXIF_FORMAT_UNDEFINED, -1,		"JPEGTables",		NULL, NULL },{ 0x828d, EXIF_FORMAT_SHORT_UNSIGNED, 2,	"CFARepeatPatternDim",	NULL, NULL },{ 0x828e, EXIF_FORMAT_BYTE_UNSIGNED, -1,	"CFAPattern",		NULL, NULL },{ 0x828f, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"BatteryLevel",		NULL, NULL },{ 0x83bb, EXIF_FORMAT_LONG_UNSIGNED, -1,	"IPTC/NAA",		NULL, NULL },{ 0x8773, EXIF_FORMAT_UNDEFINED, -1,		"InterColorProfile",	NULL, NULL },{ 0x8825, EXIF_FORMAT_LONG_UNSIGNED, 1,		"GPSInfo",		"SubIFD GPS offset", NULL },{ 0x8829, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"Interlace",		NULL, NULL },{ 0x882a, EXIF_FORMAT_SHORT, 1,			"TimeZoneOffset",	NULL, NULL },{ 0x882b, EXIF_FORMAT_SHORT_UNSIGNED, 1,	"SelfTimerMode",	NULL, NULL },{ 0x920b, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"FlashEnergy",		NULL, NULL },{ 0x920c, EXIF_FORMAT_UNDEFINED, -1,		"SpatialFrequencyResponse", NULL, NULL },{ 0x920d, EXIF_FORMAT_UNDEFINED, -1,		"Noise",		NULL, NULL },{ 0x9211, EXIF_FORMAT_LONG_UNSIGNED, 1,		"ImageNumber",		NULL, NULL },{ 0x9212, EXIF_FORMAT_STRING, 1,		"SecurityClassification", NULL, NULL },{ 0x9213, EXIF_FORMAT_STRING, -1,		"ImageHistory",		NULL, NULL },{ 0x9215, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,	"ExposureIndex",	NULL, NULL },{ 0x9216, EXIF_FORMAT_BYTE_UNSIGNED, 4,		"TIFF/EPStandardID",	NULL, NULL },EXIF_MARKER_LIST_END};ExifMarker ExifUnknownMarkersList[] = {{ 0x0000, EXIF_FORMAT_UNKNOWN, 0,		"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_BYTE_UNSIGNED, -1,	"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_STRING, -1,		"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_SHORT_UNSIGNED, -1,	"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_LONG_UNSIGNED, -1,	"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_RATIONAL_UNSIGNED, -1,	"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_BYTE, -1,			"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_UNDEFINED, -1,		"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_SHORT, -1,		"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_LONG, -1,			"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_RATIONAL, -1,		"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_FLOAT, -1,		"unknown",	NULL, NULL },{ 0x0000, EXIF_FORMAT_DOUBLE, -1,		"unknown",	NULL, NULL },};/* human readable key list */ExifFormattedText ExifFormattedList[] = {	{ "fCamera",		N_("Camera") },	{ "fDateTime",		N_("Date") },	{ "fShutterSpeed",	N_("Shutter speed") },	{ "fAperture",		N_("Aperture") },	{ "fExposureBias",	N_("Exposure bias") },	{ "fISOSpeedRating",	N_("ISO sensitivity") },	{ "fFocalLength",	N_("Focal length") },	{ "fSubjectDistance",	N_("Subject distance") },	{ "fFlash",		N_("Flash") },	{ "fResolution",	N_("Resolution") },	{ NULL, NULL }};static const ExifMarker *exif_marker_from_tag(guint16 tag, const ExifMarker *list);/* *----------------------------------------------------------------------------- * ExifItem *----------------------------------------------------------------------------- */ExifItem *exif_item_new(ExifFormatType format, guint tag,			guint elements, const ExifMarker *marker){	ExifItem *item;	item = g_new0(ExifItem, 1);	item->format = format;	item->tag = tag;	item->marker = marker;	item->elements = elements;	item->data = NULL;	item->data_len = 0;	switch (format)		{		case EXIF_FORMAT_UNKNOWN:			/* unknown, data is NULL */			return item;			break;		case EXIF_FORMAT_BYTE_UNSIGNED:			item->data_len = sizeof(char) * elements;			break;		case EXIF_FORMAT_STRING:			item->data_len = sizeof(char) * elements;			break;		case EXIF_FORMAT_SHORT_UNSIGNED:			item->data_len = sizeof(guint16) * elements;			break;		case EXIF_FORMAT_LONG_UNSIGNED:			item->data_len = sizeof(guint32) * elements;			break;		case EXIF_FORMAT_RATIONAL_UNSIGNED:			item->data_len = sizeof(ExifRational) * elements;			break;		case EXIF_FORMAT_BYTE:			item->data_len = sizeof(char) * elements;			break;		case EXIF_FORMAT_UNDEFINED:			item->data_len = sizeof(char) * elements;			break;		case EXIF_FORMAT_SHORT:			item->data_len = sizeof(gint16) * elements;			break;		case EXIF_FORMAT_LONG:			item->data_len = sizeof(gint32) * elements;			break;		case EXIF_FORMAT_RATIONAL:			item->data_len = sizeof(ExifRational) * elements;			break;		case EXIF_FORMAT_FLOAT:			item->data_len = sizeof(float) * elements;			break;		case EXIF_FORMAT_DOUBLE:			item->data_len = sizeof(double) * elements;			break;		}	item->data = g_malloc0(item->data_len);	return item;}static void exif_item_free(ExifItem *item){	if (!item) return;	g_free(item->data);	g_free(item);}const char *exif_item_get_tag_name(ExifItem *item){	if (!item || !item->marker) return NULL;	return item->marker->key;}const char *exif_item_get_description(ExifItem *item){	if (!item || !item->marker) return NULL;	return _(item->marker->description);}const char *exif_item_get_format_name(ExifItem *item, gint brief){	if (!item || !item->marker) return NULL; 	return (brief) ? ExifFormatList[item->format].short_name : ExifFormatList[item->format].description;}#define UNDEFINED_TEXT_BYTE_COUNT 16static GString *string_append_raw_bytes(GString *string, gpointer data, gint ne){	gint i;	for (i = 0 ; i < ne && i < UNDEFINED_TEXT_BYTE_COUNT; i++)		{		unsigned char c = ((char *)data)[i];		if (c < 32 || c > 127) c = '.';		g_string_append_printf(string, "%c", c);		}	string = g_string_append(string, " : ");	for (i = 0 ; i < ne && i < UNDEFINED_TEXT_BYTE_COUNT; i++)		{		const gchar *spacer;		if (i > 0)			{			if (i%8 == 0)				{				spacer = " - ";				}			else				{				spacer = " ";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -