diff src/exif-common.c @ 184:2507418ab7a2

more exiv2 fixes
author nadvornik
date Thu, 14 Feb 2008 14:04:43 +0000
parents 8a417f10ba09
children 0584cb78aa14
line wrap: on
line diff
--- a/src/exif-common.c	Thu Feb 14 11:03:20 2008 +0000
+++ b/src/exif-common.c	Thu Feb 14 14:04:43 2008 +0000
@@ -217,7 +217,7 @@
 		if (!exif_get_integer(exif, "Exif.Photo.Flash", &n)) return NULL;
 
 		/* Exif 2.1 only defines first 3 bits */
-//		if (n <= 0x07) return exif_text_list_find_value(ExifFlashList, n);
+		if (n <= 0x07) return exif_get_data_as_text(exif, "Exif.Photo.Flash");
 
 		/* must be Exif 2.2 */
 		string = g_string_new("");
@@ -293,3 +293,36 @@
 
 	return exif_get_tag_description_by_key(key);
 }
+
+gint exif_get_integer(ExifData *exif, const gchar *key, gint *value)
+{
+	ExifItem *item;
+
+	item = exif_get_item(exif, key);
+	return exif_item_get_integer(item, value);
+}
+
+ExifRational *exif_get_rational(ExifData *exif, const gchar *key, gint *sign)
+{
+	ExifItem *item;
+
+	item = exif_get_item(exif, key);
+	return exif_item_get_rational(item, sign);
+}
+
+gchar *exif_get_data_as_text(ExifData *exif, const gchar *key)
+{
+	ExifItem *item;
+	gchar *text;
+	gint key_valid;
+
+	if (!key) return NULL;
+
+	text = exif_get_formatted_by_key(exif, key, &key_valid);
+	if (key_valid) return text;
+
+	item = exif_get_item(exif, key);
+	if (item) return exif_item_get_data_as_text(item);
+
+	return NULL;
+}