Added Sigma MakerNote

v0.27.3
Andreas Huggel 22 years ago
parent 5fa6aa95fe
commit 5cb9ec44d2

@ -20,7 +20,7 @@
# 02111-1307, USA.
#
# File: Makefile
# Version: $Name: $ $Revision: 1.18 $
# Version: $Name: $ $Revision: 1.19 $
# Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
# History: 10-Dec-03, ahu: created
#
@ -52,7 +52,7 @@ CCHDR = rcsid.hpp error.hpp
# Add library C++ source files to this list
CCSRC = canonmn.cpp exif.cpp fujimn.cpp ifd.cpp image.cpp makernote.cpp \
tags.cpp types.cpp value.cpp
sigmamn.cpp tags.cpp types.cpp value.cpp
# Add source files of simple applications to this list
BINSRC = addmoddel.cpp exifprint.cpp exiftest.cpp makernote-test.cpp \

@ -0,0 +1,146 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
File: sigmamn.cpp
Version: $Name: $ $Revision: 1.1 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 02-Apr-04, ahu: created
Credits: Sigma and Foveon MakerNote implemented according to the specification
in "SIGMA and FOVEON EXIF MakerNote Documentation" by Foveon.
<http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html>
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.1 $ $RCSfile: sigmamn.cpp,v $")
// *****************************************************************************
// included header files
#include "types.hpp"
#include "sigmamn.hpp"
#include "makernote.hpp"
#include "value.hpp"
// + standard includes
#include <string>
#include <sstream>
#include <iomanip>
// Define DEBUG_MAKERNOTE to output debug information to std::cerr
#undef DEBUG_MAKERNOTE
// *****************************************************************************
// class member definitions
namespace Exif {
const SigmaMakerNote::RegisterMakerNote SigmaMakerNote::register_;
// Sigma (Foveon) MakerNote Tag Info
static const MakerNote::MnTagInfo sigmaMnTagInfo[] = {
MakerNote::MnTagInfo(0x0002, "SerialNumber", "Camera serial number"),
MakerNote::MnTagInfo(0x0003, "DriveMode", "Drive Mode"),
MakerNote::MnTagInfo(0x0004, "ResolutionMode", "Resolution Mode"),
MakerNote::MnTagInfo(0x0005, "AutofocusMode", "Autofocus mode"),
MakerNote::MnTagInfo(0x0006, "FocusSetting", "Foxus setting"),
MakerNote::MnTagInfo(0x0007, "WhiteBalance", "White balance"),
MakerNote::MnTagInfo(0x0008, "ExposureMode", "Exposure mode"),
MakerNote::MnTagInfo(0x0009, "MeteringMode", "Metering mode"),
MakerNote::MnTagInfo(0x000a, "LensRange", "Lens focal length range"),
MakerNote::MnTagInfo(0x000b, "ColorSpace", "Color space"),
MakerNote::MnTagInfo(0x000c, "Exposure", "Exposure"),
MakerNote::MnTagInfo(0x000d, "Contrast", "Contrast"),
MakerNote::MnTagInfo(0x000e, "Shadow", "Shadow"),
MakerNote::MnTagInfo(0x000f, "Highlight", "Highlight"),
MakerNote::MnTagInfo(0x0010, "Saturation", "Saturation"),
MakerNote::MnTagInfo(0x0011, "Sharpness", "Sharpness"),
MakerNote::MnTagInfo(0x0012, "FillLight", "X3 Fill light"),
MakerNote::MnTagInfo(0x0014, "ColorAdjustment", "Color adjustment"),
MakerNote::MnTagInfo(0x0015, "AdjustmentMode", "Adjustment mode"),
MakerNote::MnTagInfo(0x0016, "Quality", "Quality"),
MakerNote::MnTagInfo(0x0017, "Firmware", "Firmware"),
MakerNote::MnTagInfo(0x0018, "Software", "Software"),
MakerNote::MnTagInfo(0x0019, "AutoBracket", "Auto bracket"),
// End of list marker
MakerNote::MnTagInfo(0xffff, "(UnknownSigmaMakerNoteTag)", "Unknown SigmaMakerNote tag")
};
SigmaMakerNote::SigmaMakerNote(bool alloc)
: IfdMakerNote(sigmaMnTagInfo, alloc), sectionName_("Sigma")
{
// My one and only Sigma sample has two undocumented extra bytes
// (0x01, 0x00) after the ID string and before the start of the
// Makernote IFD. Adding them to the ID string is a hack...
prefix_ = std::string("SIGMA\0\0\0\x1\0", 10);
}
MakerNote* SigmaMakerNote::clone(bool alloc) const
{
return createSigmaMakerNote(alloc);
}
std::ostream& SigmaMakerNote::printTag(std::ostream& os,
uint16 tag,
const Value& value) const
{
switch (tag) {
case 0x0008: print0x0008(os, value); break;
case 0x0009: print0x0009(os, value); break;
default:
// All other tags (known or unknown) go here
os << value;
break;
}
return os;
}
std::ostream& SigmaMakerNote::print0x0008(std::ostream& os,
const Value& value)
{
switch (value.toString()[0]) {
case 'P': os << "Program"; break;
case 'A': os << "Aperture priority"; break;
case 'S': os << "Shutter priority"; break;
case 'M': os << "Manual"; break;
default: os << "(" << value << ")"; break;
}
return os;
}
std::ostream& SigmaMakerNote::print0x0009(std::ostream& os,
const Value& value)
{
switch (value.toString()[0]) {
case 'A': os << "Average"; break;
case 'C': os << "Center"; break;
case '8': os << "8-segment"; break;
default: os << "(" << value << ")"; break;
}
return os;
}
// *****************************************************************************
// free functions
MakerNote* createSigmaMakerNote(bool alloc)
{
return new SigmaMakerNote(alloc);
}
} // namespace Exif

