38a5b6deb9e19ccc4b053a12abbae22d9f19f16c
[geeqie.git] / src / format_raw.h
1 /*
2  *  GQView
3  *  (C) 2005 John Ellis
4  *
5  *  Authors:
6  *    Original version 2005 Lars Ellenberg, base on dcraw by David coffin.
7  *
8  * This software is released under the GNU General Public License (GNU GPL).
9  * Please read the included file COPYING for more information.
10  * This software comes with no warranty of any kind, use at your own risk!
11  */
12
13 #ifndef __FORMAT_RAW_H
14 #define __FORMAT_RAW_H
15
16 #include "exif-int.h"
17
18
19 typedef enum {
20         FORMAT_RAW_MATCH_MAGIC,
21         FORMAT_RAW_MATCH_TIFF_MAKE
22 } FormatRawMatchType;
23
24 typedef enum {
25         FORMAT_RAW_EXIF_NONE,
26         FORMAT_RAW_EXIF_TIFF,
27         FORMAT_RAW_EXIF_JPEG,
28         FORMAT_RAW_EXIF_IFD_II,
29         FORMAT_RAW_EXIF_IFD_MM,
30         FORMAT_RAW_EXIF_PROPRIETARY
31 } FormatRawExifType;
32
33 typedef gint (* FormatRawParseFunc)(unsigned char *data, const guint len,
34                                     guint *image_offset, guint *exif_offset);
35
36 typedef gint (* FormatRawExifParseFunc)(unsigned char *data, const guint len,
37                                         ExifData *exif);
38
39 gint format_raw_img_exif_offsets(unsigned char *data, const guint len,
40                                  guint *image_offset, guint *exif_offset);
41 gint format_raw_img_exif_offsets_fd(int fd, const gchar *path,
42                                     unsigned char *header_data, const guint header_len,
43                                     guint *image_offset, guint *exif_offset);
44
45 FormatRawExifType format_raw_exif_offset(unsigned char *data, const guint len, guint *exif_offset,
46                                          FormatRawExifParseFunc *exif_parse_func);
47
48
49 typedef enum {
50         FORMAT_EXIF_MATCH_MAKE,
51         FORMAT_EXIF_MATCH_MAKERNOTE
52 } FormatExifMatchType;
53
54 typedef gint (* FormatExifParseFunc)(ExifData *exif, unsigned char *tiff, guint offset,
55                                     guint size, ExifByteOrder bo);
56
57 gint format_exif_makernote_parse(ExifData *exif, unsigned char *tiff, guint offset,
58                                  guint size, ExifByteOrder bo);
59
60
61 #define DEBUG_RAW_TIFF 0
62
63 #if DEBUG_RAW_TIFF
64
65 #define FORMAT_RAW_DEBUG_TIFF { "", \
66                                 FORMAT_RAW_MATCH_MAGIC,     0, "II", 2, \
67                                 FORMAT_RAW_EXIF_NONE, NULL, \
68                                 "Tiff debugger II", format_debug_tiff_raw }, \
69                               { "", \
70                                 FORMAT_RAW_MATCH_MAGIC,     0, "MM", 2, \
71                                 FORMAT_RAW_EXIF_NONE, NULL, \
72                                 "Tiff debugger MM", format_debug_tiff_raw }
73
74 /* used for debugging only */
75 gint format_debug_tiff_raw(unsigned char *data, const guint len,
76                            guint *image_offset, guint *exif_offset);
77 #endif
78
79 #endif