Commit 10b7b1e3 authored by Dennis Real's avatar Dennis Real
Browse files

Support for Canon Exif makernote tags

parent 3c284dc8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4,3 +4,4 @@
/src/feh
/man/*.1
*~
core
+18 −5
Original line number Diff line number Diff line
@@ -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;
@@ -278,8 +279,6 @@ void exif_get_info(ExifData * ed, char *buffer, unsigned int maxsize)
             || (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,8 +289,22 @@ 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
        {
        }
      }
      
    }
    

src/exif_canon.c

0 → 100644
+61 −0
Original line number Diff line number Diff line
/* 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

src/exif_canon.h

0 → 100644
+33 −0
Original line number Diff line number Diff line
/* 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
+19 −1
Original line number Diff line number Diff line
@@ -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
Loading