summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exif.c23
-rw-r--r--src/exif_canon.c61
-rw-r--r--src/exif_canon.h33
-rw-r--r--src/exif_cfg.h20
-rw-r--r--src/exif_nikon.c23
5 files changed, 141 insertions, 19 deletions
diff --git a/src/exif.c b/src/exif.c
index ed18eb5..a30b2ef 100644
--- a/src/exif.c
+++ b/src/exif.c
@@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "options.h"
#include "debug.h"
#include "exif.h"
+#include "exif_canon.h"
#include "exif_nikon.h"
#include "exif_cfg.h"
@@ -239,7 +240,7 @@ ExifData * exif_get_data(char *path)
-/* get exif data in readable form */
+/* get all exif data in readable form */
void exif_get_info(ExifData * ed, char *buffer, unsigned int maxsize)
{
ExifEntry *entry = NULL;
@@ -272,14 +273,12 @@ void exif_get_info(ExifData * ed, char *buffer, unsigned int maxsize)
if (exif_entry_get_value(entry, buf, sizeof(buf)))
{
exif_trim_spaces(buf);
-
+
if ( (strcmp(buf, "NIKON CORPORATION") == 0)
|| (strcmp(buf, "Nikon") == 0)
|| (strcmp(buf, "NIKON") == 0)
)
{
- /* this is a nikon camera */
-
/* 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) )
@@ -290,7 +289,21 @@ void exif_get_info(ExifData * ed, char *buffer, unsigned int maxsize)
}
}
-
+ else if ( (strcmp(buf, "Canon") == 0) )
+ {
+ /* show canon makernote exif tags. list must be defined in exif_cfg.h */
+ i=0;
+ while ( (Exif_makernote_canon_tag_list[i] != EXIF_CANON_MAKERNOTE_END) && (i < USHRT_MAX) )
+ {
+ exc_get_mnote_canon_tags(ed, Exif_makernote_canon_tag_list[i],
+ buffer + strlen(buffer), maxsize - strlen(buffer));
+ i++;
+ }
+
+ }
+ else
+ {
+ }
}
}
diff --git a/src/exif_canon.c b/src/exif_canon.c
new file mode 100644
index 0000000..8801899
--- /dev/null
+++ b/src/exif_canon.c
@@ -0,0 +1,61 @@
+/* exif_canon.c
+
+Copyright (C) 2012 Dennis Real.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies of the Software and its documentation and acknowledgment shall be
+given in the documentation and software packages that this Software was
+used.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifdef HAVE_LIBEXIF
+
+#include <stdio.h>
+#include <libexif/exif-data.h>
+
+#include "feh.h"
+#include "debug.h"
+#include "exif.h"
+#include "exif_canon.h"
+
+
+
+/* get interesting canon maker note tags in readable form */
+void exc_get_mnote_canon_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)
+ {
+ default:
+ {
+ /* normal makernote tags without special treatment */
+ exif_get_mnote_tag(ed, tag, buffer, maxsize);
+ }
+ break;
+ }
+
+
+ return;
+}
+
+#endif
diff --git a/src/exif_canon.h b/src/exif_canon.h
new file mode 100644
index 0000000..d8682c3
--- /dev/null
+++ b/src/exif_canon.h
@@ -0,0 +1,33 @@
+/* exif_canon.h
+
+Copyright (C) 2012 Dennis Real.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies of the Software and its documentation and acknowledgment shall be
+given in the documentation and software packages that this Software was
+used.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef EXIF_CANON_H
+#define EXIF_CANON_H
+
+#include <libexif/exif-data.h>
+
+extern void exc_get_mnote_canon_tags(ExifData *ed, unsigned int tag, char * buffer, unsigned int maxsize);
+
+#endif
diff --git a/src/exif_cfg.h b/src/exif_cfg.h
index 390c1ad..31acc50 100644
--- a/src/exif_cfg.h
+++ b/src/exif_cfg.h
@@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
typedef struct
{
- ExifIfd ifd; /* section */
+ ExifIfd ifd; /* section */
ExifTag tag; /* tag */
} t_EXIF_INFO;
@@ -59,6 +59,9 @@ const t_EXIF_INFO Exif_tag_list [] =
};
+
+/* Nikon */
+
#define EXIF_NIKON_MAKERNOTE_END 0 /* end marker: if 0 used as a tag we must find something else */
/* show these nikon makernote tags */
@@ -78,4 +81,19 @@ const unsigned int Exif_makernote_nikon_tag_list [] =
EXIF_NIKON_MAKERNOTE_END /* end marker */
};
+
+
+/* Canon */
+#define EXIF_CANON_MAKERNOTE_END 0xFFFF /* end marker: if this is used as a tag we must find something else */
+
+/* show these canon makernote tags */
+const unsigned int Exif_makernote_canon_tag_list [] =
+{
+ 8, /* Image Number */
+ 9, /* Owner Name */
+
+ EXIF_CANON_MAKERNOTE_END /* end marker */
+};
+
+
#endif
diff --git a/src/exif_nikon.c b/src/exif_nikon.c
index 753a8bf..f4a8eea 100644
--- a/src/exif_nikon.c
+++ b/src/exif_nikon.c
@@ -26,7 +26,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef HAVE_LIBEXIF
#include <stdio.h>
-#include <string.h>
#include <libexif/exif-data.h>
#include "feh.h"
@@ -174,7 +173,7 @@ static void exn_get_mnote_nikon_34(ExifData *ed, char * buffer, unsigned int max
buf[0] = '\0';
exif_get_mnote_tag(ed, 34, buf, sizeof(buf));
- sscanf(buf, "(null): %u", &data);
+ sscanf(buf, "(null): %u", &data); /* not directly supported by libexif yet */
switch(data)
{
@@ -215,8 +214,7 @@ static void exn_get_mnote_nikon_34(ExifData *ed, char * buffer, unsigned int max
}
- snprintf(buffer + strlen(buffer), maxsize - strlen(buffer), "Active D-Lightning: %s\n",
- answer);
+ snprintf(buffer, maxsize, "Active D-Lightning: %s\n", answer);
}
@@ -244,8 +242,7 @@ static void exn_get_mnote_nikon_168(ExifData *ed, char * buffer, unsigned int ma
)
)
{
- snprintf(buffer + strlen(buffer), maxsize - strlen(buffer), "NikonFlashControlMode: %s\n",
- EXN_NikonFlashControlModeValues[exn_fcm]);
+ snprintf(buffer, maxsize, "NikonFlashControlMode: %s\n", EXN_NikonFlashControlModeValues[exn_fcm]);
}
}
@@ -283,7 +280,7 @@ static void exn_get_mnote_nikon_183(ExifData *ed, char * buffer, unsigned int ma
if ( (contrastdetectaf != 0) && (afareamode < EXN_AF_AREA_MODE_C_MAX) )
{
/* Contrast AF (live view) */
- snprintf(buffer + strlen(buffer), maxsize - strlen(buffer),
+ snprintf(buffer, maxsize,
"ContrastDetectAF: %s; AFAreaMode: %s\n",
EXN_NikonContrastDetectAF[contrastdetectaf],
EXN_NikonAFAreaModeContr[afareamode]);
@@ -295,7 +292,7 @@ static void exn_get_mnote_nikon_183(ExifData *ed, char * buffer, unsigned int ma
buf[0] = '\0';
exn_get_prim_af_pt(phasedetectaf, primaryafpoint, buf, EXIF_STD_BUF_LEN);
- snprintf(buffer + strlen(buffer), maxsize - strlen(buffer),
+ snprintf(buffer, maxsize,
"PhaseDetectAF: %s; AreaMode: %s; PrimaryAFPoint: %s\n",
EXN_NikonPhaseDetectAF[phasedetectaf],
EXN_NikonAFAreaModePhase[afareamode],
@@ -328,7 +325,7 @@ void exn_get_mnote_nikon_tags(ExifData *ed, unsigned int tag, char * buffer, uns
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));
+ exif_get_mnote_tag(ed, tag, buffer, maxsize);
}
}
break;
@@ -336,7 +333,7 @@ void exn_get_mnote_nikon_tags(ExifData *ed, unsigned int tag, char * buffer, uns
case 34:
{
/* ActiveD-Lighting */
- exn_get_mnote_nikon_34(ed, buffer + strlen(buffer), maxsize - strlen(buffer));
+ exn_get_mnote_nikon_34(ed, buffer, maxsize);
}
break;
@@ -346,7 +343,7 @@ void exn_get_mnote_nikon_tags(ExifData *ed, unsigned int tag, char * buffer, uns
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));
+ exn_get_mnote_nikon_168(ed, buffer, maxsize);
}
}
break;
@@ -354,14 +351,14 @@ void exn_get_mnote_nikon_tags(ExifData *ed, unsigned int tag, char * buffer, uns
case 183:
{
/* AFInfo 2 */
- exn_get_mnote_nikon_183(ed, buffer + strlen(buffer), maxsize - strlen(buffer));
+ exn_get_mnote_nikon_183(ed, buffer, maxsize);
}
break;
default:
{
/* normal makernote tags without special treatment */
- exif_get_mnote_tag(ed, tag, buffer + strlen(buffer), maxsize - strlen(buffer));
+ exif_get_mnote_tag(ed, tag, buffer, maxsize);
}
break;
}