exif-data.h

Go to the documentation of this file.
00001 
00004 /*
00005  * \author Lutz Mueller <lutz@users.sourceforge.net>
00006  * \date 2001-2005
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, 
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details. 
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the
00020  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021  * Boston, MA  02110-1301  USA.
00022  */
00023 
00024 #ifndef __EXIF_DATA_H__
00025 #define __EXIF_DATA_H__
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif /* __cplusplus */
00030 
00031 #include <libexif/exif-byte-order.h>
00032 #include <libexif/exif-data-type.h>
00033 #include <libexif/exif-ifd.h>
00034 #include <libexif/exif-log.h>
00035 #include <libexif/exif-tag.h>
00036 
00038 typedef struct _ExifData        ExifData;
00039 typedef struct _ExifDataPrivate ExifDataPrivate;
00040 
00041 #include <libexif/exif-content.h>
00042 #include <libexif/exif-mnote-data.h>
00043 #include <libexif/exif-mem.h>
00044 
00045 typedef enum{
00046         MAKER_CANON             = 1,
00047         MAKER_OLYMPUS   = 2,
00048         MAKER_PENTAX            = 3,
00049         MAKER_NIKON             = 4,
00050         MAKER_CASIO             = 5,
00051         MAKER_FUJI              = 6,
00052         MAKER_SAMSUNG   = 7
00053 }Manufacturer;
00054 
00056 struct _ExifData
00057 {
00059         ExifContent *ifd[EXIF_IFD_COUNT];
00060 
00062         unsigned char *data;
00063 
00065         unsigned int size;
00066 
00067         ExifDataPrivate *priv;
00068 };
00069 
00077 ExifData *exif_data_new           (void);
00078 
00086 ExifData *exif_data_new_mem       (ExifMem *);
00087 
00094 ExifData *exif_data_new_from_file (const char *path);
00095 
00102 ExifData *exif_data_new_from_data (const unsigned char *data,
00103                                    unsigned int size);
00104 
00115 void      exif_data_load_data (ExifData *data, const unsigned char *d, 
00116                                unsigned int size);
00117 
00127 void      exif_data_save_data (ExifData *data, unsigned char **d,
00128                                unsigned int *ds);
00129 
00130 void      exif_data_ref   (ExifData *data);
00131 void      exif_data_unref (ExifData *data);
00132 void      exif_data_free  (ExifData *data);
00133 
00139 ExifByteOrder exif_data_get_byte_order  (ExifData *data);
00140 
00148 void          exif_data_set_byte_order  (ExifData *data, ExifByteOrder order);
00149 
00158 ExifMnoteData *exif_data_get_mnote_data (ExifData *d);
00159 
00160 ExifByteOrder exif_data_get_data_order (ExifData *d);
00161 
00169 void           exif_data_fix (ExifData *d);
00170 
00171 typedef void (* ExifDataForeachContentFunc) (ExifContent *, void *user_data);
00172 
00179 void          exif_data_foreach_content (ExifData *data,
00180                                          ExifDataForeachContentFunc func,
00181                                          void *user_data);
00182 
00184 typedef enum {
00186         EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS = 1 << 0,
00187 
00189         EXIF_DATA_OPTION_FOLLOW_SPECIFICATION = 1 << 1,
00190 
00192         EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE = 1 << 2
00193 } ExifDataOption;
00194 
00200 const char *exif_data_option_get_name        (ExifDataOption o);
00201 
00207 const char *exif_data_option_get_description (ExifDataOption o);
00208 
00214 void        exif_data_set_option             (ExifData *d, ExifDataOption o);
00215 
00221 void        exif_data_unset_option           (ExifData *d, ExifDataOption o);
00222 
00228 void         exif_data_set_data_type (ExifData *d, ExifDataType dt);
00229 
00235 ExifDataType exif_data_get_data_type (ExifData *d);
00236 
00242 void exif_data_dump (ExifData *data);
00243 
00249 void exif_data_log  (ExifData *data, ExifLog *log);
00250 
00258 int exif_data_mnote_data_new(ExifData *d,  Manufacturer maker, ExifDataOption o);
00259 
00266 int exif_data_mnote_set_mem_for_adding_entry(ExifMnoteData *md, Manufacturer maker);
00267 
00278 int exif_data_mnote_set_add_entry(ExifMnoteData *md, Manufacturer maker, int tag, ExifFormat fmt, int components, int id);
00279 
00294 int exif_data_mnote_set_add_entry_subtag(ExifMnoteData* md, Manufacturer maker, int tag, ExifFormat fmt, int components, int subtag1, int id1, int subtag2, int id2, int val);
00295 
00306 int exif_data_mnote_set_add_entry_string(ExifMnoteData* md, Manufacturer maker, int tag, ExifFormat fmt, int components, const char* string);
00307 
00316 #define exif_data_get_entry(d,t)                                        \
00317         (exif_content_get_entry(d->ifd[EXIF_IFD_0],t) ?                 \
00318          exif_content_get_entry(d->ifd[EXIF_IFD_0],t) :                 \
00319          exif_content_get_entry(d->ifd[EXIF_IFD_1],t) ?                 \
00320          exif_content_get_entry(d->ifd[EXIF_IFD_1],t) :                 \
00321          exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) ?              \
00322          exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) :              \
00323          exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) ?               \
00324          exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) :               \
00325          exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) ?  \
00326          exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) : NULL)
00327 
00328 #ifdef __cplusplus
00329 }
00330 #endif /* __cplusplus */
00331 
00332 #endif /* __EXIF_DATA_H__ */