Before renaming...

v0.27.3
Andreas Huggel 22 years ago
parent ffa409cb78
commit 557a515ba6

@ -12,7 +12,7 @@
RCS information RCS information
$Name: $ $Name: $
$Revision: 1.2 $ $Revision: 1.3 $
*/ */
// ***************************************************************************** // *****************************************************************************
// included header files // included header files
@ -443,10 +443,8 @@ namespace Exif {
if (rc) return rc; if (rc) return rc;
} }
// Find and read Interoperability IFD in IFD1 // Todo: Should we also look for Exif IFD and GPSInfo IFD in IFD1
Ifd ifd1IopIfd(ifd1IopIfd); // and, if found, Interop. IFD in the Exif IFD???
rc = ifd1.readSubIfd(ifd1IopIfd, buf, byteOrder, 0xa005);
if (rc) return rc;
// Finally, copy all metadata from the IFDs to the internal metadata // Finally, copy all metadata from the IFDs to the internal metadata
metadata_.clear(); metadata_.clear();
@ -455,7 +453,6 @@ namespace Exif {
add(exifIopIfd.entries()); add(exifIopIfd.entries());
add(gpsIfd.entries()); add(gpsIfd.entries());
add(ifd1.entries()); add(ifd1.entries());
add(ifd1IopIfd.entries());
return 0; return 0;
} // ExifData::read } // ExifData::read

