27 #ifndef CRWIMAGE_INT_HPP_ 28 #define CRWIMAGE_INT_HPP_ 94 typedef std::auto_ptr<CiffComponent>
AutoPtr;
102 : dir_(0), tag_(0), size_(0), offset_(0), pData_(0),
103 isAllocated_(false) {}
106 : dir_(dir), tag_(tag), size_(0), offset_(0), pData_(0),
107 isAllocated_(false) {}
117 void add(AutoPtr component);
131 CiffComponent*
add(CrwDirs& crwDirs, uint16_t crwTagId);
141 void remove(CrwDirs& crwDirs, uint16_t crwTagId);
206 void print(std::ostream& os,
216 uint16_t
dir()
const {
return dir_; }
219 uint16_t
tag()
const {
return tag_; }
232 uint32_t
size()
const {
return size_; }
235 uint32_t
offset()
const {
return offset_; }
241 uint16_t
tagId()
const {
return tag_ & 0x3fff; }
253 CiffComponent*
findComponent(uint16_t crwTagId, uint16_t crwDir)
const;
259 virtual void doAdd(AutoPtr component) =0;
262 virtual CiffComponent*
doAdd(CrwDirs& crwDirs, uint16_t crwTagId);
264 virtual void doRemove(CrwDirs& crwDirs, uint16_t crwTagId);
286 virtual void doPrint(std::ostream& os,
293 uint16_t crwDir)
const;
385 virtual CiffComponent*
doAdd(CrwDirs& crwDirs, uint16_t crwTagId);
387 virtual void doRemove(CrwDirs& crwDirs, uint16_t crwTagId);
409 virtual void doPrint(std::ostream& os,
418 uint16_t crwDir)
const;
445 byteOrder_ (littleEndian),
446 offset_ (0x0000001a),
475 void add(uint16_t crwTagId, uint16_t crwDir,
DataBuf buf);
484 void remove(uint16_t crwTagId, uint16_t crwDir);
509 void decode(Image& image)
const;
523 CiffComponent*
findComponent(uint16_t crwTagId, uint16_t crwDir)
const;
528 static const char signature_[];
560 : crwTagId_ (crwTagId),
603 static void decode(
const CiffComponent& ciffComponent,
615 static void encode(
CiffHeader* pHead,
const Image& image);
623 static void loadStack(CrwDirs& crwDirs, uint16_t crwDir);
627 static const CrwMapping* crwMapping(uint16_t crwDir, uint16_t crwTagId);
638 static void decodeBasic(
const CiffComponent& ciffComponent,
639 const CrwMapping* pCrwMapping,
644 static void decode0x0805(
const CiffComponent& ciffComponent,
645 const CrwMapping* pCrwMapping,
650 static void decode0x080a(
const CiffComponent& ciffComponent,
651 const CrwMapping* pCrwMapping,
656 static void decodeArray(
const CiffComponent& ciffComponent,
657 const CrwMapping* pCrwMapping,
662 static void decode0x180e(
const CiffComponent& ciffComponent,
663 const CrwMapping* pCrwMapping,
668 static void decode0x1810(
const CiffComponent& ciffComponent,
669 const CrwMapping* pCrwMapping,
674 static void decode0x2008(
const CiffComponent& ciffComponent,
675 const CrwMapping* pCrwMapping,
693 static void encodeBasic(
const Image& image,
694 const CrwMapping* pCrwMapping,
698 static void encode0x0805(
const Image& image,
699 const CrwMapping* pCrwMapping,
703 static void encode0x080a(
const Image& image,
704 const CrwMapping* pCrwMapping,
708 static void encodeArray(
const Image& image,
709 const CrwMapping* pCrwMapping,
713 static void encode0x180e(
const Image& image,
714 const CrwMapping* pCrwMapping,
718 static void encode0x1810(
const Image& image,
719 const CrwMapping* pCrwMapping,
723 static void encode0x2008(
const Image& image,
724 const CrwMapping* pCrwMapping,
728 static const CrwMapping crwMapping_[];
747 #endif // #ifndef CRWIMAGE_INT_HPP_ virtual void doRead(const byte *pData, uint32_t size, uint32_t start, ByteOrder byteOrder)
Implements read(). The default implementation reads a directory entry.
Definition: crwimage_int.cpp:232
uint16_t parent_
Parent directory tag.
Definition: crwimage_int.hpp:541
uint32_t write(Blob &blob, ByteOrder byteOrder, uint32_t offset)
Write the metadata from the raw metadata component to the binary image blob. This method may append t...
Definition: crwimage_int.cpp:369
void writeDirEntry(Blob &blob, ByteOrder byteOrder) const
Write a directory entry for the component to the blob. If the size of the data is not larger than 8 b...
Definition: crwimage_int.cpp:449
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434
Structure for the CIFF directory hierarchy.
Definition: crwimage_int.hpp:539
uint16_t crwTagId_
CRW tag id.
Definition: crwimage_int.hpp:571
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:113
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
virtual void doPrint(std::ostream &os, ByteOrder byteOrder, const std::string &prefix) const
Implements print(). The default implementation prints the entry.
Definition: crwimage_int.cpp:505
DataBuf packIfdId(const ExifData &exifData, IfdId ifdId, ByteOrder byteOrder)
Pack the tag values of all ifdId tags in exifData into a data buffer. This function is used to pack C...
Definition: crwimage_int.cpp:1197
CiffDirectory(uint16_t tag, uint16_t dir)
Constructor taking a tag and directory.
Definition: crwimage_int.hpp:357
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:130
This class models a CIFF directory of a CRW (Canon Raw data) image.
Definition: crwimage_int.hpp:350
CiffComponent()
Default constructor.
Definition: crwimage_int.hpp:101
uint32_t offset() const
Return the offset to the data from the start of the directory.
Definition: crwimage_int.hpp:235
uint8_t byte
1 byte unsigned integer type.
Definition: types.hpp:105
bool empty() const
Return true if the component is empty, else false.
Definition: crwimage_int.cpp:754
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:81
CrwDecodeFct toExif_
Conversion function.
Definition: crwimage_int.hpp:576
virtual void doDecode(Image &image, ByteOrder byteOrder) const =0
Implements decode()
void add(AutoPtr component)
Add a component to the composition.
Definition: crwimage_int.cpp:181
TypeId typeId() const
Return the type id of thi component.
Definition: crwimage_int.hpp:244
virtual ~CiffComponent()
Virtual destructor.
Definition: crwimage_int.cpp:163
void setOffset(uint32_t offset)
Set the offset for this component.
Definition: crwimage_int.hpp:277
std::stack< CrwSubDir > CrwDirs
Stack to hold a path of CRW directories.
Definition: crwimage_int.hpp:73
This class models one directory entry of a CIFF directory of a CRW (Canon Raw data) image...
Definition: crwimage_int.hpp:311
void setValue(DataBuf buf)
Set the data value of the entry.
Definition: crwimage_int.cpp:540
uint16_t dir() const
Return the tag of the directory containing this component.
Definition: crwimage_int.hpp:216
std::auto_ptr< CiffComponent > AutoPtr
CiffComponent auto_ptr type.
Definition: crwimage_int.hpp:94
IfdId ifdId_
Exif Ifd id to map to.
Definition: crwimage_int.hpp:575
uint16_t tag() const
Return the tag of this component.
Definition: crwimage_int.hpp:219
CiffEntry(uint16_t tag, uint16_t dir)
Constructor taking a tag and directory.
Definition: crwimage_int.hpp:318
CrwEncodeFct fromExif_
Reverse conversion function.
Definition: crwimage_int.hpp:577
std::vector< byte > Blob
Container for binary data.
Definition: types.hpp:162
void read(const byte *pData, uint32_t size, uint32_t start, ByteOrder byteOrder)
Read a component from a data buffer.
Definition: crwimage_int.cpp:224
virtual CiffComponent * doFindComponent(uint16_t crwTagId, uint16_t crwDir) const
Implements findComponent(). The default implementation checks the entry.
Definition: crwimage_int.cpp:598
CiffComponent(uint16_t tag, uint16_t dir)
Constructor taking a tag and directory.
Definition: crwimage_int.hpp:105
uint16_t tagId() const
Return the tag id of this component.
Definition: crwimage_int.hpp:241
Static class providing mapping functionality from CRW entries to image metadata and vice versa...
Definition: crwimage_int.hpp:585
virtual uint32_t doWrite(Blob &blob, ByteOrder byteOrder, uint32_t offset)=0
Implements write()
IPTC string type.
Definition: types.hpp:147
Structure for a mapping table for conversion of CIFF entries to image metadata and vice versa...
Definition: crwimage_int.hpp:548
void decode(Image &image, ByteOrder byteOrder) const
Decode metadata from the component and add it to image.
Definition: crwimage_int.cpp:315
virtual void doAdd(AutoPtr component)=0
Implements add()
std::vector< CiffComponent * > Components
Container type to hold all metadata.
Definition: crwimage_int.hpp:96
DataLocId
Type to identify where the data is stored in a directory.
Definition: crwimage_int.hpp:76
uint32_t size_
Data size (overwrites the size from the entry)
Definition: crwimage_int.hpp:573
void(* CrwDecodeFct)(const CiffComponent &, const CrwMapping *, Image &, ByteOrder)
Function pointer for functions to decode Exif tags from a CRW entry.
Definition: crwimage_int.hpp:62
CiffComponent * findComponent(uint16_t crwTagId, uint16_t crwDir) const
Finds crwTagId in directory crwDir, returning a pointer to the component or 0 if not found...
Definition: crwimage_int.cpp:592
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
uint32_t size() const
Return the data size of this component.
Definition: crwimage_int.hpp:232
uint16_t crwDir_
Directory tag.
Definition: crwimage_int.hpp:540
void setDir(uint16_t dir)
Set the directory tag for this component.
Definition: crwimage_int.hpp:179
virtual void doRemove(CrwDirs &crwDirs, uint16_t crwTagId)
Implements remove(). The default implementation does nothing.
Definition: crwimage_int.cpp:717
uint16_t tag_
Exif tag to map to.
Definition: crwimage_int.hpp:574
void(* CrwEncodeFct)(const Image &, const CrwMapping *, CiffHeader *)
Function pointer for functions to encode CRW entries from Exif tags.
Definition: crwimage_int.hpp:68
DataLocId dataLocation() const
Return the data location for this component.
Definition: crwimage_int.hpp:247
const byte * pData() const
Return a pointer to the data area of this component.
Definition: crwimage_int.hpp:238
uint16_t crwDir_
CRW directory tag.
Definition: crwimage_int.hpp:572
IfdId
Type to specify the IFD to which a metadata belongs.
Definition: tags_int.hpp:54
void setSize(uint32_t size)
Set the size of the data area.
Definition: crwimage_int.hpp:275
Interface class for components of the CIFF directory hierarchy of a CRW (Canon Raw data) image...
Definition: crwimage_int.hpp:91
virtual bool doEmpty() const
Implements empty(). Default implementation returns true if size is 0.
Definition: crwimage_int.cpp:759
void print(std::ostream &os, ByteOrder byteOrder, const std::string &prefix="") const
Print debug info about a component to os.
Definition: crwimage_int.cpp:498
uint32_t writeValueData(Blob &blob, uint32_t offset)
Writes the entry's value if size is larger than eight bytes. If needed, the value is padded with one ...
Definition: crwimage_int.cpp:383