Merge pull request #1772 from postscript-dev/add_SonyMisc1_tags

Add SonyMisc1 (Tag 0x9403) makernote tags
This commit is contained in:
Kevin Backhouse 2021-07-13 10:15:53 +01:00 committed by GitHub
commit 51b5616fc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 77 additions and 2 deletions

View File

@ -111,7 +111,8 @@ TABLES = Exif \
Sony1MltCs7D \
Sony1MltCsOld \
Sony1MltCsA100 \
Sony2Fp
Sony2Fp \
SonyMisc1
SCHEMA = xmp_dc \
xmp_dwc \

View File

@ -642,7 +642,8 @@ SubImage7 MinoltaCs5D NikonFi Son
SubImage8 MinoltaCs7D NikonFl1 Olympus Panasonic Sony2Cs
SubImage9 MinoltaCsNew NikonFl2 Olympus2 PanasonicRaw Sony2Cs2
SubThumb1 MinoltaCsOld NikonFl3 OlympusCs Sony2Fp
Thumbnail NikonIi OlympusEq Sigma SonyMinolta
Thumbnail NikonIi OlympusEq Sigma SonyMisc1
SonyMinolta
.fi
.sp 1
Exiv2 supports Exif 2.2 Standard Tags. Exiv2 also supports reading and writing manufacturer's MakerNote. The information in Exif.Photo.MakerNote is encoded as manufacturer's sub-records. For example, CanonCs are Camera Settings, NikonAf are Nikon Auto Focus records, NikonCb are Nikon Color Balance Records. Every tag is defined by a unique tagId (16 bit integer) which is unique within a Group.

View File