@ -0,0 +1,133 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*!
@file sigmamn.hpp
@brief Sigma and Foveon MakerNote implemented according to the specification
in "SIGMA and FOVEON EXIF MakerNote Documentation" by Foveon.
<http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html>
@version $Name: $ $Revision: 1.1 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 02-Apr-04, ahu: created
*/
#ifndef SIGMAMN_HPP_
#define SIGMAMN_HPP_
// *****************************************************************************
// included header files
#include "types.hpp"
#include "makernote.hpp"
// + standard includes
#include <string>
#include <iosfwd>
// *****************************************************************************
// namespace extensions
namespace Exif {
// *****************************************************************************
// class declarations
class Value;
// *****************************************************************************
// free functions
/*!
@brief Return a pointer to a newly created empty MakerNote initialized to
operate in the memory management model indicated. The caller owns
this copy and is responsible to delete it!
@param alloc Memory management model for the new MakerNote. Determines if
memory required to store data should be allocated and deallocated
(true) or not (false). If false, only pointers to the buffer
provided to read() will be kept. See Ifd for more background on
this concept.
*/
MakerNote* createSigmaMakerNote(bool alloc =true);
// *****************************************************************************
// class definitions
//! MakerNote for Sigma (Foveon) cameras
class SigmaMakerNote : public IfdMakerNote {
public:
//! @name Creators
//@{
/*!
@brief Constructor. Allows to choose whether or not memory management
is required for the makernote entries.
*/
SigmaMakerNote(bool alloc =true);
//! Virtual destructor
virtual ~SigmaMakerNote() {}
//@}
//! @name Accessors
//@{
MakerNote* clone(bool alloc =true) const;
//! Return the name of the makernote section ("Sigma")
std::string sectionName(uint16 tag) const { return sectionName_; }
std::ostream& printTag(std::ostream& os,
uint16 tag,
const Value& value) const;
//@}
//! @name Print functions for Sigma (Foveon) %MakerNote tags
//@{
//! Print exposure mode
static std::ostream& print0x0008(std::ostream& os, const Value& value);
//! Print metering mode
static std::ostream& print0x0009(std::ostream& os, const Value& value);
//@}
private:
//! Structure used to auto-register the MakerNote.
struct RegisterMakerNote {
//! Default constructor
RegisterMakerNote()
{
MakerNoteFactory& mnf = MakerNoteFactory::instance();
mnf.registerMakerNote("SIGMA", "*", createSigmaMakerNote);
}
};
/*!
The static member variable is initialized before main (see note) and
will in the process register the MakerNote class. (Remember the
definition of the variable in the implementation file!)
@note The standard says that, if no function is explicitly called ever
in a module, then that module's static data might be never
initialized. This clause was introduced to allow dynamic link
libraries. The idea is, with this clause the loader is not
forced to eagerly load all modules, but load them only on
demand.
*/
static const RegisterMakerNote register_;
//! The section name (second part of the key) used for makernote tags
std::string sectionName_;
}; // class SigmaMakerNote
} // namespace Exif
#endif // #ifndef SIGMAMN_HPP_
Loading…
Cancel
Save