[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:47 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=8a8ec67
The following commit has been merged in the master branch:
commit 8a8ec671361399102519473c4391d3093bdd867c
Author: sridharb <sridhar_ml at yahoo.com>
Date: Fri Aug 26 05:36:05 2016 +0000
This is mainly a fix for #1206, but also interprets missing Canon Exif
Tags in exiv2 with the help of Phil Harvey's exiftool (see
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html).
Even with these changes (toward #1204 and #1205), exiv2 lags behind
exiftool in some areas of interpretation of Canon tags. Ideally, a
catch-up effort to bring the code in source: canonmn.cpp in line with
lib/Image/ExifTool/Canon.pm. v10.25 of exiftool was used as reference
for this change.
#1206 seeks to address the fact that when Canon does not have data for
certain tags, they use specific default values in those fields. These
default values need to be ignored and not displayed. This change
brings this feature to exiv2, something that already exiftool does.
With regards to implementation, the struct TagInfo in source: tags.hpp
is extended with four new fields.
The first field is a bool that if set to true (default false), denotes
that this field has ignorable default values.
The second field is the default value that needs to be ignored. This
can be of four types (String, Long, Float, Rational). These four types
were chosen as they had conversion functions in the Value class.
The third field is the comparison type (default equal_to). There are
six comparison types possible (equal_to, not_equal_to, less,
less_equal, greater, greater_equal). This is the comparison applied to
the value stored in the tag's field and the default value specified
above. For e.g. if the value in the tag Exif.CanonCs.RecordMode is -1,
then it needs to be ignored.
The fourth field is the data type (default Long). This could have been
guessed from the type of the second field, but that would necessitate
making this structure into a template calling for changes in multitude
of files.
Usage: In source: canonmn.cpp, several exif tags now have ignorable
default properties. I will list a few examples.
1. Exif.CanonCs.FocusMode: TagInfo(0x0007, "FocusMode", N_("Focus Mode"), N_("Focus mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsFocusMode)),
There are no changes - i.e. this is an example of how the TagInfo
structure was being populated.
2. Exif.CanonCs.RecordMode: TagInfo(0x0009, "RecordMode", N_("Record Mode"), N_("Record mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsRecordMode), true, s_1_),
Take a look at the two new arguments. The first one (true) specifies
that there is a default value that can be ignored. The second one s_1_
specifies the value (-1, in this case) to be ignored.
const UShortValue CanonMakerNote::s_1_(65535, unsignedShort); // Till bug is resolved
Note s_1_ is temporarily having the value 65535 till #1203 that causes
signedShorts to be interpreted as unsignedShorts is resolved.
3. Exif.CanonSi.TargetAperture: TagInfo(0x0004, "TargetAperture", N_("Target Aperture"), N_("Target Aperture"), canonSiId, makerTags, unsignedShort, 1, printSi0x0015, true, us0_, TagInfo::less_equal),
Note the third argument TagInfo::less_equal. This combined with the
second argument us0_ (the number 0) signifies that any values in this
tag that are less than or equal (<=) to 0 should be ignored.
4. TagInfo(0x0028, "ImageUniqueID", N_("Image Unique ID"), N_("Image Unique ID"), canonId, makerTags, asciiString, -1, printValue, true, s0x16_, TagInfo::equal_to, TagInfo::String),
The previous examples have all been of Long type. This shows a case
where the default value is a string.
const AsciiValue CanonMakerNote::s0x16_("0000000000000000");
Once these tag values have been defined, the actual mechanics of
ignoring these default values happens in Image::exifData().
Before the exifData is returned, we loop through the data, ask the
data whether it needs to be ignored (which in turn checks its
underlying tagInfo and compares it with the default value, if
specified) and if so, deletes that element.
A compile-time switch called EXV_DONT_IGNORE_UNDEFINED which when set
to a non-zero value will cause the behavior to revert back to the
original where all values are reported irregardless of the fact that
they need to be ignored.
---
include/exiv2/exif.hpp | 1354 +++++++++++++++++++++++++---------------------
include/exiv2/exv_msvc.h | 4 +
include/exiv2/image.hpp | 1 +
include/exiv2/tags.hpp | 48 +-
src/canonmn.cpp | 463 +++++++++-------
src/image.cpp | 27 +
src/tags.cpp | 37 +-
src/version.cpp | 12 +-
8 files changed, 1096 insertions(+), 850 deletions(-)
diff --git a/include/exiv2/exif.hpp b/include/exiv2/exif.hpp
index 92b7a91..3132273 100644
--- a/include/exiv2/exif.hpp
+++ b/include/exiv2/exif.hpp
@@ -1,631 +1,723 @@
-// ***************************************************************** -*- 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 exif.hpp
- @brief Encoding and decoding of Exif data
- @version $Rev: 3091 $
- @author Andreas Huggel (ahu)
- <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
- @date 09-Jan-04, ahu: created
- */
-#ifndef EXIF_HPP_
-#define EXIF_HPP_
-
-// *****************************************************************************
-// included header files
-#include "metadatum.hpp"
-#include "tags.hpp"
-#include "value.hpp"
-#include "types.hpp"
-
-// + standard includes
-#include <string>
-#include <list>
-#include <memory>
-
-// *****************************************************************************
-// namespace extensions
-/*!
- @brief Provides classes and functions to encode and decode Exif and Iptc data.
- The <b>libexiv2</b> API consists of the objects of this namespace.
- */
-namespace Exiv2 {
-
-// *****************************************************************************
-// class declarations
- class ExifData;
-
-// *****************************************************************************
-// class definitions
-
- /*!
- @brief An Exif metadatum, consisting of an ExifKey and a Value and
- methods to manipulate these.
- */
- class EXIV2API Exifdatum : public Metadatum {
- template<typename T> friend Exifdatum& setValue(Exifdatum&, const T&);
- public:
- //! @name Creators
- //@{
- /*!
- @brief Constructor for new tags created by an application. The
- %Exifdatum is created from a \em key / value pair. %Exifdatum copies
- (clones) the \em key and value if one is provided. Alternatively,
- a program can create an 'empty' %Exifdatum with only a key
- and set the value using setValue().
-
- @param key %ExifKey.
- @param pValue Pointer to an %Exifdatum value.
- @throw Error if the key cannot be parsed and converted.
- */
- explicit Exifdatum(const ExifKey& key, const Value* pValue =0);
- //! Copy constructor
- Exifdatum(const Exifdatum& rhs);
- //! Destructor
- virtual ~Exifdatum();
- //@}
-
- //! @name Manipulators
- //@{
- //! Assignment operator
- Exifdatum& operator=(const Exifdatum& rhs);
- /*!
- @brief Assign \em value to the %Exifdatum. The type of the new Value
- is set to UShortValue.
- */
- Exifdatum& operator=(const uint16_t& value);
- /*!
- @brief Assign \em value to the %Exifdatum. The type of the new Value
- is set to ULongValue.
- */
- Exifdatum& operator=(const uint32_t& value);
- /*!
- @brief Assign \em value to the %Exifdatum. The type of the new Value
- is set to URationalValue.
- */
- Exifdatum& operator=(const URational& value);
- /*!
- @brief Assign \em value to the %Exifdatum. The type of the new Value
- is set to ShortValue.
- */
- Exifdatum& operator=(const int16_t& value);
- /*!
- @brief Assign \em value to the %Exifdatum. The type of the new Value
- is set to LongValue.
- */
- Exifdatum& operator=(const int32_t& value);
- /*!
- @brief Assign \em value to the %Exifdatum. The type of the new Value
- is set to RationalValue.
- */
- Exifdatum& operator=(const Rational& value);
- /*!
- @brief Assign \em value to the %Exifdatum.
- Calls setValue(const std::string&).
- */
- Exifdatum& operator=(const std::string& value);
- /*!
- @brief Assign \em value to the %Exifdatum.
- Calls setValue(const Value*).
- */
- Exifdatum& operator=(const Value& value);
- void setValue(const Value* pValue);
- /*!
- @brief Set the value to the string \em value. Uses Value::read(const
- std::string&). If the %Exifdatum does not have a Value yet,
- then a %Value of the correct type for this %Exifdatum is
- created. An AsciiValue is created for unknown tags. Return
- 0 if the value was read successfully.
- */
- int setValue(const std::string& value);
- /*!
- @brief Set the data area by copying (cloning) the buffer pointed to
- by \em buf.
-
- Values may have a data area, which can contain additional
- information besides the actual value. This method is used to set such
- a data area.
-
- @param buf Pointer to the source data area
- @param len Size of the data area
- @return Return -1 if the %Exifdatum does not have a value yet or the
- value has no data area, else 0.
- */
- int setDataArea(const byte* buf, long len);
- //@}
-
- //! @name Accessors
- //@{
- //! Return the key of the %Exifdatum.
- std::string key() const;
- const char* familyName() const;
- std::string groupName() const;
- std::string tagName() const;
- std::string tagLabel() const;
- uint16_t tag() const;
- //! Return the IFD id as an integer. (Do not use, this is meant for library internal use.)
- int ifdId() const;
- //! Return the name of the IFD
- const char* ifdName() const;
- //! Return the index (unique id of this key within the original IFD)
- int idx() const;
- /*!
- @brief Write value to a data buffer and return the number
- of bytes written.
-
- The user must ensure that the buffer has enough memory. Otherwise
- the call results in undefined behaviour.
-
- @param buf Data buffer to write to.
- @param byteOrder Applicable byte order (little or big endian).
- @return Number of characters written.
- */
- long copy(byte* buf, ByteOrder byteOrder) const;
- std::ostream& write(std::ostream& os, const ExifData* pMetadata =0) const;
- //! Return the type id of the value
- TypeId typeId() const;
- //! Return the name of the type
- const char* typeName() const;
- //! Return the size in bytes of one component of this type
- long typeSize() const;
- //! Return the number of components in the value
- long count() const;
- //! Return the size of the value in bytes
- long size() const;
- //! Return the value as a string.
- std::string toString() const;
- std::string toString(long n) const;
- long toLong(long n =0) const;
- float toFloat(long n =0) const;
- Rational toRational(long n =0) const;
- Value::AutoPtr getValue() const;
- const Value& value() const;
- //! Return the size of the data area.
- long sizeDataArea() const;
- /*!
- @brief Return a copy of the data area of the value. The caller owns
- this copy and %DataBuf ensures that it will be deleted.
-
- Values may have a data area, which can contain additional
- information besides the actual value. This method is used to access
- such a data area.
-
- @return A %DataBuf containing a copy of the data area or an empty
- %DataBuf if the value does not have a data area assigned or the
- value is not set.
- */
- DataBuf dataArea() const;
- //@}
-
- private:
- // DATA
- ExifKey::AutoPtr key_; //!< Key
- Value::AutoPtr value_; //!< Value
-
- }; // class Exifdatum
-
- /*!
- @brief Access to a Exif %thumbnail image. This class provides higher level
- accessors to the thumbnail image that is optionally embedded in IFD1
- of the Exif data. These methods do not write to the Exif metadata.
- Manipulators are provided in subclass ExifThumb.
-
- @note Various other preview and thumbnail images may be contained in an
- image, depending on its format and the camera make and model. This
- class only provides access to the Exif thumbnail as specified in the
- Exif standard.
- */
- class EXIV2API ExifThumbC {
- public:
- //! @name Creators
- //@{
- //! Constructor.
- ExifThumbC(const ExifData& exifData);
- //@}
-
- //! @name Accessors
- //@{
- /*!
- @brief Return the thumbnail image in a %DataBuf. The caller owns the
- data buffer and %DataBuf ensures that it will be deleted.
- */
- DataBuf copy() const;
- /*!
- @brief Write the thumbnail image to a file.
-
- A filename extension is appended to \em path according to the image
- type of the thumbnail, so \em path should not include an extension.
- The function will overwrite an existing file of the same name.
-
- @param path File name of the thumbnail without extension.
- @return The number of bytes written.
- */
- long writeFile(const std::string& path) const;
-#ifdef EXV_UNICODE_PATH
- /*!
- @brief Like writeFile() but accepts a unicode path in an std::wstring.
- @note This function is only available on Windows.
- */
- long writeFile(const std::wstring& wpath) const;
-#endif
- /*!
- @brief Return the MIME type of the thumbnail, either
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list