New TIFF parser: Simplified Makernote design.
parent
670d622612
commit
15b0cf42ad
@ -1,99 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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: canonmn2.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 "canonmn2.hpp"
|
|
||||||
#include "tiffcomposite.hpp"
|
|
||||||
#include "types.hpp"
|
|
||||||
|
|
||||||
// + standard includes
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// class member definitions
|
|
||||||
namespace Exiv2 {
|
|
||||||
|
|
||||||
const TiffStructure TiffCanonCreator::tiffStructure_[] = {
|
|
||||||
// ext. tag group create function new group
|
|
||||||
//--------- -------------- ------------------- --------------
|
|
||||||
{ 0x0001, Group::canonmn, newTiffArrayEntry, Group::canoncs },
|
|
||||||
{ 0x0004, Group::canonmn, newTiffArrayEntry, Group::canonsi },
|
|
||||||
{ 0x000f, Group::canonmn, newTiffArrayEntry, Group::canoncf },
|
|
||||||
{ Tag::all, Group::canoncs, newTiffArrayElement, Group::canoncs },
|
|
||||||
{ Tag::all, Group::canonsi, newTiffArrayElement, Group::canonsi },
|
|
||||||
{ Tag::all, Group::canoncf, newTiffArrayElement, Group::canoncf }
|
|
||||||
};
|
|
||||||
|
|
||||||
TiffComponent::AutoPtr TiffCanonCreator::create(uint32_t extendedTag,
|
|
||||||
uint16_t group)
|
|
||||||
{
|
|
||||||
TiffComponent::AutoPtr tc(0);
|
|
||||||
uint16_t tag = static_cast<uint16_t>(extendedTag & 0xffff);
|
|
||||||
const TiffStructure* ts = find(tiffStructure_,
|
|
||||||
TiffStructure::Key(extendedTag, group));
|
|
||||||
if (ts && ts->newTiffCompFct_) {
|
|
||||||
tc = ts->newTiffCompFct_(tag, ts);
|
|
||||||
}
|
|
||||||
if (!ts && extendedTag != Tag::next) {
|
|
||||||
tc = TiffComponent::AutoPtr(new TiffEntry(tag, group));
|
|
||||||
}
|
|
||||||
return tc;
|
|
||||||
} // TiffCanonCreator::create
|
|
||||||
|
|
||||||
TiffRwState::AutoPtr TiffCanonMn::doGetState(uint32_t /*mnOffset*/,
|
|
||||||
ByteOrder byteOrder) const
|
|
||||||
{
|
|
||||||
// Byteorder: No change
|
|
||||||
// Offsets : No change (relative to the start of the TIFF header)
|
|
||||||
// Creator : Canon TIFF component factory
|
|
||||||
return TiffRwState::AutoPtr(
|
|
||||||
new TiffRwState(byteOrder, 0, TiffCanonCreator::create));
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************************
|
|
||||||
// free functions
|
|
||||||
|
|
||||||
TiffComponent* newCanonMn(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
uint16_t mnGroup,
|
|
||||||
const byte* /*pData*/,
|
|
||||||
uint32_t /*size*/,
|
|
||||||
ByteOrder /*byteOrder*/)
|
|
||||||
{
|
|
||||||
return new TiffCanonMn(tag, group, mnGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
@ -1,109 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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 canonmn2.hpp
|
|
||||||
@brief TIFF Canon makernote
|
|
||||||
@version $Rev$
|
|
||||||
@author Andreas Huggel (ahu)
|
|
||||||
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
|
||||||
@date 18-Apr-06, ahu: created
|
|
||||||
*/
|
|
||||||
#ifndef CANONMN2_HPP_
|
|
||||||
#define CANONMN2_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 canonmn = 259; //!< Canon makernote
|
|
||||||
const uint16_t canoncs = 260; //!< Canon camera settings
|
|
||||||
const uint16_t canonsi = 261; //!< Canon shot info
|
|
||||||
const uint16_t canoncf = 262; //!< Canon customer functions
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@brief Canon Makernote
|
|
||||||
*/
|
|
||||||
class TiffCanonMn : public TiffIfdMakernote {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
TiffCanonMn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
|
||||||
: TiffIfdMakernote(tag, group, mnGroup) {}
|
|
||||||
//! Virtual destructor
|
|
||||||
virtual ~TiffCanonMn() {}
|
|
||||||
//@}
|
|
||||||
private:
|
|
||||||
//! @name Accessors
|
|
||||||
//@{
|
|
||||||
virtual TiffRwState::AutoPtr doGetState(uint32_t mnOffset,
|
|
||||||
ByteOrder byteOrder) const;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
}; // class TiffCanonMn
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@brief TIFF component factory for Canon TIFF components.
|
|
||||||
*/
|
|
||||||
class TiffCanonCreator {
|
|
||||||
public:
|
|
||||||
/*!
|
|
||||||
@brief Create the TiffComponent for TIFF entry \em extendedTag and
|
|
||||||
\em group based on the embedded lookup table.
|
|
||||||
|
|
||||||
If a tag and group combination is not found in the table, a TiffEntry
|
|
||||||
is created. If the pointer that is returned is 0, then the TIFF entry
|
|
||||||
should be ignored.
|
|
||||||
*/
|
|
||||||
static TiffComponent::AutoPtr create(uint32_t extendedTag,
|
|
||||||
uint16_t group);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static const TiffStructure tiffStructure_[]; //<! TIFF structure
|
|
||||||
}; // class TiffCanonCreator
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// template, inline and free functions
|
|
||||||
|
|
||||||
//! Function to create a Canon makernote
|
|
||||||
TiffComponent* newCanonMn(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
uint16_t mnGroup,
|
|
||||||
const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
||||||
|
|
||||||
#endif // #ifndef CANONMN2_HPP_
|
|
@ -1,120 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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: fujimn2.cpp
|
|
||||||
Version: $Rev$
|
|
||||||
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
|
||||||
History: 15-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 "fujimn2.hpp"
|
|
||||||
#include "tiffcomposite.hpp"
|
|
||||||
#include "tiffparser.hpp"
|
|
||||||
#include "types.hpp"
|
|
||||||
|
|
||||||
// + standard includes
|
|
||||||
#include <cstring>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// class member definitions
|
|
||||||
namespace Exiv2 {
|
|
||||||
|
|
||||||
const byte FujiMnHeader::signature_[] = {
|
|
||||||
'F', 'U', 'J', 'I', 'F', 'I', 'L', 'M', 0x0c, 0x00, 0x00, 0x00
|
|
||||||
};
|
|
||||||
const uint32_t FujiMnHeader::size_ = 12;
|
|
||||||
const ByteOrder FujiMnHeader::byteOrder_ = littleEndian;
|
|
||||||
|
|
||||||
FujiMnHeader::FujiMnHeader()
|
|
||||||
{
|
|
||||||
read(signature_, size_, byteOrder_);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FujiMnHeader::read(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder /*byteOrder*/)
|
|
||||||
{
|
|
||||||
assert (pData != 0);
|
|
||||||
|
|
||||||
if (size < size_) return false;
|
|
||||||
|
|
||||||
header_.alloc(size_);
|
|
||||||
memcpy(header_.pData_, pData, header_.size_);
|
|
||||||
|
|
||||||
// Read offset to the IFD relative to the start of the makernote
|
|
||||||
// from the header. Note that we ignore the byteOrder argument
|
|
||||||
start_ = getUShort(header_.pData_ + 8, byteOrder_);
|
|
||||||
|
|
||||||
if ( static_cast<uint32_t>(header_.size_) < size_
|
|
||||||
|| 0 != memcmp(header_.pData_, signature_, 8)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} // FujiMnHeader::read
|
|
||||||
|
|
||||||
bool TiffFujiMn::doReadHeader(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder)
|
|
||||||
{
|
|
||||||
return header_.read(pData, size, byteOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t TiffFujiMn::doIfdOffset() const
|
|
||||||
{
|
|
||||||
return header_.ifdOffset();
|
|
||||||
}
|
|
||||||
|
|
||||||
TiffRwState::AutoPtr TiffFujiMn::doGetState(uint32_t mnOffset,
|
|
||||||
ByteOrder /*byteOrder*/) const
|
|
||||||
{
|
|
||||||
// Byteorder: from the header (little endian)
|
|
||||||
// Offsets : relative to the start of the makernote
|
|
||||||
// Creator : no change
|
|
||||||
return TiffRwState::AutoPtr(
|
|
||||||
new TiffRwState(header_.byteOrder(), mnOffset, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************************
|
|
||||||
// free functions
|
|
||||||
|
|
||||||
TiffComponent* newFujiMn(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
uint16_t mnGroup,
|
|
||||||
const byte* /*pData*/,
|
|
||||||
uint32_t /*size*/,
|
|
||||||
ByteOrder /*byteOrder*/)
|
|
||||||
{
|
|
||||||
return new TiffFujiMn(tag, group, mnGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
@ -1,132 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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 fujimn2.hpp
|
|
||||||
@brief TIFF Fujifilm makernote
|
|
||||||
@version $Rev$
|
|
||||||
@author Andreas Huggel (ahu)
|
|
||||||
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
|
||||||
@date 15-Apr-06, ahu: created
|
|
||||||
*/
|
|
||||||
#ifndef FUJIMN2_HPP_
|
|
||||||
#define FUJIMN2_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 fujimn = 258; //!< Fujifilm makernote
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Header of a Fujifilm Makernote
|
|
||||||
class FujiMnHeader : public MnHeader {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
FujiMnHeader();
|
|
||||||
//! Virtual destructor.
|
|
||||||
virtual ~FujiMnHeader() {}
|
|
||||||
//@}
|
|
||||||
//! @name Manipulators
|
|
||||||
//@{
|
|
||||||
virtual bool read(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
//@}
|
|
||||||
//! @name Accessors
|
|
||||||
//@{
|
|
||||||
virtual uint32_t size() const { return header_.size_; }
|
|
||||||
virtual uint32_t ifdOffset() const { return start_; }
|
|
||||||
//! Return the byte order for the header
|
|
||||||
ByteOrder byteOrder() const { return byteOrder_; }
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
DataBuf header_; //!< Data buffer for the makernote header
|
|
||||||
static const byte signature_[]; //!< Fujifilm makernote header signature
|
|
||||||
static const uint32_t size_; //!< Size of the signature
|
|
||||||
static const ByteOrder byteOrder_; //!< Byteorder for makernote (II)
|
|
||||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
|
||||||
|
|
||||||
}; // class FujiMnHeader
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@brief Fujifilm Makernote
|
|
||||||
*/
|
|
||||||
class TiffFujiMn : public TiffIfdMakernote {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
TiffFujiMn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
|
||||||
: TiffIfdMakernote(tag, group, mnGroup) {}
|
|
||||||
//! Virtual destructor
|
|
||||||
virtual ~TiffFujiMn() {}
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
//! @name Manipulators
|
|
||||||
//@{
|
|
||||||
virtual bool doReadHeader(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
//@}
|
|
||||||
|
|
||||||
//! @name Accessors
|
|
||||||
//@{
|
|
||||||
virtual uint32_t doIfdOffset() const;
|
|
||||||
virtual TiffRwState::AutoPtr doGetState(uint32_t mnOffset,
|
|
||||||
ByteOrder byteOrder) const;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// DATA
|
|
||||||
FujiMnHeader header_; //!< Makernote header
|
|
||||||
|
|
||||||
}; // TiffFujiMn
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// template, inline and free functions
|
|
||||||
|
|
||||||
//! Function to create a Fujifilm makernote
|
|
||||||
TiffComponent* newFujiMn(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
uint16_t mnGroup,
|
|
||||||
const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
||||||
|
|
||||||
#endif // #ifndef FUJIMN2_HPP_
|
|
@ -1,80 +0,0 @@
|
|||||||
// ***************************************************************** -*- C++ -*-
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2005, 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: mnreg.cpp
|
|
||||||
Version: $Rev$
|
|
||||||
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
|
||||||
History: 15-Apr-06, ahu: created
|
|
||||||
|
|
||||||
*/
|
|
||||||
// *****************************************************************************
|
|
||||||
#include "rcsid.hpp"
|
|
||||||
EXIV2_RCSID("@(#) $Id$");
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// included header files
|
|
||||||
#include "makernote2.hpp"
|
|
||||||
#include "canonmn2.hpp"
|
|
||||||
#include "fujimn2.hpp"
|
|
||||||
#include "nikonmn2.hpp"
|
|
||||||
#include "olympusmn2.hpp"
|
|
||||||
#include "panasonicmn2.hpp"
|
|
||||||
#include "sigmamn2.hpp"
|
|
||||||
#include "sonymn2.hpp"
|
|
||||||
|
|
||||||
// + standard includes
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// class member definitions
|
|
||||||
namespace Exiv2 {
|
|
||||||
|
|
||||||
const TiffMnRegistry TiffMnCreator::registry_[] = {
|
|
||||||
{ "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 }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// The find template needs to see the array from where it is called
|
|
||||||
TiffComponent* TiffMnCreator::create(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
const std::string& make,
|
|
||||||
const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder)
|
|
||||||
{
|
|
||||||
TiffComponent* tc = 0;
|
|
||||||
const TiffMnRegistry* tmr = find(registry_, TiffMnRegistry::Key(make));
|
|
||||||
if (tmr) tc = tmr->newMnFct_(tag,
|
|
||||||
group,
|
|
||||||
tmr->mnGroup_,
|
|
||||||
pData,
|
|
||||||
size,
|
|
||||||
byteOrder);
|
|
||||||
return tc;
|
|
||||||
} // TiffMnCreator::create
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
@ -1,166 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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: nikonmn2.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 "nikonmn2.hpp"
|
|
||||||
#include "tiffcomposite.hpp"
|
|
||||||
#include "types.hpp"
|
|
||||||
|
|
||||||
// + standard includes
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// class member definitions
|
|
||||||
namespace Exiv2 {
|
|
||||||
|
|
||||||
const byte Nikon2MnHeader::signature_[] = {
|
|
||||||
'N', 'i', 'k', 'o', 'n', '\0', 0x00, 0x01
|
|
||||||
};
|
|
||||||
const uint32_t Nikon2MnHeader::size_ = 8;
|
|
||||||
|
|
||||||
Nikon2MnHeader::Nikon2MnHeader()
|
|
||||||
{
|
|
||||||
read(signature_, size_, invalidByteOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Nikon2MnHeader::read(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder /*byteOrder*/)
|
|
||||||
{
|
|
||||||
assert (pData != 0);
|
|
||||||
|
|
||||||
if (size < size_) return false;
|
|
||||||
if (0 != memcmp(pData, signature_, 6)) return false;
|
|
||||||
buf_.alloc(size_);
|
|
||||||
memcpy(buf_.pData_, pData, buf_.size_);
|
|
||||||
start_ = size_;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} // Nikon2MnHeader::read
|
|
||||||
|
|
||||||
bool TiffNikon2Mn::doReadHeader(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder)
|
|
||||||
{
|
|
||||||
return header_.read(pData, size, byteOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t TiffNikon2Mn::doIfdOffset() const
|
|
||||||
{
|
|
||||||
return header_.ifdOffset();
|
|
||||||
}
|
|
||||||
|
|
||||||
const byte Nikon3MnHeader::signature_[] = {
|
|
||||||
'N', 'i', 'k', 'o', 'n', '\0',
|
|
||||||
0x02, 0x10, 0x00, 0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08
|
|
||||||
};
|
|
||||||
const uint32_t Nikon3MnHeader::size_ = 18;
|
|
||||||
|
|
||||||
Nikon3MnHeader::Nikon3MnHeader()
|
|
||||||
{
|
|
||||||
read(signature_, size_, invalidByteOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Nikon3MnHeader::read(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder /*byteOrder*/)
|
|
||||||
{
|
|
||||||
assert (pData != 0);
|
|
||||||
|
|
||||||
if (size < size_) return false;
|
|
||||||
if (0 != memcmp(pData, signature_, 6)) return false;
|
|
||||||
buf_.alloc(size_);
|
|
||||||
memcpy(buf_.pData_, pData, buf_.size_);
|
|
||||||
TiffHeade2 th;
|
|
||||||
if (!th.read(buf_.pData_ + 10, 8)) return false;
|
|
||||||
byteOrder_ = th.byteOrder();
|
|
||||||
start_ = 10 + th.ifdOffset();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} // Nikon3MnHeader::read
|
|
||||||
|
|
||||||
bool TiffNikon3Mn::doReadHeader(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder)
|
|
||||||
{
|
|
||||||
return header_.read(pData, size, byteOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t TiffNikon3Mn::doIfdOffset() const
|
|
||||||
{
|
|
||||||
return header_.ifdOffset();
|
|
||||||
}
|
|
||||||
|
|
||||||
TiffRwState::AutoPtr TiffNikon3Mn::doGetState(uint32_t mnOffset,
|
|
||||||
ByteOrder byteOrder) const
|
|
||||||
{
|
|
||||||
// Byteorder: From header
|
|
||||||
// Offsets : From header
|
|
||||||
// Creator : No change
|
|
||||||
return TiffRwState::AutoPtr(
|
|
||||||
new TiffRwState(header_.byteOrder(),
|
|
||||||
mnOffset + header_.baseOffset(),
|
|
||||||
0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************************
|
|
||||||
// free functions
|
|
||||||
|
|
||||||
TiffComponent* newNikonMn(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
uint16_t mnGroup,
|
|
||||||
const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder /*byteOrder*/)
|
|
||||||
{
|
|
||||||
// If there is no "Nikon" string it must be Nikon1 format
|
|
||||||
if (size < 6 || std::string(reinterpret_cast<const char*>(pData), 6)
|
|
||||||
!= std::string("Nikon\0", 6)) {
|
|
||||||
return new TiffNikon1Mn(tag, group, Group::nikon1mn);
|
|
||||||
}
|
|
||||||
// If the "Nikon" string is not followed by a TIFF header, we assume
|
|
||||||
// Nikon2 format
|
|
||||||
TiffHeade2 tiffHeader;
|
|
||||||
if ( size < 18
|
|
||||||
|| !tiffHeader.read(pData + 10, size - 10)
|
|
||||||
|| tiffHeader.tag() != 0x002a) {
|
|
||||||
return new TiffNikon2Mn(tag, group, Group::nikon2mn);
|
|
||||||
}
|
|
||||||
// Else we have a Nikon3 makernote
|
|
||||||
return new TiffNikon3Mn(tag, group, Group::nikon3mn);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
@ -1,221 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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 nikonmn2.hpp
|
|
||||||
@brief TIFF Nikon makernote
|
|
||||||
@version $Rev$
|
|
||||||
@author Andreas Huggel (ahu)
|
|
||||||
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
|
||||||
@date 18-Apr-06, ahu: created
|
|
||||||
*/
|
|
||||||
#ifndef NIKONMN2_HPP_
|
|
||||||
#define NIKONMN2_HPP_
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// included header files
|
|
||||||
#include "makernote2.hpp"
|
|
||||||
#include "tiffcomposite.hpp"
|
|
||||||
#include "types.hpp"
|
|
||||||
#include "tiffimage.hpp" // for TiffHeade2
|
|
||||||
|
|
||||||
// + standard includes
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// namespace extensions
|
|
||||||
namespace Exiv2 {
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// class definitions
|
|
||||||
|
|
||||||
namespace Group {
|
|
||||||
const uint16_t nikonmn = 263; //!< Any Nikon makernote
|
|
||||||
const uint16_t nikon1mn = 264; //!< Nikon1 makernote
|
|
||||||
const uint16_t nikon2mn = 265; //!< Nikon2 makernote
|
|
||||||
const uint16_t nikon3mn = 266; //!< Nikon3 makernote
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Nikon 1 Makernote
|
|
||||||
class TiffNikon1Mn : public TiffIfdMakernote {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
TiffNikon1Mn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
|
||||||
: TiffIfdMakernote(tag, group, mnGroup) {}
|
|
||||||
//! Virtual destructor
|
|
||||||
virtual ~TiffNikon1Mn() {}
|
|
||||||
//@}
|
|
||||||
|
|
||||||
}; // class TiffNikon1Mn
|
|
||||||
|
|
||||||
//! Header of a Nikon 2 Makernote
|
|
||||||
class Nikon2MnHeader : public MnHeader {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
Nikon2MnHeader();
|
|
||||||
//! Virtual destructor.
|
|
||||||
virtual ~Nikon2MnHeader() {}
|
|
||||||
//@}
|
|
||||||
//! @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_[]; //!< Nikon 2 makernote header signature
|
|
||||||
static const uint32_t size_; //!< Size of the signature
|
|
||||||
|
|
||||||
}; // class Nikon2MnHeader
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@brief Nikon 2 Makernote
|
|
||||||
*/
|
|
||||||
class TiffNikon2Mn : public TiffIfdMakernote {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
TiffNikon2Mn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
|
||||||
: TiffIfdMakernote(tag, group, mnGroup) {}
|
|
||||||
//! Virtual destructor
|
|
||||||
virtual ~TiffNikon2Mn() {}
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
//! @name Manipulators
|
|
||||||
//@{
|
|
||||||
virtual bool doReadHeader(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
//@}
|
|
||||||
|
|
||||||
//! @name Accessors
|
|
||||||
//@{
|
|
||||||
virtual uint32_t doIfdOffset() const;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// DATA
|
|
||||||
Nikon2MnHeader header_; //!< Makernote header
|
|
||||||
|
|
||||||
}; // class TiffNikon2Mn
|
|
||||||
|
|
||||||
//! Header of a Nikon 3 Makernote
|
|
||||||
class Nikon3MnHeader : public MnHeader {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
Nikon3MnHeader();
|
|
||||||
//! Virtual destructor.
|
|
||||||
virtual ~Nikon3MnHeader() {}
|
|
||||||
//@}
|
|
||||||
//! @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_; }
|
|
||||||
//! Return the byte order for the header
|
|
||||||
ByteOrder byteOrder() const { return byteOrder_; }
|
|
||||||
/*!
|
|
||||||
@brief Return the base offset for the makernote IFD entries relative
|
|
||||||
to the start of the makernote.
|
|
||||||
*/
|
|
||||||
uint32_t baseOffset() const { return 10; }
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
DataBuf buf_; //!< Raw header data
|
|
||||||
ByteOrder byteOrder_; //!< Byteorder for makernote
|
|
||||||
uint32_t start_; //!< Start of the mn IFD rel. to mn start
|
|
||||||
static const byte signature_[]; //!< Nikon 3 makernote header signature
|
|
||||||
static const uint32_t size_; //!< Size of the signature
|
|
||||||
|
|
||||||
}; // class Nikon3MnHeader
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@brief Nikon 3 Makernote
|
|
||||||
*/
|
|
||||||
class TiffNikon3Mn : public TiffIfdMakernote {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
TiffNikon3Mn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
|
||||||
: TiffIfdMakernote(tag, group, mnGroup) {}
|
|
||||||
//! Virtual destructor
|
|
||||||
virtual ~TiffNikon3Mn() {}
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
//! @name Manipulators
|
|
||||||
//@{
|
|
||||||
virtual bool doReadHeader(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
//@}
|
|
||||||
|
|
||||||
//! @name Accessors
|
|
||||||
//@{
|
|
||||||
virtual uint32_t doIfdOffset() const;
|
|
||||||
virtual TiffRwState::AutoPtr doGetState(uint32_t mnOffset,
|
|
||||||
ByteOrder byteOrder) const;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// DATA
|
|
||||||
Nikon3MnHeader header_; //!< Makernote header
|
|
||||||
|
|
||||||
}; // class TiffNikon3Mn
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// template, inline and free functions
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@brief Function to create a Nikon makernote. This will create the
|
|
||||||
appropriate Nikon 1, 2 or 3 makernote, based on the arguments.
|
|
||||||
*/
|
|
||||||
TiffComponent* newNikonMn(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
uint16_t mnGroup,
|
|
||||||
const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
||||||
|
|
||||||
#endif // #ifndef NIKONMN2_HPP_
|
|
@ -1,103 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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: olympusmn2.cpp
|
|
||||||
Version: $Rev$
|
|
||||||
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
|
|
||||||
History: 15-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 "olympusmn2.hpp"
|
|
||||||
#include "tiffcomposite.hpp"
|
|
||||||
#include "types.hpp"
|
|
||||||
|
|
||||||
// + standard includes
|
|
||||||
#include <cstring>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// class member definitions
|
|
||||||
namespace Exiv2 {
|
|
||||||
|
|
||||||
const byte OlympusMnHeader::signature_[] = {
|
|
||||||
'O', 'L', 'Y', 'M', 'P', 0x00, 0x01, 0x00
|
|
||||||
};
|
|
||||||
const uint32_t OlympusMnHeader::size_ = 8;
|
|
||||||
|
|
||||||
OlympusMnHeader::OlympusMnHeader()
|
|
||||||
{
|
|
||||||
read(signature_, size_, invalidByteOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OlympusMnHeader::read(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder /*byteOrder*/)
|
|
||||||
{
|
|
||||||
assert (pData != 0);
|
|
||||||
|
|
||||||
if (size < size_) return false;
|
|
||||||
|
|
||||||
header_.alloc(size_);
|
|
||||||
memcpy(header_.pData_, pData, header_.size_);
|
|
||||||
if ( static_cast<uint32_t>(header_.size_) < size_
|
|
||||||
|| 0 != memcmp(header_.pData_, signature_, 5)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} // OlympusMnHeader::read
|
|
||||||
|
|
||||||
bool TiffOlympusMn::doReadHeader(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder)
|
|
||||||
{
|
|
||||||
return header_.read(pData, size, byteOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t TiffOlympusMn::doIfdOffset() const
|
|
||||||
{
|
|
||||||
return header_.ifdOffset();
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************************
|
|
||||||
// free functions
|
|
||||||
|
|
||||||
TiffComponent* newOlympusMn(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
uint16_t mnGroup,
|
|
||||||
const byte* /*pData*/,
|
|
||||||
uint32_t /*size*/,
|
|
||||||
ByteOrder /*byteOrder*/)
|
|
||||||
{
|
|
||||||
return new TiffOlympusMn(tag, group, mnGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
@ -1,126 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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 olympusmn2.hpp
|
|
||||||
@brief TIFF Olympus makernote
|
|
||||||
@version $Rev$
|
|
||||||
@author Andreas Huggel (ahu)
|
|
||||||
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
|
||||||
@date 15-Apr-06, ahu: created
|
|
||||||
*/
|
|
||||||
#ifndef OLYMPUSMN2_HPP_
|
|
||||||
#define OLYMPUSMN2_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 olympmn = 257; //!< Olympus makernote
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Header of an Olympus Makernote
|
|
||||||
class OlympusMnHeader : public MnHeader {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
OlympusMnHeader();
|
|
||||||
//! Virtual destructor.
|
|
||||||
virtual ~OlympusMnHeader() {}
|
|
||||||
//@}
|
|
||||||
//! @name Manipulators
|
|
||||||
//@{
|
|
||||||
virtual bool read(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
//@}
|
|
||||||
//! @name Accessors
|
|
||||||
//@{
|
|
||||||
virtual uint32_t size() const { return header_.size_; }
|
|
||||||
virtual uint32_t ifdOffset() const { return size_; }
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
DataBuf header_; //!< Data buffer for the makernote header
|
|
||||||
static const byte signature_[]; //!< Olympus makernote header signature
|
|
||||||
static const uint32_t size_; //!< Size of the signature
|
|
||||||
|
|
||||||
}; // class OlympusMnHeader
|
|
||||||
|
|
||||||
/*!
|
|
||||||
@brief Olympus Makernote
|
|
||||||
*/
|
|
||||||
class TiffOlympusMn : public TiffIfdMakernote {
|
|
||||||
public:
|
|
||||||
//! @name Creators
|
|
||||||
//@{
|
|
||||||
//! Default constructor
|
|
||||||
TiffOlympusMn(uint16_t tag, uint16_t group, uint16_t mnGroup)
|
|
||||||
: TiffIfdMakernote(tag, group, mnGroup) {}
|
|
||||||
//! Virtual destructor
|
|
||||||
virtual ~TiffOlympusMn() {}
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
//! @name Manipulators
|
|
||||||
//@{
|
|
||||||
virtual bool doReadHeader(const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
//@}
|
|
||||||
|
|
||||||
//! @name Accessors
|
|
||||||
//@{
|
|
||||||
virtual uint32_t doIfdOffset() const;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// DATA
|
|
||||||
OlympusMnHeader header_; //!< Makernote header
|
|
||||||
|
|
||||||
}; // TiffOlympusMn
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// template, inline and free functions
|
|
||||||
|
|
||||||
//! Function to create an Olympus makernote
|
|
||||||
TiffComponent* newOlympusMn(uint16_t tag,
|
|
||||||
uint16_t group,
|
|
||||||
uint16_t mnGroup,
|
|
||||||
const byte* pData,
|
|
||||||
uint32_t size,
|
|
||||||
ByteOrder byteOrder);
|
|
||||||
|
|
||||||
} // namespace Exiv2
|
|
||||||
|
|
||||||
#endif // #ifndef OLYMPUSMN2_HPP_
|
|
@ -1,99 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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$");
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// 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
|
|
@ -1,126 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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_
|
|
@ -1,103 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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
|
|
@ -1,127 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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_
|
|
@ -1,99 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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$");
|
|
||||||
|
|
||||||
// *****************************************************************************
|
|
||||||
// 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
|
|
@ -1,126 +0,0 @@
|
|||||||
// ***************************************************************** -*- 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_
|
|
Loading…
Reference in New Issue