1 /*
2  * Copyright (c) 2001, 2002, Eric M. Johnston <emj@postal.net>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by Eric M. Johnston.
16  * 4. Neither the name of the author nor the names of any co-contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  * $Id: jpeg.h,v 1.4 2002/10/15 02:57:09 ejohnst Exp $
33  */
34 
35 /*
36  * Functions for parsing a JPEG file, specific to EXIF use.
37  *
38  * Portions of this code were developed while referencing the public domain
39  * 'Jhead' program (version 1.2) by Matthias Wandel <mwandel@rim.net>.
40  *
41  */
42 
43 #ifndef _JPEG_H
44 #define _JPEG_H
45 
46 /* The JPEG marker codes we're interested in. */
47 
48 #define JPEG_M_BEG	0xff	/* Start of marker. */
49 #define JPEG_M_SOF0	0xc0	/* Start of frame n... */
50 #define JPEG_M_SOF1	0xc1
51 #define JPEG_M_SOF2	0xc2
52 #define JPEG_M_SOF3	0xc3
53 #define JPEG_M_SOF5	0xc5
54 #define JPEG_M_SOF6	0xc6
55 #define JPEG_M_SOF7	0xc7
56 #define JPEG_M_SOF9	0xc9
57 #define JPEG_M_SOF10	0xca
58 #define JPEG_M_SOF11	0xcb
59 #define JPEG_M_SOF13	0xcd
60 #define JPEG_M_SOF14	0xce
61 #define JPEG_M_SOF15	0xcf
62 #define JPEG_M_SOI	0xd8	/* Start of image. */
63 #define JPEG_M_EOI	0xd9	/* End of image. */
64 #define JPEG_M_SOS	0xda	/* Start of scan. */
65 #define JPEG_M_APP1	0xe1	/* APP1 marker. */
66 #define JPEG_M_APP2	0xe2	/* APP2 marker. */
67 #define JPEG_M_ERR	0x100
68 
69 
70 /* Our JPEG utility functions. */
71 
72 extern int jpegscan(FILE *fp, int *mark, unsigned int *len, int first);
73 extern int jpeginfo(int *prcsn, int *cmpnts, unsigned int *height,
74     unsigned int *width, const char *prcss);
75 
76 #endif
77