@ -806,6 +806,33 @@ namespace Exiv2 {
return tagInfoFp_;
}
//! Sony Tag 9403 SonyMisc1
constexpr TagInfo SonyMakerNote::tagInfoSonyMisc1_[] = {
{0x05, "CameraTemperature", N_("Camera temperature"),
N_("Internal camera temperature (in degrees Celsius)"),
sonyMisc1Id, makerTags, signedByte, -1, printTemperatureInDegC},
// End of list marker
{0xffff, "(UnknownSonyMisc1Tag)", "(UnknownSonyMisc1Tag)",
"(UnknownSonyMisc1Tag)",
sonyMisc1Id, makerTags, unsignedByte, -1, printValue}
};
const TagInfo* SonyMakerNote::tagListSonyMisc1()
{
return tagInfoSonyMisc1_;
}
std::ostream& SonyMakerNote::printTemperatureInDegC(std::ostream& os, const Value& value, const ExifData*)
{
if (value.count() != 1)
os << "(" << value << ")";
else
os << value << " °C";
return os;
}
//! Sony Tag 2010 Sony2010 (Miscellaneous)
constexpr TagInfo SonyMakerNote::tagInfo2010e_[] = {
{0, "SequenceImageNumber", N_("Sequence Image Number"), N_("Sequence Image Number"), sony2010eId, makerTags, unsignedLong, 1, printValue},

View File

@ -49,11 +49,15 @@ namespace Exiv2 {
static const TagInfo* tagListCs2();
//! Return read-only list of built-in Sony FocusPosition tags
static const TagInfo* tagListFp();
//! Return read-only list of built-in Sony Misc1 tags (Tag 9403)
static const TagInfo* tagListSonyMisc1();
static const TagInfo* tagList2010e();
//! @name Print functions for Sony %MakerNote tags
//@{
//! Print Sony temperature values (in Degrees Celsius)
static std::ostream& printTemperatureInDegC(std::ostream&, const Value&, const ExifData*);
//! Print Sony Camera Model
static std::ostream& print0xb000(std::ostream&, const Value&, const ExifData*);
//! Print Full and Preview Image size
@ -65,6 +69,7 @@ namespace Exiv2 {
static const TagInfo tagInfoCs_[];
static const TagInfo tagInfoCs2_[];
static const TagInfo tagInfoFp_[];
static const TagInfo tagInfoSonyMisc1_[];
static const TagInfo tagInfo2010e_[];
}; // class SonyMakerNote

View File

@ -167,6 +167,7 @@ namespace Exiv2 {
{ sony2CsId, "Makernote", "Sony2Cs", SonyMakerNote::tagListCs },
{ sony2Cs2Id, "Makernote", "Sony2Cs2", SonyMakerNote::tagListCs2 },
{ sony2FpId, "Makernote", "Sony2Fp", SonyMakerNote::tagListFp },
{ sonyMisc1Id, "Makernote", "SonyMisc1", SonyMakerNote::tagListSonyMisc1},
{ sony2010eId, "Makernote", "Sony2010e", SonyMakerNote::tagList2010e },
{ lastId, "(Last IFD info)", "(Last IFD item)", nullptr }
};

View File

@ -174,6 +174,7 @@ namespace Exiv2 {
sony2CsId,
sony2Cs2Id,
sony2FpId,
sonyMisc1Id,
sony2010eId,
sony1MltCs7DId,
sony1MltCsOldId,

View File

@ -826,6 +826,21 @@ namespace Exiv2 {
{ 0x2d, ttUnsignedByte, 1 } // Exif.Sony2Fp.FocusPosition2
};
constexpr ArrayCfg sonyMisc1Cfg = {
sonyMisc1Id, // Group for the elements
bigEndian, // Big endian
ttUnsignedByte, // Type for array entry and size element
sonyTagDecipher, // (uint16_t, const byte*, uint32_t, TiffComponent* const);
false, // No size element
false, // No fillers
false, // Don't concatenate gaps
{ 0, ttUnsignedByte, 1 }
};
constexpr ArrayDef sonyMisc1Def[] = {
{ 0x05, ttSignedByte , 1 }, // Exif.SonyMisc1.CameraTemperature
};
constexpr ArrayCfg sony2010eCfg = {
sony2010eId, // Group for the elements
invalidByteOrder, // inherit from file. Usually littleEndian
@ -1096,6 +1111,7 @@ namespace Exiv2 {
{ Tag::root, sony1Id, exifId, 0x927c },
{ Tag::root, sony2010eId, sony1Id, 0x2010 },
{ Tag::root, sony2FpId, sony1Id, 0x9402 },
{ Tag::root, sonyMisc1Id, sony1Id, 0x9403 },
{ Tag::root, sony1CsId, sony1Id, 0x0114 },
{ Tag::root, sony1Cs2Id, sony1Id, 0x0114 },
{ Tag::root, sonyMltId, sony1Id, 0xb028 },
@ -1106,6 +1122,7 @@ namespace Exiv2 {
{ Tag::root, sony2Id, exifId, 0x927c },
{ Tag::root, sony2010eId, sony2Id, 0x2010 },
{ Tag::root, sony2FpId, sony2Id, 0x9402 },
{ Tag::root, sonyMisc1Id, sony2Id, 0x9403 },
{ Tag::root, sony2CsId, sony2Id, 0x0114 },
{ Tag::root, sony2Cs2Id, sony2Id, 0x0114 },
{ Tag::root, minoltaId, exifId, 0x927c },
@ -1544,6 +1561,10 @@ namespace Exiv2 {
{ Tag::all, sony2FpId, newTiffBinaryElement },
{ 0x9402, sony1Id, EXV_BINARY_ARRAY(sony2FpCfg, sony2FpDef) },
// Tag 0x9403 SonyMisc1
{ Tag::all, sonyMisc1Id, newTiffBinaryElement },
{ 0x9403, sony1Id, EXV_BINARY_ARRAY(sonyMisc1Cfg, sonyMisc1Def) },
// Sony1 makernote
{ 0x0114, sony1Id, EXV_COMPLEX_BINARY_ARRAY(sony1CsSet, sonyCsSelector) },
{ 0xb028, sony1Id, newTiffSubIfd<sonyMltId> },
@ -1561,6 +1582,10 @@ namespace Exiv2 {
{ Tag::all, sony2FpId, newTiffBinaryElement },
{ 0x9402, sony2Id, EXV_BINARY_ARRAY(sony2FpCfg, sony2FpDef) },
// Tag 0x9403 SonyMisc1
{ Tag::all, sonyMisc1Id, newTiffBinaryElement },
{ 0x9403, sony2Id, EXV_BINARY_ARRAY(sonyMisc1Cfg, sonyMisc1Def) },
// Sony2 makernote
{ 0x0114, sony2Id, EXV_COMPLEX_BINARY_ARRAY(sony2CsSet, sonyCsSelector) },
{ Tag::next, sony2Id, ignoreTiffComponent },

View File

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from system_tests import CaseMeta, path
class SonyMisc1Test(metaclass=CaseMeta):
filename = path("$data_path/exiv2-pr906.exv")
commands = ["$exiv2 -pa --grep SonyMisc1 $filename"]
stdout = ["""Exif.SonyMisc1.CameraTemperature SByte 1 26 °C
"""
]
stderr = [""]
retval = [0]