2005-04-27 Lutz Mueller <lutz@users.sourceforge.net>
authorLutz Mueller <lutz.s.mueller@gmail.com>
Wed, 27 Apr 2005 06:45:42 +0000 (08:45 +0200)
committerLutz Mueller <lutz.s.mueller@gmail.com>
Wed, 27 Apr 2005 06:45:42 +0000 (08:45 +0200)
* libexif/exif-entry.h
* libexif/exif-content.h: New convenience functions/macros.

ChangeLog
libexif/exif-content.c
libexif/exif-content.h
libexif/exif-entry.h

index 7c23f79..163958e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-04-27  Lutz Mueller <lutz@users.sourceforge.net>
 
+       * libexif/exif-entry.h
+       * libexif/exif-content.h: New convenience functions/macros.
+
+2005-04-27  Lutz Mueller <lutz@users.sourceforge.net>
+
        * configure.ac: AGE = 1
        * libexif/exif-entry.c (exif_entry_fix): Add a break to avoid unnecessary
        checks.
index 464a8e1..633e6e9 100644 (file)
@@ -209,3 +209,17 @@ exif_content_log (ExifContent *content, ExifLog *log)
        content->priv->log = log;
        exif_log_ref (log);
 }
+
+ExifIfd
+exif_content_get_ifd (ExifContent *c)
+{
+       if (!c || !c->parent) return EXIF_IFD_COUNT;
+
+       return 
+               ((c)->parent->ifd[EXIF_IFD_0] == (c)) ? EXIF_IFD_0 :
+               ((c)->parent->ifd[EXIF_IFD_1] == (c)) ? EXIF_IFD_1 :
+               ((c)->parent->ifd[EXIF_IFD_EXIF] == (c)) ? EXIF_IFD_EXIF :
+               ((c)->parent->ifd[EXIF_IFD_GPS] == (c)) ? EXIF_IFD_GPS :
+               ((c)->parent->ifd[EXIF_IFD_INTEROPERABILITY] == (c)) ? EXIF_IFD_INTEROPERABILITY :
+               EXIF_IFD_COUNT;
+}
index 115f8ed..53b55ce 100644 (file)
@@ -62,6 +62,7 @@ void         exif_content_foreach_entry (ExifContent *content,
                                         void *user_data);
 
 /* For your convenience */
+ExifIfd exif_content_get_ifd (ExifContent *);
 #define exif_content_get_value(c,t,v,m)                                        \
        (exif_content_get_entry (c,t) ?                                 \
         exif_entry_get_value (exif_content_get_entry (c,t),v,m) : NULL)
index 072ee29..22b17de 100644 (file)
@@ -62,6 +62,8 @@ const char *exif_entry_get_value (ExifEntry *entry, char *val,
 
 void        exif_entry_dump      (ExifEntry *entry, unsigned int indent);
 
+#define exif_entry_get_ifd(e) ((e)?exif_content_get_ifd((e)->parent):EXIF_IFD_COUNT)
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */