Skip to content

Commit a1d2139

Browse files
committed
enhance translation for Exif.NikonAf2.AFAreaMode
1 parent d8b4e53 commit a1d2139

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

src/nikonmn_int.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,8 @@ constexpr TagDetails nikonAfAreaMode[] = {
744744
{3, N_("Group Dynamic")}, {4, N_("Single Area (wide)")}, {5, N_("Dynamic Area (wide)")},
745745
};
746746

747-
//! AF2 Area Mode
748-
constexpr TagDetails nikonAf2AreaMode[] = {
747+
//! AF2 Area Mode when Contrast Detect AF is off
748+
constexpr TagDetails nikonAf2AreaModeContrastDetectAfOff[] = {
749749
{0, N_("Single-point AF")},
750750
{1, N_("Dynamic-area AF")},
751751
{2, N_("Closest Subject")},
@@ -766,6 +766,12 @@ constexpr TagDetails nikonAf2AreaMode[] = {
766766
{17, N_("Group-area AF (VL)")},
767767
};
768768

769+
//! AF2 Area Mode when Contrast Detect AF is on
770+
constexpr TagDetails nikonAf2AreaModeContrastDetectAfOn[] = {
771+
{0, N_("Contrast AF")}, {1, N_("Normal-area AF")}, {2, N_("Wide-area AF")},
772+
{3, N_("Face-priority AF")}, {4, N_("Subject-tracking AF")}, {5, N_("Pinpoint AF")},
773+
};
774+
769775
//! AfPoint
770776
constexpr TagDetails nikonAfPoint[] = {
771777
{0, N_("Center")}, {1, N_("Top")}, {2, N_("Bottom")}, {3, N_("Mid-left")},
@@ -810,7 +816,7 @@ constexpr TagInfo Nikon3MakerNote::tagInfoAf21_[] = {
810816
{4, "ContrastDetectAF", N_("Contrast Detect AF"), N_("Contrast detect AF"), IfdId::nikonAf21Id,
811817
SectionId::makerTags, unsignedByte, 1, EXV_PRINT_TAG(nikonOffOn)},
812818
{5, "AFAreaMode", N_("AF Area Mode"), N_("AF area mode"), IfdId::nikonAf21Id, SectionId::makerTags, unsignedByte, 1,
813-
EXV_PRINT_TAG(nikonAf2AreaMode)},
819+
printAf2AreaMode},
814820
{6, "PhaseDetectAF", N_("Phase Detect AF"), N_("Phase detect AF"), IfdId::nikonAf21Id, SectionId::makerTags,
815821
unsignedByte, 1, EXV_PRINT_TAG(nikonPhaseDetectAF)},
816822
{7, "PrimaryAFPoint", N_("Primary AF Point"), N_("Primary AF point"), IfdId::nikonAf21Id, SectionId::makerTags,
@@ -1766,6 +1772,21 @@ std::ostream& Nikon3MakerNote::print0x0002(std::ostream& os, const Value& value,
17661772
return os;
17671773
}
17681774

1775+
std::ostream& Nikon3MakerNote::printAf2AreaMode(std::ostream& os, const Value& value, const ExifData* metadata) {
1776+
int contrastDetectAF = 0;
1777+
if (metadata) {
1778+
auto pos = metadata->findKey(ExifKey("Exif.NikonAf2.ContrastDetectAF"));
1779+
if (pos != metadata->end() && pos->count() != 0) {
1780+
contrastDetectAF = pos->toUint32();
1781+
}
1782+
}
1783+
1784+
if (contrastDetectAF == 0)
1785+
return EXV_PRINT_TAG(nikonAf2AreaModeContrastDetectAfOff)(os, value, nullptr);
1786+
else
1787+
return EXV_PRINT_TAG(nikonAf2AreaModeContrastDetectAfOn)(os, value, nullptr);
1788+
}
1789+
17691790
std::ostream& Nikon3MakerNote::print0x0007(std::ostream& os, const Value& value, const ExifData*) {
17701791
std::string focus = value.toString();
17711792
if (focus == "AF-C ")

src/nikonmn_int.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ class Nikon3MakerNote {
144144
//@{
145145
//! Print ISO setting
146146
static std::ostream& print0x0002(std::ostream& os, const Value& value, const ExifData*);
147+
//! Print AF2 Area Mode
148+
static std::ostream& printAf2AreaMode(std::ostream& os, const Value& value, const ExifData* metadata);
147149
//! Print autofocus mode
148150
static std::ostream& print0x0007(std::ostream& os, const Value& value, const ExifData*);
149151
//! Print lens type

test/data/test_reference_files/Tokina_AT-X_14-20_F2_PRO_DX.exv.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Exif.NikonMe.MultiExposureAutoGain Long 1 0 Off
149149
Exif.Nikon3.HighISONoiseReduction Short 1 0 Off
150150
Exif.NikonAf2.Version Undefined 4 48 49 48 48 1.00
151151
Exif.NikonAf2.ContrastDetectAF Byte 1 1 On
152-
Exif.NikonAf2.AFAreaMode Byte 1 2 Closest Subject
152+
Exif.NikonAf2.AFAreaMode Byte 1 2 Wide-area AF
153153
Exif.NikonAf2.PhaseDetectAF Byte 1 0 Off
154154
Exif.NikonAf2.PrimaryAFPoint Byte 1 0 0
155155
Exif.NikonAf2.AFPointsUsed Byte 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 commit comments

Comments
 (0)