Fixed writing of TiffImageEntry previews in the Makernote (Exif.OlympusCs.PreviewImageStart).
This commit is contained in:
+37
-6
@@ -927,23 +927,30 @@ namespace Exiv2 {
|
||||
|
||||
uint32_t TiffImageEntry::doWrite(Blob& blob,
|
||||
ByteOrder byteOrder,
|
||||
int32_t /*offset*/,
|
||||
int32_t offset,
|
||||
uint32_t /*valueIdx*/,
|
||||
uint32_t /*dataIdx*/,
|
||||
uint32_t dataIdx,
|
||||
uint32_t& imageIdx)
|
||||
{
|
||||
uint32_t o2 = imageIdx;
|
||||
// For makernotes, write TIFF image data to the data area
|
||||
if (group() > Group::mn) o2 = offset + dataIdx;
|
||||
#ifdef DEBUG
|
||||
std::cerr << "TiffImageEntry, Directory " << tiffGroupName(group())
|
||||
<< ", entry 0x" << std::setw(4)
|
||||
<< std::setfill('0') << std::hex << tag() << std::dec
|
||||
<< ": Writing offset " << imageIdx << "\n";
|
||||
<< ": Writing offset " << o2 << "\n";
|
||||
#endif
|
||||
DataBuf buf(static_cast<long>(strips_.size()) * 4);
|
||||
uint32_t idx = 0;
|
||||
for (Strips::const_iterator i = strips_.begin(); i != strips_.end(); ++i) {
|
||||
idx += writeOffset(buf.pData_ + idx, imageIdx, tiffType(), byteOrder);
|
||||
imageIdx += i->second;
|
||||
imageIdx += i->second & 1; // Align strip data to word boundary
|
||||
idx += writeOffset(buf.pData_ + idx, o2, tiffType(), byteOrder);
|
||||
o2 += i->second;
|
||||
o2 += i->second & 1; // Align strip data to word boundary
|
||||
if (!(group() > Group::mn)) {
|
||||
imageIdx += i->second;
|
||||
imageIdx += i->second & 1; // Align strip data to word boundary
|
||||
}
|
||||
}
|
||||
append(blob, buf.pData_, buf.size_);
|
||||
return buf.size_;
|
||||
@@ -1081,6 +1088,20 @@ namespace Exiv2 {
|
||||
return 0;
|
||||
} // TiffEntryBase::doWriteData
|
||||
|
||||
uint32_t TiffImageEntry::doWriteData(Blob& blob,
|
||||
ByteOrder byteOrder,
|
||||
int32_t /*offset*/,
|
||||
uint32_t /*dataIdx*/,
|
||||
uint32_t& /*imageIdx*/) const
|
||||
{
|
||||
uint32_t len = 0;
|
||||
// For makernotes, write TIFF image data to the data area
|
||||
if (group() > Group::mn) {
|
||||
len = writeImage(blob, byteOrder);
|
||||
}
|
||||
return len;
|
||||
} // TiffImageEntry::doWriteData
|
||||
|
||||
uint32_t TiffDataEntry::doWriteData(Blob& blob,
|
||||
ByteOrder /*byteOrder*/,
|
||||
int32_t /*offset*/,
|
||||
@@ -1282,6 +1303,16 @@ namespace Exiv2 {
|
||||
return 0;
|
||||
} // TiffEntryBase::doSizeData
|
||||
|
||||
uint32_t TiffImageEntry::doSizeData() const
|
||||
{
|
||||
uint32_t len = 0;
|
||||
// For makernotes, TIFF image data is written to the data area
|
||||
if (group() > Group::mn) {
|
||||
len = sizeImage();
|
||||
}
|
||||
return len;
|
||||
} // TiffImageEntry::doSizeData
|
||||
|
||||
uint32_t TiffDataEntry::doSizeData() const
|
||||
{
|
||||
if (!pValue()) return 0;
|
||||
|
||||
@@ -726,7 +726,19 @@ namespace Exiv2 {
|
||||
//@}
|
||||
//! @name Write support (Accessors)
|
||||
//@{
|
||||
// Using doWriteData from base class
|
||||
/*!
|
||||
@brief Implements writeData(). Write the image data area to the blob.
|
||||
Return the number of bytes written.
|
||||
|
||||
This function writes the image data to the data area of the current
|
||||
directory. It is used for TIFF image entries in the makernote (large
|
||||
preview images) so that the image data remains in the makernote IFD.
|
||||
*/
|
||||
virtual uint32_t doWriteData(Blob& blob,
|
||||
ByteOrder byteOrder,
|
||||
int32_t offset,
|
||||
uint32_t dataIdx,
|
||||
uint32_t& imageIdx) const;
|
||||
/*!
|
||||
@brief Implements writeImage(). Write the image data area to the blob.
|
||||
Return the number of bytes written.
|
||||
@@ -735,7 +747,8 @@ namespace Exiv2 {
|
||||
ByteOrder byteOrder) const;
|
||||
//! Implements size(). Return the size of the strip pointers.
|
||||
virtual uint32_t doSize() const;
|
||||
// Using doSizeData from base class
|
||||
//! Implements sizeData(). Return the size of the image data area.
|
||||
virtual uint32_t doSizeData() const;
|
||||
//! Implements sizeImage(). Return the size of the image data area.
|
||||
virtual uint32_t doSizeImage() const;
|
||||
//@}
|
||||
|
||||
Reference in New Issue
Block a user