comparison src/format_fuji.c @ 45:7cfa60beda76

Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net> * format_raw.[ch]: Move camera specific code to manufacturer specific format_*.c files. Change code so that file descripter version is now a separate functions that wraps the standard parser by using mmap. * format_canon.[ch]: Moved Canon specific raw support here, removed file descriptor versions of parser. This Canon raw file parser written by Daniel M. German. * format_fuji.[ch]: Move Fuji specific raw support here, parser written by Lars Ellenberg. * exif.c: Update for change to format_raw_img_exif_offsets. * filelist.c: Add cr2 extension to Canon raw format list. * image-load.c: Fixes for changes to format_raw_img_exif_offset_fd so that buffer is refilled using new offset of file descriptor. * src/Makefile.am: Add format_canon.[ch], format_fuji.[ch] to build. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Thu, 26 May 2005 18:10:52 +0000
parents
children 276ea4c98d33
comparison
equal deleted inserted replaced
44:458e396d3f35 45:7cfa60beda76
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 #ifdef HAVE_CONFIG_H
14 # include "config.h"
15 #endif
16
17
18 #include <stdio.h>
19 #include <string.h>
20 #include <unistd.h>
21
22 #include <glib.h>
23
24 #include "intl.h"
25
26 #include "format_fuji.h"
27 #include "format_raw.h"
28
29
30 gint format_raw_test_fuji(const void *data, const guint len,
31 guint *image_offset, guint *exif_offset)
32 {
33 guint io;
34 guint eo;
35
36 if (len < 128 ||
37 memcmp(data, "FUJIFILM", 8) != 0)
38 {
39 return FALSE;
40 }
41
42 io = GUINT32_FROM_BE(*(guint32*)(data + 84));
43 eo = *image_offset + 12;
44
45 /* verify jpeg marker */
46 if (memcmp(data + io, "\xff\xd8\xff\xe1", 4) != 0)
47 {
48 return FALSE;
49 }
50
51 if (image_offset) *image_offset = io;
52 if (exif_offset) *exif_offset = eo;
53
54 printf("raw Fuji format file\n");
55
56 return TRUE;
57 }
58
59