Project

General

Profile

Feature #1219 » canonmn_int.hpp

Raphael Attie, 09 Sep 2016 21:10

 
1
// ***************************************************************** -*- C++ -*-
2
/*
3
 * Copyright (C) 2004-2015 Andreas Huggel <ahuggel@gmx.net>
4
 *
5
 * This program is part of the Exiv2 distribution.
6
 *
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.
11
 *
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.
16
 *
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.
20
 */
21
/*!
22
  @file    canonmn_int.hpp
23
  @brief   Canon makernote tags.<BR>References:<BR>
24
           [1] <a href="http://www.burren.cx/david/canon.html">EXIF MakerNote of Canon</a> by David Burren<br>
25
           [2] <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html">Canon makernote tags</a> by Phil Harvey
26
  @version $Rev: 4450 $
27
  @author  <a href="mailto:ahuggel@gmx.net">Andreas Huggel (ahu)</a><br>
28
           <a href="mailto:david@edeca.net">David Cannings (dc)</a>
29
           <a href="mailto:andi.clemens@gmx.net">Andi Clemens (ac)</a>
30
  @date    18-Feb-04, ahu: created<BR>
31
           07-Mar-04, ahu: isolated as a separate component<BR>
32
           12-Aug-06,  dc: started updating all tags
33
 */
34
#ifndef CANONMN_INT_HPP_
35
#define CANONMN_INT_HPP_
36

    
37
// *****************************************************************************
38
// included header files
39
#include "tags.hpp"
40
#include "types.hpp"
41

    
42
// + standard includes
43
#include <string>
44
#include <iosfwd>
45
#include <memory>
46

    
47
// *****************************************************************************
48
// namespace extensions
49
namespace Exiv2 {
50
    class Value;
51

    
52
    namespace Internal {
53

    
54
// *****************************************************************************
55
// class definitions
56

    
57
    //! MakerNote for Canon cameras
58
    class CanonMakerNote {
59
    public:
60
        //! Return read-only list of built-in Canon tags
61
        static const TagInfo* tagList();
62
        //! Return read-only list of built-in Canon Camera Settings tags
63
        static const TagInfo* tagListCs();
64
        //! Return read-only list of built-in Canon Shot Info tags
65
        static const TagInfo* tagListSi();
66
        //! Return read-only list of built-in Canon Panorama tags
67
        static const TagInfo* tagListPa();
68
        //! Return read-only list of built-in Canon Custom Function tags
69
        static const TagInfo* tagListCf();
70
        //! Return read-only list of built-in Canon Picture Info tags
71
        static const TagInfo* tagListPi();
72
        //! Return read-only list of built-in Canon File Info tags
73
        static const TagInfo* tagListFi();
74
        //! Return read-only list of built-in Canon Processing Info tags
75
        static const TagInfo* tagListPr();
76

    
77
        //! @name Print functions for Canon %MakerNote tags
78
        //@{
79
        //! Print the FileInfo FileNumber
80
        static std::ostream& printFiFileNumber(std::ostream& os, const Value& value, const ExifData* metadata);
81
        //! Print the focal length
82
        static std::ostream& printFocalLength(std::ostream& os, const Value& value, const ExifData*);
83
        //! Print the image number
84
        static std::ostream& print0x0008(std::ostream& os, const Value& value, const ExifData*);
85
        //! Print the serial number of the camera
86
        static std::ostream& print0x000c(std::ostream& os, const Value& value, const ExifData*);
87
        //! Self timer
88
        static std::ostream& printCs0x0002(std::ostream& os, const Value& value, const ExifData*);
89
        //! Camera lens type. For some values, the exact type can only be determined if \em metadata is provided.
90
        static std::ostream& printCsLensType(std::ostream& os, const Value& value, const ExifData* metadata);
91
        //! Camera lens information
92
        static std::ostream& printCsLens(std::ostream& os, const Value& value, const ExifData*);
93
        //! ISO speed used
94
        static std::ostream& printSi0x0002(std::ostream& os, const Value& value, const ExifData*);
95
        //! MeasuredEV
96
        static std::ostream& printSi0x0003(std::ostream& os, const Value& value, const ExifData*);
97
        //! Sequence number
98
        static std::ostream& printSi0x0009(std::ostream& os, const Value& value, const ExifData*);
99
        //! AF point used
100
        static std::ostream& printSi0x000e(std::ostream& os, const Value& value, const ExifData* pExifData);
101
        //! Subject distance
102
        static std::ostream& printSi0x0013(std::ostream& os, const Value& value, const ExifData*);
103
        //! Aperture
104
        static std::ostream& printSi0x0015(std::ostream& os, const Value& value, const ExifData*);
105
        //! Shutter speed
106
        static std::ostream& printSi0x0016(std::ostream& os, const Value& value, const ExifData*);
107
        //! MeasuredEV2
108
        static std::ostream& printSi0x0017(std::ostream& os, const Value& value, const ExifData*);
109
        //! Focus Distance
110
        static std::ostream& printFiFocusDistance(std::ostream& os, const Value& value, const ExifData*);
111
        //! Print the tag value minus 128
112
        static std::ostream& printValueMinus128(std::ostream& os, const Value& value, const ExifData*);
113

    
114
        //@}
115

    
116
    private:
117
        // DATA
118

    
119
        //! Tag information
120
        static const TagInfo tagInfo_[];
121
        static const TagInfo tagInfoCs_[];
122
        static const TagInfo tagInfoSi_[];
123
        static const TagInfo tagInfoCf_[];
124
        static const TagInfo tagInfoPi_[];
125
        static const TagInfo tagInfoFi_[];
126
        static const TagInfo tagInfoPa_[];
127
        static const TagInfo tagInfoPr_[];
128

    
129
    }; // class CanonMakerNote
130

    
131
// *****************************************************************************
132
// template, inline and free functions
133

    
134
    /*!
135
       @brief Convert Canon hex-based EV (modulo 0x20) to real number
136
              Ported from Phil Harvey's Image::ExifTool::Canon::CanonEv
137
              by Will Stokes
138

    
139
       0x00 -> 0
140
       0x0c -> 0.33333
141
       0x10 -> 0.5
142
       0x14 -> 0.66666
143
       0x20 -> 1
144
       ..
145
       160 -> 5
146
       128 -> 4
147
       143 -> 4.46875
148
     */
149
    float canonEv(long val);
150

    
151
}}                                      // namespace Internal, Exiv2
152

    
153
#endif                                  // #ifndef CANONMN_INT_HPP_
(7-7/8)