@ -8,7 +8,7 @@
/*! /*!
@file exif.h @file exif.h
@brief Encoding and decoding of %Exif data @brief Encoding and decoding of %Exif data
@version $Name: $ $Revision: 1.2 $ @version $Name: $ $Revision: 1.3 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
@date 09-Jan-03, ahu: created @date 09-Jan-03, ahu: created
*/ */
@ -159,6 +159,11 @@ namespace Exif {
const char* typeName() const { return ExifTags::typeName(type_); } const char* typeName() const { return ExifTags::typeName(type_); }
//! Returns the size in bytes of one element of this type //! Returns the size in bytes of one element of this type
long typeSize() const { return ExifTags::typeSize(type_); } long typeSize() const { return ExifTags::typeSize(type_); }
//! Returns the name of the IFD
const char* ifdName() const { return ExifTags::ifdName(ifdId_); }
//! Returns the name of the section
const char* sectionName() const
{ return ExifTags::sectionName(tag_, ifdId_); }
public: public:
uint16 tag_; //!< Tag value uint16 tag_; //!< Tag value

@ -19,7 +19,11 @@ int main(int argc, char* const argv[])
Exif::ExifData::const_iterator i = beg; Exif::ExifData::const_iterator i = beg;
for (; i != end; ++i) { for (; i != end; ++i) {
std::cout << "0x" std::cout << std::setw(9) << std::setfill(' ') << std::left
<< i->ifdName() << " "
<< std::setw(9) << std::setfill(' ') << std::left
<< i->sectionName() << " "
<< "0x"
<< std::hex << std::setw(4) << std::setfill('0') << std::right << std::hex << std::setw(4) << std::setfill('0') << std::right
<< i->tag_ << " " << i->tag_ << " "
<< std::setw(27) << std::setfill(' ') << std::left << std::setw(27) << std::setfill(' ') << std::left

@ -12,7 +12,7 @@
RCS information RCS information
$Name: $ $Name: $
$Revision: 1.1 $ $Revision: 1.2 $
*/ */
// ***************************************************************************** // *****************************************************************************
// included header files // included header files
@ -30,6 +30,43 @@ namespace {
// class member definitions // class member definitions
namespace Exif { namespace Exif {
IfdInfo::IfdInfo(IfdId ifdId, const char* name)
: ifdId_(ifdId), name_(name)
{
}
const IfdInfo ExifTags::ifdInfo_[] = {
IfdInfo(IfdIdNotSet, "(Unknown IFD)"),
IfdInfo(ifd0, "IFD0"),
IfdInfo(exifIfd, "Exif"),
IfdInfo(gpsIfd, "GPSInfo"),
IfdInfo(exifMakerIfd, "MakerNote"),
IfdInfo(exifIopIfd, "Exif Iop."),
IfdInfo(ifd1, "IFD1"),
IfdInfo(ifd1ExifIfd, "Exif (at IFD1)"),
IfdInfo(ifd1GpsIfd, "GPSInfo (at IFD1)"),
IfdInfo(ifd1MakerIfd, "MakerNote (at IFD1)"),
IfdInfo(ifd1ExifIopIfd, "Exif Iop. (at IFD1)")
};
SectionInfo::SectionInfo(SectionId sectionId, const char* name)
: sectionId_(sectionId), name_(name)
{
}
const SectionInfo ExifTags::sectionInfo_[] = {
SectionInfo(SectionIdNotSet, "(Unknown Section)"),
SectionInfo(ifd0Tiff, "IFD0"),
SectionInfo(exifIfdSection, "Exif"),
SectionInfo(gpsIfdSection, "GPSInfo"),
SectionInfo(exifIopIfdSection, "Exif Iop."),
SectionInfo(ifd1Section, "IFD1")
};
TagFormat::TagFormat(uint16 type, const char* name, long size) TagFormat::TagFormat(uint16 type, const char* name, long size)
: type_(type), name_(name), size_(size) : type_(type), name_(name), size_(size)
{ {
@ -57,10 +94,10 @@ namespace Exif {
const char* name, const char* name,
const char* desc, const char* desc,
IfdId ifdId, IfdId ifdId,
TagSection section SectionId sectionId
) )
: tag_(tag), name_(name), desc_(desc), : tag_(tag), name_(name), desc_(desc),
ifdId_(ifdId), section_(section) ifdId_(ifdId), sectionId_(sectionId)
{ {
} }
@ -234,7 +271,7 @@ namespace Exif {
TagInfo(0xa420, "ImageUniqueID", "Unique image ID", exifIfd, exifIfdSection), TagInfo(0xa420, "ImageUniqueID", "Unique image ID", exifIfd, exifIfdSection),
// End of list marker // End of list marker
TagInfo(0xffff, "(Unknown)", "Unknown tag", IfdIdNotSet, TagSectionNotSet) TagInfo(0xffff, "(Unknown)", "Unknown tag", IfdIdNotSet, SectionIdNotSet)
}; };
int ExifTags::tagInfoIdx(uint16 tag, IfdId ifdId) int ExifTags::tagInfoIdx(uint16 tag, IfdId ifdId)
@ -253,6 +290,11 @@ namespace Exif {
return tagInfo_[tagInfoIdx(tag, ifdId)].name_; return tagInfo_[tagInfoIdx(tag, ifdId)].name_;
} }
const char* ExifTags::sectionName(uint16 tag, IfdId ifdId)
{
return sectionInfo_[tagInfo_[tagInfoIdx(tag, ifdId)].sectionId_].name_;
}
const char* ExifTags::typeName(uint16 type) const char* ExifTags::typeName(uint16 type)
{ {
return tagFormat_[type].name_; return tagFormat_[type].name_;
@ -263,6 +305,16 @@ namespace Exif {
return tagFormat_[type].size_; return tagFormat_[type].size_;
} }
const char* ExifTags::ifdName(IfdId ifdId)
{
return ifdInfo_[ifdId].name_;
}
const char* ExifTags::sectionName(SectionId sectionId)
{
return sectionInfo_[sectionId].name_;
}
// ************************************************************************* // *************************************************************************
// free functions // free functions

@ -8,7 +8,7 @@
/*! /*!
@file tags.h @file tags.h
@brief %Exif tag and type information @brief %Exif tag and type information
@version $Name: $ $Revision: 1.1 $ @version $Name: $ $Revision: 1.2 $
@author Andreas Huggel (ahu) @author Andreas Huggel (ahu)
@date 15-Jan-03, ahu: created @date 15-Jan-03, ahu: created
*/ */
@ -38,17 +38,33 @@ namespace Exif {
//! Type to specify the IFD to which a metadata belongs //! Type to specify the IFD to which a metadata belongs
enum IfdId { IfdIdNotSet, enum IfdId { IfdIdNotSet,
ifd0, ifd1, exifIfd, gpsIfd, ifd0, exifIfd, gpsIfd, exifMakerIfd, exifIopIfd,
makerNoteIfd, exifIopIfd, ifd1IopIfd }; ifd1, ifd1ExifIfd, ifd1GpsIfd, ifd1MakerIfd, ifd1ExifIopIfd };
//! Section identifiers to logically group tags //! Section identifiers to logically group tags
enum TagSection { TagSectionNotSet, enum SectionId { SectionIdNotSet,
ifd0Tiff, ifd1Section, exifIfdSection, gpsIfdSection, ifd0Tiff, exifIfdSection, gpsIfdSection,
exifIopIfdSection }; exifIopIfdSection, ifd1Section };
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! Contains information pertaining to one IFD
struct IfdInfo {
//! Constructor
IfdInfo(IfdId ifdId, const char* name);
IfdId ifdId_; //!< IFD id
const char* name_; //!< IFD name
};
//! Contains information pertaining to one section
struct SectionInfo {
//! Constructor
SectionInfo(SectionId sectionId, const char* name);
SectionId sectionId_; //!< Section id
const char* name_; //!< Section name
};
//! Description of the format of a metadatum //! Description of the format of a metadatum
struct TagFormat { struct TagFormat {
//! Constructor //! Constructor
@ -66,13 +82,13 @@ namespace Exif {
const char* name, const char* name,
const char* desc, const char* desc,
IfdId ifdId, IfdId ifdId,
TagSection section SectionId sectionId
); );
uint16 tag_; //!< Tag uint16 tag_; //!< Tag
const char* name_; //!< One word tag label const char* name_; //!< One word tag label
const char* desc_; //!< Short tag description const char* desc_; //!< Short tag description
IfdId ifdId_; //!< Link to the IFD IfdId ifdId_; //!< Link to the IFD
TagSection section_; //!< Section id SectionId sectionId_; //!< Section id
}; // struct TagInfo }; // struct TagInfo
//! Container for Exif tag information. Implemented as a static class. //! Container for Exif tag information. Implemented as a static class.
@ -91,13 +107,20 @@ namespace Exif {
static const char* typeName(uint16 type); static const char* typeName(uint16 type);
//! Returns the size in bytes of one element of this type //! Returns the size in bytes of one element of this type
static long typeSize(uint16 type); static long typeSize(uint16 type);
//! Returns the name of the IFD
static const char* ifdName(IfdId ifdId);
//! Returns the name of the section
static const char* sectionName(SectionId sectionId);
//! Returns the name of the section
static const char* sectionName(uint16 tag, IfdId ifdId);
private: private:
static int tagInfoIdx(uint16 tag, IfdId ifdId); static int tagInfoIdx(uint16 tag, IfdId ifdId);
static const TagFormat tagFormat_[]; static const IfdInfo ifdInfo_[];
static const TagInfo tagInfo_[]; static const SectionInfo sectionInfo_[];
static const TagFormat tagFormat_[];
static const TagInfo tagInfo_[];
}; };
// ***************************************************************************** // *****************************************************************************

Loading…
Cancel
Save