1
// ***************************************************************** -*- C++ -*-
3
* Copyright (C) 2004, 2005 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
25
History: 18-Apr-05, ahu: created
27
// *****************************************************************************
29
EXIV2_RCSID("@(#) $Id: sonymn.cpp 600 2005-07-09 10:38:09Z ahuggel $");
31
// *****************************************************************************
32
// included header files
35
#include "makernote.hpp"
38
// + standard includes
44
// *****************************************************************************
45
// class member definitions
49
SonyMakerNote::RegisterMn::RegisterMn()
51
MakerNoteFactory::registerMakerNote("SONY", "*", createSonyMakerNote);
52
MakerNoteFactory::registerMakerNote(
53
sonyIfdId, MakerNote::AutoPtr(new SonyMakerNote));
55
ExifTags::registerMakerTagInfo(sonyIfdId, tagInfo_);
59
// Sony MakerNote Tag Info
60
const TagInfo SonyMakerNote::tagInfo_[] = {
61
TagInfo(0x2000, "0x2000", "Unknown", sonyIfdId, makerTags, undefined, printValue),
62
TagInfo(0x9001, "0x9001", "Unknown", sonyIfdId, makerTags, undefined, printValue),
63
TagInfo(0x9002, "0x9002", "Unknown", sonyIfdId, makerTags, undefined, printValue),
64
TagInfo(0x9003, "0x9003", "Unknown", sonyIfdId, makerTags, undefined, printValue),
65
TagInfo(0x9004, "0x9004", "Unknown", sonyIfdId, makerTags, undefined, printValue),
66
TagInfo(0x9005, "0x9005", "Unknown", sonyIfdId, makerTags, undefined, printValue),
67
TagInfo(0x9006, "0x9006", "Unknown", sonyIfdId, makerTags, undefined, printValue),
68
TagInfo(0x9007, "0x9007", "Unknown", sonyIfdId, makerTags, undefined, printValue),
69
TagInfo(0x9008, "0x9008", "Unknown", sonyIfdId, makerTags, undefined, printValue),
71
TagInfo(0xffff, "(UnknownSonyMakerNoteTag)", "Unknown SonyMakerNote tag", sonyIfdId, makerTags, invalidTypeId, printValue)
74
SonyMakerNote::SonyMakerNote(bool alloc)
75
: IfdMakerNote(sonyIfdId, alloc, false)
78
'S', 'O', 'N', 'Y', ' ', 'D', 'S', 'C', ' ', '\0', '\0', '\0'
80
readHeader(buf, 12, byteOrder_);
83
SonyMakerNote::SonyMakerNote(const SonyMakerNote& rhs)
88
int SonyMakerNote::readHeader(const byte* buf,
92
if (len < 12) return 1;
94
memcpy(header_.pData_, buf, header_.size_);
95
// Adjust the offset of the IFD for the prefix
100
int SonyMakerNote::checkHeader() const
103
// Check the SONY prefix
104
if ( header_.size_ < 12
105
|| std::string(reinterpret_cast<char*>(header_.pData_), 12)
106
!= std::string("SONY DSC \0\0\0", 12)) {
112
SonyMakerNote::AutoPtr SonyMakerNote::create(bool alloc) const
114
return AutoPtr(create_(alloc));
117
SonyMakerNote* SonyMakerNote::create_(bool alloc) const
119
AutoPtr makerNote = AutoPtr(new SonyMakerNote(alloc));
120
assert(makerNote.get() != 0);
121
makerNote->readHeader(header_.pData_, header_.size_, byteOrder_);
122
return makerNote.release();
125
SonyMakerNote::AutoPtr SonyMakerNote::clone() const
127
return AutoPtr(clone_());
130
SonyMakerNote* SonyMakerNote::clone_() const
132
return new SonyMakerNote(*this);
135
// *****************************************************************************
138
MakerNote::AutoPtr createSonyMakerNote(bool alloc,
144
return MakerNote::AutoPtr(new SonyMakerNote(alloc));