Exiv2::ExifParser Class Reference

Stateless parser class for Exif data. Images use this class to decode and encode binary Exif data. More...

#include <exif.hpp>

List of all members.

Static Public Member Functions

ByteOrder decode (ExifData &exifData, const byte *pData, uint32_t size)
 Decode metadata from a buffer pData of length size with binary Exif data to the provided metadata container.
WriteMethod encode (Blob &blob, const byte *pData, uint32_t size, ByteOrder byteOrder, const ExifData &exifData)
 
void encode (Blob &blob, ByteOrder byteOrder, const ExifData &exifData)
 Encode metadata from the provided metadata to Exif format.


Detailed Description

Stateless parser class for Exif data. Images use this class to decode and encode binary Exif data.

Note:
Encode is lossy and is not the inverse of decode.


Member Function Documentation

ByteOrder Exiv2::ExifParser::decode ExifData exifData,
const byte pData,
uint32_t  size
[static]
 

Decode metadata from a buffer pData of length size with binary Exif data to the provided metadata container.

The buffer must start with a TIFF header. Return byte order in which the data is encoded.

Parameters:
exifData Exif metadata container.
pData Pointer to the data buffer. Must point to data in binary Exif format; no checks are performed.
size Length of the data buffer
Returns:
Byte order in which the data is encoded.

void Exiv2::ExifParser::encode Blob blob,
ByteOrder  byteOrder,
const ExifData exifData
[inline, static]
 

Encode metadata from the provided metadata to Exif format.

Encode Exif metadata from the ExifData container to binary Exif format in the blob, encoded in byteOrder.

This simpler encode method uses "intrusive" writing, i.e., it builds the binary representation of the metadata from scratch. It does not attempt "non-intrusive", i.e., in-place updating. It's better to use the other encode() method, if the metadata is already available in binary format, in order to allow for "non-intrusive" updating of the existing binary representation.

This is just an inline wrapper for ExifParser::encode(blob, 0, 0, byteOrder, exifData).

Parameters:
blob Container for the binary Exif data.
byteOrder Byte order to use.
exifData Exif metadata container.

WriteMethod Exiv2::ExifParser::encode Blob blob,
const byte pData,
uint32_t  size,
ByteOrder  byteOrder,
const ExifData exifData
[static]
 

The original binary Exif data in the memory block pData, size is parsed and updated in-place if possible ("non-intrusive" writing). If that is not possible (e.g., if new tags were added), the entire Exif structure is re-written to the blob ("intrusive" writing). The return value indicates which write method was used. If it is wmNonIntrusive, the original memory pData, size contains the result and blob is empty. If the return value is wmIntrusive, a new Exif structure was created and returned in blob. The memory block pData, size may be partly updated in this case and should not be used anymore.

Encode is a lossy operation. It attempts to fit the Exif data into a binary block suitable as the payload of a JPEG APP1 Exif segment, which can be at most 65527 bytes large. Encode omits IFD0 tags that are "not recorded" in compressed images according to the Exif 2.2 specification. It also doesn't write tags in groups which do not occur in JPEG images. If the resulting binary block is larger than allowed, it further deletes specific large preview tags and unknown tags. The operation succeeds even if the end result is still larger than the allowed size. Application should therefore always check the size of the blob.

Parameters:
blob Container for the binary Exif data if "intrusive" writing is necessary. Empty otherwise.
pData Pointer to the binary Exif data buffer. Must point to data in Exif format; no checks are performed. Will be modified if "non-intrusive" writing is possible.
size Length of the data buffer.
byteOrder Byte order to use.
exifData Exif metadata container.
Returns:
Write method used.


The documentation for this class was generated from the following files:
Generated on Thu Dec 31 03:58:01 2009 for Exiv2 by  doxygen 1.3.9.1