*** empty log message ***
authorLutz Mueller <lutz.s.mueller@gmail.com>
Thu, 21 Feb 2002 09:55:22 +0000 (10:55 +0100)
committerLutz Mueller <lutz.s.mueller@gmail.com>
Thu, 21 Feb 2002 09:55:22 +0000 (10:55 +0100)
libexif/Makefile.am
libexif/canon/exif-canon-note.c
libexif/exif-note.c
libexif/exif-note.h

index f0fc694..33180aa 100644 (file)
@@ -16,7 +16,8 @@ libexif_la_SOURCES =          \
        exif-note.c             \
        exif-tag.c              \
        exif-utils.c
-libexif_la_LIBADD = -lm
+libexif_la_LIBADD = -lm                \
+       canon/libexif-canon.la
 
 libexifincludedir = $(includedir)/libexif
 libexifinclude_HEADERS =       \
index e0a1f05..ffa4304 100644 (file)
@@ -52,7 +52,7 @@ exif_canon_note_save_data (ExifNote *n, unsigned char **data,
 }
 
 static void
-exif_canon_note_load_data (ExifNote *n, unsigned char *data,
+exif_canon_note_load_data (ExifNote *n, const unsigned char *data,
                           unsigned int size)
 {
        ExifCanonNote *note = (ExifCanonNote *) n;
index 53a89fe..d8f15cc 100644 (file)
@@ -24,6 +24,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <canon/exif-canon-note.h>
+
 struct _ExifNotePrivate {
        unsigned int ref_count;
 };
@@ -75,3 +77,40 @@ exif_note_free (ExifNote *note)
 
        free (note);
 }
+
+static void
+exif_note_load_data (ExifNote *note,
+                    const unsigned char *data, unsigned int size)
+{
+       if (!note)
+               return;
+
+       if (note->methods.load_data)
+               note->methods.load_data (note, data, size);
+}
+
+ExifNote *
+exif_note_new_from_data (const unsigned char *data, unsigned int size)
+{
+       ExifNote *note = NULL;
+
+       if (!size || !data)
+               return (NULL);
+
+       /* Canon notes begin with 0x0000 */
+       if ((size > 1) && (data[0] == 0x00) && (data[1] == 0x00))
+               note = exif_canon_note_new ();
+
+       /* Insert your maker here... Patches welcome. */
+       else if (0) {
+               note = NULL;
+
+       } else {
+               note = NULL;
+       }
+
+       if (note)
+               exif_note_load_data (note, data, size);
+
+       return (note);
+}
index be2a4bd..c3caac3 100644 (file)
@@ -27,7 +27,7 @@ typedef struct _ExifNotePrivate ExifNotePrivate;
 typedef struct _ExifNoteMethods ExifNoteMethods;
 struct _ExifNoteMethods {
        void    (* free)      (ExifNote *);
-       void    (* load_data) (ExifNote *, unsigned char *,  unsigned int);
+       void    (* load_data) (ExifNote *, const unsigned char *, unsigned int);
        void    (* save_data) (ExifNote *, unsigned char **, unsigned int *);
        char ** (*get_value)  (ExifNote *);
 };
@@ -43,4 +43,7 @@ void exif_note_ref   (ExifNote *note);
 void exif_note_unref (ExifNote *note);
 void exif_note_free  (ExifNote *note);
 
+ExifNote *exif_note_new_from_data (const unsigned char *data,
+                                  unsigned int size);
+
 #endif /* __EXIF_NOTE_H__ */