Simplify vflist_get_formatted()
[geeqie.git] / src / jpeg_parser.h
1 /*
2  * Copyright (C) 2004 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: Vladimir Nadvornik
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program 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
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef JPEG_PARSER_H
23 #define JPEG_PARSER_H
24
25 #define JPEG_MARKER             0xFF
26 #define JPEG_MARKER_SOI         0xD8
27 #define JPEG_MARKER_EOI         0xD9
28 #define JPEG_MARKER_APP1        0xE1
29 #define JPEG_MARKER_APP2        0xE2
30
31 /* jpeg container format:
32      all data markers start with 0XFF
33      2 byte long file start and end markers: 0xFFD8(SOI) and 0XFFD9(EOI)
34      4 byte long data segment markers in format: 0xFFTTSSSSNNN...
35        FF:   1 byte standard marker identifier
36        TT:   1 byte data type
37        SSSS: 2 bytes in Motorola byte alignment for length of the data.
38              This value includes these 2 bytes in the count, making actual
39              length of NN... == SSSS - 2.
40        NNN.: the data in this segment
41  */
42
43 gboolean jpeg_segment_find(const guchar *data, guint size,
44                             guchar app_marker, const gchar *magic, guint magic_len,
45                             guint *seg_offset, guint *seg_length);
46
47
48 typedef struct _MPOData MPOData;
49 typedef struct _MPOEntry MPOEntry;
50
51 struct _MPOEntry {
52         guint type_code;
53         gboolean representative;
54         gboolean dependent_child;
55         gboolean dependent_parent;
56         guint offset;
57         guint length;
58         guint dep1;
59         guint dep2;
60
61         guint MPFVersion;
62         guint MPIndividualNum;
63         guint PanOrientation;
64         double PanOverlap_H;
65         double PanOverlap_V;
66         guint BaseViewpointNum;
67         double ConvergenceAngle;
68         double BaselineLength;
69         double VerticalDivergence;
70         double AxisDistance_X;
71         double AxisDistance_Y;
72         double AxisDistance_Z;
73         double YawAngle;
74         double PitchAngle;
75         double RollAngle;
76
77 };
78
79
80 struct _MPOData {
81         guint mpo_offset;
82
83         guint version;
84         guint num_images;
85         MPOEntry *images;
86 };
87
88 MPOData* jpeg_get_mpo_data(const guchar *data, guint size);
89 void jpeg_mpo_data_free(MPOData *mpo);
90
91 #endif
92
93 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */