Commit e51a7235 authored by Dirk Mueller's avatar Dirk Mueller
Browse files

revert libkexiv so bump breakage as well

svn path=/branches/KDE/4.1/kdegraphics/libs/libkexiv2/; revision=866938
parent 588a3e29
......@@ -15,12 +15,11 @@ PROJECT(libkexiv2)
# 0.1.7 => 4.0.1
# 0.1.8 => 5.0.0
# ... here we can have new releases from KDE3 branch
# 0.2.0 => 6.0.0 (released with KDE 4.1.0)
# 0.3.0 => 7.0.0
# 0.2.0 => 6.0.0
# Library API version
SET(KEXIV2_LIB_MAJOR_VERSION "0")
SET(KEXIV2_LIB_MINOR_VERSION "3")
SET(KEXIV2_LIB_MINOR_VERSION "2")
SET(KEXIV2_LIB_PATCH_VERSION "0")
# Suffix to add at end of version string. Usual values are:
......@@ -30,11 +29,11 @@ SET(KEXIV2_LIB_PATCH_VERSION "0")
# "-beta3" : beta3 release.
# "-rc" : release candidate.
# "" : final relase. Can be used in production.
SET(KEXIV2_LIB_SUFFIX_VERSION "")
SET(KEXIV2_LIB_SUFFIX_VERSION "-svn")
# Library ABI version used by linker.
# For details : http://www.gnu.org/software/libtool/manual.html#Updating-version-info
SET(KEXIV2_LIB_SO_CUR_VERSION "7")
SET(KEXIV2_LIB_SO_CUR_VERSION "6")
SET(KEXIV2_LIB_SO_REV_VERSION "0")
SET(KEXIV2_LIB_SO_AGE_VERSION "0")
......
0.3.0 -
------------------------------------------------------------------------
- API changed: Added 2 new static methods to init and clear non re-entrant Adobe XMP
SDK code from Exiv2 core. This code must be called before and after
all multithreaded operations with KExiv2.
* initializeExiv2().
* cleanupExiv2().
Added a new method to load image data from a byte array.
Bugs fixed from B.K.O (http://bugs.kde.org):
001 ==> 166424: Crash when editing Caption with Digikam4 SVN.
0.2.0 - Released with KDE 4.1.0
0.2.0
------------------------------------------------------------------------
Port to CMake/KDE4/QT4
Support of XMP metadata (require Exiv2 0.16)
Split methods to separate files to provide a more readable implementation.
New method to fix orientation of a QImage accordingly with Exif orientation tag.
Moved from extragear/libs to kdegraphics/libs
Bugs fixed from B.K.O (http://bugs.kde.org):
001 ==> 146864: Lesser XMP support in digiKam.
......
......@@ -17,10 +17,10 @@ The library documentation is available on header files.
-- DEPENDENCIES -------------------------------------------------------
CMake >= 2.4.x http://www.cmake.org
libqt >= 4.2.x http://www.trolltech.com
libkde >= 4.0.x http://www.kde.org
libexiv2 >= 0.13 (0.18 recommended) http://www.exiv2.org
CMake >= 2.4.x http://www.cmake.org
libqt >= 4.2.x http://www.trolltech.com
libkde >= 4.0.x http://www.kde.org
libexiv2 >= 0.12 (0.17 recommended) http://www.exiv2.org
Note: Exiv2 >= 0.16 is require to handle XMP metadata.
......
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
INCLUDE_DIRECTORIES(${EXIV2_INCLUDE_DIR})
ADD_DEFINITIONS(${EXIV2_DEFINITIONS})
ADD_DEFINITIONS(${KDE4_ENABLE_EXCEPTIONS})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h)
# This was used to enable catching of exceptions thrown by libexiv2.
......@@ -22,7 +20,7 @@ SET(kexiv2_LIB_SRCS kexiv2.cpp
KDE4_ADD_LIBRARY(kexiv2 SHARED ${kexiv2_LIB_SRCS})
TARGET_LINK_LIBRARIES(kexiv2 ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} ${EXIV2_LIBRARIES})
TARGET_LINK_LIBRARIES(kexiv2 ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} exiv2)
IF( WIN32 )
TARGET_LINK_LIBRARIES( kexiv2 ${EXPAT_LIBRARIES} )
......
......@@ -83,25 +83,6 @@ KExiv2& KExiv2::operator=(const KExiv2& metadata)
//-- Statics methods ----------------------------------------------
bool KExiv2::initializeExiv2()
{
#ifdef _XMP_SUPPORT_
return (Exiv2::XmpParser::initialize());
#endif // _XMP_SUPPORT_
return true;
}
bool KExiv2::cleanupExiv2()
{
// Fix memory leak if Exiv2 support XMP.
#ifdef _XMP_SUPPORT_
Exiv2::XmpParser::terminate();
#endif // _XMP_SUPPORT_
return true;
}
bool KExiv2::supportXmp()
{
#ifdef _XMP_SUPPORT_
......@@ -111,38 +92,13 @@ bool KExiv2::supportXmp()
#endif // _XMP_SUPPORT_
}
bool KExiv2::supportMetadataWritting(const QString& typeMime)
bool KExiv2::supportTiffWritting()
{
if (typeMime == QString("image/jpeg"))
{
return true;
}
else if (typeMime == QString("image/tiff"))
{
#if (EXIV2_TEST_VERSION(0,17,91))
return true;
#else
return false;
#endif
}
else if (typeMime == QString("image/png"))
{
#if (EXIV2_TEST_VERSION(0,17,91))
return true;
#else
return false;
#endif
}
else if (typeMime == QString("image/jp2"))
{
#if (EXIV2_TEST_VERSION(0,17,91))
return true;
return true;
#else
return false;
#endif
}
return false;
#endif
}
QString KExiv2::Exiv2Version()
......@@ -185,48 +141,6 @@ bool KExiv2::isReadOnly(const QString& filePath)
//-- General methods ----------------------------------------------
bool KExiv2::load(const QByteArray& imgData) const
{
if (imgData.isEmpty())
return false;
try
{
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open((Exiv2::byte*)imgData.data(), imgData.size());
d->filePath = QString();
image->readMetadata();
// Image comments ---------------------------------
d->imageComments = image->comment();
// Exif metadata ----------------------------------
d->exifMetadata = image->exifData();
// Iptc metadata ----------------------------------
d->iptcMetadata = image->iptcData();
#ifdef _XMP_SUPPORT_
// Xmp metadata -----------------------------------
d->xmpMetadata = image->xmpData();
#endif // _XMP_SUPPORT_
return true;
}
catch( Exiv2::Error &e )
{
d->printExiv2ExceptionError("Cannot load metadata using Exiv2 ", e);
}
return false;
}
bool KExiv2::load(const QString& filePath) const
{
QFileInfo finfo(filePath);
......@@ -238,6 +152,7 @@ bool KExiv2::load(const QString& filePath) const
try
{
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open((const char*)
(QFile::encodeName(filePath)));
......@@ -293,14 +208,6 @@ bool KExiv2::save(const QString& filePath) const
return false;
}
// TIFF/EP Raw file based supported by Exiv2 0.18 are : DNG, NEF, PEF.
QString rawTiffBasedNotSupported("3fr arw cr2 dcr erf k25 kdc mos orf raw sr2 srf");
if (rawTiffBasedNotSupported.contains(finfo.suffix().toUpper()))
{
qDebug("'%s' is TIFF based RAW file not yet supported. Metadata not saved.", dinfo.filePath().toAscii().constData());
return false;
}
try
{
Exiv2::AccessMode mode;
......@@ -328,12 +235,11 @@ bool KExiv2::save(const QString& filePath) const
{
if (image->mimeType() == "image/tiff")
{
Exiv2::ExifData exif = image->exifData();
QStringList untouchedTags;
// With tiff image we cannot overwrite whole Exif data as well, because
// image data are stored in Exif container. We need to take a care about
// to not lost image data.
Exiv2::ExifData exif = image->exifData();
QStringList untouchedTags;
untouchedTags << "Exif.Image.ImageWidth";
untouchedTags << "Exif.Image.ImageLength";
untouchedTags << "Exif.Image.BitsPerSample";
......
......@@ -118,27 +118,13 @@ public:
//-- STATICS methods ----------------------------------------------
//-----------------------------------------------------------------
/** Return true if Exiv2 library initialization is done properlly.
This method must be call before to use multithreading with libkexiv2.
It initialize several non re-entrancy code from Adobe XMP SDK
See B.K.O #166424 for details.
*/
static bool initializeExiv2();
/** Return true if Exiv2 library memory allocations are cleaned properlly.
This method must be call after to use multithreading with libkexiv2.
It cleanup memory used by Adobe XMP SDK
See B.K.O #166424 for details.
*/
static bool cleanupExiv2();
/** Return true if library can handle Xmp metadata
*/
static bool supportXmp();
/** Return true if library can writte metadata to typeMime file format.
/** Return true if library can writte metadata to TIFF/DNG files
*/
static bool supportMetadataWritting(const QString& typeMime);
static bool supportTiffWritting();
/** Return a string version of Exiv2 release in format "major.minor.patch"
*/
......@@ -156,11 +142,6 @@ public:
//-- GENERAL methods ----------------------------------------------
//-----------------------------------------------------------------
/** Load all metadata (Exif, Iptc, Xmp, and JFIF Comments) from a byte array.
Return true if metadata have been loaded successfully from image data.
*/
bool load(const QByteArray& imgData) const;
/** Load all metadata (Exif, Iptc, Xmp, and JFIF Comments) from a picture (JPEG, RAW, TIFF, PNG,
DNG, etc...). Return true if metadata have been loaded successfully from file.
*/
......
......@@ -185,7 +185,7 @@ bool KExiv2::getGPSAltitude(double *altitude) const
Exiv2::ExifKey exifKey3("Exif.GPSInfo.GPSAltitude");
Exiv2::ExifData exifData(d->exifMetadata);
Exiv2::ExifData::iterator it = exifData.findKey(exifKey3);
if (it != exifData.end() && (*it).count())
if (it != exifData.end())
{
num = (double)((*it).toRational(0).first);
den = (double)((*it).toRational(0).second);
......@@ -226,7 +226,7 @@ QString KExiv2::getGPSLatitudeString() const
Exiv2::ExifKey exifKey("Exif.GPSInfo.GPSLatitude");
Exiv2::ExifData exifData(d->exifMetadata);
Exiv2::ExifData::iterator it = exifData.findKey(exifKey);
if (it != exifData.end() && (*it).count() == 3)
if (it != exifData.end())
{
return convertToGPSCoordinateString((*it).toRational(0).first, (*it).toRational(0).second,
(*it).toRational(1).first, (*it).toRational(1).second,
......@@ -258,7 +258,7 @@ QString KExiv2::getGPSLongitudeString() const
Exiv2::ExifKey exifKey("Exif.GPSInfo.GPSLongitude");
Exiv2::ExifData exifData(d->exifMetadata);
Exiv2::ExifData::iterator it = exifData.findKey(exifKey);
if (it != exifData.end() && (*it).count() == 3)
if (it != exifData.end())
{
return convertToGPSCoordinateString((*it).toRational(0).first, (*it).toRational(0).second,
(*it).toRational(1).first, (*it).toRational(1).second,
......
......@@ -708,7 +708,7 @@ bool KExiv2::setImageDateTime(const QDateTime& dateTime, bool setDateTimeDigitiz
// In second we write date & time into Xmp.
const std::string &xmpdatetime(dateTime.toString(Qt::ISODate).toAscii().constData());
const std::string &xmpdatetime(dateTime.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii().constData());
Exiv2::Value::AutoPtr xmpTxtVal = Exiv2::Value::create(Exiv2::xmpText);
xmpTxtVal->read(xmpdatetime);
......
......@@ -35,10 +35,18 @@ namespace KExiv2Iface
KExiv2Priv::KExiv2Priv()
{
imageComments = std::string();
#ifdef _XMP_SUPPORT_
Exiv2::XmpProperties::registerNs("http://www.microsoft.com/Photo/", "MicrosoftPhoto");
#endif
}
KExiv2Priv::~KExiv2Priv()
{
// Fix memory leak if Exiv2 support XMP.
#ifdef _XMP_SUPPORT_
Exiv2::XmpParser::terminate();
#endif // _XMP_SUPPORT_
}
void KExiv2Priv::printExiv2ExceptionError(const QString& msg, Exiv2::Error& e)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment