Added config for IFD3 (needed for CR2, at least some), fixed Nikon assertion failure for unknown complex binary arrays (reported by Marcel Wiesweg).

This commit is contained in:
Andreas Huggel 2009-12-07 16:05:44 +00:00
parent 4a9c193624
commit bb71f49bdc
6 changed files with 48 additions and 20 deletions

View File

@ -689,7 +689,8 @@ namespace Exiv2 {
subImage3Id,
subImage4Id,
panaRawIfdId,
ifd2Id
ifd2Id,
ifd3Id
};
for (unsigned int i = 0; i < EXV_COUNTOF(filteredIfds); ++i) {
#ifdef DEBUG

View File

@ -102,6 +102,7 @@ namespace Exiv2 {
{ iopIfdId, "Iop", "Iop", ExifTags::iopTagList },
{ ifd1Id, "IFD1", "Thumbnail", ExifTags::ifdTagList },
{ ifd2Id, "IFD2", "Image2", ExifTags::ifdTagList },
{ ifd3Id, "IFD3", "Image3", ExifTags::ifdTagList },
{ subImage1Id, "SubImage1", "SubImage1", ExifTags::ifdTagList },
{ subImage2Id, "SubImage2", "SubImage2", ExifTags::ifdTagList },
{ subImage3Id, "SubImage3", "SubImage3", ExifTags::ifdTagList },
@ -1720,6 +1721,7 @@ namespace Exiv2 {
case iopIfdId:
case ifd1Id:
case ifd2Id:
case ifd3Id:
case subImage1Id:
case subImage2Id:
case subImage3Id:

View File

@ -78,13 +78,14 @@ namespace Exiv2 {
{ 1, "Image" },
{ 2, "Thumbnail" },
{ 3, "Image2" },
{ 4, "Photo" },
{ 5, "GPSInfo" },
{ 6, "Iop" },
{ 7, "SubImage1" },
{ 8, "SubImage2" },
{ 9, "SubImage3" },
{ 10, "SubImage4" },
{ 4, "Image3" },
{ 5, "Photo" },
{ 6, "GPSInfo" },
{ 7, "Iop" },
{ 8, "SubImage1" },
{ 9, "SubImage2" },
{ 10, "SubImage3" },
{ 11, "SubImage4" },
{ 64, "PanasonicRaw" },
{ 256, "MakerNote" },
// 257 not needed (olympmn)
@ -754,11 +755,14 @@ namespace Exiv2 {
TiffComponent* TiffBinaryArray::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot)
{
assert(tiffPath.size() > 1);
pRoot_ = pRoot;
if (tiffPath.size() == 1) {
// An unknown complex binary array has no children and acts like a standard TIFF entry
return this;
}
tiffPath.pop();
const TiffPathItem tpi = tiffPath.top();
// Initialize the binary array (if it is a complex array)
pRoot_ = pRoot;
initialize(tpi.group());
TiffComponent* tc = 0;
// Todo: Duplicates are not allowed!
@ -1021,6 +1025,8 @@ namespace Exiv2 {
uint32_t TiffBinaryArray::doCount() const
{
if (cfg() == 0) return TiffEntryBase::doCount();
if (elements_.empty()) return 0;
TypeId typeId = toTypeId(tiffType(), tag(), group());
@ -1347,6 +1353,12 @@ namespace Exiv2 {
uint32_t dataIdx,
uint32_t& imageIdx)
{
if (cfg() == 0) return TiffEntryBase::doWrite(ioWrapper,
byteOrder,
offset,
valueIdx,
dataIdx,
imageIdx);
if (cfg()->byteOrder_ != invalidByteOrder) byteOrder = cfg()->byteOrder_;
// Tags must be sorted in ascending order
std::sort(elements_.begin(), elements_.end(), cmpTagLt);
@ -1656,6 +1668,8 @@ namespace Exiv2 {
uint32_t TiffBinaryArray::doSize() const
{
if (cfg() == 0) return TiffEntryBase::doSize();
if (elements_.empty()) return 0;
uint32_t idx = 0;

View File

@ -89,13 +89,14 @@ namespace Exiv2 {
const uint16_t ifd0 = 1; //!< Exif IFD0
const uint16_t ifd1 = 2; //!< Thumbnail IFD
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 ifd3 = 4; //!< IFD3
const uint16_t exif = 5; //!< Exif IFD
const uint16_t gps = 6; //!< GPS IFD
const uint16_t iop = 7; //!< Interoperability IFD
const uint16_t subimg1 = 8; //!< 1st TIFF SubIFD in IFD0
const uint16_t subimg2 = 9; //!< 2nd TIFF SubIFD in IFD0
const uint16_t subimg3 = 10; //!< 3rd TIFF SubIFD in IFD0
const uint16_t subimg4 = 11; //!< 4th TIFF SubIFD in IFD0
const uint16_t panaraw = 64; //!< IFD0 of Panasonic RAW images
const uint16_t mn = 256; //!< Makernote
const uint16_t ignr = 511; //!< Read but do not decode
@ -1383,7 +1384,7 @@ namespace Exiv2 {
// DATA
const CfgSelFct cfgSelFct_; //!< Pointer to a function to determine which cfg to use (may be 0)
const ArraySet* arraySet_; //!< Pointer to the array set, if any (may be 0)
const ArrayCfg* arrayCfg_; //!< Pointer to the array configuration (must not be 0)
const ArrayCfg* arrayCfg_; //!< Pointer to the array configuration (must not be 0, except for unrecognized complex binary arrays)
const ArrayDef* arrayDef_; //!< Pointer to the array definition (may be 0)
int defSize_; //!< Size of the array definition array (may be 0)
int setSize_; //!< Size of the array set (may be 0)

View File

@ -772,6 +772,7 @@ namespace Exiv2 {
{ Tag::root, Group::iop, Group::exif, 0xa005 },
{ Tag::root, Group::ifd1, Group::ifd0, Tag::next },
{ Tag::root, Group::ifd2, Group::ifd1, Tag::next },
{ Tag::root, Group::ifd3, Group::ifd2, Tag::next },
{ Tag::root, Group::olymp1mn, Group::exif, 0x927c },
{ Tag::root, Group::olymp2mn, Group::exif, 0x927c },
{ Tag::root, Group::olympeq, Group::olymp2mn, 0x2010 },
@ -932,14 +933,22 @@ namespace Exiv2 {
{ Tag::next, Group::ifd1, newTiffDirectory<Group::ifd2> },
{ Tag::all, Group::ifd1, newTiffEntry },
// IFD2 (eg, in Pentax PEF files)
// IFD2 (eg, in Pentax PEF and Canon CR2 files)
{ 0x0111, Group::ifd2, newTiffImageData<0x0117, Group::ifd2> },
{ 0x0117, Group::ifd2, newTiffImageSize<0x0111, Group::ifd2> },
{ 0x0201, Group::ifd2, newTiffImageData<0x0202, Group::ifd2> },
{ 0x0202, Group::ifd2, newTiffImageSize<0x0201, Group::ifd2> },
{ Tag::next, Group::ifd2, newTiffDirectory<Group::ignr> },
{ Tag::next, Group::ifd2, newTiffDirectory<Group::ifd3> },
{ Tag::all, Group::ifd2, newTiffEntry },
// IFD3 (eg, in Canon CR2 files)
{ 0x0111, Group::ifd3, newTiffImageData<0x0117, Group::ifd3> },
{ 0x0117, Group::ifd3, newTiffImageSize<0x0111, Group::ifd3> },
{ 0x0201, Group::ifd3, newTiffImageData<0x0202, Group::ifd3> },
{ 0x0202, Group::ifd3, newTiffImageSize<0x0201, Group::ifd3> },
{ Tag::next, Group::ifd3, newTiffDirectory<Group::ignr> },
{ Tag::all, Group::ifd3, 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::olymp1mn, EXV_SIMPLE_BINARY_ARRAY(minoCsoCfg) },

View File

@ -147,6 +147,7 @@ namespace Exiv2 {
iopIfdId,
ifd1Id,
ifd2Id,
ifd3Id,
subImage1Id,
subImage2Id,
subImage3Id,