New TIFF parser: Added Panasonic, Sigma and Sony makernotes
This commit is contained in:
parent
dabc5d7bb1
commit
4e7f2ee7d9
@ -77,8 +77,11 @@ CCSRC = basicio.cpp \
|
||||
olympusmn.cpp \
|
||||
olympusmn2.cpp \
|
||||
panasonicmn.cpp \
|
||||
panasonicmn2.cpp \
|
||||
sigmamn.cpp \
|
||||
sigmamn2.cpp \
|
||||
sonymn.cpp \
|
||||
sonymn2.cpp \
|
||||
tags.cpp \
|
||||
tiffcomposite.cpp \
|
||||
tiffimage.cpp \
|
||||
|
||||
@ -145,8 +145,11 @@ namespace Exiv2 {
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor
|
||||
TiffIfdMakernote(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
||||
: TiffComponent(tag, group), ifd_(tag, mnGroup) {}
|
||||
TiffIfdMakernote(uint16_t tag,
|
||||
uint16_t group,
|
||||
uint16_t mnGroup,
|
||||
bool hasNext =true)
|
||||
: TiffComponent(tag, group), ifd_(tag, mnGroup, hasNext) {}
|
||||
//! Virtual destructor
|
||||
virtual ~TiffIfdMakernote() =0;
|
||||
//@}
|
||||
|
||||
@ -36,6 +36,9 @@ EXIV2_RCSID("@(#) $Id$");
|
||||
#include "fujimn2.hpp"
|
||||
#include "nikonmn2.hpp"
|
||||
#include "olympusmn2.hpp"
|
||||
#include "panasonicmn2.hpp"
|
||||
#include "sigmamn2.hpp"
|
||||
#include "sonymn2.hpp"
|
||||
|
||||
// + standard includes
|
||||
|
||||
@ -44,10 +47,14 @@ EXIV2_RCSID("@(#) $Id$");
|
||||
namespace Exiv2 {
|
||||
|
||||
const TiffMnRegistry TiffMnCreator::registry_[] = {
|
||||
{ "Canon", newCanonMn, Group::canonmn },
|
||||
{ "FUJIFILM", newFujiMn, Group::fujimn },
|
||||
{ "NIKON", newNikonMn, Group::nikonmn },
|
||||
{ "OLYMPUS", newOlympusMn, Group::olympmn }
|
||||
{ "Canon", newCanonMn, Group::canonmn },
|
||||
{ "FOVEON", newSigmaMn, Group::sigmamn },
|
||||
{ "FUJIFILM", newFujiMn, Group::fujimn },
|
||||
{ "NIKON", newNikonMn, Group::nikonmn },
|
||||
{ "OLYMPUS", newOlympusMn, Group::olympmn },
|
||||
{ "Panasonic", newPanasonicMn, Group::panamn },
|
||||
{ "SIGMA", newSigmaMn, Group::sigmamn },
|
||||
{ "SONY", newSonyMn, Group::sonymn }
|
||||
};
|
||||
|
||||
|
||||
|
||||
103
src/panasonicmn2.cpp
Normal file
103
src/panasonicmn2.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
// ***************************************************************** -*- 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: panasonicmn2.cpp
|
||||
Version: $Rev$
|
||||
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
||||
History: 18-Apr-06, ahu: created
|
||||
*/
|
||||
// *****************************************************************************
|
||||
#include "rcsid.hpp"
|
||||
EXIV2_RCSID("@(#) $Id$");
|
||||
|
||||
// Define DEBUG to output debug information to std::cerr, e.g, by calling make
|
||||
// like this: make DEFS=-DDEBUG makernote2.o
|
||||
//#define DEBUG
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
#ifdef _MSC_VER
|
||||
# include "exv_msvc.h"
|
||||
#else
|
||||
# include "exv_conf.h"
|
||||
#endif
|
||||
|
||||
#include "panasonicmn2.hpp"
|
||||
#include "tiffcomposite.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
// + standard includes
|
||||
|
||||
// *****************************************************************************
|
||||
// class member definitions
|
||||
namespace Exiv2 {
|
||||
|
||||
const byte PanasonicMnHeader::signature_[] = {
|
||||
'P', 'a', 'n', 'a', 's', 'o', 'n', 'i', 'c', 0x00, 0x00, 0x00
|
||||
};
|
||||
const uint32_t PanasonicMnHeader::size_ = 12;
|
||||
|
||||
PanasonicMnHeader::PanasonicMnHeader()
|
||||
{
|
||||
read(signature_, size_, invalidByteOrder);
|
||||
}
|
||||
|
||||
bool PanasonicMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
assert (pData != 0);
|
||||
|
||||
if (size < size_) return false;
|
||||
if (0 != memcmp(pData, signature_, 9)) return false;
|
||||
buf_.alloc(size_);
|
||||
memcpy(buf_.pData_, pData, buf_.size_);
|
||||
start_ = size_;
|
||||
return true;
|
||||
|
||||
} // PanasonicMnHeader::read
|
||||
|
||||
bool TiffPanasonicMn::doReadHeader(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder)
|
||||
{
|
||||
return header_.read(pData, size, byteOrder);
|
||||
}
|
||||
|
||||
uint32_t TiffPanasonicMn::doIfdOffset() const
|
||||
{
|
||||
return header_.ifdOffset();
|
||||
}
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
|
||||
TiffComponent* newPanasonicMn(uint16_t tag,
|
||||
uint16_t group,
|
||||
uint16_t mnGroup,
|
||||
const byte* /*pData*/,
|
||||
uint32_t /*size*/,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
return new TiffPanasonicMn(tag, group, mnGroup);
|
||||
}
|
||||
|
||||
} // namespace Exiv2
|
||||
126
src/panasonicmn2.hpp
Normal file
126
src/panasonicmn2.hpp
Normal file
@ -0,0 +1,126 @@
|
||||
// ***************************************************************** -*- 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 panasonicmn2.hpp
|
||||
@brief TIFF Panasonic makernote
|
||||
@version $Rev$
|
||||
@author Andreas Huggel (ahu)
|
||||
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
||||
@date 18-Apr-06, ahu: created
|
||||
*/
|
||||
#ifndef PANASONICMN2_HPP_
|
||||
#define PANASONICMN2_HPP_
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
#include "makernote2.hpp"
|
||||
#include "tiffcomposite.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
// + standard includes
|
||||
|
||||
// *****************************************************************************
|
||||
// namespace extensions
|
||||
namespace Exiv2 {
|
||||
|
||||
// *****************************************************************************
|
||||
// class definitions
|
||||
|
||||
namespace Group {
|
||||
const uint16_t panamn = 267; //!< Panasonic makernote
|
||||
}
|
||||
|
||||
//! Header of a Panasonic Makernote
|
||||
class PanasonicMnHeader : public MnHeader {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor
|
||||
PanasonicMnHeader();
|
||||
//! Virtual destructor.
|
||||
virtual ~PanasonicMnHeader() {}
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
virtual bool read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
virtual uint32_t size() const { return size_; }
|
||||
virtual uint32_t ifdOffset() const { return start_; }
|
||||
//@}
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature_[]; //!< Panasonic makernote header signature
|
||||
static const uint32_t size_; //!< Size of the signature
|
||||
|
||||
}; // class PanasonicMnHeader
|
||||
|
||||
/*!
|
||||
@brief Panasonic Makernote
|
||||
*/
|
||||
class TiffPanasonicMn : public TiffIfdMakernote {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor.
|
||||
TiffPanasonicMn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
||||
: TiffIfdMakernote(tag, group, mnGroup, false) {}
|
||||
//! Virtual destructor
|
||||
virtual ~TiffPanasonicMn() {}
|
||||
//@}
|
||||
private:
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
virtual bool doReadHeader(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
//@}
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
virtual uint32_t doIfdOffset() const;
|
||||
//@}
|
||||
|
||||
private:
|
||||
// DATA
|
||||
PanasonicMnHeader header_; //!< Makernote header
|
||||
|
||||
}; // class TiffPanasonicMn
|
||||
|
||||
// *****************************************************************************
|
||||
// template, inline and free functions
|
||||
|
||||
//! Function to create a Panasonic makernote
|
||||
TiffComponent* newPanasonicMn(uint16_t tag,
|
||||
uint16_t group,
|
||||
uint16_t mnGroup,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
|
||||
} // namespace Exiv2
|
||||
|
||||
#endif // #ifndef PANASONICMN2_HPP_
|
||||
103
src/sigmamn2.cpp
Normal file
103
src/sigmamn2.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
// ***************************************************************** -*- 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: sigmamn2.cpp
|
||||
Version: $Rev$
|
||||
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
||||
History: 18-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 "sigmamn2.hpp"
|
||||
#include "tiffcomposite.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
// + standard includes
|
||||
|
||||
// *****************************************************************************
|
||||
// class member definitions
|
||||
namespace Exiv2 {
|
||||
|
||||
const byte SigmaMnHeader::signature1_[] = {
|
||||
'S', 'I', 'G', 'M', 'A', '\0', '\0', '\0', 0x01, 0x00
|
||||
};
|
||||
const byte SigmaMnHeader::signature2_[] = {
|
||||
'F', 'O', 'V', 'E', 'O', 'N', '\0', '\0', 0x01, 0x00
|
||||
};
|
||||
const uint32_t SigmaMnHeader::size_ = 10;
|
||||
|
||||
SigmaMnHeader::SigmaMnHeader()
|
||||
{
|
||||
read(signature1_, size_, invalidByteOrder);
|
||||
}
|
||||
|
||||
bool SigmaMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
assert (pData != 0);
|
||||
|
||||
if (size < size_) return false;
|
||||
if ( 0 != memcmp(pData, signature1_, 8)
|
||||
&& 0 != memcmp(pData, signature2_, 8)) return false;
|
||||
buf_.alloc(size_);
|
||||
memcpy(buf_.pData_, pData, buf_.size_);
|
||||
start_ = size_;
|
||||
return true;
|
||||
|
||||
} // SigmaMnHeader::read
|
||||
|
||||
bool TiffSigmaMn::doReadHeader(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder)
|
||||
{
|
||||
return header_.read(pData, size, byteOrder);
|
||||
}
|
||||
|
||||
uint32_t TiffSigmaMn::doIfdOffset() const
|
||||
{
|
||||
return header_.ifdOffset();
|
||||
}
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
|
||||
TiffComponent* newSigmaMn(uint16_t tag,
|
||||
uint16_t group,
|
||||
uint16_t mnGroup,
|
||||
const byte* /*pData*/,
|
||||
uint32_t /*size*/,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
return new TiffSigmaMn(tag, group, mnGroup);
|
||||
}
|
||||
|
||||
} // namespace Exiv2
|
||||
127
src/sigmamn2.hpp
Normal file
127
src/sigmamn2.hpp
Normal file
@ -0,0 +1,127 @@
|
||||
// ***************************************************************** -*- 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 sigmamn2.hpp
|
||||
@brief TIFF Sigma makernote
|
||||
@version $Rev$
|
||||
@author Andreas Huggel (ahu)
|
||||
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
||||
@date 18-Apr-06, ahu: created
|
||||
*/
|
||||
#ifndef SIGMAMN2_HPP_
|
||||
#define SIGMAMN2_HPP_
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
#include "makernote2.hpp"
|
||||
#include "tiffcomposite.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
// + standard includes
|
||||
|
||||
// *****************************************************************************
|
||||
// namespace extensions
|
||||
namespace Exiv2 {
|
||||
|
||||
// *****************************************************************************
|
||||
// class definitions
|
||||
|
||||
namespace Group {
|
||||
const uint16_t sigmamn = 268; //!< Sigma makernote
|
||||
}
|
||||
|
||||
//! Header of a Sigma Makernote
|
||||
class SigmaMnHeader : public MnHeader {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor
|
||||
SigmaMnHeader();
|
||||
//! Virtual destructor.
|
||||
virtual ~SigmaMnHeader() {}
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
virtual bool read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
virtual uint32_t size() const { return size_; }
|
||||
virtual uint32_t ifdOffset() const { return start_; }
|
||||
//@}
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature1_[]; //!< Sigma makernote header signature 1
|
||||
static const byte signature2_[]; //!< Sigma makernote header signature 2
|
||||
static const uint32_t size_; //!< Size of the signature
|
||||
|
||||
}; // class SigmaMnHeader
|
||||
|
||||
/*!
|
||||
@brief Sigma Makernote
|
||||
*/
|
||||
class TiffSigmaMn : public TiffIfdMakernote {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor.
|
||||
TiffSigmaMn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
||||
: TiffIfdMakernote(tag, group, mnGroup) {}
|
||||
//! Virtual destructor
|
||||
virtual ~TiffSigmaMn() {}
|
||||
//@}
|
||||
private:
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
virtual bool doReadHeader(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
//@}
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
virtual uint32_t doIfdOffset() const;
|
||||
//@}
|
||||
|
||||
private:
|
||||
// DATA
|
||||
SigmaMnHeader header_; //!< Makernote header
|
||||
|
||||
}; // class TiffSigmaMn
|
||||
|
||||
// *****************************************************************************
|
||||
// template, inline and free functions
|
||||
|
||||
//! Function to create a Sigma makernote
|
||||
TiffComponent* newSigmaMn(uint16_t tag,
|
||||
uint16_t group,
|
||||
uint16_t mnGroup,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
|
||||
} // namespace Exiv2
|
||||
|
||||
#endif // #ifndef SIGMAMN2_HPP_
|
||||
103
src/sonymn2.cpp
Normal file
103
src/sonymn2.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
// ***************************************************************** -*- 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: sonymn2.cpp
|
||||
Version: $Rev$
|
||||
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
||||
History: 18-Apr-06, ahu: created
|
||||
*/
|
||||
// *****************************************************************************
|
||||
#include "rcsid.hpp"
|
||||
EXIV2_RCSID("@(#) $Id$");
|
||||
|
||||
// Define DEBUG to output debug information to std::cerr, e.g, by calling make
|
||||
// like this: make DEFS=-DDEBUG makernote2.o
|
||||
//#define DEBUG
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
#ifdef _MSC_VER
|
||||
# include "exv_msvc.h"
|
||||
#else
|
||||
# include "exv_conf.h"
|
||||
#endif
|
||||
|
||||
#include "sonymn2.hpp"
|
||||
#include "tiffcomposite.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
// + standard includes
|
||||
|
||||
// *****************************************************************************
|
||||
// class member definitions
|
||||
namespace Exiv2 {
|
||||
|
||||
const byte SonyMnHeader::signature_[] = {
|
||||
'S', 'O', 'N', 'Y', ' ', 'D', 'S', 'C', ' ', '\0', '\0', '\0'
|
||||
};
|
||||
const uint32_t SonyMnHeader::size_ = 12;
|
||||
|
||||
SonyMnHeader::SonyMnHeader()
|
||||
{
|
||||
read(signature_, size_, invalidByteOrder);
|
||||
}
|
||||
|
||||
bool SonyMnHeader::read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
assert (pData != 0);
|
||||
|
||||
if (size < size_) return false;
|
||||
if (0 != memcmp(pData, signature_, size_)) return false;
|
||||
buf_.alloc(size_);
|
||||
memcpy(buf_.pData_, pData, buf_.size_);
|
||||
start_ = size_;
|
||||
return true;
|
||||
|
||||
} // SonyMnHeader::read
|
||||
|
||||
bool TiffSonyMn::doReadHeader(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder)
|
||||
{
|
||||
return header_.read(pData, size, byteOrder);
|
||||
}
|
||||
|
||||
uint32_t TiffSonyMn::doIfdOffset() const
|
||||
{
|
||||
return header_.ifdOffset();
|
||||
}
|
||||
|
||||
// *************************************************************************
|
||||
// free functions
|
||||
|
||||
TiffComponent* newSonyMn(uint16_t tag,
|
||||
uint16_t group,
|
||||
uint16_t mnGroup,
|
||||
const byte* /*pData*/,
|
||||
uint32_t /*size*/,
|
||||
ByteOrder /*byteOrder*/)
|
||||
{
|
||||
return new TiffSonyMn(tag, group, mnGroup);
|
||||
}
|
||||
|
||||
} // namespace Exiv2
|
||||
126
src/sonymn2.hpp
Normal file
126
src/sonymn2.hpp
Normal file
@ -0,0 +1,126 @@
|
||||
// ***************************************************************** -*- 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 sonymn2.hpp
|
||||
@brief TIFF Sony makernote
|
||||
@version $Rev$
|
||||
@author Andreas Huggel (ahu)
|
||||
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
||||
@date 18-Apr-06, ahu: created
|
||||
*/
|
||||
#ifndef SONYMN2_HPP_
|
||||
#define SONYMN2_HPP_
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
#include "makernote2.hpp"
|
||||
#include "tiffcomposite.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
// + standard includes
|
||||
|
||||
// *****************************************************************************
|
||||
// namespace extensions
|
||||
namespace Exiv2 {
|
||||
|
||||
// *****************************************************************************
|
||||
// class definitions
|
||||
|
||||
namespace Group {
|
||||
const uint16_t sonymn = 269; //!< Sony makernote
|
||||
}
|
||||
|
||||
//! Header of a Sony Makernote
|
||||
class SonyMnHeader : public MnHeader {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor
|
||||
SonyMnHeader();
|
||||
//! Virtual destructor.
|
||||
virtual ~SonyMnHeader() {}
|
||||
//@}
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
virtual bool read(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
//@}
|
||||
//! @name Accessors
|
||||
//@{
|
||||
virtual uint32_t size() const { return size_; }
|
||||
virtual uint32_t ifdOffset() const { return start_; }
|
||||
//@}
|
||||
|
||||
private:
|
||||
DataBuf buf_; //!< Raw header data
|
||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
||||
static const byte signature_[]; //!< Sony makernote header signature
|
||||
static const uint32_t size_; //!< Size of the signature
|
||||
|
||||
}; // class SonyMnHeader
|
||||
|
||||
/*!
|
||||
@brief Sony Makernote
|
||||
*/
|
||||
class TiffSonyMn : public TiffIfdMakernote {
|
||||
public:
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor.
|
||||
TiffSonyMn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
||||
: TiffIfdMakernote(tag, group, mnGroup) {}
|
||||
//! Virtual destructor
|
||||
virtual ~TiffSonyMn() {}
|
||||
//@}
|
||||
private:
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
virtual bool doReadHeader(const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
//@}
|
||||
|
||||
//! @name Accessors
|
||||
//@{
|
||||
virtual uint32_t doIfdOffset() const;
|
||||
//@}
|
||||
|
||||
private:
|
||||
// DATA
|
||||
SonyMnHeader header_; //!< Makernote header
|
||||
|
||||
}; // class TiffSonyMn
|
||||
|
||||
// *****************************************************************************
|
||||
// template, inline and free functions
|
||||
|
||||
//! Function to create a Sony makernote
|
||||
TiffComponent* newSonyMn(uint16_t tag,
|
||||
uint16_t group,
|
||||
uint16_t mnGroup,
|
||||
const byte* pData,
|
||||
uint32_t size,
|
||||
ByteOrder byteOrder);
|
||||
|
||||
} // namespace Exiv2
|
||||
|
||||
#endif // #ifndef SONYMN2_HPP_
|
||||
@ -105,9 +105,13 @@ namespace Exiv2 {
|
||||
case 260: group = "CanonCs1"; break;
|
||||
case 261: group = "CanonCs2"; break;
|
||||
case 262: group = "CanonCf"; break;
|
||||
// 263 not needed (canonmn)
|
||||
case 264: group = "Nikon1"; break;
|
||||
case 265: group = "Nikon2"; break;
|
||||
case 266: group = "Nikon3"; break;
|
||||
case 267: group = "Panasonic"; break;
|
||||
case 268: group = "Sigma"; break;
|
||||
case 269: group = "Sony"; break;
|
||||
default: group = "Unknown"; break;
|
||||
}
|
||||
return group;
|
||||
|
||||
@ -59,6 +59,7 @@ EXIV2_RCSID("@(#) $Id$");
|
||||
+ TiffComponent: should it have end() and setEnd() or pData and size?
|
||||
+ Can NewTiffCompFct and TiffCompFactoryFct be combined?
|
||||
+ Create function is repeated when actually only the table changes. Fix it.
|
||||
+ Is it easier (for writing) to combine all creation tables into one?
|
||||
+ CR2 Makernotes don't seem to have a next pointer but Canon Jpeg Makernotes
|
||||
do. What a mess. (That'll become an issue when it comes to writing to CR2)
|
||||
|
||||
|
||||
@ -568,7 +568,10 @@ namespace Exiv2 {
|
||||
static_cast<uint32_t>(pLast_ - object->start()),
|
||||
byteOrder())) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
std::cerr << "Error: Failed to read IFD Makernote header.\n";
|
||||
std::cerr << "Error: Failed to read "
|
||||
<< object->ifd_.groupName()
|
||||
<< " (" << object->ifd_.group()
|
||||
<< ") IFD Makernote header.\n";
|
||||
#endif
|
||||
return; // todo: signal error to parent, delete object
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user