3 * \author This code was written by Nathan Stenzel for gphoto
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #ifndef __GPHOTO2_JPEG_H__
25 #define __GPHOTO2_JPEG_H__
27 #include <gphoto2/gphoto2-file.h>
30 JPEG_START=0xD8, JPEG_COMMENT=0xFE, JPEG_APPO=0xE0,
31 JPEG_QUANTIZATION=0xDB, JPEG_HUFFMAN=0xC4, JPEG_SOFC0=0xC0,
32 JPEG_SSSEAHAL=0xDA, JPEG_EOI=0xD9
40 typedef char jpeg_quantization_table[64];
44 struct chunk *marker[20]; /* I think this should be big enough */
47 chunk *gpi_jpeg_chunk_new(int length);
48 chunk *gpi_jpeg_chunk_new_filled(int length, char *data);
49 void gpi_jpeg_chunk_destroy(chunk *mychunk);
50 void gpi_jpeg_chunk_print(chunk *mychunk);
52 char gpi_jpeg_findff(int *location, chunk *picture);
53 char gpi_jpeg_findactivemarker(char *id, int *location, chunk *picture);
54 char *gpi_jpeg_markername(int c);
56 jpeg *gpi_jpeg_new (void);
57 void gpi_jpeg_destroy (jpeg *myjpeg);
58 void gpi_jpeg_add_marker (jpeg *myjpeg, chunk *picture, int start, int end);
59 void gpi_jpeg_add_chunk (jpeg *myjpeg, chunk *source);
60 void gpi_jpeg_parse (jpeg *myjpeg, chunk *picture);
61 void gpi_jpeg_print (jpeg *myjpeg);
63 chunk *gpi_jpeg_make_start (void);
64 chunk *gpi_jpeg_make_SOFC (int width, int height,
65 char vh1, char vh2, char vh3,
66 char q1, char q2, char q3);
67 chunk *gpi_jpeg_makeSsSeAhAl (int huffset1, int huffset2, int huffset3);
69 void gpi_jpeg_print_quantization_table(jpeg_quantization_table *table);
70 chunk *gpi_jpeg_make_quantization(jpeg_quantization_table *table, char number);
71 jpeg_quantization_table *gpi_jpeg_quantization2table(chunk *qmarker);
73 jpeg *gpi_jpeg_header(int width, int height,
74 char vh1, char vh2, char vh3,
75 char q1, char q2, char q3,
76 jpeg_quantization_table *quant1, jpeg_quantization_table *quant2,
77 char huffset1, char huffset2, char huffset3,
78 chunk *huff1, chunk *huff2, chunk *huff3, chunk *huff4);
80 char gpi_jpeg_write(CameraFile *file, const char *name, jpeg *myjpeg);