New TIFF parser: Added Panasonic, Sigma and Sony makernotes
parent
dabc5d7bb1
commit
4e7f2ee7d9
@ -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
|
@ -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_
|
@ -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
|
@ -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_
|
@ -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
|
@ -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_
|
Loading…
Reference in New Issue