TiffParser can now be parametrized with a decoder. Added Cr2Image which uses this to filter not applicable IFD0 tags.
parent
28f1dbe8b4
commit
fe512e1470
@ -0,0 +1,285 @@
|
|||||||
|
// ***************************************************************** -*- C++ -*-
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Andreas Huggel <ahuggel@gmx.net>
|
||||||
|
*
|
||||||
|
* This program is part of the Exiv2 distribution.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
File: cr2image.cpp
|
||||||
|
Version: $Rev$
|
||||||
|
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
||||||
|
History: 22-Apr-06, ahu: created
|
||||||
|
|
||||||
|
*/
|
||||||
|
// *****************************************************************************
|
||||||
|
#include "rcsid.hpp"
|
||||||
|
EXIV2_RCSID("@(#) $Id$")
|
||||||
|
|
||||||
|
// *****************************************************************************
|
||||||
|
// included header files
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# include "exv_msvc.h"
|
||||||
|
#else
|
||||||
|
# include "exv_conf.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "cr2image.hpp"
|
||||||
|
#include "tiffparser.hpp"
|
||||||
|
#include "tiffvisitor.hpp"
|
||||||
|
#include "image.hpp"
|
||||||
|
#include "error.hpp"
|
||||||
|
#include "futils.hpp"
|
||||||
|
|
||||||
|
// + standard includes
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
// *****************************************************************************
|
||||||
|
// class member definitions
|
||||||
|
namespace Exiv2 {
|
||||||
|
|
||||||
|
// CR2 decoder table for special CR2 decoding requirements
|
||||||
|
const TiffDecoderInfo Cr2DecoderItems::cr2DecoderInfo_[] = {
|
||||||
|
{ "*", Tag::all, Group::ignr, 0 }, // Do not decode tags with group == Group::ignr
|
||||||
|
{ "*", 0x014a, Group::ifd0, 0 }, // Todo: Controversial, causes problems with Exiftool
|
||||||
|
{ "*", 0x0100, Group::ifd0, 0 }, // CR2 IFD0 refers to a preview image, ignore these tags
|
||||||
|
{ "*", 0x0101, Group::ifd0, 0 },
|
||||||
|
{ "*", 0x0102, Group::ifd0, 0 },
|
||||||
|
{ "*", 0x0103, Group::ifd0, 0 },
|
||||||
|
{ "*", 0x0111, Group::ifd0, 0 },
|
||||||
|
{ "*", 0x0117, Group::ifd0, 0 },
|
||||||
|
{ "*", 0x011a, Group::ifd0, 0 },
|
||||||
|
{ "*", 0x011b, Group::ifd0, 0 },
|
||||||
|
{ "*", 0x0128, Group::ifd0, 0 },
|
||||||
|
{ "*", 0x8649, Group::ifd0, &TiffMetadataDecoder::decodeIrbIptc }
|
||||||
|
};
|
||||||
|
|
||||||
|
const DecoderFct Cr2DecoderItems::findDecoder(const std::string& make,
|
||||||
|
uint32_t extendedTag,
|
||||||
|
uint16_t group)
|
||||||
|
{
|
||||||
|
DecoderFct decoderFct = &TiffMetadataDecoder::decodeStdTiffEntry;
|
||||||
|
const TiffDecoderInfo* td = find(cr2DecoderInfo_,
|
||||||
|
TiffDecoderInfo::Key(make, extendedTag, group));
|
||||||
|
if (td) {
|
||||||
|
// This may set decoderFct to 0, meaning that the tag should not be decoded
|
||||||
|
decoderFct = td->decoderFct_;
|
||||||
|
}
|
||||||
|
return decoderFct;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cr2Image::Cr2Image(BasicIo::AutoPtr io, bool create)
|
||||||
|
: Image(mdExif | mdIptc), io_(io)
|
||||||
|
{
|
||||||
|
if (create) {
|
||||||
|
IoCloser closer(*io_);
|
||||||
|
io_->open();
|
||||||
|
}
|
||||||
|
} // Cr2Image::Cr2Image
|
||||||
|
|
||||||
|
bool Cr2Image::good() const
|
||||||
|
{
|
||||||
|
if (io_->open() != 0) return false;
|
||||||
|
IoCloser closer(*io_);
|
||||||
|
return isThisType(*io_, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::clearMetadata()
|
||||||
|
{
|
||||||
|
clearExifData();
|
||||||
|
clearComment();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::setMetadata(const Image& image)
|
||||||
|
{
|
||||||
|
setExifData(image.exifData());
|
||||||
|
setComment(image.comment());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::clearExifData()
|
||||||
|
{
|
||||||
|
exifData_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::setExifData(const ExifData& exifData)
|
||||||
|
{
|
||||||
|
exifData_ = exifData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::clearIptcData()
|
||||||
|
{
|
||||||
|
iptcData_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::setIptcData(const IptcData& iptcData)
|
||||||
|
{
|
||||||
|
iptcData_ = iptcData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::clearComment()
|
||||||
|
{
|
||||||
|
comment_.erase();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::setComment(const std::string& comment)
|
||||||
|
{
|
||||||
|
comment_ = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cr2Image::readMetadata()
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cerr << "Reading CR2 file " << io_->path() << "\n";
|
||||||
|
#endif
|
||||||
|
if (io_->open() != 0) {
|
||||||
|
throw Error(9, io_->path(), strError());
|
||||||
|
}
|
||||||
|
IoCloser closer(*io_);
|
||||||
|
// Ensure that this is the correct image type
|
||||||
|
if (!isThisType(*io_, false)) {
|
||||||
|
if (io_->error() || io_->eof()) throw Error(14);
|
||||||
|
throw Error(3, "CR2");
|
||||||
|
}
|
||||||
|
clearMetadata();
|
||||||
|
|
||||||
|
// Read the image into a memory buffer
|
||||||
|
long len = io_->size();
|
||||||
|
DataBuf buf(len);
|
||||||
|
io_->read(buf.pData_, len);
|
||||||
|
if (io_->error() || io_->eof()) throw Error(14);
|
||||||
|
|
||||||
|
TiffParser::decode(this, buf.pData_, buf.size_,
|
||||||
|
TiffCreator::create, Cr2DecoderItems::findDecoder);
|
||||||
|
} // Cr2Image::readMetadata
|
||||||
|
|
||||||
|
void Cr2Image::writeMetadata()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|
||||||
|
Todo: implement me!
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cerr << "Writing CR2 file " << io_->path() << "\n";
|
||||||
|
#endif
|
||||||
|
// Read existing image
|
||||||
|
DataBuf buf;
|
||||||
|
if (io_->open() == 0) {
|
||||||
|
IoCloser closer(*io_);
|
||||||
|
// Ensure that this is the correct image type
|
||||||
|
if (isThisType(*io_, false)) {
|
||||||
|
// Read the image into a memory buffer
|
||||||
|
buf.alloc(io_->size());
|
||||||
|
io_->read(buf.pData_, buf.size_);
|
||||||
|
if (io_->error() || io_->eof()) {
|
||||||
|
buf.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse image, starting with a CR2 header component
|
||||||
|
Cr2Header::AutoPtr head(new Cr2Header);
|
||||||
|
if (buf.size_ != 0) {
|
||||||
|
head->read(buf.pData_, buf.size_);
|
||||||
|
}
|
||||||
|
|
||||||
|
Blob blob;
|
||||||
|
Cr2Parser::encode(blob, head.get(), this);
|
||||||
|
|
||||||
|
// Write new buffer to file
|
||||||
|
BasicIo::AutoPtr tempIo(io_->temporary()); // may throw
|
||||||
|
assert (tempIo.get() != 0);
|
||||||
|
tempIo->write(&blob[0], static_cast<long>(blob.size()));
|
||||||
|
io_->close();
|
||||||
|
io_->transfer(*tempIo); // may throw
|
||||||
|
*/
|
||||||
|
} // Cr2Image::writeMetadata
|
||||||
|
|
||||||
|
bool Cr2Image::isThisType(BasicIo& iIo, bool advance) const
|
||||||
|
{
|
||||||
|
return isCr2Type(iIo, advance);
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint16_t Cr2Header::tag_ = 42;
|
||||||
|
const char* Cr2Header::cr2sig_ = "CR\2\0";
|
||||||
|
|
||||||
|
bool Cr2Header::read(const byte* pData, uint32_t size)
|
||||||
|
{
|
||||||
|
if (size < 16) return false;
|
||||||
|
|
||||||
|
if (pData[0] == 0x49 && pData[1] == 0x49) {
|
||||||
|
byteOrder_ = littleEndian;
|
||||||
|
}
|
||||||
|
else if (pData[0] == 0x4d && pData[1] == 0x4d) {
|
||||||
|
byteOrder_ = bigEndian;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (tag_ != getUShort(pData + 2, byteOrder_)) return false;
|
||||||
|
offset_ = getULong(pData + 4, byteOrder_);
|
||||||
|
if (0 != memcmp(pData + 8, cr2sig_, 4)) return false;
|
||||||
|
offset2_ = getULong(pData + 12, byteOrder_);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} // Cr2Header::read
|
||||||
|
|
||||||
|
void Cr2Header::print(std::ostream& os, const std::string& prefix) const
|
||||||
|
{
|
||||||
|
os << prefix
|
||||||
|
<< "Header, offset = 0x" << std::setw(8) << std::setfill('0')
|
||||||
|
<< std::hex << std::right << offset_;
|
||||||
|
|
||||||
|
switch (byteOrder_) {
|
||||||
|
case littleEndian: os << ", little endian encoded"; break;
|
||||||
|
case bigEndian: os << ", big endian encoded"; break;
|
||||||
|
case invalidByteOrder: break;
|
||||||
|
}
|
||||||
|
os << "\n";
|
||||||
|
|
||||||
|
} // Cr2Header::print
|
||||||
|
|
||||||
|
// *************************************************************************
|
||||||
|
// free functions
|
||||||
|
|
||||||
|
Image::AutoPtr newCr2Instance(BasicIo::AutoPtr io, bool create)
|
||||||
|
{
|
||||||
|
Image::AutoPtr image(new Cr2Image(io, create));
|
||||||
|
if (!image->good()) {
|
||||||
|
image.reset();
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isCr2Type(BasicIo& iIo, bool advance)
|
||||||
|
{
|
||||||
|
const int32_t len = 16;
|
||||||
|
byte buf[len];
|
||||||
|
iIo.read(buf, len);
|
||||||
|
if (iIo.error() || iIo.eof()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Cr2Header header;
|
||||||
|
bool rc = header.read(buf, len);
|
||||||
|
if (!advance || !rc) {
|
||||||
|
iIo.seek(-len, BasicIo::cur);
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Exiv2
|
@ -0,0 +1,264 @@
|
|||||||
|
// ***************************************************************** -*- C++ -*-
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Andreas Huggel <ahuggel@gmx.net>
|
||||||
|
*
|
||||||
|
* This program is part of the Exiv2 distribution.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
/*!
|
||||||
|
@file cr2image.hpp
|
||||||
|
@brief Class Cr2Image
|
||||||
|
@version $Rev$
|
||||||
|
@author Andreas Huggel (ahu)
|
||||||
|
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
||||||
|
@date 22-Apr-06, ahu: created
|
||||||
|
*/
|
||||||
|
#ifndef CR2IMAGE_HPP_
|
||||||
|
#define CR2IMAGE_HPP_
|
||||||
|
|
||||||
|
// *****************************************************************************
|
||||||
|
// included header files
|
||||||
|
#include "exif.hpp"
|
||||||
|
#include "iptc.hpp"
|
||||||
|
#include "image.hpp"
|
||||||
|
#include "tiffcomposite.hpp"
|
||||||
|
|
||||||
|
// + standard includes
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// *****************************************************************************
|
||||||
|
// namespace extensions
|
||||||
|
namespace Exiv2 {
|
||||||
|
|
||||||
|
struct TiffDecoderInfo;
|
||||||
|
|
||||||
|
// *****************************************************************************
|
||||||
|
// class definitions
|
||||||
|
|
||||||
|
// Add CR2 to the supported image formats
|
||||||
|
namespace ImageType {
|
||||||
|
const int cr2 = 7; //!< CR2 image type (see class Cr2Image)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@brief Class to access Canon CR2 images. Exif metadata and a comment
|
||||||
|
are supported directly, IPTC is read from the Exif data, if present.
|
||||||
|
*/
|
||||||
|
class Cr2Image : public Image {
|
||||||
|
friend bool isCr2Type(BasicIo& iIo, bool advance);
|
||||||
|
|
||||||
|
//! @name NOT Implemented
|
||||||
|
//@{
|
||||||
|
//! Copy constructor
|
||||||
|
Cr2Image(const Cr2Image& rhs);
|
||||||
|
//! Assignment operator
|
||||||
|
Cr2Image& operator=(const Cr2Image& rhs);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! @name Creators
|
||||||
|
//@{
|
||||||
|
/*!
|
||||||
|
@brief Constructor that can either open an existing CR2 image or create
|
||||||
|
a new image from scratch. If a new image is to be created, any
|
||||||
|
existing data is overwritten. Since the constructor can not return
|
||||||
|
a result, callers should check the good() method after object
|
||||||
|
construction to determine success or failure.
|
||||||
|
@param io An auto-pointer that owns a BasicIo instance used for
|
||||||
|
reading and writing image metadata. \b Important: The constructor
|
||||||
|
takes ownership of the passed in BasicIo instance through the
|
||||||
|
auto-pointer. Callers should not continue to use the BasicIo
|
||||||
|
instance after it is passed to this method. Use the Image::io()
|
||||||
|
method to get a temporary reference.
|
||||||
|
@param create Specifies if an existing image should be read (false)
|
||||||
|
or if a new file should be created (true).
|
||||||
|
*/
|
||||||
|
Cr2Image(BasicIo::AutoPtr io, bool create);
|
||||||
|
//! Destructor
|
||||||
|
~Cr2Image() {}
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! @name Manipulators
|
||||||
|
//@{
|
||||||
|
void readMetadata();
|
||||||
|
/*!
|
||||||
|
@brief Todo: Write metadata back to the image. This method is not
|
||||||
|
yet implemented.
|
||||||
|
*/
|
||||||
|
void writeMetadata();
|
||||||
|
void setExifData(const ExifData& exifData);
|
||||||
|
void clearExifData();
|
||||||
|
void setIptcData(const IptcData& iptcData);
|
||||||
|
void clearIptcData();
|
||||||
|
void setComment(const std::string& comment);
|
||||||
|
void clearComment();
|
||||||
|
void setMetadata(const Image& image);
|
||||||
|
void clearMetadata();
|
||||||
|
ExifData& exifData() { return exifData_; }
|
||||||
|
IptcData& iptcData() { return iptcData_; }
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! @name Accessors
|
||||||
|
//@{
|
||||||
|
bool good() const;
|
||||||
|
const ExifData& exifData() const { return exifData_; }
|
||||||
|
const IptcData& iptcData() const { return iptcData_; }
|
||||||
|
std::string comment() const { return comment_; }
|
||||||
|
BasicIo& io() const { return *io_; }
|
||||||
|
//@}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! @name Accessors
|
||||||
|
//@{
|
||||||
|
/*!
|
||||||
|
@brief Determine if the content of the BasicIo instance is a CR2 image.
|
||||||
|
|
||||||
|
The advance flag determines if the read position in the stream is
|
||||||
|
moved (see below). This applies only if the type matches and the
|
||||||
|
function returns true. If the type does not match, the stream
|
||||||
|
position is not changed. However, if reading from the stream fails,
|
||||||
|
the stream position is undefined. Consult the stream state to obtain
|
||||||
|
more information in this case.
|
||||||
|
|
||||||
|
@param iIo BasicIo instance to read from.
|
||||||
|
@param advance Flag indicating whether the position of the io
|
||||||
|
should be advanced by the number of characters read to
|
||||||
|
analyse the data (true) or left at its original
|
||||||
|
position (false). This applies only if the type matches.
|
||||||
|
@return true if the data matches the type of this class;<BR>
|
||||||
|
false if the data does not match
|
||||||
|
*/
|
||||||
|
bool isThisType(BasicIo& iIo, bool advance) const;
|
||||||
|
/*!
|
||||||
|
@brief Todo: Write CR2 header. Not implemented yet.
|
||||||
|
*/
|
||||||
|
int writeHeader(BasicIo& oIo) const;
|
||||||
|
//@}
|
||||||
|
|
||||||
|
// DATA
|
||||||
|
BasicIo::AutoPtr io_; //!< Image data io pointer
|
||||||
|
ExifData exifData_; //!< Exif data container
|
||||||
|
IptcData iptcData_; //!< IPTC data container
|
||||||
|
std::string comment_; //!< User comment
|
||||||
|
|
||||||
|
}; // class Cr2Image
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@brief Table of special Cr2 decoding functions and find function. See
|
||||||
|
TiffDecoderItems for details.
|
||||||
|
*/
|
||||||
|
class Cr2DecoderItems {
|
||||||
|
public:
|
||||||
|
/*!
|
||||||
|
@brief Find the decoder function for a key.
|
||||||
|
|
||||||
|
If the returned pointer is 0, the tag should not be decoded,
|
||||||
|
else the decoder function should be used.
|
||||||
|
|
||||||
|
@param make Camera make
|
||||||
|
@param extendedTag Extended tag
|
||||||
|
@param group %Group
|
||||||
|
|
||||||
|
@return Pointer to the decoder function
|
||||||
|
*/
|
||||||
|
static const DecoderFct findDecoder(const std::string& make,
|
||||||
|
uint32_t extendedTag,
|
||||||
|
uint16_t group);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const TiffDecoderInfo cr2DecoderInfo_[]; //<! CR2 decoder table
|
||||||
|
|
||||||
|
}; // class Cr2DecoderItems
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@brief This class models a Canon CR2 header structure.
|
||||||
|
*/
|
||||||
|
class Cr2Header {
|
||||||
|
public:
|
||||||
|
//! @name Creators
|
||||||
|
//@{
|
||||||
|
//! Default constructor
|
||||||
|
Cr2Header()
|
||||||
|
: byteOrder_ (littleEndian),
|
||||||
|
offset_ (0x00000010),
|
||||||
|
offset2_ (0x00000000)
|
||||||
|
{}
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! @name Manipulators
|
||||||
|
//@{
|
||||||
|
/*!
|
||||||
|
@brief Read the CR2 header from a data buffer. Return false if the
|
||||||
|
data buffer does not contain a CR2 header, else true.
|
||||||
|
|
||||||
|
@param pData Pointer to the data buffer.
|
||||||
|
@param size Number of bytes in the data buffer.
|
||||||
|
*/
|
||||||
|
bool read(const byte* pData, uint32_t size);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! @name Accessors
|
||||||
|
//@{
|
||||||
|
/*!
|
||||||
|
@brief Write the CR2 header to the binary image \em blob.
|
||||||
|
This method appends to the blob.
|
||||||
|
|
||||||
|
@param blob Binary image to add to.
|
||||||
|
|
||||||
|
@throw Error If the header cannot be written.
|
||||||
|
*/
|
||||||
|
void write(Blob& blob) const;
|
||||||
|
/*!
|
||||||
|
@brief Print debug info for the CR2 header to \em os.
|
||||||
|
|
||||||
|
@param os Output stream to write to.
|
||||||
|
@param prefix Prefix to be written before each line of output.
|
||||||
|
*/
|
||||||
|
void print(std::ostream& os, const std::string& prefix ="") const;
|
||||||
|
//! Return the byte order (little or big endian).
|
||||||
|
ByteOrder byteOrder() const { return byteOrder_; }
|
||||||
|
//! Return the offset to the start of the root directory
|
||||||
|
uint32_t offset() const { return offset_; }
|
||||||
|
//@}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// DATA
|
||||||
|
ByteOrder byteOrder_; //!< Applicable byte order
|
||||||
|
uint32_t offset_; //!< Offset to the start of the root dir
|
||||||
|
uint32_t offset2_; //!< Bytes 12-15 from the header
|
||||||
|
|
||||||
|
static const uint16_t tag_; //!< 42, identifies the buffer as TIFF data
|
||||||
|
static const char* cr2sig_; //!< Signature for CR2 type TIFF
|
||||||
|
}; // class Cr2Header
|
||||||
|
|
||||||
|
// *****************************************************************************
|
||||||
|
// template, inline and free functions
|
||||||
|
|
||||||
|
// These could be static private functions on Image subclasses but then
|
||||||
|
// ImageFactory needs to be made a friend.
|
||||||
|
/*!
|
||||||
|
@brief Create a new Cr2Image instance and return an auto-pointer to it.
|
||||||
|
Caller owns the returned object and the auto-pointer ensures that
|
||||||
|
it will be deleted.
|
||||||
|
*/
|
||||||
|
Image::AutoPtr newCr2Instance(BasicIo::AutoPtr io, bool create);
|
||||||
|
|
||||||
|
//! Check if the file iIo is a CR2 image.
|
||||||
|
bool isCr2Type(BasicIo& iIo, bool advance);
|
||||||
|
|
||||||
|
} // namespace Exiv2
|
||||||
|
|
||||||
|
#endif // #ifndef CR2IMAGE_HPP_
|
Loading…
Reference in New Issue