[Kde-imaging] KDE/kdegraphics/libs/libkexiv2/libkexiv2
Gilles Caulier
caulier.gilles at gmail.com
Sun Jun 22 19:09:16 CEST 2008
SVN commit 823156 by cgilles:
fix compilation using current Exiv2 from trunk (future Exiv2 0.18 with tiff write mode support)
here linking faild with Exiv2Data::sortByKey(). i don't know why yet.
Note : Take a care than Exiv2 from trunk still alpha stage and do not be used in production yet. there are huge changes in API.
CCMAIL: digikam-devel at kde.org
CCMAIL: kde-imaging at kde.org
M +24 -3 kexiv2exif.cpp
M +15 -0 kexiv2iptc.cpp
--- trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2exif.cpp #823155:823156
@@ -62,8 +62,14 @@
{
QByteArray data;
Exiv2::ExifData& exif = d->exifMetadata;
- Exiv2::DataBuf c2 = exif.copy();
+#if (EXIV2_TEST_VERSION(0,17,91))
+ Exiv2::Blob blob;
+ Exiv2::ExifParser::encode(blob, Exiv2::bigEndian, exif);
+ QByteArray ba((const char*)&blob[0], blob.size());
+#else
+ Exiv2::DataBuf c2 = exif.copy();
QByteArray ba((const char*)c2.pData_, c2.size_);
+#endif
if (addExifHeader)
{
const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
@@ -95,10 +101,15 @@
{
if (!data.isEmpty())
{
+#if (EXIV2_TEST_VERSION(0,17,91))
+ Exiv2::ExifParser::decode(d->exifMetadata, (const Exiv2::byte*)data.data(), data.size());
+ return (!d->exifMetadata.empty());
+#else
if (d->exifMetadata.load((const Exiv2::byte*)data.data(), data.size()) != 0)
return false;
else
return true;
+#endif
}
}
catch( Exiv2::Error &e )
@@ -290,8 +301,8 @@
catch( Exiv2::Error &e )
{
d->printExiv2ExceptionError("Cannot remove Exif tag using Exiv2 ", e);
- }
-
+ }
+
return false;
}
@@ -691,7 +702,12 @@
try
{
+#if (EXIV2_TEST_VERSION(0,17,91))
+ Exiv2::ExifThumbC thumb(d->exifMetadata);
+ Exiv2::DataBuf const c1 = thumb.copy();
+#else
Exiv2::DataBuf const c1(d->exifMetadata.copyThumbnail());
+#endif
thumbnail.loadFromData(c1.pData_, c1.size_);
if (!thumbnail.isNull())
@@ -784,7 +800,12 @@
qDebug("Thumbnail temp file: %s", thumbFile.fileName().toAscii().data());
const std::string &fileName((const char*)(QFile::encodeName(thumbFile.fileName())));
+#if (EXIV2_TEST_VERSION(0,17,91))
+ Exiv2::ExifThumb thumb(d->exifMetadata);
+ thumb.setJpegThumbnail( fileName );
+#else
d->exifMetadata.setJpegThumbnail( fileName );
+#endif
return true;
}
catch( Exiv2::Error &e )
--- trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2iptc.cpp #823155:823156
@@ -73,7 +73,15 @@
#endif
}
else
+ {
+ // Since 0.18 release, API has changed.
+
+#if (EXIV2_TEST_VERSION(0,17,91))
+ c2 = Exiv2::IptcParser::encode(d->iptcMetadata);
+#else
c2 = iptc.copy();
+#endif
+ }
QByteArray data((const char*)c2.pData_, c2.size_);
return data;
@@ -97,10 +105,17 @@
{
if (!data.isEmpty())
{
+ // Since 0.18 release, API has changed.
+
+#if (EXIV2_TEST_VERSION(0,17,91))
+ Exiv2::IptcParser::decode(d->iptcMetadata, (const Exiv2::byte*)data.data(), data.size());
+ return (!d->iptcMetadata.empty());
+#else
if (d->iptcMetadata.load((const Exiv2::byte*)data.data(), data.size()) != 0)
return false;
else
return true;
+#endif
}
}
catch( Exiv2::Error &e )
More information about the Kde-imaging
mailing list