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 = \
}
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;
#include <stdlib.h>
#include <string.h>
+#include <canon/exif-canon-note.h>
+
struct _ExifNotePrivate {
unsigned int ref_count;
};
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);
+}
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 *);
};
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__ */