1 /* jpeg-data.h 2 * 3 * Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301 USA. 19 */ 20 21 #ifndef __JPEG_DATA_H__ 22 #define __JPEG_DATA_H__ 23 24 #include "libjpeg/jpeg-marker.h" 25 26 #include <libexif/exif-data.h> 27 #include <libexif/exif-log.h> 28 29 typedef ExifData * JPEGContentAPP1; 30 31 typedef struct _JPEGContentGeneric JPEGContentGeneric; 32 struct _JPEGContentGeneric 33 { 34 unsigned char *data; 35 unsigned int size; 36 }; 37 38 typedef union _JPEGContent JPEGContent; 39 union _JPEGContent 40 { 41 JPEGContentGeneric generic; 42 JPEGContentAPP1 app1; 43 }; 44 45 typedef struct _JPEGSection JPEGSection; 46 struct _JPEGSection 47 { 48 JPEGMarker marker; 49 JPEGContent content; 50 }; 51 52 typedef struct _JPEGData JPEGData; 53 typedef struct _JPEGDataPrivate JPEGDataPrivate; 54 55 struct _JPEGData 56 { 57 JPEGSection *sections; 58 unsigned int count; 59 60 unsigned char *data; 61 unsigned int size; 62 63 JPEGDataPrivate *priv; 64 }; 65 66 JPEGData *jpeg_data_new (void); 67 JPEGData *jpeg_data_new_from_file (const char *path); 68 JPEGData *jpeg_data_new_from_data (const unsigned char *data, 69 unsigned int size); 70 71 void jpeg_data_ref (JPEGData *data); 72 void jpeg_data_unref (JPEGData *data); 73 void jpeg_data_free (JPEGData *data); 74 75 void jpeg_data_load_data (JPEGData *data, const unsigned char *d, 76 unsigned int size); 77 void jpeg_data_save_data (JPEGData *data, unsigned char **d, 78 unsigned int *size); 79 80 void jpeg_data_load_file (JPEGData *data, const char *path); 81 int jpeg_data_save_file (JPEGData *data, const char *path); 82 83 void jpeg_data_set_exif_data (JPEGData *data, ExifData *exif_data); 84 ExifData *jpeg_data_get_exif_data (JPEGData *data); 85 86 void jpeg_data_dump (JPEGData *data); 87 88 void jpeg_data_append_section (JPEGData *data); 89 90 void jpeg_data_log (JPEGData *data, ExifLog *log); 91 92 #endif /* __JPEG_DATA_H__ */ 93