@@ -1050,7 +1050,6 @@ namespace Exiv2 {
10501050 { 5 , N_ (" GN (distance priority)" ) },
10511051 { 6 , N_ (" Manual" ) },
10521052 { 7 , N_ (" Repeating Flash" ) },
1053- { 7 , N_ (" Repeating Flash" ) } // To silence compiler warning
10541053 };
10551054
10561055 // ! ExternalFlashFlags
@@ -1135,6 +1134,32 @@ namespace Exiv2 {
11351134 return tagInfoFl3_;
11361135 }
11371136
1137+ // Nikon3 Flash Info 7 (0107 and 0108) Tag Info
1138+ constexpr TagInfo Nikon3MakerNote::tagInfoFl7_[] = {
1139+ { 0 , " Version" , N_ (" Version" ), N_ (" Flash info version" ), nikonFl7Id, makerTags, undefined, 4 , printExifVersion},
1140+ { 4 , " FlashSource" , N_ (" Flash source" ), N_ (" The type of flash used (if any)" ), nikonFl7Id, makerTags, unsignedByte, 1 , EXV_PRINT_TAG (nikonFlashSource)},
1141+ { 6 , " ExternalFlashFirmware" , N_ (" External Flash Firmware" ), N_ (" External flash firmware version" ), nikonFl7Id, makerTags, unsignedShort, 1 , EXV_PRINT_TAG (nikonFlashFirmware)},
1142+ { 8 , " ExternalFlashData1" , N_ (" External flash data" ), N_ (" External flash data" ), nikonFl7Id, makerTags, unsignedByte, 1 , printExternalFlashData1},
1143+ { 9 , " ExternalFlashData2" , N_ (" External flash ready state" ), N_ (" External flash ready state" ), nikonFl7Id, makerTags, unsignedByte, 1 , printExternalFlashData2},
1144+ { 10 , " FlashCompensation" , N_ (" Flash compensation" ), N_ (" Flash compensation" ), nikonFl7Id, makerTags, signedByte, 1 , printFlashCompensation},
1145+ { 12 , " FlashFocalLength" , N_ (" Flash focal length" ), N_ (" Flash focal length" ), nikonFl7Id, makerTags, unsignedByte, 1 , printFlashFocalLength},
1146+ { 13 , " RepeatingFlashRate" , N_ (" Repeating flash rate" ), N_ (" Repeating flash rate" ), nikonFl7Id, makerTags, unsignedByte, 1 , printRepeatingFlashRate},
1147+ { 14 , " RepeatingFlashCount" , N_ (" Repeating flash count" ), N_ (" Repeating flash count" ), nikonFl7Id, makerTags, unsignedByte, 1 , printRepeatingFlashCount},
1148+ { 15 , " FlashGNDistance" , N_ (" Flash GN Distance" ), N_ (" Flash GN distance" ), nikonFl7Id, makerTags, unsignedByte, 1 , EXV_PRINT_TAG (nikonFlashGNDistance)},
1149+ { 17 , " FlashGroupAControlData" , N_ (" Flash group A control data" ), N_ (" Flash group A control data" ), nikonFl7Id, makerTags, unsignedByte, 1 , EXV_PRINT_TAG (nikonFlashControlMode)},
1150+ { 18 , " FlashGroupBCControlData" , N_ (" Flash group B/C control data" ), N_ (" Flash group B/C control data" ), nikonFl7Id, makerTags, unsignedByte, 1 , printFlashGroupBCControlData},
1151+ { 40 , " FlashGroupAData" , N_ (" Flash group A data" ), N_ (" Depending upon FlashGroupAControlData, either the FlashGroupACompensation value or the FlashGroupAOutput value" ), nikonFl7Id, makerTags, unsignedByte, 1 , printFlashGroupAData},
1152+ { 41 , " FlashGroupBData" , N_ (" Flash group B data" ), N_ (" Depending upon FlashGroupBCControlData, either the FlashGroupBCompensation value or the FlashGroupBOutput value" ), nikonFl7Id, makerTags, unsignedByte, 1 , printFlashGroupBData},
1153+ { 42 , " FlashGroupCData" , N_ (" Flash group C data" ), N_ (" Depending upon FlashGroupBCControlData, either the FlashGroupCCompensation value or the FlashGroupCOutput value" ), nikonFl7Id, makerTags, unsignedByte, 1 , printFlashGroupCData},
1154+ // End of list marker
1155+ {0xffff , " (UnknownNikonFl7Tag)" , " (UnknownNikonFl7Tag)" , N_ (" Unknown Nikon Flash Info 7 Tag" ), nikonFl7Id, makerTags, unsignedByte, 1 , printValue},
1156+ };
1157+
1158+ const TagInfo* Nikon3MakerNote::tagListFl7 ()
1159+ {
1160+ return tagInfoFl7_;
1161+ }
1162+
11381163 // Nikon3 Shot Info D80 Tag Info
11391164 constexpr TagInfo Nikon3MakerNote::tagInfoSi1_[] = {
11401165 { 0 , " Version" , N_ (" Version" ), N_ (" Version" ), nikonSi1Id, makerTags, unsignedByte, 4 , printExifVersion},
@@ -2772,14 +2797,18 @@ fmountlens[] = {
27722797 const ExifData*)
27732798 {
27742799 std::ios::fmtflags f ( os.flags () );
2775- if (value.count () != 1 || value.typeId () != unsignedByte || value. toLong () == 0 || value. toLong () == 255 ) {
2800+ if (value.count () != 1 || value.typeId () != unsignedByte) {
27762801 os << " (" << value << " )" ;
27772802 os.flags (f);
27782803 return os;
27792804 }
2805+ auto temp = value.toLong ();
2806+ if (temp == 0 || temp == 255 )
2807+ return os << _ (" n/a" );
2808+
27802809 std::ostringstream oss;
27812810 oss.copyfmt (os);
2782- os << std::fixed << std::setprecision (1 ) << value. toLong () << " mm" ;
2811+ os << std::fixed << std::setprecision (1 ) << temp << " mm" ;
27832812 os.copyfmt (oss);
27842813 os.flags (f);
27852814 return os;
@@ -2790,12 +2819,16 @@ fmountlens[] = {
27902819 const ExifData*)
27912820 {
27922821 std::ios::fmtflags f ( os.flags () );
2793- if (value.count () != 1 || value.typeId () != unsignedByte || value. toLong () == 0 || value. toLong () == 255 ) {
2822+ if (value.count () != 1 || value.typeId () != unsignedByte) {
27942823 return os << " (" << value << " )" ;
27952824 }
2825+ auto temp = value.toLong ();
2826+ if (temp == 0 || temp == 255 )
2827+ return os << _ (" n/a" );
2828+
27962829 std::ostringstream oss;
27972830 oss.copyfmt (os);
2798- os << std::fixed << std::setprecision (2 ) << value. toLong () << " Hz" ;
2831+ os << std::fixed << std::setprecision (2 ) << temp << " Hz" ;
27992832 os.copyfmt (oss);
28002833 os.flags (f);
28012834 return os;
@@ -2806,12 +2839,249 @@ fmountlens[] = {
28062839 const ExifData*)
28072840 {
28082841 std::ios::fmtflags f ( os.flags () );
2809- if (value.count () != 1 || value.typeId () != unsignedByte || value. toLong () == 0 || value. toLong () == 255 ) {
2842+ if (value.count () != 1 || value.typeId () != unsignedByte) {
28102843 return os << " (" << value << " )" ;
28112844 }
2845+ auto temp = value.toLong ();
2846+ if (temp == 0 || temp == 255 )
2847+ return os << _ (" n/a" );
2848+
28122849 std::ostringstream oss;
28132850 oss.copyfmt (os);
2814- os << std::fixed << std::setprecision (2 ) << value.toLong ();
2851+ os << std::fixed << std::setprecision (2 ) << temp;
2852+ os.copyfmt (oss);
2853+ os.flags (f);
2854+ return os;
2855+ }
2856+
2857+ std::ostream& Nikon3MakerNote::printExternalFlashData1 (std::ostream& os,
2858+ const Value& value,
2859+ const ExifData*)
2860+ {
2861+ std::ios::fmtflags f ( os.flags () );
2862+ if (value.count () != 1 || value.typeId () != unsignedByte) {
2863+ os << " (" << value << " )" ;
2864+ os.flags (f);
2865+ return os;
2866+ }
2867+ std::ostringstream oss;
2868+ oss.copyfmt (os);
2869+ os << (value.toLong () & 0x80 ? _ (" External flash zoom override" ) : _ (" No external flash zoom override" ));
2870+ os << " , " ;
2871+ os << (value.toLong () & 0x01 ? _ (" external flash attached" ) : _ (" external flash not attached" ));
2872+
2873+ os.copyfmt (oss);
2874+ os.flags (f);
2875+ return os;
2876+ }
2877+
2878+ std::ostream& Nikon3MakerNote::printExternalFlashData2 (std::ostream& os,
2879+ const Value& value,
2880+ const ExifData*)
2881+ {
2882+ std::ios::fmtflags f ( os.flags () );
2883+ if (value.count () != 1 || value.typeId () != unsignedByte) {
2884+ os << " (" << value << " )" ;
2885+ os.flags (f);
2886+ return os;
2887+ }
2888+
2889+ std::ostringstream oss;
2890+ oss.copyfmt (os);
2891+ long temp = value.toLong ();
2892+
2893+ switch (temp & 0x07 ) {
2894+ case 0 :
2895+ os << _ (" n/a" );
2896+ break ;
2897+ case 1 :
2898+ os << _ (" Ready" );
2899+ break ;
2900+ case 6 :
2901+ os << _ (" Not ready" );
2902+ break ;
2903+ default :
2904+ os << " (" << temp << " )" ;
2905+ break ;
2906+ }
2907+
2908+ os.copyfmt (oss);
2909+ os.flags (f);
2910+ return os;
2911+ }
2912+
2913+ std::ostream& Nikon3MakerNote::printFlashCompensation (std::ostream& os,
2914+ const Value& value,
2915+ const ExifData*)
2916+ {
2917+ std::ios::fmtflags f ( os.flags () );
2918+ if (value.count () != 1 || value.typeId () != signedByte) {
2919+ os << " (" << value << " )" ;
2920+ os.flags (f);
2921+ return os;
2922+ }
2923+ std::ostringstream oss;
2924+ oss.copyfmt (os);
2925+ float temp = ( value.toFloat ()/float (-6.0 ) );
2926+ temp *= 1.00001 ; // Avoid round-off errors
2927+
2928+ if (temp == 0 )
2929+ os << 0 ;
2930+ else if ( (int (temp)/temp) > 0.999 )
2931+ os << int (temp);
2932+ else if ( (int (temp*2 )/(temp*2 )) > 0.999 )
2933+ os << int (temp)*2 << " /2" ;
2934+ else if ( (int (temp*3 )/(temp*3 )) > 0.999 )
2935+ os << int (temp)*3 << " /3" ;
2936+ else
2937+ os << std::setprecision (3 ) << temp;
2938+
2939+ os.copyfmt (oss);
2940+ os.flags (f);
2941+ return os;
2942+ }
2943+
2944+ std::ostream& Nikon3MakerNote::printFlashGroupBCControlData (std::ostream& os,
2945+ const Value& value,
2946+ const ExifData* data)
2947+ {
2948+ std::ios::fmtflags f ( os.flags () );
2949+ if (value.count () != 1 || value.typeId () != unsignedByte) {
2950+ os << " (" << value << " )" ;
2951+ os.flags (f);
2952+ return os;
2953+ }
2954+ std::ostringstream oss;
2955+ oss.copyfmt (os);
2956+ long temp = value.toLong ();
2957+
2958+ printTag<EXV_COUNTOF (nikonFlashControlMode), nikonFlashControlMode>(os, (temp & 0xf0 ), data);
2959+ os << " , " ;
2960+ printTag<EXV_COUNTOF (nikonFlashControlMode), nikonFlashControlMode>(os, (temp & 0x0f ), data);
2961+
2962+ os.copyfmt (oss);
2963+ os.flags (f);
2964+ return os;
2965+ }
2966+
2967+ std::ostream& Nikon3MakerNote::printFlashGroupAData (std::ostream& os,
2968+ const Value& value,
2969+ const ExifData* metadata)
2970+ {
2971+ std::ios::fmtflags f ( os.flags () );
2972+ if (value.count () != 1 || value.typeId () != unsignedByte) {
2973+ os << " (" << value << " )" ;
2974+ os.flags (f);
2975+ return os;
2976+ }
2977+
2978+ std::ostringstream oss;
2979+ oss.copyfmt (os);
2980+ double temp = value.toFloat ()/double (-6.0 );
2981+
2982+ auto pos = metadata->findKey (ExifKey (" Exif.NikonFl7.FlashGroupAControlData" ));
2983+ if (pos == metadata->end () || pos-> count () != 1 || pos->typeId () != unsignedByte) {
2984+ os << " (" << value << " )" ;
2985+ }
2986+ else {
2987+ if (pos->toLong () < 0x06 ) {
2988+ // FlashGroupACompensation value
2989+ if (temp == 0 )
2990+ os << 0 ;
2991+ else
2992+ os << std::fixed << std::setprecision (1 ) << temp;
2993+ }
2994+ else {
2995+ // FlashGroupAOutput value
2996+ double flashGroupAOutput = std::exp2 (temp);
2997+ if (flashGroupAOutput > 0.99 )
2998+ os << _ (" Full" );
2999+ else
3000+ os << std::setprecision (2 ) << std::round (flashGroupAOutput*100 ) << " %" ;
3001+ }
3002+ }
3003+ os.copyfmt (oss);
3004+ os.flags (f);
3005+ return os;
3006+ }
3007+
3008+ std::ostream& Nikon3MakerNote::printFlashGroupBData (std::ostream& os,
3009+ const Value& value,
3010+ const ExifData* metadata)
3011+ {
3012+ std::ios::fmtflags f ( os.flags () );
3013+ if (value.count () != 1 || value.typeId () != unsignedByte) {
3014+ os << " (" << value << " )" ;
3015+ os.flags (f);
3016+ return os;
3017+ }
3018+
3019+ std::ostringstream oss;
3020+ oss.copyfmt (os);
3021+ double temp = value.toFloat ()/double (-6.0 );
3022+
3023+ auto pos = metadata->findKey (ExifKey (" Exif.NikonFl7.FlashGroupBCControlData" ));
3024+ if (pos == metadata->end () || pos-> count () != 1 || pos->typeId () != unsignedByte) {
3025+ os << " (" << value << " )" ;
3026+ }
3027+ else {
3028+ if (pos->toLong () < 0x06 ) {
3029+ // FlashGroupBCompensation value
3030+ if (temp == 0 )
3031+ os << 0 ;
3032+ else
3033+ os << std::fixed << std::setprecision (1 ) << temp;
3034+ }
3035+ else {
3036+ // FlashGroupBOutput value
3037+ double flashGroupAOutput = std::exp2 (temp);
3038+ if (flashGroupAOutput > 0.99 )
3039+ os << _ (" Full" );
3040+ else
3041+ os << std::setprecision (2 ) << std::round (flashGroupAOutput*100 ) << " %" ;
3042+ }
3043+ }
3044+ os.copyfmt (oss);
3045+ os.flags (f);
3046+ return os;
3047+ }
3048+
3049+ std::ostream& Nikon3MakerNote::printFlashGroupCData (std::ostream& os,
3050+ const Value& value,
3051+ const ExifData* metadata)
3052+ {
3053+ std::ios::fmtflags f ( os.flags () );
3054+ if (value.count () != 1 || value.typeId () != unsignedByte) {
3055+ os << " (" << value << " )" ;
3056+ os.flags (f);
3057+ return os;
3058+ }
3059+
3060+ std::ostringstream oss;
3061+ oss.copyfmt (os);
3062+ double temp = value.toFloat ()/double (-6.0 );
3063+
3064+ auto pos = metadata->findKey (ExifKey (" Exif.NikonFl7.FlashGroupBCControlData" ));
3065+ if (pos == metadata->end () || pos-> count () != 1 || pos->typeId () != unsignedByte) {
3066+ os << " (" << value << " )" ;
3067+ }
3068+ else {
3069+ if (pos->toLong () < 0x06 ) {
3070+ // FlashGroupCCompensation value
3071+ if (temp == 0 )
3072+ os << 0 ;
3073+ else
3074+ os << std::fixed << std::setprecision (1 ) << temp;
3075+ }
3076+ else {
3077+ // FlashGroupCOutput value
3078+ double flashGroupAOutput = std::exp2 (temp);
3079+ if (flashGroupAOutput > 0.99 )
3080+ os << _ (" Full" );
3081+ else
3082+ os << std::setprecision (2 ) << std::round (flashGroupAOutput*100 ) << " %" ;
3083+ }
3084+ }
28153085 os.copyfmt (oss);
28163086 os.flags (f);
28173087 return os;
0 commit comments