* libexif/canon: Set up support for parsing MakerNotes.
+2002-02-21 Lutz Müller <lutz@users.sourceforge.net>
+
+ * libexif/canon: Set up support for parsing MakerNotes.
+
2002-02-20 Lutz Müller <lutz@users.sourceforge.net>
* libexif/exif-data.c:
AC_OUTPUT([
Makefile
libexif/Makefile
+libexif/canon/Makefile
libjpeg/Makefile
test/Makefile
libexif/libexif.pc
+SUBDIRS = canon
+
INCLUDES = \
-I$(top_srcdir)
exif-entry.c \
exif-format.c \
exif-i18n.h \
+ exif-note.c \
exif-tag.c \
exif-utils.c
libexif_la_LIBADD = -lm
exif-data.h \
exif-entry.h \
exif-format.h \
+ exif-note.h \
exif-result.h \
exif-tag.h \
exif-utils.h
--- /dev/null
+Makefile
+Makefile.in
+.libs
+.deps
+libexif.la
+*.o
+*.lo
+libexif.pc
--- /dev/null
+INCLUDES = \
+ -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libexif-canon.la
+libexif_canon_la_SOURCES = \
+ exif-canon-entry.c exif-canon-entry.h \
+ exif-canon-note.c exif-canon-note.h \
+ exif-canon-tag.c exif-canon-tag.h
+libexif_canon_la_LDFLAGS = -avoid-version
--- /dev/null
+/* exif-canon-entry.c
+ *
+ * Copyright (C) 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include "exif-canon-entry.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+struct _ExifCanonEntryPrivate {
+ unsigned int ref_count;
+};
+
+ExifCanonEntry *
+exif_canon_entry_new (void)
+{
+ ExifCanonEntry *entry;
+
+ entry = malloc (sizeof (ExifCanonEntry));
+ if (!entry)
+ return (NULL);
+ memset (entry, 0, sizeof (ExifCanonEntry));
+
+ entry->priv = malloc (sizeof (ExifCanonEntry));
+ if (!entry->priv) {
+ exif_canon_entry_free (entry);
+ return (NULL);
+ }
+ memset (entry->priv, 0, sizeof (ExifCanonEntryPrivate));
+
+ entry->priv->ref_count = 1;
+
+ return (entry);
+}
+
+void
+exif_canon_entry_ref (ExifCanonEntry *entry)
+{
+ if (!entry || !entry->priv)
+ return;
+
+ entry->priv->ref_count++;
+}
+
+void
+exif_canon_entry_unref (ExifCanonEntry *entry)
+{
+ if (!entry || !entry->priv)
+ return;
+
+ entry->priv->ref_count--;
+ if (!entry->priv->ref_count)
+ exif_canon_entry_free (entry);
+}
+
+void
+exif_canon_entry_free (ExifCanonEntry *entry)
+{
+ if (!entry)
+ return;
+
+ if (entry->priv) {
+ free (entry->priv);
+ entry->priv = NULL;
+ }
+
+ if (entry->data) {
+ free (entry->data);
+ entry->data = NULL;
+ }
+
+ free (entry);
+}
--- /dev/null
+/* exif-canon-entry.h
+ *
+ * Copyright (C) 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EXIF_CANON_ENTRY_H__
+#define __EXIF_CANON_ENTRY_H__
+
+#include <libexif/exif-format.h>
+#include <libexif/canon/exif-canon-tag.h>
+
+typedef struct _ExifCanonEntry ExifCanonEntry;
+typedef struct _ExifCanonEntryPrivate ExifCanonEntryPrivate;
+
+#include <libexif/canon/exif-canon-note.h>
+
+struct _ExifCanonEntry {
+ ExifCanonTag tag;
+ ExifFormat format;
+ unsigned long components;
+
+ unsigned char *data;
+ unsigned int size;
+
+ /* Note containing this entry */
+ ExifCanonNote *parent;
+
+ ExifCanonEntryPrivate *priv;
+};
+
+/* Lifecycle */
+ExifCanonEntry *exif_canon_entry_new (void);
+void exif_canon_entry_ref (ExifCanonEntry *entry);
+void exif_canon_entry_unref (ExifCanonEntry *entry);
+void exif_canon_entry_free (ExifCanonEntry *entry);
+
+#endif /* __EXIF_CANON_ENTRY_H__ */
--- /dev/null
+/* exif-canon-note.c
+ *
+ * Copyright (C) 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include "exif-canon-note.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+static void
+exif_canon_note_free (ExifNote *n)
+{
+ ExifCanonNote *note = (ExifCanonNote *) n;
+
+ note = NULL;
+}
+
+static char **
+exif_canon_note_get_value (ExifNote *n)
+{
+ ExifCanonNote *note = (ExifCanonNote *) n;
+
+ note = NULL;
+
+ return (NULL);
+}
+
+static void
+exif_canon_note_save_data (ExifNote *n, unsigned char **data,
+ unsigned int *size)
+{
+ ExifCanonNote *note = (ExifCanonNote *) n;
+
+ note = NULL;
+}
+
+static void
+exif_canon_note_load_data (ExifNote *n, unsigned char *data,
+ unsigned int size)
+{
+ ExifCanonNote *note = (ExifCanonNote *) n;
+
+ note = NULL;
+}
+
+ExifNote *
+exif_canon_note_new (void)
+{
+ ExifCanonNote *note;
+
+ note = malloc (sizeof (ExifCanonNote));
+ if (!note)
+ return (NULL);
+ exif_note_construct ((ExifNote *) note);
+ ((ExifNote *) note)->methods.free = exif_canon_note_free;
+ ((ExifNote *) note)->methods.load_data = exif_canon_note_load_data;
+ ((ExifNote *) note)->methods.save_data = exif_canon_note_save_data;
+ ((ExifNote *) note)->methods.get_value = exif_canon_note_get_value;
+
+ return ((ExifNote *) note);
+}
--- /dev/null
+/* exif-canon-note.h
+ *
+ * Copyright (C) 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EXIF_CANON_NOTE_H__
+#define __EXIF_CANON_NOTE_H__
+
+#include <libexif/exif-note.h>
+
+typedef struct _ExifCanonNote ExifCanonNote;
+
+#include <libexif/canon/exif-canon-entry.h>
+
+struct _ExifCanonNote {
+ ExifNote parent;
+
+ ExifCanonEntry **entries;
+ unsigned int count;
+};
+
+ExifNote *exif_canon_note_new (void);
+
+#endif /* __EXIF_CANON_NOTE_H__ */
--- /dev/null
+/* exif-canon-tag.c
+ *
+ * Copyright (C) 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include "exif-canon-tag.h"
+
+#include <stdlib.h>
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# undef _
+# define _(String) dgettext (PACKAGE, String)
+# ifdef gettext_noop
+# define N_(String) gettext_noop (String)
+# else
+# define N_(String) (String)
+# endif
+#else
+# define textdomain(String) (String)
+# define gettext(String) (String)
+# define dgettext(Domain,Message) (Message)
+# define dcgettext(Domain,Message,Type) (Message)
+# define bindtextdomain(Domain,Directory) (Domain)
+# define _(String) (String)
+# define N_(String) (String)
+#endif
+
+static struct {
+ ExifCanonTag tag;
+ const char *name;
+} table[] = {
+ {EXIF_CANON_TAG_SETTINGS_1, N_("Settings (first part)")},
+ {EXIF_CANON_TAG_SETTINGS_2, N_("Settings (second part)")},
+ {EXIF_CANON_TAG_IMAGE_TYPE, N_("Image type")},
+ {EXIF_CANON_TAG_FIRMWARE, N_("Firmware version")},
+ {EXIF_CANON_TAG_IMAGE_NUMBER, N_("Image number")},
+ {EXIF_CANON_TAG_OWNER, N_("Owner name")},
+ {EXIF_CANON_TAG_SERIAL_NUMBER, N_("Serial number")},
+ {EXIF_CANON_TAG_CUSTOM_FUNCS, N_("Custom functions")},
+ {0, NULL}
+};
+
+const char *
+exif_canon_tag_get_name (ExifCanonTag tag)
+{
+ unsigned int i;
+
+ for (i = 0; table[i].name; i++)
+ if (table[i].tag == tag)
+ break;
+
+ return (_(table[i].name));
+}
--- /dev/null
+/* exif-canon-tag.h
+ *
+ * Copyright (C) 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EXIF_CANON_TAG_H__
+#define __EXIF_CANON_TAG_H__
+
+typedef enum _ExifCanonTag ExifCanonTag;
+enum _ExifCanonTag {
+ EXIF_CANON_TAG_UNKNOWN_0 = 0x0,
+ EXIF_CANON_TAG_SETTINGS_1 = 0x1,
+ EXIF_CANON_TAG_UNKNOWN_3 = 0x3,
+ EXIF_CANON_TAG_SETTINGS_2 = 0x4,
+ EXIF_CANON_TAG_IMAGE_TYPE = 0x6,
+ EXIF_CANON_TAG_FIRMWARE = 0x7,
+ EXIF_CANON_TAG_IMAGE_NUMBER = 0x8,
+ EXIF_CANON_TAG_OWNER = 0x9,
+ EXIF_CANON_TAG_UNKNOWN_10 = 0xa,
+ EXIF_CANON_TAG_SERIAL_NUMBER = 0xc,
+ EXIF_CANON_TAG_UNKNOWN_13 = 0xd,
+ EXIF_CANON_TAG_CUSTOM_FUNCS = 0xf
+};
+
+const char *exif_canon_tag_get_name (ExifCanonTag tag);
+
+#endif /* __EXIF_CANON_TAG_H__ */
--- /dev/null
+/* exif-note.c
+ *
+ * Copyright (C) 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include "exif-note.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+struct _ExifNotePrivate {
+ unsigned int ref_count;
+};
+
+void
+exif_note_construct (ExifNote *note)
+{
+ if (!note)
+ return;
+
+ note->priv = malloc (sizeof (ExifNotePrivate));
+ if (!note->priv)
+ return;
+ memset (note->priv, 0, sizeof (ExifNotePrivate));
+
+ note->priv->ref_count = 1;
+}
+
+void
+exif_note_ref (ExifNote *note)
+{
+ if (!note || !note->priv)
+ return;
+
+ note->priv->ref_count++;
+}
+
+void
+exif_note_unref (ExifNote *note)
+{
+ if (!note || !note->priv)
+ return;
+
+ note->priv->ref_count--;
+ if (!note->priv->ref_count)
+ exif_note_free (note);
+};
+
+void
+exif_note_free (ExifNote *note)
+{
+ if (!note)
+ return;
+
+ if (!note->priv) {
+ free (note->priv);
+ note->priv = NULL;
+ }
+
+ free (note);
+}
--- /dev/null
+/* exif-note.h
+ *
+ * Copyright (C) 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EXIF_NOTE_H__
+#define __EXIF_NOTE_H__
+
+typedef struct _ExifNote ExifNote;
+typedef struct _ExifNotePrivate ExifNotePrivate;
+
+typedef struct _ExifNoteMethods ExifNoteMethods;
+struct _ExifNoteMethods {
+ void (* free) (ExifNote *);
+ void (* load_data) (ExifNote *, unsigned char *, unsigned int);
+ void (* save_data) (ExifNote *, unsigned char **, unsigned int *);
+ char ** (*get_value) (ExifNote *);
+};
+
+struct _ExifNote {
+ ExifNoteMethods methods;
+ ExifNotePrivate *priv;
+};
+
+void exif_note_construct (ExifNote *note);
+
+void exif_note_ref (ExifNote *note);
+void exif_note_unref (ExifNote *note);
+void exif_note_free (ExifNote *note);
+
+#endif /* __EXIF_NOTE_H__ */