#620: Added support for Nikon Auto Focus Tags.

v0.27.3
Andreas Huggel 16 years ago
parent 65c421e6ee
commit 974fb65f5d

@ -101,6 +101,7 @@ namespace Exiv2 {
const uint16_t nikoncb4 = 309; //!< Nikon Color Balance 4 Tags
const uint16_t nikonvr = 310; //!< Nikon Vibration Reduction Tags
const uint16_t nikonpc = 311; //!< Nikon Picture Control Tags
const uint16_t nikonaf = 312; //!< Nikon Auto Focus Tags
const uint16_t canonfi = 320; //!< Canon File Info
}

@ -742,6 +742,60 @@ namespace Exiv2 {
return tagInfoIi_;
}
//! AfAreaMode
extern const TagDetails nikonAfAreaMode[] = {
{ 0, N_("Single Area") },
{ 1, N_("Dynamic Area") },
{ 2, N_("Dynamic Area, Closest Subject") },
{ 3, N_("Group Dynamic") },
{ 4, N_("Single Area (wide)") },
{ 5, N_("Dynamic Area (wide)") }
};
//! AfPoint
extern const TagDetails nikonAfPoint[] = {
{ 0, N_("Center") },
{ 1, N_("Top") },
{ 2, N_("Bottom") },
{ 3, N_("Mid-left") },
{ 4, N_("Mid-right") },
{ 5, N_("Upper-left") },
{ 6, N_("Upper-right") },
{ 7, N_("Lower-left") },
{ 8, N_("Lower-right") },
{ 9, N_("Far Left") },
{ 10, N_("Far Right") }
};
//! AfPointsInFocus
extern const TagDetailsBitmask nikonAfPointsInFocus[] = {
{ 0x0001, N_("Center") },
{ 0x0002, N_("Top") },
{ 0x0004, N_("Bottom") },
{ 0x0008, N_("Mid-left") },
{ 0x0010, N_("Mid-right") },
{ 0x0020, N_("Upper-left") },
{ 0x0040, N_("Upper-right") },
{ 0x0080, N_("Lower-left") },
{ 0x0100, N_("Lower-right") },
{ 0x0200, N_("Far Left") },
{ 0x0400, N_("Far Right") }
};
// Nikon3 Auto Focus Tag Info
const TagInfo Nikon3MakerNote::tagInfoAf_[] = {
TagInfo( 0, "AFAreaMode", N_("AF Area Mode"), N_("AF area mode"), nikonAfIfdId, makerTags, unsignedByte, EXV_PRINT_TAG(nikonAfAreaMode)),
TagInfo( 1, "AFPoint", N_("AF Point"), N_("AF point"), nikonAfIfdId, makerTags, unsignedByte, EXV_PRINT_TAG(nikonAfPoint)),
TagInfo( 2, "AFPointsInFocus", N_("AF Points In Focus"), N_("AF points in focus"), nikonAfIfdId, makerTags, unsignedShort, printAfPointsInFocus),
// End of list marker
TagInfo(0xffff, "(UnknownNikonAfTag)", "(UnknownNikonAfTag)", N_("Unknown Nikon Auto Focus Tag"), nikonAfIfdId, makerTags, invalidTypeId, printValue)
};
const TagInfo* Nikon3MakerNote::tagListAf()
{
return tagInfoAf_;
}
// Nikon3 Color Balance 1 Tag Info
const TagInfo Nikon3MakerNote::tagInfoCb1_[] = {
TagInfo( 0, "Version", N_("Version"), N_("Version"), nikonCb1IfdId, makerTags, undefined, printExifVersion),
@ -1100,6 +1154,33 @@ namespace Exiv2 {
return os;
}
std::ostream& Nikon3MakerNote::printAfPointsInFocus(std::ostream& os,
const Value& value,
const ExifData* metadata)
{
if (value.typeId() != unsignedShort) return os << "(" << value << ")";
bool dModel = false;
if (metadata) {
ExifData::const_iterator pos = metadata->findKey(ExifKey("Exif.Image.Model"));
if (pos != metadata->end() && pos->count() != 0) {
std::string model = pos->toString();
if (model.find("NIKON D") != std::string::npos) {
dModel = true;
}
}
}
uint16_t val = value.toLong();
if (dModel) val = (val >> 8) | ((val & 0x00ff) << 8);
if (val == 0x07ff) return os << _("All 11 Points");
UShortValue v;
v.value_.push_back(val);
return EXV_PRINT_TAG_BITMASK(nikonAfPointsInFocus)(os, v, 0);
}
std::ostream& Nikon3MakerNote::print0x0089(std::ostream& os,
const Value& value,
const ExifData* metadata)

@ -118,6 +118,8 @@ namespace Exiv2 {
static const TagInfo* tagListWt();
//! Return read-only list of built-in ISO info tags
static const TagInfo* tagListIi();
//! Return read-only list of built-in Auto Focus tags
static const TagInfo* tagListAf();
//! Return read-only list of built-in Color Balance 1 tags
static const TagInfo* tagListCb1();
//! Return read-only list of built-in Color Balance 2 tags
@ -157,6 +159,8 @@ namespace Exiv2 {
static std::ostream& print0x0089(std::ostream& os, const Value& value, const ExifData* metadata);
//! Print number of lens stops
static std::ostream& print0x008b(std::ostream& os, const Value& value, const ExifData*);
//! Print AF Points In Focus
static std::ostream& printAfPointsInFocus(std::ostream& os, const Value& value, const ExifData* metadata);
//! Print lens name
static std::ostream& printLensId(std::ostream& os, const Value& value, const ExifData* metadata, const std::string& group);
@ -183,6 +187,8 @@ namespace Exiv2 {
static const TagInfo tagInfoWt_[];
//! ISO info tag information
static const TagInfo tagInfoIi_[];
//! Auto Focus tag information
static const TagInfo tagInfoAf_[];
//! Color Balance 1 tag information
static const TagInfo tagInfoCb1_[];
//! Color Balance 2 tag information

@ -128,6 +128,7 @@ namespace Exiv2 {
{ nikonPcIfdId, "Makernote", "NikonPc", Nikon3MakerNote::tagListPc },
{ nikonWtIfdId, "Makernote", "NikonWt", Nikon3MakerNote::tagListWt },
{ nikonIiIfdId, "Makernote", "NikonIi", Nikon3MakerNote::tagListIi },
{ nikonAfIfdId, "Makernote", "NikonAf", Nikon3MakerNote::tagListAf },
{ nikonCb1IfdId, "Makernote", "NikonCb1", Nikon3MakerNote::tagListCb1 },
{ nikonCb2IfdId, "Makernote", "NikonCb2", Nikon3MakerNote::tagListCb2 },
{ nikonCb2aIfdId, "Makernote", "NikonCb2a", Nikon3MakerNote::tagListCb2a },

@ -142,6 +142,7 @@ namespace Exiv2 {
{ 309, "NikonCb4" },
{ 310, "NikonVr" },
{ 311, "NikonPc" },
{ 312, "NikonAf" },
{ 320, "CanonFi" }
};

@ -422,6 +422,21 @@ namespace Exiv2 {
{ 13, ttUnsignedByte, 1 } // The array contains 14 bytes
};
//! Nikon Auto Focus binary array - configuration
extern const ArrayCfg nikonAfCfg = {
Group::nikonaf, // Group for the elements
littleEndian, // Byte order
ttUndefined, // Type for array entry
notEncrypted, // Not encrypted
false, // No size element
true, // Write all tags
{ 0, ttUnsignedByte, 1 }
};
//! Nikon Auto Focus binary array - definition
extern const ArrayDef nikonAfDef[] = {
{ 2, ttUnsignedShort, 1 } // The array contains 4 bytes
};
//! Nikon Lens Data binary array - configuration 1
extern const ArrayCfg nikonLd1Cfg = {
Group::nikonld1, // Group for the elements
@ -687,6 +702,7 @@ namespace Exiv2 {
{ Tag::root, Group::nikonpc, Group::nikon3mn, 0x0023 },
{ Tag::root, Group::nikonwt, Group::nikon3mn, 0x0024 },
{ Tag::root, Group::nikonii, Group::nikon3mn, 0x0025 },
{ Tag::root, Group::nikonaf, Group::nikon3mn, 0x0088 },
{ Tag::root, Group::nikoncb1, Group::nikon3mn, 0x0097 },
{ Tag::root, Group::nikoncb2, Group::nikon3mn, 0x0097 },
{ Tag::root, Group::nikoncb2a, Group::nikon3mn, 0x0097 },
@ -930,6 +946,7 @@ namespace Exiv2 {
{ 0x0023, Group::nikon3mn, EXV_BINARY_ARRAY(nikonPcCfg, nikonPcDef) },
{ 0x0024, Group::nikon3mn, EXV_BINARY_ARRAY(nikonWtCfg, nikonWtDef) },
{ 0x0025, Group::nikon3mn, EXV_BINARY_ARRAY(nikonIiCfg, nikonIiDef) },
{ 0x0088, Group::nikon3mn, EXV_BINARY_ARRAY(nikonAfCfg, nikonAfDef) },
{ 0x0097, Group::nikon3mn, EXV_COMPLEX_BINARY_ARRAY(nikonCbSet, nikonSelector) },
{ 0x0098, Group::nikon3mn, EXV_COMPLEX_BINARY_ARRAY(nikonLdSet, nikonSelector) },
{ Tag::all, Group::nikon3mn, newTiffEntry },
@ -952,6 +969,9 @@ namespace Exiv2 {
// Nikon3 ISO info
{ Tag::all, Group::nikonii, newTiffBinaryElement },
// Nikon3 auto focus
{ Tag::all, Group::nikonaf, newTiffBinaryElement },
// Nikon3 color balance
{ Tag::all, Group::nikoncb1, newTiffBinaryElement },
{ Tag::all, Group::nikoncb2, newTiffBinaryElement },

@ -173,6 +173,7 @@ namespace Exiv2 {
nikonPcIfdId,
nikonWtIfdId,
nikonIiIfdId,
nikonAfIfdId,
nikonLd1IfdId,
nikonLd2IfdId,
nikonLd3IfdId,

@ -743,7 +743,9 @@ Exif.Nikon3.ToneComp 0x0081 Makernote Ascii 9
Exif.Nikon3.LensType 0x0083 Makernote Byte 1 6
Exif.Nikon3.Lens 0x0084 Makernote Rational 4 180/10 700/10 35/10 45/10
Exif.Nikon3.FlashMode 0x0087 Makernote Byte 1 0
Exif.Nikon3.AFInfo 0x0088 Makernote Undefined 4 0 0 0 1
Exif.NikonAf.AFAreaMode 0x0000 Makernote Byte 1 0
Exif.NikonAf.AFPoint 0x0001 Makernote Byte 1 0
Exif.NikonAf.AFPointsInFocus 0x0002 Makernote Short 1 256
Exif.Nikon3.ShootingMode 0x0089 Makernote Short 1 0
Exif.Nikon3.AutoBracketRelease 0x008a Makernote Short 1 0
Exif.Nikon3.LensFStops 0x008b Makernote Undefined 4 64 1 12 0
@ -888,7 +890,9 @@ Exif.Nikon3.ToneComp 0x0081 Makernote Ascii 9
Exif.Nikon3.LensType 0x0083 Makernote Byte 1 6
Exif.Nikon3.Lens 0x0084 Makernote Rational 4 180/10 700/10 35/10 45/10
Exif.Nikon3.FlashMode 0x0087 Makernote Byte 1 0
Exif.Nikon3.AFInfo 0x0088 Makernote Undefined 4 0 0 0 1
Exif.NikonAf.AFAreaMode 0x0000 Makernote Byte 1 0
Exif.NikonAf.AFPoint 0x0001 Makernote Byte 1 0
Exif.NikonAf.AFPointsInFocus 0x0002 Makernote Short 1 256
Exif.Nikon3.ShootingMode 0x0089 Makernote Short 1 0
Exif.Nikon3.AutoBracketRelease 0x008a Makernote Short 1 0
Exif.Nikon3.LensFStops 0x008b Makernote Undefined 4 64 1 12 0
@ -1034,7 +1038,9 @@ Exif.Nikon3.ToneComp 0x0081 Makernote Ascii 9
Exif.Nikon3.LensType 0x0083 Makernote Byte 1 6
Exif.Nikon3.Lens 0x0084 Makernote Rational 4 180/10 700/10 35/10 45/10
Exif.Nikon3.FlashMode 0x0087 Makernote Byte 1 0
Exif.Nikon3.AFInfo 0x0088 Makernote Undefined 4 0 0 0 1
Exif.NikonAf.AFAreaMode 0x0000 Makernote Byte 1 0
Exif.NikonAf.AFPoint 0x0001 Makernote Byte 1 0
Exif.NikonAf.AFPointsInFocus 0x0002 Makernote Short 1 256
Exif.Nikon3.ShootingMode 0x0089 Makernote Short 1 0
Exif.Nikon3.AutoBracketRelease 0x008a Makernote Short 1 0
Exif.Nikon3.LensFStops 0x008b Makernote Undefined 4 64 1 12 0
@ -1180,7 +1186,9 @@ Exif.Nikon3.ToneComp 0x0081 Makernote Ascii 9
Exif.Nikon3.LensType 0x0083 Makernote Byte 1 6
Exif.Nikon3.Lens 0x0084 Makernote Rational 4 180/10 700/10 35/10 45/10
Exif.Nikon3.FlashMode 0x0087 Makernote Byte 1 0
Exif.Nikon3.AFInfo 0x0088 Makernote Undefined 4 0 0 0 1
Exif.NikonAf.AFAreaMode 0x0000 Makernote Byte 1 0
Exif.NikonAf.AFPoint 0x0001 Makernote Byte 1 0
Exif.NikonAf.AFPointsInFocus 0x0002 Makernote Short 1 256
Exif.Nikon3.ShootingMode 0x0089 Makernote Short 1 0
Exif.Nikon3.AutoBracketRelease 0x008a Makernote Short 1 0
Exif.Nikon3.LensFStops 0x008b Makernote Undefined 4 64 1 12 0

@ -848,7 +848,9 @@ File 4/15: 20040329_224245.jpg
20040329_224245.jpg Exif.Nikon3.LensType Byte 1 D G
20040329_224245.jpg Exif.Nikon3.Lens Rational 4 18-70mm F3.5-4.5
20040329_224245.jpg Exif.Nikon3.FlashMode Byte 1 Did not fire
20040329_224245.jpg Exif.Nikon3.AFInfo Undefined 4 0 0 0 1
20040329_224245.jpg Exif.NikonAf.AFAreaMode Byte 1 Single Area
20040329_224245.jpg Exif.NikonAf.AFPoint Byte 1 Center
20040329_224245.jpg Exif.NikonAf.AFPointsInFocus Short 1 Center
20040329_224245.jpg Exif.Nikon3.ShootingMode Short 1 Single-frame
20040329_224245.jpg Exif.Nikon3.AutoBracketRelease Short 1 None
20040329_224245.jpg Exif.Nikon3.LensFStops Undefined 4 5.33333
@ -2170,7 +2172,7 @@ Writing thumbnail (image/jpeg, 6137 Bytes) to file ./20060127_225027-thumb.jpg
exiv2-empty.exv: No Exif data found in the file
Compare image data and extracted data ------------------------------------
1,1501c1,1501
1,1503c1,1503
< File 1/15: exiv2-empty.jpg
< File 2/15: 20031214_000043.jpg
< 20031214_000043.jpg Exif.Image.Make Ascii 6 Canon
@ -2422,7 +2424,9 @@ Compare image data and extracted data ------------------------------------
< 20040329_224245.jpg Exif.Nikon3.LensType Byte 1 D G
< 20040329_224245.jpg Exif.Nikon3.Lens Rational 4 18-70mm F3.5-4.5
< 20040329_224245.jpg Exif.Nikon3.FlashMode Byte 1 Did not fire
< 20040329_224245.jpg Exif.Nikon3.AFInfo Undefined 4 0 0 0 1
< 20040329_224245.jpg Exif.NikonAf.AFAreaMode Byte 1 Single Area
< 20040329_224245.jpg Exif.NikonAf.AFPoint Byte 1 Center
< 20040329_224245.jpg Exif.NikonAf.AFPointsInFocus Short 1 Center
< 20040329_224245.jpg Exif.Nikon3.ShootingMode Short 1 Single-frame
< 20040329_224245.jpg Exif.Nikon3.AutoBracketRelease Short 1 None
< 20040329_224245.jpg Exif.Nikon3.LensFStops Undefined 4 5.33333
@ -3924,7 +3928,9 @@ Compare image data and extracted data ------------------------------------
> 20040329_224245.exv Exif.Nikon3.LensType Byte 1 D G
> 20040329_224245.exv Exif.Nikon3.Lens Rational 4 18-70mm F3.5-4.5
> 20040329_224245.exv Exif.Nikon3.FlashMode Byte 1 Did not fire
> 20040329_224245.exv Exif.Nikon3.AFInfo Undefined 4 0 0 0 1
> 20040329_224245.exv Exif.NikonAf.AFAreaMode Byte 1 Single Area
> 20040329_224245.exv Exif.NikonAf.AFPoint Byte 1 Center
> 20040329_224245.exv Exif.NikonAf.AFPointsInFocus Short 1 Center
> 20040329_224245.exv Exif.Nikon3.ShootingMode Short 1 Single-frame
> 20040329_224245.exv Exif.Nikon3.AutoBracketRelease Short 1 None
> 20040329_224245.exv Exif.Nikon3.LensFStops Undefined 4 5.33333
@ -5394,7 +5400,7 @@ Writing Exif data from ./20060127_225027.exv to 20060127_225027.jpg
exiv2-empty.exv: No Exif data found in the file
Compare original and inserted image data ---------------------------------
1,1501c1,1501
1,1503c1,1503
< File 1/15: exiv2-empty.jpg
< File 2/15: 20031214_000043.jpg
< 20031214_000043.jpg Exif.Image.Make Ascii 6 Canon
@ -5646,7 +5652,9 @@ Compare original and inserted image data ---------------------------------
< 20040329_224245.jpg Exif.Nikon3.LensType Byte 1 D G
< 20040329_224245.jpg Exif.Nikon3.Lens Rational 4 18-70mm F3.5-4.5
< 20040329_224245.jpg Exif.Nikon3.FlashMode Byte 1 Did not fire
< 20040329_224245.jpg Exif.Nikon3.AFInfo Undefined 4 0 0 0 1
< 20040329_224245.jpg Exif.NikonAf.AFAreaMode Byte 1 Single Area
< 20040329_224245.jpg Exif.NikonAf.AFPoint Byte 1 Center
< 20040329_224245.jpg Exif.NikonAf.AFPointsInFocus Short 1 Center
< 20040329_224245.jpg Exif.Nikon3.ShootingMode Short 1 Single-frame
< 20040329_224245.jpg Exif.Nikon3.AutoBracketRelease Short 1 None
< 20040329_224245.jpg Exif.Nikon3.LensFStops Undefined 4 5.33333
@ -7148,7 +7156,9 @@ Compare original and inserted image data ---------------------------------
> 20040329_224245.exv Exif.Nikon3.LensType Byte 1 D G
> 20040329_224245.exv Exif.Nikon3.Lens Rational 4 18-70mm F3.5-4.5
> 20040329_224245.exv Exif.Nikon3.FlashMode Byte 1 Did not fire
> 20040329_224245.exv Exif.Nikon3.AFInfo Undefined 4 0 0 0 1
> 20040329_224245.exv Exif.NikonAf.AFAreaMode Byte 1 Single Area
> 20040329_224245.exv Exif.NikonAf.AFPoint Byte 1 Center
> 20040329_224245.exv Exif.NikonAf.AFPointsInFocus Short 1 Center
> 20040329_224245.exv Exif.Nikon3.ShootingMode Short 1 Single-frame
> 20040329_224245.exv Exif.Nikon3.AutoBracketRelease Short 1 None
> 20040329_224245.exv Exif.Nikon3.LensFStops Undefined 4 5.33333

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save