[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9698 - in Extractor: . src/include src/main src/plugins/ex
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9698 - in Extractor: . src/include src/main src/plugins/exiv2 |
Date: |
Sat, 5 Dec 2009 11:33:19 +0100 |
Author: grothoff
Date: 2009-12-05 11:33:19 +0100 (Sat, 05 Dec 2009)
New Revision: 9698
Modified:
Extractor/ChangeLog
Extractor/src/include/extractor.h
Extractor/src/main/extractor.c
Extractor/src/plugins/exiv2/exiv2extractor.cc
Log:
iptc support
Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2009-12-05 00:22:56 UTC (rev 9697)
+++ Extractor/ChangeLog 2009-12-05 10:33:19 UTC (rev 9698)
@@ -1,3 +1,6 @@
+Sat Dec 5 11:32:30 CET 2009
+ Adding extraction of Iptc data using exiv2.
+
Sat Jul 4 23:05:22 CEST 2009
Fixed code to work with RPM 4.7.
Releasing libextractor 0.5.23.
Modified: Extractor/src/include/extractor.h
===================================================================
--- Extractor/src/include/extractor.h 2009-12-05 00:22:56 UTC (rev 9697)
+++ Extractor/src/include/extractor.h 2009-12-05 10:33:19 UTC (rev 9698)
@@ -190,7 +190,14 @@
EXTRACTOR_DISC_NUMBER = 134,
EXTRACTOR_GNUNET_DISPLAY_TYPE = 135,
EXTRACTOR_GNUNET_ECBC_URI = 136,
- EXTRACTOR_GNUNET_FULL_DATA = 137
+ EXTRACTOR_GNUNET_FULL_DATA = 137,
+ EXTRACTOR_LOCATION_CITY = 138,
+ EXTRACTOR_LOCATION_COUNTRY = 139,
+ EXTRACTOR_LOCATION_SUBLOCATION = 140,
+ EXTRACTOR_GPS_LATITUDE_REF = 141,
+ EXTRACTOR_GPS_LATITUDE = 142,
+ EXTRACTOR_GPS_LONGITUDE_REF = 143,
+ EXTRACTOR_GPS_LONGITUDE = 144
} EXTRACTOR_KeywordType;
/**
Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c 2009-12-05 00:22:56 UTC (rev 9697)
+++ Extractor/src/main/extractor.c 2009-12-05 10:33:19 UTC (rev 9698)
@@ -176,15 +176,22 @@
gettext_noop("filesize"),
gettext_noop("track number"),
gettext_noop("international standard recording code"),
- gettext_noop("disc number"), /* 134 */
- gettext_noop("preferred display style (GNUnet)"),
+ gettext_noop("disc number"),
+ gettext_noop("preferred display style (GNUnet)"), /* 135 */
gettext_noop("GNUnet URI of ECBC data"),
gettext_noop("Complete file data (for non-binary files only)"),
+ gettext_noop("city"),
+ gettext_noop("country"),
+ gettext_noop("sublocation"), /* 140 */
+ gettext_noop("GPS latitude ref"),
+ gettext_noop("GPS latitude"),
+ gettext_noop("GPS longitude ref"),
+ gettext_noop("GPS longitude"),
NULL
};
/* the number of keyword types (for bounds-checking) */
-#define HIGHEST_TYPE_NUMBER 138
+#define HIGHEST_TYPE_NUMBER 145
#ifdef HAVE_LIBOGG
#if HAVE_VORBIS
Modified: Extractor/src/plugins/exiv2/exiv2extractor.cc
===================================================================
--- Extractor/src/plugins/exiv2/exiv2extractor.cc 2009-12-05 00:22:56 UTC
(rev 9697)
+++ Extractor/src/plugins/exiv2/exiv2extractor.cc 2009-12-05 10:33:19 UTC
(rev 9698)
@@ -79,368 +79,440 @@
result = addKeyword(type,
strdup(str),
result);
+ md++;
}
return result;
}
-extern "C" {
-#if WORKAROUND_905
- static struct EXTRACTOR_Keywords * extract(const char * filename,
- unsigned char * data,
- size_t size,
- struct EXTRACTOR_Keywords * prev)
-#else
- struct EXTRACTOR_Keywords * libextractor_exiv2_extract(const char *
filename,
- unsigned char *
data,
- size_t size,
- struct
EXTRACTOR_Keywords * prev)
-#endif
- {
- struct EXTRACTOR_Keywords * result = prev;
+struct EXTRACTOR_Keywords * addIptcData(const Exiv2::IptcData& iptcData,
+ const std::string& key,
+ EXTRACTOR_KeywordType type,
+ struct EXTRACTOR_Keywords * result)
+{
+ const char * str;
+
+ Exiv2::IptcKey ek(key);
+ Exiv2::IptcData::const_iterator md = iptcData.findKey(ek);
+ while (md != iptcData.end())
+ {
+ if (0 != strcmp (Exiv2::toString(md->key()).c_str(), key.c_str()))
+ break;
+ std::string ccstr = Exiv2::toString(*md);
+ str = ccstr.c_str();
+ while ( (strlen(str) > 0) && isspace(str[0])) str++;
+ if (strlen(str) > 0)
+ result = addKeyword(type,
+ strdup(str),
+ result);
+ md++;
+ }
+ return result;
+}
- try {
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(data, size);
- assert(image.get() != 0);
- image->readMetadata();
- Exiv2::ExifData &exifData = image->exifData();
- if (exifData.empty()) return result;
- // Camera make
- result = addExiv2Tag(exifData,
- "Exif.Image.Make",
- EXTRACTOR_CAMERA_MAKE,
- result);
- // Camera model
- result = addExiv2Tag(exifData,
- "Exif.Image.Model",
- EXTRACTOR_CAMERA_MODEL,
- result);
- // Camera model
- result = addExiv2Tag(exifData,
- "Exif.Image.Orientation",
- EXTRACTOR_ORIENTATION,
- result);
- // Image Timestamp
- result = addExiv2Tag(exifData,
- "Exif.Photo.DateTimeOriginal",
- EXTRACTOR_DATE,
- result);
- // Exposure time
- // From ExposureTime, failing that, try ShutterSpeedValue
- struct EXTRACTOR_Keywords * newResult;
- newResult = addExiv2Tag(exifData,
- "Exif.Photo.ExposureTime",
- EXTRACTOR_EXPOSURE,
- result);
- Exiv2::ExifData::const_iterator md;
- if (newResult == result) {
- md =
exifData.findKey(Exiv2::ExifKey("Exif.Photo.ShutterSpeedValue"));
- if (md != exifData.end()) {
+extern "C" {
+
+#if WORKAROUND_905
+ static struct EXTRACTOR_Keywords * extract(const char * filename,
+ unsigned char * data,
+ size_t size,
+ struct EXTRACTOR_Keywords * prev)
+#else
+ struct EXTRACTOR_Keywords * libextractor_exiv2_extract(const char * filename,
+ unsigned char * data,
+ size_t size,
+ struct
EXTRACTOR_Keywords * prev)
+#endif
+ {
+ struct EXTRACTOR_Keywords * result = prev;
+ try
+ {
+ Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(data, size);
+ assert(image.get() != 0);
+ image->readMetadata();
+ Exiv2::ExifData &exifData = image->exifData();
+ if (!exifData.empty())
+ {
+ // Camera make
+ result = addExiv2Tag(exifData,
+ "Exif.Image.Make",
+ EXTRACTOR_CAMERA_MAKE,
+ result);
+
+ // Camera model
+ result = addExiv2Tag(exifData,
+ "Exif.Image.Model",
+ EXTRACTOR_CAMERA_MODEL,
+ result);
+
+ // Camera model
+ result = addExiv2Tag(exifData,
+ "Exif.Image.Orientation",
+ EXTRACTOR_ORIENTATION,
+ result);
+
+ // Image Timestamp
+ result = addExiv2Tag(exifData,
+ "Exif.Photo.DateTimeOriginal",
+ EXTRACTOR_DATE,
+ result);
+
+ // Exposure time
+ // From ExposureTime, failing that, try ShutterSpeedValue
+ struct EXTRACTOR_Keywords * newResult;
+ newResult = addExiv2Tag(exifData,
+ "Exif.Photo.ExposureTime",
+ EXTRACTOR_EXPOSURE,
+ result);
+ Exiv2::ExifData::const_iterator md;
+ if (newResult == result) {
+ md =
exifData.findKey(Exiv2::ExifKey("Exif.Photo.ShutterSpeedValue"));
+ if (md != exifData.end()) {
double tmp = exp(log(2.0) * md->toFloat()) + 0.5;
std::ostringstream os;
if (tmp > 1) {
- os << "1/" << static_cast<long>(tmp) << " s";
+ os << "1/" << static_cast<long>(tmp) << " s";
}
else {
- os << static_cast<long>(1/tmp) << " s";
+ os << static_cast<long>(1/tmp) << " s";
}
newResult = addKeyword(EXTRACTOR_EXPOSURE,
strdup(os.str().c_str()),
result);
- }
- }
- result = newResult;
-
- // Aperture
- // Get if from FNumber and, failing that, try ApertureValue
- newResult = addExiv2Tag(exifData,
- "Exif.Photo.FNumber",
- EXTRACTOR_APERTURE,
- result);
- if (newResult == result) {
- md = exifData.findKey(Exiv2::ExifKey("Exif.Photo.ApertureValue"));
- if (md != exifData.end()) {
+ }
+ }
+ result = newResult;
+
+ // Aperture
+ // Get if from FNumber and, failing that, try ApertureValue
+ newResult = addExiv2Tag(exifData,
+ "Exif.Photo.FNumber",
+ EXTRACTOR_APERTURE,
+ result);
+ if (newResult == result) {
+ md = exifData.findKey(Exiv2::ExifKey("Exif.Photo.ApertureValue"));
+ if (md != exifData.end()) {
std::ostringstream os;
os << std::fixed << std::setprecision(1)
<< "F" << exp(log(2.0) * md->toFloat() / 2);
newResult = addKeyword(EXTRACTOR_APERTURE,
strdup(os.str().c_str()),
result);
- }
- }
- result = newResult;
+ }
+ }
+ result = newResult;
+
+ // Exposure bias
+ result = addExiv2Tag(exifData,
+ "Exif.Photo.ExposureBiasValue",
+ EXTRACTOR_EXPOSURE_BIAS,
+ result);
+
+ // Flash
+ result = addExiv2Tag(exifData,
+ "Exif.Photo.Flash",
+ EXTRACTOR_FLASH,
+ result);
+
+ // Flash bias
+ // Todo: Implement this for other cameras
+ newResult = addExiv2Tag(exifData,
+ "Exif.CanonSi.FlashBias",
+ EXTRACTOR_FLASH_BIAS,
+ result);
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Panasonic.FlashBias",
+ EXTRACTOR_FLASH_BIAS,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Olympus.FlashBias",
+ EXTRACTOR_FLASH_BIAS,
+ result);
+ }
+ result = newResult;
+
+ // Actual focal length and 35 mm equivalent
+ // Todo: Calculate 35 mm equivalent a la jhead
+ result = addExiv2Tag(exifData,
+ "Exif.Photo.FocalLength",
+ EXTRACTOR_FOCAL_LENGTH,
+ result);
+
+ result = addExiv2Tag(exifData,
+ "Exif.Photo.FocalLengthIn35mmFilm",
+ EXTRACTOR_FOCAL_LENGTH_35MM,
+ result);
+
+ // ISO speed
+ // from ISOSpeedRatings or the Makernote
+ newResult = addExiv2Tag(exifData,
+ "Exif.Photo.ISOSpeedRatings",
+ EXTRACTOR_ISO_SPEED,
+ result);
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.CanonSi.ISOSpeed",
+ EXTRACTOR_ISO_SPEED,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon1.ISOSpeed",
+ EXTRACTOR_ISO_SPEED,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon2.ISOSpeed",
+ EXTRACTOR_ISO_SPEED,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon3.ISOSpeed",
+ EXTRACTOR_ISO_SPEED,
+ result);
+ }
+ result = newResult;
+
+ // Exposure mode
+ // From ExposureProgram or Canon Makernote
+ newResult = addExiv2Tag(exifData,
+ "Exif.Photo.ExposureProgram",
+ EXTRACTOR_EXPOSURE_MODE,
+ result);
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.CanonCs.ExposureProgram",
+ EXTRACTOR_EXPOSURE_MODE,
+ result);
+ }
+ result = newResult;
+
+ // Metering mode
+ result = addExiv2Tag(exifData,
+ "Exif.Photo.MeteringMode",
+ EXTRACTOR_METERING_MODE,
+ result);
+
+ // Macro mode
+ // Todo: Implement this for other cameras
+ newResult = addExiv2Tag(exifData,
+ "Exif.CanonCs.Macro",
+ EXTRACTOR_MACRO_MODE,
+ result);
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Fujifilm.Macro",
+ EXTRACTOR_MACRO_MODE,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Olympus.Macro",
+ EXTRACTOR_MACRO_MODE,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Panasonic.Macro",
+ EXTRACTOR_MACRO_MODE,
+ result);
+ }
+ result = newResult;
- // Exposure bias
- result = addExiv2Tag(exifData,
- "Exif.Photo.ExposureBiasValue",
- EXTRACTOR_EXPOSURE_BIAS,
- result);
+ // Image quality setting (compression)
+ // Todo: Implement this for other cameras
+ newResult = addExiv2Tag(exifData,
+ "Exif.CanonCs.Quality",
+ EXTRACTOR_IMAGE_QUALITY,
+ result);
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Fujifilm.Quality",
+ EXTRACTOR_IMAGE_QUALITY,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Sigma.Quality",
+ EXTRACTOR_IMAGE_QUALITY,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon1.Quality",
+ EXTRACTOR_IMAGE_QUALITY,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon2.Quality",
+ EXTRACTOR_IMAGE_QUALITY,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon3.Quality",
+ EXTRACTOR_IMAGE_QUALITY,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Olympus.Quality",
+ EXTRACTOR_IMAGE_QUALITY,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Panasonic.Quality",
+ EXTRACTOR_IMAGE_QUALITY,
+ result);
+ }
+ result = newResult;
+
- // Flash
- result = addExiv2Tag(exifData,
- "Exif.Photo.Flash",
- EXTRACTOR_FLASH,
- result);
+ /* this can sometimes be wrong (corrupt exiv2 data?).
+ Either way, we should get the data directly from
+ the specific file format parser (i.e. jpeg, tiff). */
+ // Exif Resolution
+ unsigned long xdim = 0;
+ unsigned long ydim = 0;
+ md = exifData.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension"));
+ if (md != exifData.end()) xdim = md->toLong();
+ md = exifData.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension"));
+ if (md != exifData.end()) ydim = md->toLong();
+ if (xdim != 0 && ydim != 0) {
+ std::ostringstream os;
+ os << xdim << "x" << ydim;
+ result = addKeyword(EXTRACTOR_SIZE,
+ strdup(os.str().c_str()),
+ result);
+ }
+ // White balance
+ // Todo: Implement this for other cameras
+
+ newResult = addExiv2Tag(exifData,
+ "Exif.CanonSi.WhiteBalance",
+ EXTRACTOR_WHITE_BALANCE,
+ result);
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Fujifilm.WhiteBalance",
+ EXTRACTOR_WHITE_BALANCE,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Sigma.WhiteBalance",
+ EXTRACTOR_WHITE_BALANCE,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon1.WhiteBalance",
+ EXTRACTOR_WHITE_BALANCE,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon2.WhiteBalance",
+ EXTRACTOR_WHITE_BALANCE,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Nikon3.WhiteBalance",
+ EXTRACTOR_WHITE_BALANCE,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Olympus.WhiteBalance",
+ EXTRACTOR_WHITE_BALANCE,
+ result);
+ }
+ if (newResult == result) {
+ newResult = addExiv2Tag(exifData,
+ "Exif.Panasonic.WhiteBalance",
+ EXTRACTOR_WHITE_BALANCE,
+ result);
+ }
+ result = newResult;
+
+ // Copyright
+ result = addExiv2Tag(exifData,
+ "Exif.Image.Copyright",
+ EXTRACTOR_COPYRIGHT,
+ result);
+
+ // Exif Comment
+ result = addExiv2Tag(exifData,
+ "Exif.Photo.UserComment",
+ EXTRACTOR_COMMENT,
+ result);
+ // GPS
+ result = addExiv2Tag(exifData,
+ "Exif.GPSInfo.GPSLatitudeRef",
+ EXTRACTOR_GPS_LATITUDE_REF,
+ result);
+ result = addExiv2Tag(exifData,
+ "Exif.GPSInfo.GPSLatitude",
+ EXTRACTOR_GPS_LATITUDE,
+ result);
+ result = addExiv2Tag(exifData,
+ "Exif.GPSInfo.GPSLongitudeRef",
+ EXTRACTOR_GPS_LONGITUDE_REF,
+ result);
+ result = addExiv2Tag(exifData,
+ "Exif.GPSInfo.GPSLongitude",
+ EXTRACTOR_GPS_LONGITUDE,
+ result);
+ }
- // Flash bias
- // Todo: Implement this for other cameras
- newResult = addExiv2Tag(exifData,
- "Exif.CanonSi.FlashBias",
- EXTRACTOR_FLASH_BIAS,
- result);
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Panasonic.FlashBias",
- EXTRACTOR_FLASH_BIAS,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Olympus.FlashBias",
- EXTRACTOR_FLASH_BIAS,
- result);
- }
- result = newResult;
+ Exiv2::IptcData &iptcData = image->iptcData();
+ if (! iptcData.empty()) {
+ result = addIptcData (iptcData,
+ "Iptc.Application2.Keywords",
+ EXTRACTOR_KEYWORDS,
+ result);
+ result = addIptcData (iptcData,
+ "Iptc.Application2.City",
+ EXTRACTOR_LOCATION_CITY,
+ result);
+ result = addIptcData (iptcData,
+ "Iptc.Application2.SubLocation",
+ EXTRACTOR_LOCATION_SUBLOCATION,
+ result);
+ result = addIptcData (iptcData,
+ "Iptc.Application2.CountryName",
+ EXTRACTOR_LOCATION_COUNTRY,
+ result);
+
+ }
- // Actual focal length and 35 mm equivalent
- // Todo: Calculate 35 mm equivalent a la jhead
- result = addExiv2Tag(exifData,
- "Exif.Photo.FocalLength",
- EXTRACTOR_FOCAL_LENGTH,
- result);
-
- result = addExiv2Tag(exifData,
- "Exif.Photo.FocalLengthIn35mmFilm",
- EXTRACTOR_FOCAL_LENGTH_35MM,
- result);
-
- // ISO speed
- // from ISOSpeedRatings or the Makernote
- newResult = addExiv2Tag(exifData,
- "Exif.Photo.ISOSpeedRatings",
- EXTRACTOR_ISO_SPEED,
- result);
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.CanonSi.ISOSpeed",
- EXTRACTOR_ISO_SPEED,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon1.ISOSpeed",
- EXTRACTOR_ISO_SPEED,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon2.ISOSpeed",
- EXTRACTOR_ISO_SPEED,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon3.ISOSpeed",
- EXTRACTOR_ISO_SPEED,
- result);
- }
- result = newResult;
-
- // Exposure mode
- // From ExposureProgram or Canon Makernote
- newResult = addExiv2Tag(exifData,
- "Exif.Photo.ExposureProgram",
- EXTRACTOR_EXPOSURE_MODE,
- result);
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.CanonCs.ExposureProgram",
- EXTRACTOR_EXPOSURE_MODE,
- result);
- }
- result = newResult;
-
- // Metering mode
- result = addExiv2Tag(exifData,
- "Exif.Photo.MeteringMode",
- EXTRACTOR_METERING_MODE,
- result);
-
- // Macro mode
- // Todo: Implement this for other cameras
- newResult = addExiv2Tag(exifData,
- "Exif.CanonCs.Macro",
- EXTRACTOR_MACRO_MODE,
- result);
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Fujifilm.Macro",
- EXTRACTOR_MACRO_MODE,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Olympus.Macro",
- EXTRACTOR_MACRO_MODE,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Panasonic.Macro",
- EXTRACTOR_MACRO_MODE,
- result);
- }
- result = newResult;
-
- // Image quality setting (compression)
- // Todo: Implement this for other cameras
- newResult = addExiv2Tag(exifData,
- "Exif.CanonCs.Quality",
- EXTRACTOR_IMAGE_QUALITY,
- result);
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Fujifilm.Quality",
- EXTRACTOR_IMAGE_QUALITY,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Sigma.Quality",
- EXTRACTOR_IMAGE_QUALITY,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon1.Quality",
- EXTRACTOR_IMAGE_QUALITY,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon2.Quality",
- EXTRACTOR_IMAGE_QUALITY,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon3.Quality",
- EXTRACTOR_IMAGE_QUALITY,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Olympus.Quality",
- EXTRACTOR_IMAGE_QUALITY,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Panasonic.Quality",
- EXTRACTOR_IMAGE_QUALITY,
- result);
- }
- result = newResult;
-
- /* this can sometimes be wrong (corrupt exiv2 data?).
- Either way, we should get the data directly from
- the specific file format parser (i.e. jpeg, tiff). */
- // Exif Resolution
- unsigned long xdim = 0;
- unsigned long ydim = 0;
- md = exifData.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension"));
- if (md != exifData.end()) xdim = md->toLong();
- md = exifData.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension"));
- if (md != exifData.end()) ydim = md->toLong();
- if (xdim != 0 && ydim != 0) {
- std::ostringstream os;
- os << xdim << "x" << ydim;
- result = addKeyword(EXTRACTOR_SIZE,
- strdup(os.str().c_str()),
- result);
- }
- // White balance
- // Todo: Implement this for other cameras
-
- newResult = addExiv2Tag(exifData,
- "Exif.CanonSi.WhiteBalance",
- EXTRACTOR_WHITE_BALANCE,
- result);
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Fujifilm.WhiteBalance",
- EXTRACTOR_WHITE_BALANCE,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Sigma.WhiteBalance",
- EXTRACTOR_WHITE_BALANCE,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon1.WhiteBalance",
- EXTRACTOR_WHITE_BALANCE,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon2.WhiteBalance",
- EXTRACTOR_WHITE_BALANCE,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Nikon3.WhiteBalance",
- EXTRACTOR_WHITE_BALANCE,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Olympus.WhiteBalance",
- EXTRACTOR_WHITE_BALANCE,
- result);
- }
- if (newResult == result) {
- newResult = addExiv2Tag(exifData,
- "Exif.Panasonic.WhiteBalance",
- EXTRACTOR_WHITE_BALANCE,
- result);
- }
- result = newResult;
-
- // Copyright
- result = addExiv2Tag(exifData,
- "Exif.Image.Copyright",
- EXTRACTOR_COPYRIGHT,
- result);
-
- // Exif Comment
- result = addExiv2Tag(exifData,
- "Exif.Photo.UserComment",
- EXTRACTOR_COMMENT,
- result);
- }
- catch (const Exiv2::AnyError& e) {
+
+ }
+ catch (const Exiv2::AnyError& e) {
#ifndef SUPPRESS_WARNINGS
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ std::cout << "Caught Exiv2 exception '" << e << "'\n";
#endif
- }
-
- return result;
}
+
+ return result;
+ }
-
#if WORKAROUND_905
-
struct X {
unsigned char * data;
size_t size;
@@ -470,5 +542,4 @@
}
#endif
-
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9698 - in Extractor: . src/include src/main src/plugins/exiv2,
gnunet <=