Loading src/exif.c +10 −1 Original line number Diff line number Diff line Loading @@ -279,7 +279,16 @@ void exif_get_info(ExifData * ed, char *buffer, unsigned int maxsize) ) { /* this is a nikon camera */ exn_get_mnote_nikon_tags(ed, buffer + strlen(buffer), maxsize - strlen(buffer)); /* show nikon makernote exif tags. list must be defined in exif_cfg.h */ i=0; while ( (Exif_makernote_nikon_tag_list[i] != EXIF_NIKON_MAKERNOTE_END) && (i < USHRT_MAX) ) { exn_get_mnote_nikon_tags(ed, Exif_makernote_nikon_tag_list[i], buffer + strlen(buffer), maxsize - strlen(buffer)); i++; } } } Loading src/exif_cfg.h +20 −1 Original line number Diff line number Diff line Loading @@ -34,8 +34,8 @@ typedef struct ExifTag tag; /* tag */ } t_EXIF_INFO; /* show these standard tags. section must be given first, than the tag itself */ /* note: maker note specific tags are handled directly in exif.c up to now */ const t_EXIF_INFO Exif_tag_list [] = { {EXIF_IFD_0, EXIF_TAG_MAKE}, Loading @@ -58,4 +58,23 @@ const t_EXIF_INFO Exif_tag_list [] = {EXIF_IFD_COUNT, 0} /* end marker */ }; #define EXIF_NIKON_MAKERNOTE_END 0 /* end marker: if 0 used as a tag we must find something else */ /* show these nikon makernote tags */ const unsigned int Exif_makernote_nikon_tag_list [] = { 8, /* Flash Setting */ 9, /* Flash Mode */ 24, /* Flash exposure bracket value */ 135, /* Flash used */ 168, /* Flash info: control mode */ 132, /* Lens */ 171, /* Digital Vari-Program */ 183, /* AFInfo2 */ EXIF_NIKON_MAKERNOTE_END /* end marker */ }; #endif src/exif_nikon.c +102 −59 Original line number Diff line number Diff line Loading @@ -100,10 +100,12 @@ static void exn_get_prim_af_pt(unsigned int phasedetectaf, unsigned int primafpt, char * buffer, unsigned int maxsize); static void exn_get_mnote_nikon_168(ExifData *ed, char * buffer, unsigned int maxsize); static void exn_get_mnote_nikon_183(ExifData *ed, char * buffer, unsigned int maxsize); /* get primary AF point */ static void exn_get_prim_af_pt(unsigned int phasedetectaf, unsigned int primafpt, char * buffer, Loading Loading @@ -162,36 +164,14 @@ static void exn_get_prim_af_pt(unsigned int phasedetectaf, /* get interesting nikon maker note tags in readable form */ void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize) /* get nikon Flash info: control mode (168) info */ static void exn_get_mnote_nikon_168(ExifData *ed, char * buffer, unsigned int maxsize) { char buf[EXIF_STD_BUF_LEN]; unsigned int exn_fcm = (EXN_FLASH_CONTROL_MODES_MAX-1); /* default to N/A */ unsigned int version = 0; unsigned int length = 0; unsigned int contrastdetectaf = 0; unsigned int afareamode = 0; unsigned int phasedetectaf = 0; unsigned int primaryafpoint = 0; buf[0] = '\0'; exif_get_tag(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH, buf, sizeof(buf)); exif_trim_spaces(buf); unsigned int exn_fcm = (EXN_FLASH_CONTROL_MODES_MAX-1); /* default to N/A */ if ( !(strcmp("Flash: Flash did not fire\n", buf) == 0) ) { /* show extended flash info if flash was fired */ /* Flash Setting */ exif_get_mnote_tag(ed, 8, buffer + strlen(buffer), maxsize - strlen(buffer)); /* Flash Mode */ exif_get_mnote_tag(ed, 9, buffer + strlen(buffer), maxsize - strlen(buffer)); /* flash exposure bracket value */ exif_get_mnote_tag(ed, 24, buffer + strlen(buffer), maxsize - strlen(buffer)); /* Flash used */ exif_get_mnote_tag(ed, 135, buffer + strlen(buffer), maxsize - strlen(buffer)); /* Flash info: control mode. */ /* libexif does not support flash info 168 yet. so we have to parse the debug data :-( */ buf[0] = '\0'; exif_get_mnote_tag(ed, 168, buf, sizeof(buf)); Loading @@ -209,12 +189,21 @@ void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize) snprintf(buffer + strlen(buffer), maxsize - strlen(buffer), "NikonFlashControlMode: %s\n", EXN_NikonFlashControlModeValues[exn_fcm]); } } /* Lens */ exif_get_mnote_tag(ed, 132, buffer + strlen(buffer), maxsize - strlen(buffer)); /* Digital Vari-Program */ exif_get_mnote_tag(ed, 171, buffer + strlen(buffer), maxsize - strlen(buffer)); /* get nikon AFInfo2 (183) info */ static void exn_get_mnote_nikon_183(ExifData *ed, char * buffer, unsigned int maxsize) { char buf[EXIF_STD_BUF_LEN]; unsigned int contrastdetectaf = 0; unsigned int afareamode = 0; unsigned int phasedetectaf = 0; unsigned int primaryafpoint = 0; unsigned int version = 0; unsigned int length = 0; /* AFInfo2 */ /* libexif does not support AFInfo2 183 yet. so we have to parse the debug data :-( */ Loading @@ -231,7 +220,6 @@ void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize) if ( ((length == 30) && (version == '0')) && (contrastdetectaf < EXN_CONTRAST_DETECT_AF_MAX) && (phasedetectaf < EXN_PHASE_DETECT_AF_MAX) ) { if ( (contrastdetectaf != 0) && (afareamode < EXN_AF_AREA_MODE_C_MAX) ) Loading @@ -258,6 +246,61 @@ void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize) } } } /* get interesting nikon maker note tags in readable form */ void exn_get_mnote_nikon_tags(ExifData *ed, unsigned int tag, char * buffer, unsigned int maxsize) { char buf[EXIF_STD_BUF_LEN]; buf[0] = '\0'; exif_get_tag(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH, buf, sizeof(buf)); exif_trim_spaces(buf); switch(tag) { /* show only if flash was used */ case 8: /* Flash Setting */ case 9: /* Flash Mode */ case 24: /* Flash exposure bracket value */ case 135: /* Flash used */ { if ( !(strcmp("Flash: Flash did not fire\n", buf) == 0) ) { /* show extended flash info only if flash was fired */ exif_get_mnote_tag(ed, tag, buffer + strlen(buffer), maxsize - strlen(buffer)); } } break; case 168: { /* Flash info: control mode */ if ( !(strcmp("Flash: Flash did not fire\n", buf) == 0) ) { /* show extended flash info only if flash was fired */ exn_get_mnote_nikon_168(ed, buffer + strlen(buffer), maxsize - strlen(buffer)); } } break; case 183: { /* AFInfo 2 */ exn_get_mnote_nikon_183(ed, buffer + strlen(buffer), maxsize - strlen(buffer)); } break; default: { /* normal makernote tags without special treatment */ exif_get_mnote_tag(ed, tag, buffer + strlen(buffer), maxsize - strlen(buffer)); } break; } return; } Loading src/exif_nikon.h +1 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <libexif/exif-data.h> extern void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize); extern void exn_get_mnote_nikon_tags(ExifData *ed, unsigned int tag, char * buffer, unsigned int maxsize); #endif Loading
src/exif.c +10 −1 Original line number Diff line number Diff line Loading @@ -279,7 +279,16 @@ void exif_get_info(ExifData * ed, char *buffer, unsigned int maxsize) ) { /* this is a nikon camera */ exn_get_mnote_nikon_tags(ed, buffer + strlen(buffer), maxsize - strlen(buffer)); /* show nikon makernote exif tags. list must be defined in exif_cfg.h */ i=0; while ( (Exif_makernote_nikon_tag_list[i] != EXIF_NIKON_MAKERNOTE_END) && (i < USHRT_MAX) ) { exn_get_mnote_nikon_tags(ed, Exif_makernote_nikon_tag_list[i], buffer + strlen(buffer), maxsize - strlen(buffer)); i++; } } } Loading
src/exif_cfg.h +20 −1 Original line number Diff line number Diff line Loading @@ -34,8 +34,8 @@ typedef struct ExifTag tag; /* tag */ } t_EXIF_INFO; /* show these standard tags. section must be given first, than the tag itself */ /* note: maker note specific tags are handled directly in exif.c up to now */ const t_EXIF_INFO Exif_tag_list [] = { {EXIF_IFD_0, EXIF_TAG_MAKE}, Loading @@ -58,4 +58,23 @@ const t_EXIF_INFO Exif_tag_list [] = {EXIF_IFD_COUNT, 0} /* end marker */ }; #define EXIF_NIKON_MAKERNOTE_END 0 /* end marker: if 0 used as a tag we must find something else */ /* show these nikon makernote tags */ const unsigned int Exif_makernote_nikon_tag_list [] = { 8, /* Flash Setting */ 9, /* Flash Mode */ 24, /* Flash exposure bracket value */ 135, /* Flash used */ 168, /* Flash info: control mode */ 132, /* Lens */ 171, /* Digital Vari-Program */ 183, /* AFInfo2 */ EXIF_NIKON_MAKERNOTE_END /* end marker */ }; #endif
src/exif_nikon.c +102 −59 Original line number Diff line number Diff line Loading @@ -100,10 +100,12 @@ static void exn_get_prim_af_pt(unsigned int phasedetectaf, unsigned int primafpt, char * buffer, unsigned int maxsize); static void exn_get_mnote_nikon_168(ExifData *ed, char * buffer, unsigned int maxsize); static void exn_get_mnote_nikon_183(ExifData *ed, char * buffer, unsigned int maxsize); /* get primary AF point */ static void exn_get_prim_af_pt(unsigned int phasedetectaf, unsigned int primafpt, char * buffer, Loading Loading @@ -162,36 +164,14 @@ static void exn_get_prim_af_pt(unsigned int phasedetectaf, /* get interesting nikon maker note tags in readable form */ void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize) /* get nikon Flash info: control mode (168) info */ static void exn_get_mnote_nikon_168(ExifData *ed, char * buffer, unsigned int maxsize) { char buf[EXIF_STD_BUF_LEN]; unsigned int exn_fcm = (EXN_FLASH_CONTROL_MODES_MAX-1); /* default to N/A */ unsigned int version = 0; unsigned int length = 0; unsigned int contrastdetectaf = 0; unsigned int afareamode = 0; unsigned int phasedetectaf = 0; unsigned int primaryafpoint = 0; buf[0] = '\0'; exif_get_tag(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH, buf, sizeof(buf)); exif_trim_spaces(buf); unsigned int exn_fcm = (EXN_FLASH_CONTROL_MODES_MAX-1); /* default to N/A */ if ( !(strcmp("Flash: Flash did not fire\n", buf) == 0) ) { /* show extended flash info if flash was fired */ /* Flash Setting */ exif_get_mnote_tag(ed, 8, buffer + strlen(buffer), maxsize - strlen(buffer)); /* Flash Mode */ exif_get_mnote_tag(ed, 9, buffer + strlen(buffer), maxsize - strlen(buffer)); /* flash exposure bracket value */ exif_get_mnote_tag(ed, 24, buffer + strlen(buffer), maxsize - strlen(buffer)); /* Flash used */ exif_get_mnote_tag(ed, 135, buffer + strlen(buffer), maxsize - strlen(buffer)); /* Flash info: control mode. */ /* libexif does not support flash info 168 yet. so we have to parse the debug data :-( */ buf[0] = '\0'; exif_get_mnote_tag(ed, 168, buf, sizeof(buf)); Loading @@ -209,12 +189,21 @@ void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize) snprintf(buffer + strlen(buffer), maxsize - strlen(buffer), "NikonFlashControlMode: %s\n", EXN_NikonFlashControlModeValues[exn_fcm]); } } /* Lens */ exif_get_mnote_tag(ed, 132, buffer + strlen(buffer), maxsize - strlen(buffer)); /* Digital Vari-Program */ exif_get_mnote_tag(ed, 171, buffer + strlen(buffer), maxsize - strlen(buffer)); /* get nikon AFInfo2 (183) info */ static void exn_get_mnote_nikon_183(ExifData *ed, char * buffer, unsigned int maxsize) { char buf[EXIF_STD_BUF_LEN]; unsigned int contrastdetectaf = 0; unsigned int afareamode = 0; unsigned int phasedetectaf = 0; unsigned int primaryafpoint = 0; unsigned int version = 0; unsigned int length = 0; /* AFInfo2 */ /* libexif does not support AFInfo2 183 yet. so we have to parse the debug data :-( */ Loading @@ -231,7 +220,6 @@ void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize) if ( ((length == 30) && (version == '0')) && (contrastdetectaf < EXN_CONTRAST_DETECT_AF_MAX) && (phasedetectaf < EXN_PHASE_DETECT_AF_MAX) ) { if ( (contrastdetectaf != 0) && (afareamode < EXN_AF_AREA_MODE_C_MAX) ) Loading @@ -258,6 +246,61 @@ void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize) } } } /* get interesting nikon maker note tags in readable form */ void exn_get_mnote_nikon_tags(ExifData *ed, unsigned int tag, char * buffer, unsigned int maxsize) { char buf[EXIF_STD_BUF_LEN]; buf[0] = '\0'; exif_get_tag(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH, buf, sizeof(buf)); exif_trim_spaces(buf); switch(tag) { /* show only if flash was used */ case 8: /* Flash Setting */ case 9: /* Flash Mode */ case 24: /* Flash exposure bracket value */ case 135: /* Flash used */ { if ( !(strcmp("Flash: Flash did not fire\n", buf) == 0) ) { /* show extended flash info only if flash was fired */ exif_get_mnote_tag(ed, tag, buffer + strlen(buffer), maxsize - strlen(buffer)); } } break; case 168: { /* Flash info: control mode */ if ( !(strcmp("Flash: Flash did not fire\n", buf) == 0) ) { /* show extended flash info only if flash was fired */ exn_get_mnote_nikon_168(ed, buffer + strlen(buffer), maxsize - strlen(buffer)); } } break; case 183: { /* AFInfo 2 */ exn_get_mnote_nikon_183(ed, buffer + strlen(buffer), maxsize - strlen(buffer)); } break; default: { /* normal makernote tags without special treatment */ exif_get_mnote_tag(ed, tag, buffer + strlen(buffer), maxsize - strlen(buffer)); } break; } return; } Loading
src/exif_nikon.h +1 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <libexif/exif-data.h> extern void exn_get_mnote_nikon_tags(ExifData *ed, char * buffer, unsigned int maxsize); extern void exn_get_mnote_nikon_tags(ExifData *ed, unsigned int tag, char * buffer, unsigned int maxsize); #endif