1 // ***************************************************************** -*- C++ -*-
2 /*
3  * Copyright (C) 2004-2021 Exiv2 authors
4  * This program is part of the Exiv2 distribution.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19  */
20 // *****************************************************************************
21 // included header files
22 #include "types.hpp"
23 #include "sigmamn_int.hpp"
24 #include "tags_int.hpp"
25 #include "value.hpp"
26 #include "i18n.h"                // NLS support.
27 
28 // + standard includes
29 #include <string>
30 #include <sstream>
31 #include <iomanip>
32 #include <cassert>
33 #include <cstring>
34 
35 // *****************************************************************************
36 // class member definitions
37 namespace Exiv2 {
38     namespace Internal {
39 
40     // Sigma (Foveon) MakerNote Tag Info
41     const TagInfo SigmaMakerNote::tagInfo_[] = {
42         TagInfo(0x0002, "SerialNumber", N_("Serial Number"),
43                 N_("Camera serial number"),
44                 sigmaId, makerTags, asciiString, -1, printValue),
45         TagInfo(0x0003, "DriveMode", N_("Drive Mode"),
46                 N_("Drive mode"),
47                 sigmaId, makerTags, asciiString, -1, printValue),
48         TagInfo(0x0004, "ResolutionMode", N_("Resolution Mode"),
49                 N_("Resolution mode"),
50                 sigmaId, makerTags, asciiString, -1, printValue),
51         TagInfo(0x0005, "AutofocusMode", N_("Autofocus Mode"),
52                 N_("Autofocus mode"),
53                 sigmaId, makerTags, asciiString, -1, printValue),
54         TagInfo(0x0006, "FocusSetting", N_("Focus Setting"),
55                 N_("Focus setting"),
56                 sigmaId, makerTags, asciiString, -1, printValue),
57         TagInfo(0x0007, "WhiteBalance", N_("White Balance"),
58                 N_("White balance"),
59                 sigmaId, makerTags, asciiString, -1, printValue),
60         TagInfo(0x0008, "ExposureMode", N_("Exposure Mode"),
61                 N_("Exposure mode"),
62                 sigmaId, makerTags, asciiString, -1, print0x0008),
63         TagInfo(0x0009, "MeteringMode", N_("Metering Mode"),
64                 N_("Metering mode"),
65                 sigmaId, makerTags, asciiString, -1, print0x0009),
66         TagInfo(0x000a, "LensRange", N_("Lens Range"),
67                 N_("Lens focal length range"),
68                 sigmaId, makerTags, asciiString, -1, printValue),
69         TagInfo(0x000b, "ColorSpace", N_("Color Space"),
70                 N_("Color space"),
71                 sigmaId, makerTags, asciiString, -1, printValue),
72         TagInfo(0x000c, "Exposure", N_("Exposure"),
73                 N_("Exposure"),
74                 sigmaId, makerTags, asciiString, -1, printStripLabel),
75         TagInfo(0x000d, "Contrast", N_("Contrast"),
76                 N_("Contrast"),
77                 sigmaId, makerTags, asciiString, -1, printStripLabel),
78         TagInfo(0x000e, "Shadow", N_("Shadow"),
79                 N_("Shadow"),
80                 sigmaId, makerTags, asciiString, -1, printStripLabel),
81         TagInfo(0x000f, "Highlight", N_("Highlight"),
82                 N_("Highlight"),
83                 sigmaId, makerTags, asciiString, -1, printStripLabel),
84         TagInfo(0x0010, "Saturation", N_("Saturation"),
85                 N_("Saturation"),
86                 sigmaId, makerTags, asciiString, -1, printStripLabel),
87         TagInfo(0x0011, "Sharpness", N_("Sharpness"),
88                 N_("Sharpness"),
89                 sigmaId, makerTags, asciiString, -1, printStripLabel),
90         TagInfo(0x0012, "FillLight", N_("Fill Light"),
91                 N_("X3 Fill light"),
92                 sigmaId, makerTags, asciiString, -1, printStripLabel),
93         TagInfo(0x0014, "ColorAdjustment", N_("Color Adjustment"),
94                 N_("Color adjustment"),
95                 sigmaId, makerTags, asciiString, -1, printStripLabel),
96         TagInfo(0x0015, "AdjustmentMode", N_("Adjustment Mode"),
97                 N_("Adjustment mode"),
98                 sigmaId, makerTags, asciiString, -1, printValue),
99         TagInfo(0x0016, "Quality", N_("Quality"),
100                 N_("Quality"),
101                 sigmaId, makerTags, asciiString, -1, printStripLabel),
102         TagInfo(0x0017, "Firmware", N_("Firmware"),
103                 N_("Firmware"),
104                 sigmaId, makerTags, asciiString, -1, printValue),
105         TagInfo(0x0018, "Software", N_("Software"),
106                 N_("Software"),
107                 sigmaId, makerTags, asciiString, -1, printValue),
108         TagInfo(0x0019, "AutoBracket", N_("Auto Bracket"),
109                 N_("Auto bracket"),
110                 sigmaId, makerTags, asciiString, -1, printValue),
111         // End of list marker
112         TagInfo(0xffff, "(UnknownSigmaMakerNoteTag)", "(UnknownSigmaMakerNoteTag)",
113                 N_("Unknown SigmaMakerNote tag"),
114                 sigmaId, makerTags, asciiString, -1, printValue)
115     };
116 
tagList()117     const TagInfo* SigmaMakerNote::tagList()
118     {
119         return tagInfo_;
120     }
121 
printStripLabel(std::ostream & os,const Value & value,const ExifData *)122     std::ostream& SigmaMakerNote::printStripLabel(std::ostream& os,
123                                                   const Value& value,
124                                                   const ExifData*)
125     {
126         std::string v = value.toString();
127         std::string::size_type pos = v.find(':');
128         if (pos != std::string::npos) {
129             if (v.at(pos + 1) == ' ') ++pos;
130             v = v.substr(pos + 1);
131         }
132         return os << v;
133     }
134 
print0x0008(std::ostream & os,const Value & value,const ExifData *)135     std::ostream& SigmaMakerNote::print0x0008(std::ostream& os,
136                                               const Value& value,
137                                               const ExifData*)
138     {
139         switch (value.toString().at(0)) {
140         case 'P': os << _("Program"); break;
141         case 'A': os << _("Aperture priority"); break;
142         case 'S': os << _("Shutter priority"); break;
143         case 'M': os << _("Manual"); break;
144         default: os << "(" << value << ")"; break;
145         }
146         return os;
147     }
148 
print0x0009(std::ostream & os,const Value & value,const ExifData *)149     std::ostream& SigmaMakerNote::print0x0009(std::ostream& os,
150                                               const Value& value,
151                                               const ExifData*)
152     {
153         switch (value.toString().at(0)) {
154         case 'A': os << _("Average"); break;
155         case 'C': os << _("Center"); break;
156         case '8': os << _("8-Segment"); break;
157         default: os << "(" << value << ")"; break;
158         }
159         return os;
160     }
161 
162 }}                                      // namespace Internal, Exiv2
163