Added IFD2 for PEF write support, fixed order in which image data is written.
This commit is contained in:
parent
533b3d224a
commit
5955cfab94
@ -86,6 +86,7 @@ namespace Exiv2 {
|
||||
{ gpsIfdId, "GPSInfo", "GPSInfo", ExifTags::gpsTagList },
|
||||
{ iopIfdId, "Iop", "Iop", ExifTags::iopTagList },
|
||||
{ ifd1Id, "IFD1", "Thumbnail", ExifTags::ifdTagList },
|
||||
{ ifd2Id, "IFD2", "Image2", ExifTags::ifdTagList },
|
||||
{ subImage1Id, "SubImage1", "SubImage1", ExifTags::ifdTagList },
|
||||
{ subImage2Id, "SubImage2", "SubImage2", ExifTags::ifdTagList },
|
||||
{ subImage3Id, "SubImage3", "SubImage3", ExifTags::ifdTagList },
|
||||
@ -1639,6 +1640,7 @@ namespace Exiv2 {
|
||||
case gpsIfdId:
|
||||
case iopIfdId:
|
||||
case ifd1Id:
|
||||
case ifd2Id:
|
||||
case subImage1Id:
|
||||
case subImage2Id:
|
||||
case subImage3Id:
|
||||
|
||||
@ -69,13 +69,14 @@ namespace Exiv2 {
|
||||
extern const TiffGroupInfo tiffGroupInfo[] = {
|
||||
{ 1, "Image" },
|
||||
{ 2, "Thumbnail" },
|
||||
{ 3, "Photo" },
|
||||
{ 4, "GPSInfo" },
|
||||
{ 5, "Iop" },
|
||||
{ 6, "SubImage1" },
|
||||
{ 7, "SubImage2" },
|
||||
{ 8, "SubImage3" },
|
||||
{ 9, "SubImage4" },
|
||||
{ 3, "Image2" },
|
||||
{ 4, "Photo" },
|
||||
{ 5, "GPSInfo" },
|
||||
{ 6, "Iop" },
|
||||
{ 7, "SubImage1" },
|
||||
{ 8, "SubImage2" },
|
||||
{ 9, "SubImage3" },
|
||||
{ 10, "SubImage4" },
|
||||
{ 257, "Olympus" },
|
||||
{ 258, "Fujifilm" },
|
||||
{ 259, "Canon" },
|
||||
@ -897,7 +898,8 @@ namespace Exiv2 {
|
||||
uint32_t& imageIdx)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "TiffImageEntry, tag 0x" << std::setw(4)
|
||||
std::cerr << "TiffImageEntry, Directory " << tiffGroupName(group())
|
||||
<< ", entry 0x" << std::setw(4)
|
||||
<< std::setfill('0') << std::hex << tag() << std::dec
|
||||
<< ": Writing offset " << imageIdx << "\n";
|
||||
#endif
|
||||
@ -1088,9 +1090,19 @@ namespace Exiv2 {
|
||||
ByteOrder byteOrder) const
|
||||
{
|
||||
uint32_t len = 0;
|
||||
TiffComponent* pSubIfd = 0;
|
||||
for (Components::const_iterator i = components_.begin(); i != components_.end(); ++i) {
|
||||
if ((*i)->tag() == 0x014a) {
|
||||
// Hack: delay writing of sub-IFD image data to get the order correct
|
||||
assert(pSubIfd == 0);
|
||||
pSubIfd = *i;
|
||||
continue;
|
||||
}
|
||||
len += (*i)->writeImage(blob, byteOrder);
|
||||
}
|
||||
if (pSubIfd) {
|
||||
len += pSubIfd->writeImage(blob, byteOrder);
|
||||
}
|
||||
if (pNext_) {
|
||||
len += pNext_->writeImage(blob, byteOrder);
|
||||
}
|
||||
@ -1126,7 +1138,8 @@ namespace Exiv2 {
|
||||
uint32_t len = pValue()->sizeDataArea();
|
||||
if (len > 0) {
|
||||
#ifdef DEBUG
|
||||
std::cerr << "TiffImageEntry, tag 0x" << std::setw(4)
|
||||
std::cerr << "TiffImageEntry, Directory " << tiffGroupName(group())
|
||||
<< ", entry 0x" << std::setw(4)
|
||||
<< std::setfill('0') << std::hex << tag() << std::dec
|
||||
<< ": Writing data area, blob-size = " << blob.size();
|
||||
#endif
|
||||
@ -1138,7 +1151,8 @@ namespace Exiv2 {
|
||||
}
|
||||
else {
|
||||
#ifdef DEBUG
|
||||
std::cerr << "TiffImageEntry, tag 0x" << std::setw(4)
|
||||
std::cerr << "TiffImageEntry, Directory " << tiffGroupName(group())
|
||||
<< ", entry 0x" << std::setw(4)
|
||||
<< std::setfill('0') << std::hex << tag() << std::dec
|
||||
<< ": Writing data area, blob-size = " << blob.size();
|
||||
#endif
|
||||
|
||||
@ -81,13 +81,14 @@ namespace Exiv2 {
|
||||
const uint16_t none = 0; //!< Dummy group
|
||||
const uint16_t ifd0 = 1; //!< Exif IFD0
|
||||
const uint16_t ifd1 = 2; //!< Thumbnail IFD
|
||||
const uint16_t exif = 3; //!< Exif IFD
|
||||
const uint16_t gps = 4; //!< GPS IFD
|
||||
const uint16_t iop = 5; //!< Interoperability IFD
|
||||
const uint16_t subimg1 = 6; //!< 1st TIFF SubIFD in IFD0
|
||||
const uint16_t subimg2 = 7; //!< 2nd TIFF SubIFD in IFD0
|
||||
const uint16_t subimg3 = 8; //!< 3rd TIFF SubIFD in IFD0
|
||||
const uint16_t subimg4 = 9; //!< 4th TIFF SubIFD in IFD0
|
||||
const uint16_t ifd2 = 3; //!< IFD2
|
||||
const uint16_t exif = 4; //!< Exif IFD
|
||||
const uint16_t gps = 5; //!< GPS IFD
|
||||
const uint16_t iop = 6; //!< Interoperability IFD
|
||||
const uint16_t subimg1 = 7; //!< 1st TIFF SubIFD in IFD0
|
||||
const uint16_t subimg2 = 8; //!< 2nd TIFF SubIFD in IFD0
|
||||
const uint16_t subimg3 = 9; //!< 3rd TIFF SubIFD in IFD0
|
||||
const uint16_t subimg4 = 10; //!< 4th TIFF SubIFD in IFD0
|
||||
const uint16_t mn = 256; //!< Makernote
|
||||
const uint16_t ignr = 511; //!< Read but do not decode
|
||||
}
|
||||
|
||||
@ -290,8 +290,8 @@ namespace Exiv2 {
|
||||
{ 0x0117, Group::ifd0, Group::ifd0, Tag::root, Group::none, newTiffImageSize<0x0111, Group::ifd0> },
|
||||
{ 0x0144, Group::ifd0, Group::ifd0, Tag::root, Group::none, newTiffImageData<0x0145, Group::ifd0> },
|
||||
{ 0x0145, Group::ifd0, Group::ifd0, Tag::root, Group::none, newTiffImageSize<0x0144, Group::ifd0> },
|
||||
{ 0x0201, Group::ifd0, Group::ifd0, Tag::root, Group::ifd0, newTiffImageData<0x0202, Group::ifd0> },
|
||||
{ 0x0202, Group::ifd0, Group::ifd0, Tag::root, Group::ifd0, newTiffImageSize<0x0201, Group::ifd0> },
|
||||
{ 0x0201, Group::ifd0, Group::ifd0, Tag::root, Group::none, newTiffImageData<0x0202, Group::ifd0> },
|
||||
{ 0x0202, Group::ifd0, Group::ifd0, Tag::root, Group::none, newTiffImageSize<0x0201, Group::ifd0> },
|
||||
{ 0x014a, Group::ifd0, Group::subimg1, Tag::root, Group::none, newTiffSubIfd },
|
||||
{ Tag::next, Group::ifd0, Group::ifd1, Tag::root, Group::none, newTiffDirectory },
|
||||
{ Tag::all, Group::ifd0, Group::ifd0, Tag::root, Group::none, newTiffEntry },
|
||||
@ -355,9 +355,17 @@ namespace Exiv2 {
|
||||
{ 0x0117, Group::ifd1, Group::ifd1, Tag::next, Group::ifd0, newTiffThumbSize<0x0111, Group::ifd1> },
|
||||
{ 0x0201, Group::ifd1, Group::ifd1, Tag::next, Group::ifd0, newTiffThumbData<0x0202, Group::ifd1> },
|
||||
{ 0x0202, Group::ifd1, Group::ifd1, Tag::next, Group::ifd0, newTiffThumbSize<0x0201, Group::ifd1> },
|
||||
{ Tag::next, Group::ifd1, Group::ignr, Tag::next, Group::ifd0, newTiffDirectory },
|
||||
{ Tag::next, Group::ifd1, Group::ifd2, Tag::next, Group::ifd0, newTiffDirectory },
|
||||
{ Tag::all, Group::ifd1, Group::ifd1, Tag::next, Group::ifd0, newTiffEntry },
|
||||
|
||||
// IFD2 (eg, in Pentax PEF files)
|
||||
{ 0x0111, Group::ifd2, Group::ifd2, Tag::next, Group::ifd1, newTiffImageData<0x0117, Group::ifd2> },
|
||||
{ 0x0117, Group::ifd2, Group::ifd2, Tag::next, Group::ifd1, newTiffImageSize<0x0111, Group::ifd2> },
|
||||
{ 0x0201, Group::ifd2, Group::ifd2, Tag::next, Group::ifd1, newTiffImageData<0x0202, Group::ifd2> },
|
||||
{ 0x0202, Group::ifd2, Group::ifd2, Tag::next, Group::ifd1, newTiffImageSize<0x0201, Group::ifd2> },
|
||||
{ Tag::next, Group::ifd2, Group::ignr, Tag::next, Group::ifd1, newTiffDirectory },
|
||||
{ Tag::all, Group::ifd2, Group::ifd2, Tag::next, Group::ifd1, newTiffEntry },
|
||||
|
||||
// Olympus makernote - some Olympus cameras use Minolta structures
|
||||
// Todo: Adding such tags will not work (maybe result in a Minolta makernote), need separate groups
|
||||
{ 0x0001, Group::olympmn, Group::minocso, 0x927c, Group::exif, newTiffArrayEntry<ttUnsignedLong, false> },
|
||||
@ -409,6 +417,8 @@ namespace Exiv2 {
|
||||
{ Tag::all, Group::panamn, Group::panamn, 0x927c, Group::exif, newTiffEntry },
|
||||
|
||||
// Pentax makernote
|
||||
{ 0x0003, Group::pentaxmn, Group::pentaxmn, 0x927c, Group::exif, newTiffThumbSize<0x0004, Group::pentaxmn> },
|
||||
{ 0x0004, Group::pentaxmn, Group::pentaxmn, 0x927c, Group::exif, newTiffThumbData<0x0003, Group::pentaxmn> },
|
||||
{ Tag::next, Group::pentaxmn, Group::ignr, 0x927c, Group::exif, newTiffDirectory },
|
||||
{ Tag::all, Group::pentaxmn, Group::pentaxmn, 0x927c, Group::exif, newTiffEntry },
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ namespace Exiv2 {
|
||||
|
||||
//! Type to specify the IFD to which a metadata belongs
|
||||
enum IfdId { ifdIdNotSet,
|
||||
ifd0Id, exifIfdId, gpsIfdId, iopIfdId, ifd1Id,
|
||||
ifd0Id, exifIfdId, gpsIfdId, iopIfdId, ifd1Id, ifd2Id,
|
||||
subImage1Id, subImage2Id, subImage3Id, subImage4Id,
|
||||
canonIfdId, canonCsIfdId, canonSiIfdId, canonCfIfdId,
|
||||
canonPiIfdId, canonPaIfdId,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user