[gthumb] added the dump_exif_data function



commit e24669a3a40ddad4500c181eb49e7a2bc2de6746
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Jul 20 12:44:25 2011 +0200

    added the dump_exif_data function
    
    useful to find exiv2 bugs

 extensions/exiv2_tools/exiv2-utils.cpp |   34 ++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/extensions/exiv2_tools/exiv2-utils.cpp b/extensions/exiv2_tools/exiv2-utils.cpp
index a0f5ecb..bb9055c 100644
--- a/extensions/exiv2_tools/exiv2-utils.cpp
+++ b/extensions/exiv2_tools/exiv2-utils.cpp
@@ -855,6 +855,40 @@ gth_main_get_metadata_type (gpointer    metadata,
 }
 
 
+static void
+dump_exif_data (Exiv2::ExifData &exifData,
+		const char      *prefix)
+{
+	std::cout << prefix << "\n";
+
+	try {
+		if (exifData.empty()) {
+			throw Exiv2::Error(1, " No Exif data found in the file");
+		}
+		Exiv2::ExifData::const_iterator end = exifData.end();
+		for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
+			const char* tn = i->typeName();
+			std::cout << std::setw(44) << std::setfill(' ') << std::left
+				  << i->key() << " "
+				  << "0x" << std::setw(4) << std::setfill('0') << std::right
+				  << std::hex << i->tag() << " "
+				  << std::setw(9) << std::setfill(' ') << std::left
+				  << (tn ? tn : "Unknown") << " "
+				  << std::dec << std::setw(3)
+				  << std::setfill(' ') << std::right
+				  << i->count() << "  "
+				  << std::dec << i->value()
+				  << "\n";
+		}
+		std::cout << "\n";
+	}
+	catch (Exiv2::Error& e) {
+	    std::cout << "Caught Exiv2 exception '" << e.what() << "'\n";
+	    return;
+	}
+}
+
+
 static Exiv2::DataBuf
 exiv2_write_metadata_private (Exiv2::Image::AutoPtr  image,
 			      GFileInfo             *info,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]