1
// ***************************************************************** -*- C++ -*-
3
* Copyright (C) 2004-2008 Andreas Huggel <ahuggel@gmx.net>
5
* This program is part of the Exiv2 distribution.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
23
@brief Pentax MakerNote implemented according to the specification
24
http://www.gvsoft.homedns.org/exif/makernote-pentax-type3.html and
25
based on ExifTool implementation and
26
<a href="http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html">Pentax Makernote list</a> by Phil Harvey<br>
29
<a href="mailto:michal@cihar.com">michal@cihar.com</a>
35
// *****************************************************************************
36
// included header files
38
#include "makernote.hpp"
41
// + standard includes
47
// *****************************************************************************
48
// namespace extensions
51
// *****************************************************************************
55
// *****************************************************************************
59
@brief Return an auto-pointer to a newly created empty MakerNote
60
initialized to operate in the memory management model indicated.
61
The caller owns this copy and the auto-pointer ensures that it
64
@param alloc Memory management model for the new MakerNote. Determines if
65
memory required to store data should be allocated and deallocated
66
(true) or not (false). If false, only pointers to the buffer
67
provided to read() will be kept. See Ifd for more background on
69
@param buf Pointer to the makernote character buffer (not used).
70
@param len Length of the makernote character buffer (not used).
71
@param byteOrder Byte order in which the Exif data (and possibly the
72
makernote) is encoded (not used).
73
@param offset Offset from the start of the TIFF header of the makernote
76
@return An auto-pointer to a newly created empty MakerNote. The caller
77
owns this copy and the auto-pointer ensures that it will be
80
MakerNote::AutoPtr createPentaxMakerNote(bool alloc,
86
// *****************************************************************************
89
//! MakerNote for Pentaxfilm cameras
90
class PentaxMakerNote : public IfdMakerNote {
92
//! Shortcut for a %PentaxMakerNote auto pointer.
93
typedef std::auto_ptr<PentaxMakerNote> AutoPtr;
98
@brief Constructor. Allows to choose whether or not memory management
99
is required for the makernote entries.
101
PentaxMakerNote(bool alloc =true);
103
PentaxMakerNote(const PentaxMakerNote& rhs);
104
//! Virtual destructor
105
virtual ~PentaxMakerNote() {}
108
//! @name Manipulators
110
int readHeader(const byte* buf,
112
ByteOrder byteOrder);
117
int checkHeader() const;
118
AutoPtr create(bool alloc =true) const;
119
AutoPtr clone() const;
120
//! Return read-only list of built-in Pentaxfilm tags
121
static const TagInfo* tagList();
125
// Public only so that we can create a static instance
131
//! Print Pentax version
132
static std::ostream& printPentaxVersion(std::ostream& os, const Value& value);
133
//! Print Pentax resolution
134
static std::ostream& printPentaxResolution(std::ostream& os, const Value& value);
135
//! Print Pentax date
136
static std::ostream& printPentaxDate(std::ostream& os, const Value& value);
137
//! Print Pentax time
138
static std::ostream& printPentaxTime(std::ostream& os, const Value& value);
139
//! Print Pentax exposure
140
static std::ostream& printPentaxExposure(std::ostream& os, const Value& value);
141
//! Print Pentax F value
142
static std::ostream& printPentaxFValue(std::ostream& os, const Value& value);
143
//! Print Pentax focal length
144
static std::ostream& printPentaxFocalLength(std::ostream& os, const Value& value);
145
//! Print Pentax compensation
146
static std::ostream& printPentaxCompensation(std::ostream& os, const Value& value);
147
//! Print Pentax temperature
148
static std::ostream& printPentaxTemperature(std::ostream& os, const Value& value);
149
//! Print Pentax flash compensation
150
static std::ostream& printPentaxFlashCompensation(std::ostream& os, const Value& value);
151
//! Print Pentax bracketing
152
static std::ostream& printPentaxBracketing(std::ostream& os, const Value& value);
155
//! Internal virtual create function.
156
PentaxMakerNote* create_(bool alloc =true) const;
157
//! Internal virtual copy constructor.
158
PentaxMakerNote* clone_() const;
161
static const TagInfo tagInfo_[];
162
}; // class PentaxMakerNote
164
static PentaxMakerNote::RegisterMn registerPentaxMakerNote;
167
@brief Print function to translate Pentax "combi-values" to a description
168
by looking up a reference table.
170
template <int N, const TagDetails (&array)[N], int count, int ignoredcount>
171
std::ostream& printCombiTag(std::ostream& os, const Value& value)
173
if ((value.count() != count && value.count() != (count + ignoredcount)) || count > 4) {
174
return printValue(os, value);
177
for (int c = 0; c < count; ++c) {
178
if (value.toLong(c) < 0 || value.toLong(c) > 255) {
179
return printValue(os, value);
181
l += (value.toLong(c) << ((count - c - 1) * 8));
183
const TagDetails* td = find(array, l);
185
os << exvGettext(td->label_);
188
os << exvGettext("Unknown") << " (0x"
189
<< std::setw(2 * count) << std::setfill('0')
190
<< std::hex << l << std::dec << ")";
196
//! Shortcut for the printCombiTag template which requires typing the array name only once.
197
#define EXV_PRINT_COMBITAG(array, count, ignoredcount) printCombiTag<EXV_COUNTOF(array), array, count, ignoredcount>
201
#endif // #ifndef PENTAXMN_HPP_