[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:37:38 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=d857011
The following commit has been merged in the master branch:
commit d85701137e75597e7652fb1a4bf1b249c7183ede
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Fri May 19 16:13:42 2006 +0000
Added correct decoding of NEF primary image tags
---
src/tiffcomposite.cpp | 24 +++++++++++++++++-------
src/tiffcomposite.hpp | 24 +++++++++++++++---------
src/tiffvisitor.cpp | 30 +++++++++++++++++++-----------
src/tiffvisitor.hpp | 15 ++++++++++++++-
4 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/src/tiffcomposite.cpp b/src/tiffcomposite.cpp
index 8944028..0cad52d 100644
--- a/src/tiffcomposite.cpp
+++ b/src/tiffcomposite.cpp
@@ -67,6 +67,10 @@ namespace Exiv2 {
{ 3, "Photo" },
{ 4, "GPSInfo" },
{ 5, "Iop" },
+ { 6, "ImageSubIfd0" },
+ { 7, "ImageSubIfd1" },
+ { 8, "ImageSubIfd2" },
+ { 9, "ImageSubIfd3" },
{ 257, "Olympus" },
{ 258, "Fujifilm" },
{ 259, "Canon" },
@@ -117,6 +121,13 @@ namespace Exiv2 {
delete pNext_;
} // TiffDirectory::~TiffDirectory
+ TiffSubIfd::~TiffSubIfd()
+ {
+ for (Ifds::iterator i = ifds_.begin(); i != ifds_.end(); ++i) {
+ delete *i;
+ }
+ } // TiffSubIfd::~TiffSubIfd
+
TiffEntryBase::~TiffEntryBase()
{
if (isAllocated_) {
@@ -157,7 +168,9 @@ namespace Exiv2 {
void TiffSubIfd::doAddChild(TiffComponent::AutoPtr tiffComponent)
{
- ifd_.addChild(tiffComponent);
+ TiffDirectory* d = dynamic_cast<TiffDirectory*>(tiffComponent.release());
+ assert(d);
+ ifds_.push_back(d);
} // TiffSubIfd::doAddChild
void TiffMnEntry::doAddChild(TiffComponent::AutoPtr tiffComponent)
@@ -180,11 +193,6 @@ namespace Exiv2 {
if (hasNext_) pNext_ = tiffComponent.release();
} // TiffDirectory::doAddNext
- void TiffSubIfd::doAddNext(TiffComponent::AutoPtr tiffComponent)
- {
- ifd_.addNext(tiffComponent);
- } // TiffSubIfd::doAddNext
-
void TiffMnEntry::doAddNext(TiffComponent::AutoPtr tiffComponent)
{
if (mn_) mn_->addNext(tiffComponent);
@@ -227,7 +235,9 @@ namespace Exiv2 {
void TiffSubIfd::doAccept(TiffVisitor& visitor)
{
visitor.visitSubIfd(this);
- ifd_.accept(visitor);
+ for (Ifds::iterator i = ifds_.begin(); visitor.go() && i != ifds_.end(); ++i) {
+ (*i)->accept(visitor);
+ }
} // TiffSubIfd::doAccept
void TiffMnEntry::doAccept(TiffVisitor& visitor)
diff --git a/src/tiffcomposite.hpp b/src/tiffcomposite.hpp
index ac3322f..f516fcc 100644
--- a/src/tiffcomposite.hpp
+++ b/src/tiffcomposite.hpp
@@ -72,7 +72,10 @@ namespace Exiv2 {
const uint16_t exif = 3; //!< Exif IFD
const uint16_t gps = 4; //!< GPS IFD
const uint16_t iop = 5; //!< Interoperability IFD
- const uint16_t sub0_0 = 6; //!< Tiff SubIFD in IFD0
+ const uint16_t sub0_0 = 6; //!< Tiff SubIFD 0 in IFD0
+ const uint16_t sub0_1 = 7; //!< Tiff SubIFD 1 in IFD0
+ const uint16_t sub0_2 = 8; //!< Tiff SubIFD 2 in IFD0
+ const uint16_t sub0_3 = 9; //!< Tiff SubIFD 3 in IFD0
const uint16_t mn = 256; //!< Makernote
const uint16_t ignr = 511; //!< Read but do not decode
}
@@ -94,8 +97,8 @@ namespace Exiv2 {
(Composite pattern). Both TIFF directories as well as entries
implement this interface. A component can be uniquely identified
by a tag, group tupel. This class is implemented as a NVI
- (Non-Virtual Interface) and it has an interface for visitors (Visitor
- pattern).
+ (Non-Virtual Interface) and it has an interface for visitors
+ (Visitor pattern).
*/
class TiffComponent {
public:
@@ -402,10 +405,13 @@ namespace Exiv2 {
}; // class TiffDirectory
+ //! A collection of TIFF directories (IFDs)
+ typedef std::vector<TiffDirectory*> Ifds;
+
/*!
@brief This class models a TIFF sub-directory (sub-IFD). A sub-IFD
- is an entry with a value that is a pointer to an IFD
- structure and contains this IFD. The TIFF standard defines
+ is an entry with one or more values that are pointers to IFD
+ structures containing an IFD. The TIFF standard defines
some important tags to be sub-IFDs, including the %Exif and
GPS tags.
*/
@@ -416,22 +422,22 @@ namespace Exiv2 {
//@{
//! Default constructor
TiffSubIfd(uint16_t tag, uint16_t group, uint16_t newGroup)
- : TiffEntryBase(tag, group), ifd_(tag, newGroup) {}
+ : TiffEntryBase(tag, group), newGroup_(newGroup) {}
//! Virtual destructor
- virtual ~TiffSubIfd() {}
+ virtual ~TiffSubIfd();
//@}
private:
//! @name Manipulators
//@{
virtual void doAddChild(TiffComponent::AutoPtr tiffComponent);
- virtual void doAddNext(TiffComponent::AutoPtr tiffComponent);
virtual void doAccept(TiffVisitor& visitor);
//@}
private:
// DATA
- TiffDirectory ifd_; //!< The subdirectory
+ uint16_t newGroup_; //!< Start of the range of group numbers for the sub-IFDs
+ Ifds ifds_; //!< The subdirectories
}; // class TiffSubIfd
diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp
index 4928dc7..732189d 100644
--- a/src/tiffvisitor.cpp
+++ b/src/tiffvisitor.cpp
@@ -56,8 +56,9 @@ namespace Exiv2 {
// TIFF Decoder table for special decoding requirements
const TiffDecoderInfo TiffMetadataDecoder::tiffDecoderInfo_[] = {
{ "*", Tag::all, Group::ignr, 0 }, // Do not decode tags with group == Group::ignr
- { "OLYMPUS", 0x0100, Group::olympmn, &TiffMetadataDecoder::decodeOlympThumb }
-// { "NIKON", 0x0100, Group::sub0_0, &TiffMetadataDecoder::decodeTo<0x0100, Group::ifd0> }
+ { "OLYMPUS", 0x0100, Group::olympmn, &TiffMetadataDecoder::decodeOlympThumb },
+ { "NIKON", Tag::all, Group::sub0_0, 0 },
+ { "NIKON", Tag::all, Group::sub0_1, &TiffMetadataDecoder::decodeTo<Group::ifd0> }
};
bool TiffDecoderInfo::operator==(const TiffDecoderInfo::Key& key) const
@@ -560,18 +561,25 @@ namespace Exiv2 {
readTiffEntry(object);
if (object->typeId() == unsignedLong && object->count() >= 1) {
- uint32_t offset = getULong(object->pData(), byteOrder());
- if (baseOffset() + offset > size_) {
+ for (uint32_t i = 0; i < object->count(); ++i) {
+ uint32_t offset = getULong(object->pData() + 4*i, byteOrder());
+ if (baseOffset() + offset > size_) {
#ifndef SUPPRESS_WARNINGS
- std::cerr << "Error: "
- << "Directory " << object->groupName()
- << ", entry 0x" << std::setw(4)
- << std::setfill('0') << std::hex << object->tag()
- << " Sub-IFD pointer is out of bounds; ignoring it.
";
+ std::cerr << "Error: "
+ << "Directory " << object->groupName()
+ << ", entry 0x" << std::setw(4)
+ << std::setfill('0') << std::hex << object->tag()
+ << " Sub-IFD pointer " << i
+ << " is out of bounds; ignoring it.
";
#endif
- return;
+ return;
+ }
+ // If there are multiple dirs, group is incremented for each
+ TiffComponent::AutoPtr td(new TiffDirectory(object->tag(),
+ object->newGroup_ + i));
+ td->setStart(pData_ + baseOffset() + offset);
+ object->addChild(td);
}
- object->ifd_.setStart(pData_ + baseOffset() + offset);
}
#ifndef SUPPRESS_WARNINGS
else {
diff --git a/src/tiffvisitor.hpp b/src/tiffvisitor.hpp
index ce73d68..2766cf0 100644
--- a/src/tiffvisitor.hpp
+++ b/src/tiffvisitor.hpp
@@ -279,9 +279,12 @@ namespace Exiv2 {
void decodeTiffEntry(const TiffEntryBase* object);
//! Decode Olympus Thumbnail from the TIFF makernote into IFD1
void decodeOlympThumb(const TiffEntryBase* object);
- //! Decode object to the Exif entry tag, group
+ //! Decode object to the Exif entry tag, group given as template parameters
template<uint16_t tag, uint16_t group>
void decodeTo(const TiffEntryBase* object);
+ //! Decode object to the Exif entry with group according to the template parameter
+ template<uint16_t group>
+ void decodeTo(const TiffEntryBase* object);
//@}
private:
@@ -512,6 +515,16 @@ namespace Exiv2 {
setExifTag(key, object->pValue());
}
+ template<uint16_t group>
+ void TiffMetadataDecoder::decodeTo(const TiffEntryBase* object)
+ {
+ assert(object);
+ // Todo: ExifKey should have an appropriate c'tor, it should not be
+ // necessary to use groupName here
+ ExifKey key(object->tag(), tiffGroupName(group));
+ setExifTag(key, object->pValue());
+ }
+
} // namespace Exiv2
#endif // #ifndef TIFFVISITOR_HPP_
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list