Exiv2
crwimage_int.hpp
Go to the documentation of this file.
1 // ***************************************************************** -*- C++ -*-
2 /*
3  * Copyright (C) 2004-2018 Exiv2 authors
4  * This program is part of the Exiv2 distribution.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19  */
27 #ifndef CRWIMAGE_INT_HPP_
28 #define CRWIMAGE_INT_HPP_
29 
30 // *****************************************************************************
31 // included header files
32 #include "tags_int.hpp"
33 #include "image.hpp"
34 
35 // + standard includes
36 #include <iosfwd>
37 #include <string>
38 #include <vector>
39 #include <stack>
40 
41 // *****************************************************************************
42 // namespace extensions
43 namespace Exiv2 {
44 
45 // *****************************************************************************
46 // class declarations
47  class ExifData;
48 
49  namespace Internal {
50 
51 // *****************************************************************************
52 // class declarations
53  class CiffHeader;
54  class CiffComponent;
55  struct CrwMapping;
56  struct CrwSubDir;
57 
58 // *****************************************************************************
59 // type definitions
60 
62  typedef void (*CrwDecodeFct)(const CiffComponent&,
63  const CrwMapping*,
64  Image&,
65  ByteOrder);
66 
68  typedef void (*CrwEncodeFct)(const Image&,
69  const CrwMapping*,
70  CiffHeader*);
71 
73  typedef std::stack<CrwSubDir> CrwDirs;
74 
76  enum DataLocId {
77  valueData,
78  directoryData,
79  lastDataLocId
80  };
81 
82 // *****************************************************************************
83 // class definitions
84 
91  class CiffComponent {
92  public:
94  typedef std::auto_ptr<CiffComponent> AutoPtr;
96  typedef std::vector<CiffComponent*> Components;
97 
99 
100  CiffComponent()
102  : dir_(0), tag_(0), size_(0), offset_(0), pData_(0),
103  isAllocated_(false) {}
105  CiffComponent(uint16_t tag, uint16_t dir)
106  : dir_(dir), tag_(tag), size_(0), offset_(0), pData_(0),
107  isAllocated_(false) {}
109  virtual ~CiffComponent();
111 
113 
114  // Default assignment operator is fine
115 
117  void add(AutoPtr component);
131  CiffComponent* add(CrwDirs& crwDirs, uint16_t crwTagId);
141  void remove(CrwDirs& crwDirs, uint16_t crwTagId);
152  void read(const byte* pData,
153  uint32_t size,
154  uint32_t start,
155  ByteOrder byteOrder);
166  uint32_t write(Blob& blob, ByteOrder byteOrder, uint32_t offset);
177  uint32_t writeValueData(Blob& blob, uint32_t offset);
179  void setDir(uint16_t dir) { dir_ = dir; }
181  void setValue(DataBuf buf);
183 
185  static TypeId typeId(uint16_t tag);
187  static DataLocId dataLocation(uint16_t tag);
188 
190 
191 
198  void decode(Image& image, ByteOrder byteOrder) const;
206  void print(std::ostream& os,
207  ByteOrder byteOrder,
208  const std::string& prefix ="") const;
214  void writeDirEntry(Blob& blob, ByteOrder byteOrder) const;
216  uint16_t dir() const { return dir_; }
217 
219  uint16_t tag() const { return tag_; }
220 
222  bool empty() const;
223 
232  uint32_t size() const { return size_; }
233 
235  uint32_t offset() const { return offset_; }
236 
238  const byte* pData() const { return pData_; }
239 
241  uint16_t tagId() const { return tag_ & 0x3fff; }
242 
244  TypeId typeId() const { return typeId(tag_); }
245 
247  DataLocId dataLocation() const { return dataLocation(tag_); }
248 
253  CiffComponent* findComponent(uint16_t crwTagId, uint16_t crwDir) const;
255 
256  protected:
258 
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);
266  virtual void doRead(const byte* pData,
267  uint32_t size,
268  uint32_t start,
269  ByteOrder byteOrder);
271  virtual uint32_t doWrite(Blob& blob,
272  ByteOrder byteOrder,
273  uint32_t offset) =0;
275  void setSize(uint32_t size) { size_ = size; }
277  void setOffset(uint32_t offset) { offset_ = offset; }
279 
281 
282  virtual void doDecode(Image& image,
284  ByteOrder byteOrder) const =0;
286  virtual void doPrint(std::ostream& os,
287  ByteOrder byteOrder,
288  const std::string& prefix) const;
290  virtual bool doEmpty() const;
292  virtual CiffComponent* doFindComponent(uint16_t crwTagId,
293  uint16_t crwDir) const;
295 
296  private:
297  // DATA
298  uint16_t dir_;
299  uint16_t tag_;
300  uint32_t size_;
301  uint32_t offset_;
302  const byte* pData_;
303  bool isAllocated_;
304 
305  }; // class CiffComponent
306 
311  class CiffEntry : public CiffComponent {
312  public:
314 
315  CiffEntry() {}
318  CiffEntry(uint16_t tag, uint16_t dir) : CiffComponent(tag, dir) {}
319 
321  virtual ~CiffEntry();
323 
324  // Default assignment operator is fine
325 
326  private:
328 
329  using CiffComponent::doAdd;
330  // See base class comment
331  virtual void doAdd(AutoPtr component);
336  virtual uint32_t doWrite(Blob& blob,
337  ByteOrder byteOrder,
338  uint32_t offset);
340 
342 
343  // See base class comment
344  virtual void doDecode(Image& image, ByteOrder byteOrder) const;
346 
347  }; // class CiffEntry
348 
350  class CiffDirectory : public CiffComponent {
351  public:
353 
354  CiffDirectory() : cc_(NULL) {}
357  CiffDirectory(uint16_t tag, uint16_t dir) : CiffComponent(tag, dir), cc_(NULL) {}
358 
360  virtual ~CiffDirectory();
362 
364 
365  // Default assignment operator is fine
366 
374  void readDirectory(const byte* pData,
375  uint32_t size,
376  ByteOrder byteOrder);
378 
379  private:
381 
382  // See base class comment
383  virtual void doAdd(AutoPtr component);
384  // See base class comment
385  virtual CiffComponent* doAdd(CrwDirs& crwDirs, uint16_t crwTagId);
386  // See base class comment
387  virtual void doRemove(CrwDirs& crwDirs, uint16_t crwTagId);
392  virtual uint32_t doWrite(Blob& blob,
393  ByteOrder byteOrder,
394  uint32_t offset);
395  // See base class comment
396  virtual void doRead(const byte* pData,
397  uint32_t size,
398  uint32_t start,
399  ByteOrder byteOrder);
401 
403 
404  // See base class comment
405  virtual void doDecode(Image& image,
406  ByteOrder byteOrder) const;
407 
408  // See base class comment
409  virtual void doPrint(std::ostream& os,
410  ByteOrder byteOrder,
411  const std::string& prefix) const;
412 
414  virtual bool doEmpty() const;
415 
416  // See base class comment
417  virtual CiffComponent* doFindComponent(uint16_t crwTagId,
418  uint16_t crwDir) const;
420 
421  private:
422  // DATA
423  Components components_;
424  AutoPtr m_; // used by recursive doAdd
425  CiffComponent* cc_;
426 
427  }; // class CiffDirectory
428 
435  class CiffHeader {
436  public:
438  typedef std::auto_ptr<CiffHeader> AutoPtr;
439 
441 
442  CiffHeader()
444  : pRootDir_ (0),
445  byteOrder_ (littleEndian),
446  offset_ (0x0000001a),
447  pPadding_ (0),
448  padded_ (0)
449  {}
451  virtual ~CiffHeader();
453 
455 
456 
465  void read(const byte* pData, uint32_t size);
475  void add(uint16_t crwTagId, uint16_t crwDir, DataBuf buf);
484  void remove(uint16_t crwTagId, uint16_t crwDir);
486 
488  static const char* signature() { return signature_; }
489 
491 
492 
500  void write(Blob& blob) const;
509  void decode(Image& image) const;
516  void print(std::ostream& os, const std::string& prefix ="") const;
518  ByteOrder byteOrder() const { return byteOrder_; }
523  CiffComponent* findComponent(uint16_t crwTagId, uint16_t crwDir) const;
525 
526  private:
527  // DATA
528  static const char signature_[];
529 
530  CiffDirectory* pRootDir_;
531  ByteOrder byteOrder_;
532  uint32_t offset_;
533  byte* pPadding_;
534  uint32_t padded_;
535 
536  }; // class CiffHeader
537 
539  struct CrwSubDir {
540  uint16_t crwDir_;
541  uint16_t parent_;
542  }; // struct CrwSubDir
543 
548  struct CrwMapping {
550 
551  CrwMapping(
553  uint16_t crwTagId,
554  uint16_t crwDir,
555  uint32_t size,
556  uint16_t tag,
557  Internal::IfdId ifdId,
558  CrwDecodeFct toExif,
559  CrwEncodeFct fromExif)
560  : crwTagId_ (crwTagId),
561  crwDir_ (crwDir),
562  size_ (size),
563  tag_ (tag),
564  ifdId_ (ifdId),
565  toExif_ (toExif),
566  fromExif_ (fromExif)
567  {}
569 
570  // DATA
571  uint16_t crwTagId_;
572  uint16_t crwDir_;
573  uint32_t size_;
574  uint16_t tag_;
578 
579  }; // struct CrwMapping
580 
585  class CrwMap {
587 
588  CrwMap();
591 
592  public:
603  static void decode(const CiffComponent& ciffComponent,
604  Image& image,
605  ByteOrder byteOrder);
615  static void encode(CiffHeader* pHead, const Image& image);
616 
623  static void loadStack(CrwDirs& crwDirs, uint16_t crwDir);
624 
625  private:
627  static const CrwMapping* crwMapping(uint16_t crwDir, uint16_t crwTagId);
628 
638  static void decodeBasic(const CiffComponent& ciffComponent,
639  const CrwMapping* pCrwMapping,
640  Image& image,
641  ByteOrder byteOrder);
642 
644  static void decode0x0805(const CiffComponent& ciffComponent,
645  const CrwMapping* pCrwMapping,
646  Image& image,
647  ByteOrder byteOrder);
648 
650  static void decode0x080a(const CiffComponent& ciffComponent,
651  const CrwMapping* pCrwMapping,
652  Image& image,
653  ByteOrder byteOrder);
654 
656  static void decodeArray(const CiffComponent& ciffComponent,
657  const CrwMapping* pCrwMapping,
658  Image& image,
659  ByteOrder byteOrder);
660 
662  static void decode0x180e(const CiffComponent& ciffComponent,
663  const CrwMapping* pCrwMapping,
664  Image& image,
665  ByteOrder byteOrder);
666 
668  static void decode0x1810(const CiffComponent& ciffComponent,
669  const CrwMapping* pCrwMapping,
670  Image& image,
671  ByteOrder byteOrder);
672 
674  static void decode0x2008(const CiffComponent& ciffComponent,
675  const CrwMapping* pCrwMapping,
676  Image& image,
677  ByteOrder byteOrder);
678 
693  static void encodeBasic(const Image& image,
694  const CrwMapping* pCrwMapping,
695  CiffHeader* pHead);
696 
698  static void encode0x0805(const Image& image,
699  const CrwMapping* pCrwMapping,
700  CiffHeader* pHead);
701 
703  static void encode0x080a(const Image& image,
704  const CrwMapping* pCrwMapping,
705  CiffHeader* pHead);
706 
708  static void encodeArray(const Image& image,
709  const CrwMapping* pCrwMapping,
710  CiffHeader* pHead);
711 
713  static void encode0x180e(const Image& image,
714  const CrwMapping* pCrwMapping,
715  CiffHeader* pHead);
716 
718  static void encode0x1810(const Image& image,
719  const CrwMapping* pCrwMapping,
720  CiffHeader* pHead);
721 
723  static void encode0x2008(const Image& image,
724  const CrwMapping* pCrwMapping,
725  CiffHeader* pHead);
726  private:
727  // DATA
728  static const CrwMapping crwMapping_[];
729  static const CrwSubDir crwSubDir_[];
730 
731  }; // class CrwMap
732 
733 // *****************************************************************************
734 // template, inline and free functions
735 
741  DataBuf packIfdId(const ExifData& exifData,
742  IfdId ifdId,
743  ByteOrder byteOrder);
744 
745 }} // namespace Internal, Exiv2
746 
747 #endif // #ifndef CRWIMAGE_INT_HPP_
Exiv2::Internal::CrwSubDir::crwDir_
uint16_t crwDir_
Directory tag.
Definition: crwimage_int.hpp:540
Exiv2::Internal::CiffComponent::setValue
void setValue(DataBuf buf)
Set the data value of the entry.
Definition: crwimage_int.cpp:540
Exiv2::Internal::CiffComponent::CiffComponent
CiffComponent(uint16_t tag, uint16_t dir)
Constructor taking a tag and directory.
Definition: crwimage_int.hpp:105
Exiv2::Internal::CiffComponent::tagId
uint16_t tagId() const
Return the tag id of this component.
Definition: crwimage_int.hpp:241
Exiv2::Internal::CrwMapping::toExif_
CrwDecodeFct toExif_
Conversion function.
Definition: crwimage_int.hpp:576
Exiv2::Internal::canonEv
float canonEv(long val)
Convert Canon hex-based EV (modulo 0x20) to real number Ported from Phil Harvey's Image::ExifTool::Ca...
Definition: canonmn_int.cpp:2154
Exiv2::DataBuf::pData_
byte * pData_
Pointer to the buffer, 0 if none has been allocated.
Definition: types.hpp:269
Exiv2::Internal::CrwMap::decode
static void decode(const CiffComponent &ciffComponent, Image &image, ByteOrder byteOrder)
Decode image metadata from a CRW entry, convert and add it to the image metadata. This function conve...
Definition: crwimage_int.cpp:769
Exiv2::Internal::CiffComponent::AutoPtr
std::auto_ptr< CiffComponent > AutoPtr
CiffComponent auto_ptr type.
Definition: crwimage_int.hpp:94
Exiv2::Internal::CiffComponent::tag
uint16_t tag() const
Return the tag of this component.
Definition: crwimage_int.hpp:219
Exiv2::Internal::CiffHeader::write
void write(Blob &blob) const
Write the CRW image to the binary image blob, starting with the Ciff header. This method appends to t...
Definition: crwimage_int.cpp:334
Exiv2::ExifData::findKey
iterator findKey(const ExifKey &key)
Find the first Exifdatum with the given key, return an iterator to it.
Definition: exif.cpp:581
Exiv2::Internal::CiffComponent::doFindComponent
virtual CiffComponent * doFindComponent(uint16_t crwTagId, uint16_t crwDir) const
Implements findComponent(). The default implementation checks the entry.
Definition: crwimage_int.cpp:598
Exiv2::Internal::CrwMapping::crwDir_
uint16_t crwDir_
CRW directory tag.
Definition: crwimage_int.hpp:572
Exiv2::Internal::CiffComponent::read
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
Exiv2::Internal::exposureTime
URational exposureTime(float shutterSpeedValue)
Calculate the exposure time from an APEX shutter speed value.
Definition: tags_int.cpp:2172
Exiv2::Internal::CiffEntry::CiffEntry
CiffEntry()
Default constructor.
Definition: crwimage_int.hpp:316
Exiv2::Internal::CiffComponent::decode
void decode(Image &image, ByteOrder byteOrder) const
Decode metadata from the component and add it to image.
Definition: crwimage_int.cpp:315
Exiv2::Internal::CrwDecodeFct
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
Exiv2::Internal::CiffComponent::Components
std::vector< CiffComponent * > Components
Container type to hold all metadata.
Definition: crwimage_int.hpp:96
Exiv2::Internal::IfdId
IfdId
Type to specify the IFD to which a metadata belongs.
Definition: tags_int.hpp:54
Exiv2::ExifData::begin
iterator begin()
Begin of the metadata.
Definition: exif.hpp:490
Exiv2::Internal::CiffComponent::doWrite
virtual uint32_t doWrite(Blob &blob, ByteOrder byteOrder, uint32_t offset)=0
Implements write()
Exiv2::ExifData::const_iterator
ExifMetadata::const_iterator const_iterator
ExifMetadata const iterator type.
Definition: exif.hpp:439
Exiv2::undefined
@ undefined
Exif UNDEFINED type, an 8-bit byte that may contain anything.
Definition: types.hpp:137
Exiv2::Internal::CiffComponent::findComponent
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
Exiv2::Internal::CiffHeader::CiffHeader
CiffHeader()
Default constructor.
Definition: crwimage_int.hpp:443
Exiv2::Internal::CrwMapping::crwTagId_
uint16_t crwTagId_
CRW tag id.
Definition: crwimage_int.hpp:571
Exiv2::Internal::CiffComponent::size
uint32_t size() const
Return the data size of this component.
Definition: crwimage_int.hpp:232
Exiv2::DataBuf::release
EXV_WARN_UNUSED_RESULT std::pair< byte *, long > release()
Release ownership of the buffer to the caller. Returns the buffer as a data pointer and size pair,...
Definition: types.cpp:172
Exiv2::Internal::CiffEntry
This class models one directory entry of a CIFF directory of a CRW (Canon Raw data) image.
Definition: crwimage_int.hpp:311
Exiv2::Internal::CiffComponent::setDir
void setDir(uint16_t dir)
Set the directory tag for this component.
Definition: crwimage_int.hpp:179
Exiv2::comment
@ comment
Exiv2 type for the Exif user comment.
Definition: types.hpp:150
Exiv2::Internal::CiffComponent::doAdd
virtual void doAdd(AutoPtr component)=0
Implements add()
Exiv2::asciiString
@ asciiString
Exif ASCII type, 8-bit byte.
Definition: types.hpp:132
Exiv2::Value::create
static AutoPtr create(TypeId typeId)
A (simple) factory to create a Value type.
Definition: value.cpp:100
Exiv2::Internal::CrwMap::loadStack
static void loadStack(CrwDirs &crwDirs, uint16_t crwDir)
Load the stack: loop through the CRW subdirs hierarchy and push all directories on the path from crwD...
Definition: crwimage_int.cpp:982
Exiv2::Internal::CiffComponent::doRemove
virtual void doRemove(CrwDirs &crwDirs, uint16_t crwTagId)
Implements remove(). The default implementation does nothing.
Definition: crwimage_int.cpp:717
Exiv2::Internal::CiffHeader::AutoPtr
std::auto_ptr< CiffHeader > AutoPtr
CiffHeader auto_ptr type.
Definition: crwimage_int.hpp:438
Exiv2::ExifData::end
iterator end()
End of the metadata.
Definition: exif.hpp:492
Exiv2::unsignedLong
@ unsignedLong
Exif LONG type, 32-bit (4-byte) unsigned integer.
Definition: types.hpp:134
Exiv2::Internal::CrwMapping::CrwMapping
CrwMapping(uint16_t crwTagId, uint16_t crwDir, uint32_t size, uint16_t tag, Internal::IfdId ifdId, CrwDecodeFct toExif, CrwEncodeFct fromExif)
Default constructor.
Definition: crwimage_int.hpp:552
Exiv2::ULongValue
ValueType< uint32_t > ULongValue
Unsigned long value type.
Definition: value.hpp:1341
Exiv2::Internal::CiffHeader::byteOrder
ByteOrder byteOrder() const
Return the byte order (little or big endian).
Definition: crwimage_int.hpp:518
Exiv2::Internal::CiffEntry::~CiffEntry
virtual ~CiffEntry()
Virtual destructor.
Definition: crwimage_int.cpp:168
Exiv2::Internal::CiffComponent::pData
const byte * pData() const
Return a pointer to the data area of this component.
Definition: crwimage_int.hpp:238
Exiv2::URationalValue
ValueType< URational > URationalValue
Unsigned rational value type.
Definition: value.hpp:1343
Exiv2::Internal::groupName
const char * groupName(IfdId ifdId)
Return the group name for a group id.
Definition: tags_int.cpp:2155
canonmn_int.hpp
Canon makernote tags. References: [1] EXIF MakerNote of Canon by David Burren [2] Canon makernote t...
Exiv2::Internal::CrwMapping::tag_
uint16_t tag_
Exif tag to map to.
Definition: crwimage_int.hpp:574
Exiv2::Internal::CiffDirectory
This class models a CIFF directory of a CRW (Canon Raw data) image.
Definition: crwimage_int.hpp:350
Exiv2::Internal::CrwMapping::ifdId_
IfdId ifdId_
Exif Ifd id to map to.
Definition: crwimage_int.hpp:575
Exiv2::Internal::CiffComponent::setSize
void setSize(uint32_t size)
Set the size of the data area.
Definition: crwimage_int.hpp:275
Exiv2::Internal::CrwSubDir::parent_
uint16_t parent_
Parent directory tag.
Definition: crwimage_int.hpp:541
Exiv2::Internal::CiffComponent::dataLocation
DataLocId dataLocation() const
Return the data location for this component.
Definition: crwimage_int.hpp:247
Exiv2::exifTime
EXIV2API int exifTime(const char *buf, struct tm *tm)
Converts a string in the form "%Y:%m:%d %H:%M:%S", e.g., "2007:05:24 12:31:55" to broken down time fo...
Definition: types.cpp:556
Exiv2::Internal::CiffHeader::signature
static const char * signature()
Return a pointer to the Canon CRW signature.
Definition: crwimage_int.hpp:488
Exiv2::invalidTypeId
@ invalidTypeId
Invalid type id.
Definition: types.hpp:157
Exiv2::append
EXIV2API void append(Exiv2::Blob &blob, const byte *buf, uint32_t len)
Append len bytes pointed to by buf to blob.
Definition: image.cpp:984
Exiv2::orientation
EXIV2API ExifData::const_iterator orientation(const ExifData &ed)
Return the orientation of the image.
Definition: easyaccess.cpp:58
Exiv2::Internal::CiffHeader::print
void print(std::ostream &os, const std::string &prefix="") const
Print debug info for the CRW image to os.
Definition: crwimage_int.cpp:488
Exiv2::Internal::CiffHeader::~CiffHeader
virtual ~CiffHeader()
Virtual destructor.
Definition: crwimage_int.cpp:157
Exiv2::Internal::CiffDirectory::CiffDirectory
CiffDirectory(uint16_t tag, uint16_t dir)
Constructor taking a tag and directory.
Definition: crwimage_int.hpp:357
Exiv2::Internal::CiffComponent::doEmpty
virtual bool doEmpty() const
Implements empty(). Default implementation returns true if size is 0.
Definition: crwimage_int.cpp:759
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
Exiv2::l2Data
EXIV2API long l2Data(byte *buf, int32_t l, ByteOrder byteOrder)
Convert a signed long to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:445
Exiv2::unsignedByte
@ unsignedByte
Exif BYTE type, 8-bit unsigned integer.
Definition: types.hpp:131
Exiv2::us2Data
EXIV2API long us2Data(byte *buf, uint16_t s, ByteOrder byteOrder)
Convert an unsigned short to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:395
Exiv2::Internal::CiffComponent::writeValueData
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
Exiv2::Internal::CrwMap
Static class providing mapping functionality from CRW entries to image metadata and vice versa.
Definition: crwimage_int.hpp:585
Exiv2::Internal::CiffComponent::print
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
Exiv2::ExifKey
Concrete keys for Exif metadata and access to Exif tag reference data.
Definition: tags.hpp:148
Exiv2::DataBuf::size_
long size_
The current size of the buffer.
Definition: types.hpp:271
Exiv2::getLong
EXIV2API int32_t getLong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte signed long value from the data buffer.
Definition: types.cpp:328
Exiv2::Internal::CiffComponent::doRead
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
Exiv2::Internal::CiffHeader
This class models the header of a CRW (Canon Raw data) image. It is the head of a CIFF parse tree,...
Definition: crwimage_int.hpp:435
Exiv2::Internal::CiffComponent::write
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
Exiv2::Internal::CiffDirectory::readDirectory
void readDirectory(const byte *pData, uint32_t size, ByteOrder byteOrder)
Parse a CIFF directory from a memory buffer.
Definition: crwimage_int.cpp:277
Exiv2::Internal::CiffComponent::writeDirEntry
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
Exiv2::Internal::CiffComponent::doPrint
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
Exiv2::unsignedShort
@ unsignedShort
Exif SHORT type, 16-bit (2-byte) unsigned integer.
Definition: types.hpp:133
Exiv2::Internal::CrwDirs
std::stack< CrwSubDir > CrwDirs
Stack to hold a path of CRW directories.
Definition: crwimage_int.hpp:73
Exiv2::Internal::CrwMap::encode
static void encode(CiffHeader *pHead, const Image &image)
Encode image metadata from image into the CRW parse tree. This function converts all Exif metadata th...
Definition: crwimage_int.cpp:992
Exiv2::Internal::CiffHeader::remove
void remove(uint16_t crwTagId, uint16_t crwDir)
Remove entry crwTagId in directory crwDir from the parse tree. If it's the last entry in the director...
Definition: crwimage_int.cpp:699
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
Exiv2::Rational
std::pair< int32_t, int32_t > Rational
8 byte signed rational type.
Definition: types.hpp:110
Exiv2::TypeId
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:130
Exiv2::UShortValue
ValueType< uint16_t > UShortValue
Unsigned short value type.
Definition: value.hpp:1339
image.hpp
Exiv2::Internal::CiffHeader::decode
void decode(Image &image) const
Decode the CRW image and add it to image.
Definition: crwimage_int.cpp:309
Exiv2::ul2Data
EXIV2API long ul2Data(byte *buf, uint32_t l, ByteOrder byteOrder)
Convert an unsigned long to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:408
Exiv2::Internal::CrwMapping::fromExif_
CrwEncodeFct fromExif_
Reverse conversion function.
Definition: crwimage_int.hpp:577
Exiv2::TypeInfo::typeName
static const char * typeName(TypeId typeId)
Return the name of the type, 0 if unknown.
Definition: types.cpp:107
Exiv2::Internal::CiffDirectory::CiffDirectory
CiffDirectory()
Default constructor.
Definition: crwimage_int.hpp:355
Exiv2::Internal::CiffComponent::offset
uint32_t offset() const
Return the offset to the data from the start of the directory.
Definition: crwimage_int.hpp:235
Exiv2::Internal::CiffDirectory::~CiffDirectory
virtual ~CiffDirectory()
Virtual destructor.
Definition: crwimage_int.cpp:172
Exiv2::getUShort
EXIV2API uint16_t getUShort(const byte *buf, ByteOrder byteOrder)
Read a 2 byte unsigned short value from the data buffer.
Definition: types.cpp:278
Exiv2::ByteOrder
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:113
Exiv2::Internal::CrwSubDir
Structure for the CIFF directory hierarchy.
Definition: crwimage_int.hpp:539
Exiv2::Internal::CiffComponent::remove
void remove(CrwDirs &crwDirs, uint16_t crwTagId)
Remove crwTagId from the parse tree, if it exists yet. crwDirs contains the path of subdirectories,...
Definition: crwimage_int.cpp:712
Exiv2::Internal::CiffComponent::~CiffComponent
virtual ~CiffComponent()
Virtual destructor.
Definition: crwimage_int.cpp:163
tags_int.hpp
Internal Exif tag and type information.
Exiv2::URational
std::pair< uint32_t, uint32_t > URational
8 byte unsigned rational type.
Definition: types.hpp:108
Exiv2::Error
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:323
Exiv2::Internal::CiffComponent::CiffComponent
CiffComponent()
Default constructor.
Definition: crwimage_int.hpp:101
Exiv2::Internal::CrwMapping::size_
uint32_t size_
Data size (overwrites the size from the entry)
Definition: crwimage_int.hpp:573
Exiv2::Internal::CiffComponent
Interface class for components of the CIFF directory hierarchy of a CRW (Canon Raw data) image....
Definition: crwimage_int.hpp:91
Exiv2::Internal::CiffComponent::empty
bool empty() const
Return true if the component is empty, else false.
Definition: crwimage_int.cpp:754
Exiv2::Internal::CiffHeader::add
void add(uint16_t crwTagId, uint16_t crwDir, DataBuf buf)
Set the value of entry crwTagId in directory crwDir to buf. If this tag doesn't exist,...
Definition: crwimage_int.cpp:620
Exiv2::Internal::CiffComponent::setOffset
void setOffset(uint32_t offset)
Set the offset for this component.
Definition: crwimage_int.hpp:277
Exiv2::string
@ string
IPTC string type.
Definition: types.hpp:147
Exiv2::Internal::CrwEncodeFct
void(* CrwEncodeFct)(const Image &, const CrwMapping *, CiffHeader *)
Function pointer for functions to encode CRW entries from Exif tags.
Definition: crwimage_int.hpp:68
Exiv2::directory
@ directory
Exiv2 type for a CIFF directory.
Definition: types.hpp:151
Exiv2::Internal::CiffComponent::doDecode
virtual void doDecode(Image &image, ByteOrder byteOrder) const =0
Implements decode()
Exiv2::Internal::CiffComponent::add
void add(AutoPtr component)
Add a component to the composition.
Definition: crwimage_int.cpp:181
Exiv2::Internal::CiffComponent::typeId
TypeId typeId() const
Return the type id of thi component.
Definition: crwimage_int.hpp:244
Exiv2::floatToRationalCast
EXIV2API Rational floatToRationalCast(float f)
Very simple conversion of a float to a Rational.
Definition: types.cpp:694
Exiv2::Internal::CrwMapping
Structure for a mapping table for conversion of CIFF entries to image metadata and vice versa.
Definition: crwimage_int.hpp:548
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:81
Exiv2::Internal::CiffEntry::CiffEntry
CiffEntry(uint16_t tag, uint16_t dir)
Constructor taking a tag and directory.
Definition: crwimage_int.hpp:318
Exiv2::Internal::DataLocId
DataLocId
Type to identify where the data is stored in a directory.
Definition: crwimage_int.hpp:76
crwimage_int.hpp
Internal classes to support CRW/CIFF format.
Exiv2::Internal::CiffHeader::read
void read(const byte *pData, uint32_t size)
Read the CRW image from a data buffer, starting with the Ciff header.
Definition: crwimage_int.cpp:196
Exiv2::Internal::packIfdId
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
Exiv2::Value::AutoPtr
std::auto_ptr< Value > AutoPtr
Shortcut for a Value auto pointer.
Definition: value.hpp:63
Exiv2::Internal::CiffComponent::dir
uint16_t dir() const
Return the tag of the directory containing this component.
Definition: crwimage_int.hpp:216
Exiv2::getULong
EXIV2API uint32_t getULong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte unsigned long value from the data buffer.
Definition: types.cpp:283
Exiv2::Internal::CiffHeader::findComponent
CiffComponent * findComponent(uint16_t crwTagId, uint16_t crwDir) const
Finds crwTagId in directory crwDir in the parse tree, returning a pointer to the component or 0 if no...
Definition: crwimage_int.cpp:585
error.hpp
Error class for exceptions, log message class.
Exiv2::Image::exifData
virtual ExifData & exifData()
Returns an ExifData instance containing currently buffered Exif data.
Definition: image.cpp:551
Exiv2::Blob
std::vector< byte > Blob
Container for binary data.
Definition: types.hpp:162
Exiv2::ExifData
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434
Exiv2::Internal::fnumber
float fnumber(float apertureValue)
Calculate F number from an APEX aperture value.
Definition: tags_int.cpp:2167