[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:46:35 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=b3f107b
The following commit has been merged in the master branch:
commit b3f107bd8ce7ae5790a327580f0a8b2c749855ef
Author: Robin Mills <robin at clanmills.com>
Date: Mon Aug 8 14:33:49 2016 +0000
#1199 WebP Support (work in progress). Thank You to Ben for the patch. Thanks to Gilles for encouragement.
---
include/exiv2/{xmpsidecar.hpp => webpimage.hpp} | 71 ++---
msvc2005/libexiv2/libexiv2.vcproj | 8 +
src/CMakeLists.txt | 2 +
src/Makefile | 3 +-
src/image.cpp | 2 +
src/webpimage.cpp | 402 ++++++++++++++++++++++++
6 files changed, 452 insertions(+), 36 deletions(-)
diff --git a/include/exiv2/xmpsidecar.hpp b/include/exiv2/webpimage.hpp
similarity index 62%
copy from include/exiv2/xmpsidecar.hpp
copy to include/exiv2/webpimage.hpp
index 1b5225d..652384f 100644
--- a/include/exiv2/xmpsidecar.hpp
+++ b/include/exiv2/webpimage.hpp
@@ -19,24 +19,21 @@
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
/*!
- @file xmpsidecar.hpp
- @brief An Image subclass to support XMP sidecar files
- @version $Rev: 3090 $
- @author Andreas Huggel
- <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
- @date 07-Mar-08, ahu: created
+ @file webpimage.hpp
+ @brief An Image subclass to support WEBP image files
+ @version $Rev$
+ @author Ben Touchette
+ <a href="mailto:draekko.software+exiv2 at gmail.com">draekko.software+exiv2 at gmail.com</a>
+ @date 29-Jul-16
*/
-#ifndef XMPSIDECAR_HPP_
-#define XMPSIDECAR_HPP_
+#ifndef WEBPIMAGE_HPP
+#define WEBPIMAGE_HPP
// *****************************************************************************
// included header files
+#include "exif.hpp"
#include "image.hpp"
-#include "basicio.hpp"
-#include "types.hpp"
-
-// + standard includes
-#include <string>
+#include "tags_int.hpp"
// *****************************************************************************
// namespace extensions
@@ -45,20 +42,21 @@ namespace Exiv2 {
// *****************************************************************************
// class definitions
- // Add XMP to the supported image formats
+ // Add WEBP to the supported image formats
namespace ImageType {
- const int xmp = 10; //!< XMP sidecar files (see class XmpSidecar)
+ const int webp = 23; //!< Treating webp as an image type>
}
/*!
- @brief Class to access XMP sidecar files. They contain only XMP metadata.
+ @brief Class to access WEBP video files.
*/
- class EXIV2API XmpSidecar : public Image {
+ class EXIV2API WebPImage:public Image
+ {
public:
//! @name Creators
//@{
/*!
- @brief Constructor for an XMP sidecar file. Since the constructor
+ @brief Constructor for a WebP video. Since the constructor
can not return a result, callers should check the good() method
after object construction to determine success or failure.
@param io An auto-pointer that owns a BasicIo instance used for
@@ -67,22 +65,21 @@ namespace Exiv2 {
auto-pointer. Callers should not continue to use the BasicIo
instance after it is passed to this method. Use the Image::io()
method to get a temporary reference.
- @param create Specifies if an existing image should be read (false)
- or if a new image should be created (true).
*/
- XmpSidecar(BasicIo::AutoPtr io, bool create);
+ WebPImage(BasicIo::AutoPtr io);
//@}
//! @name Manipulators
//@{
void readMetadata();
void writeMetadata();
+ //@}
+
/*!
- @brief Not supported. XMP sidecar files do not contain a comment.
- Calling this function will throw an instance of Error(32).
+ @brief Not supported. Calling this function will throw an Error(32).
*/
void setComment(const std::string& comment);
- //@}
+ void setIptcData(const IptcData& iptcData);
//! @name Accessors
//@{
@@ -90,17 +87,21 @@ namespace Exiv2 {
//@}
private:
+ EXV_DLLLOCAL void doWriteMetadata(BasicIo& outIo);
//! @name NOT Implemented
//@{
+ bool equalsWebPTag(Exiv2::DataBuf& buf ,const char* str);
+ void decodeChunks(uint64_t filesize);
//! Copy constructor
- XmpSidecar(const XmpSidecar& rhs);
+ WebPImage(const WebPImage& rhs);
//! Assignment operator
- XmpSidecar& operator=(const XmpSidecar& rhs);
+ WebPImage& operator=(const WebPImage& rhs);
//@}
- Exiv2::Dictionary dates_;
+ private:
+ int streamType_;
- }; // class XmpSidecar
+ }; //Class WebPImage
// *****************************************************************************
// template, inline and free functions
@@ -108,15 +109,15 @@ namespace Exiv2 {
// These could be static private functions on Image subclasses but then
// ImageFactory needs to be made a friend.
/*!
- @brief Create a new XmpSidecar instance and return an auto-pointer to it.
- Caller owns the returned object and the auto-pointer ensures that
- it will be deleted.
+ @brief Create a new WebPImage instance and return an auto-pointer to it.
+ Caller owns the returned object and the auto-pointer ensures that
+ it will be deleted.
*/
- EXIV2API Image::AutoPtr newXmpInstance(BasicIo::AutoPtr io, bool create);
+ EXIV2API Image::AutoPtr newWebPInstance(BasicIo::AutoPtr io, bool create);
- //! Check if the file iIo is an XMP sidecar file.
- EXIV2API bool isXmpType(BasicIo& iIo, bool advance);
+ //! Check if the file iIo is a WebP Video.
+ EXIV2API bool isWebPType(BasicIo& iIo, bool advance);
} // namespace Exiv2
-#endif // #ifndef XMPSIDECAR_HPP_
+#endif // WEBPIMAGE_HPP
diff --git a/msvc2005/libexiv2/libexiv2.vcproj b/msvc2005/libexiv2/libexiv2.vcproj
index 2d602d5..e8a4220 100644
--- a/msvc2005/libexiv2/libexiv2.vcproj
+++ b/msvc2005/libexiv2/libexiv2.vcproj
@@ -909,6 +909,10 @@
>
</File>
<File
+ RelativePath="..\..\src\webpimage.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\src\xmp.cpp"
>
</File>
@@ -1099,6 +1103,10 @@
>
</File>
<File
+ RelativePath="..\..\include\exiv2\webpimage.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\include\exiv2\xmp.hpp"
>
</File>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fec7e82..4632007 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -79,6 +79,7 @@ SET( LIBEXIV2_HDR ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/asfvideo.hp
${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/utilsvideo.hpp
${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/value.hpp
${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/version.hpp
+ ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/webpimage.hpp
${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/xmp.hpp
${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/xmpsidecar.hpp
${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/utilsvideo.hpp
@@ -138,6 +139,7 @@ SET( LIBEXIV2_SRC asfvideo.cpp
utilsvideo.cpp
value.cpp
version.cpp
+ webpimage.cpp
xmp.cpp
xmpsidecar.cpp
utilsvideo.cpp
diff --git a/src/Makefile b/src/Makefile
index 585b154..8a8366f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -120,10 +120,11 @@ CCSRC += sigmamn.cpp \
types.cpp \
value.cpp \
version.cpp \
+ webpimage.cpp \
xmp.cpp \
xmpsidecar.cpp
ifdef ENABLE_VIDEO
-CCSRC += asfvideo.cpp \
+CCSRC += asfvideo.cpp \
matroskavideo.cpp \
quicktimevideo.cpp \
riffvideo.cpp \
diff --git a/src/image.cpp b/src/image.cpp
index 7f04871..b40ba61 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -50,6 +50,7 @@ EXIV2_RCSID("@(#) $Id$")
#endif // EXV_HAVE_LIBZ
#include "rafimage.hpp"
#include "tiffimage.hpp"
+#include "webpimage.hpp"
#include "orfimage.hpp"
#include "gifimage.hpp"
#include "psdimage.hpp"
@@ -112,6 +113,7 @@ namespace {
{ ImageType::crw, newCrwInstance, isCrwType, amReadWrite, amNone, amNone, amReadWrite },
{ ImageType::mrw, newMrwInstance, isMrwType, amRead, amRead, amRead, amNone },
{ ImageType::tiff, newTiffInstance, isTiffType, amReadWrite, amReadWrite, amReadWrite, amNone },
+ { ImageType::webp, newWebPInstance, isWebPType, amReadWrite, amReadWrite, amReadWrite, amNone },
{ ImageType::dng, newTiffInstance, isTiffType, amReadWrite, amReadWrite, amReadWrite, amNone },
{ ImageType::nef, newTiffInstance, isTiffType, amReadWrite, amReadWrite, amReadWrite, amNone },
{ ImageType::pef, newTiffInstance, isTiffType, amReadWrite, amReadWrite, amReadWrite, amNone },
diff --git a/src/webpimage.cpp b/src/webpimage.cpp
new file mode 100644
index 0000000..c5bddac
--- /dev/null
+++ b/src/webpimage.cpp
@@ -0,0 +1,402 @@
+// ***************************************************************** -*- C++ -*-
+/*
+ * Copyright (C) 2004-2015 Andreas Huggel <ahuggel at gmx.net>
+ *
+ * This program is part of the Exiv2 distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
+ */
+/*
+ File: webpimage.cpp
+ Version: $Rev: 3845 $
+ Author(s): Ben Touchette <draekko.software+exiv2 at gmail.com>
+ History: 29-Jul-16
+ Credits: See header file
+ */
+// *****************************************************************************
+#include "rcsid_int.hpp"
+
+// *****************************************************************************
+// included header files
+#include "config.h"
+
+#include "webpimage.hpp"
+#include "futils.hpp"
+#include "basicio.hpp"
+#include "tags.hpp"
+#include "tags_int.hpp"
+#include "types.hpp"
+#include "tiffimage.hpp"
+#include "tiffimage_int.hpp"
+#include "exiv2/convert.hpp"
+#include <cmath>
+#include <sstream>
+#include <iomanip>
+#include <string>
+#include <cstring>
+#include <iostream>
+#include <cassert>
+#include <cstdio>
+
+#include <zlib.h> // To uncompress or compress text chunk
+
+#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
+
+// *****************************************************************************
+// class member definitions
+namespace Exiv2 {
+ namespace Internal {
+
+
+}} // namespace Internal, Exiv2
+
+namespace Exiv2 {
+ using namespace Exiv2::Internal;
+
+ WebPImage::WebPImage(BasicIo::AutoPtr io)
+ : Image(ImageType::webp, mdNone, io)
+ {
+ } // WebPImage::WebPImage
+
+ std::string WebPImage::mimeType() const
+ {
+ return "image/webp";
+ }
+
+ /* =========================================== */
+
+ void WebPImage::setIptcData(const IptcData& /*iptcData*/)
+ {
+ // not supported
+ throw(Error(32, "IPTC metadata", "WebP"));
+ }
+
+ void WebPImage::setComment(const std::string& /*comment*/)
+ {
+ // not supported
+ throw(Error(32, "Image comment", "WebP"));
+ }
+
+ /* =========================================== */
+
+ void WebPImage::writeMetadata()
+ {
+ if (io_->open() != 0) {
+ throw Error(9, io_->path(), strError());
+ }
+ IoCloser closer(*io_);
+ BasicIo::AutoPtr tempIo(io_->temporary()); // may throw
+ assert (tempIo.get() != 0);
+
+ doWriteMetadata(*tempIo); // may throw
+ io_->close();
+ io_->transfer(*tempIo); // may throw
+ } // WebPImage::writeMetadata
+
+
+ void WebPImage::doWriteMetadata(BasicIo& outIo)
+ {
+ if (!io_->isopen()) throw Error(20);
+ if (!outIo.isopen()) throw Error(21);
+
+ byte data[12];
+ DataBuf chunkId(5);
+ const int TAG_SIZE = 4;
+ chunkId.pData_[4] = '
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list