7029
|
1 #ifndef NAV_TYPES_H_INCLUDED
|
|
2 #define NAV_TYPES_H_INCLUDED
|
|
3
|
|
4 /*
|
15874
|
5 * Copyright (C) 2000, 2001, 2002 Håkan Hjort <d95hjort@dtek.chalmers.se>
|
7029
|
6 *
|
|
7 * The data structures in this file should represent the layout of the
|
|
8 * pci and dsi packets as they are stored in the stream. Information
|
|
9 * found by reading the source to VOBDUMP is the base for the structure
|
|
10 * and names of these data types.
|
|
11 *
|
|
12 * VOBDUMP: a program for examining DVD .VOB files.
|
|
13 * Copyright 1998, 1999 Eric Smith <eric@brouhaha.com>
|
|
14 *
|
|
15 * VOBDUMP is free software; you can redistribute it and/or modify it
|
|
16 * under the terms of the GNU General Public License version 2 as
|
|
17 * published by the Free Software Foundation. Note that I am not
|
|
18 * granting permission to redistribute or modify VOBDUMP under the terms
|
|
19 * of any later version of the General Public License.
|
|
20 *
|
|
21 * This program is distributed in the hope that it will be useful (or at
|
|
22 * least amusing), but WITHOUT ANY WARRANTY; without even the implied
|
|
23 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
24 * the GNU General Public License for more details.
|
|
25 *
|
|
26 * You should have received a copy of the GNU General Public License
|
|
27 * along with this program; if not, write to the Free Software
|
|
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
29 * USA
|
|
30 */
|
|
31
|
|
32 #include <inttypes.h>
|
20983
|
33 #include <dvdread/ifo_types.h> /* only dvd_time_t, vm_cmd_t and user_ops_t */
|
7029
|
34
|
|
35
|
|
36 #undef ATTRIBUTE_PACKED
|
|
37 #undef PRAGMA_PACK_BEGIN
|
|
38 #undef PRAGMA_PACK_END
|
|
39
|
|
40 #if defined(__GNUC__)
|
|
41 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
|
42 #define ATTRIBUTE_PACKED __attribute__ ((packed))
|
|
43 #define PRAGMA_PACK 0
|
|
44 #endif
|
|
45 #endif
|
|
46
|
|
47 #if !defined(ATTRIBUTE_PACKED)
|
|
48 #define ATTRIBUTE_PACKED
|
|
49 #define PRAGMA_PACK 1
|
|
50 #endif
|
|
51
|
|
52
|
|
53 /* The length including the substream id byte. */
|
|
54 #define PCI_BYTES 0x3d4
|
|
55 #define DSI_BYTES 0x3fa
|
|
56
|
|
57 #define PS2_PCI_SUBSTREAM_ID 0x00
|
|
58 #define PS2_DSI_SUBSTREAM_ID 0x01
|
|
59
|
|
60 /* Remove this */
|
|
61 #define DSI_START_BYTE 1031
|
|
62
|
|
63
|
|
64 #if PRAGMA_PACK
|
|
65 #pragma pack(1)
|
|
66 #endif
|
|
67
|
|
68
|
|
69 /**
|
|
70 * PCI General Information
|
|
71 */
|
|
72 typedef struct {
|
15874
|
73 uint32_t nv_pck_lbn; /**< sector address of this nav pack */
|
|
74 uint16_t vobu_cat; /**< 'category' of vobu */
|
|
75 uint16_t zero1; /**< reserved */
|
|
76 user_ops_t vobu_uop_ctl; /**< UOP of vobu */
|
|
77 uint32_t vobu_s_ptm; /**< start presentation time of vobu */
|
|
78 uint32_t vobu_e_ptm; /**< end presentation time of vobu */
|
|
79 uint32_t vobu_se_e_ptm; /**< end ptm of sequence end in vobu */
|
|
80 dvd_time_t e_eltm; /**< Cell elapsed time */
|
7029
|
81 char vobu_isrc[32];
|
|
82 } ATTRIBUTE_PACKED pci_gi_t;
|
|
83
|
|
84 /**
|
|
85 * Non Seamless Angle Information
|
|
86 */
|
|
87 typedef struct {
|
15874
|
88 uint32_t nsml_agl_dsta[9]; /**< address of destination vobu in AGL_C#n */
|
7029
|
89 } ATTRIBUTE_PACKED nsml_agli_t;
|
|
90
|
|
91 /**
|
|
92 * Highlight General Information
|
15874
|
93 *
|
|
94 * For btngrX_dsp_ty the bits have the following meaning:
|
|
95 * 000b: normal 4/3 only buttons
|
|
96 * XX1b: wide (16/9) buttons
|
|
97 * X1Xb: letterbox buttons
|
|
98 * 1XXb: pan&scan buttons
|
7029
|
99 */
|
|
100 typedef struct {
|
15874
|
101 uint16_t hli_ss; /**< status, only low 2 bits 0: no buttons, 1: different 2: equal 3: eual except for button cmds */
|
|
102 uint32_t hli_s_ptm; /**< start ptm of hli */
|
|
103 uint32_t hli_e_ptm; /**< end ptm of hli */
|
|
104 uint32_t btn_se_e_ptm; /**< end ptm of button select */
|
7029
|
105 #ifdef WORDS_BIGENDIAN
|
15874
|
106 unsigned int zero1 : 2; /**< reserved */
|
|
107 unsigned int btngr_ns : 2; /**< number of button groups 1, 2 or 3 with 36/18/12 buttons */
|
|
108 unsigned int zero2 : 1; /**< reserved */
|
|
109 unsigned int btngr1_dsp_ty : 3; /**< display type of subpic stream for button group 1 */
|
|
110 unsigned int zero3 : 1; /**< reserved */
|
|
111 unsigned int btngr2_dsp_ty : 3; /**< display type of subpic stream for button group 2 */
|
|
112 unsigned int zero4 : 1; /**< reserved */
|
|
113 unsigned int btngr3_dsp_ty : 3; /**< display type of subpic stream for button group 3 */
|
7029
|
114 #else
|
|
115 unsigned int btngr1_dsp_ty : 3;
|
|
116 unsigned int zero2 : 1;
|
|
117 unsigned int btngr_ns : 2;
|
|
118 unsigned int zero1 : 2;
|
|
119 unsigned int btngr3_dsp_ty : 3;
|
|
120 unsigned int zero4 : 1;
|
|
121 unsigned int btngr2_dsp_ty : 3;
|
|
122 unsigned int zero3 : 1;
|
|
123 #endif
|
15874
|
124 uint8_t btn_ofn; /**< button offset number range 0-255 */
|
|
125 uint8_t btn_ns; /**< number of valid buttons <= 36/18/12 (low 6 bits) */
|
|
126 uint8_t nsl_btn_ns; /**< number of buttons selectable by U_BTNNi (low 6 bits) nsl_btn_ns <= btn_ns */
|
|
127 uint8_t zero5; /**< reserved */
|
|
128 uint8_t fosl_btnn; /**< forcedly selected button (low 6 bits) */
|
|
129 uint8_t foac_btnn; /**< forcedly activated button (low 6 bits) */
|
7029
|
130 } ATTRIBUTE_PACKED hl_gi_t;
|
|
131
|
|
132
|
|
133 /**
|
|
134 * Button Color Information Table
|
15874
|
135 * Each entry beeing a 32bit word that contains the color indexs and alpha
|
|
136 * values to use. They are all represented by 4 bit number and stored
|
|
137 * like this [Ci3, Ci2, Ci1, Ci0, A3, A2, A1, A0]. The actual palette
|
|
138 * that the indexes reference is in the PGC.
|
|
139 * @TODO split the uint32_t into a struct
|
7029
|
140 */
|
|
141 typedef struct {
|
15874
|
142 uint32_t btn_coli[3][2]; /**< [button color number-1][select:0/action:1] */
|
7029
|
143 } ATTRIBUTE_PACKED btn_colit_t;
|
|
144
|
|
145 /**
|
|
146 * Button Information
|
15874
|
147 *
|
|
148 * NOTE: I've had to change the structure from the disk layout to get
|
|
149 * the packing to work with Sun's Forte C compiler.
|
|
150 * The 4 and 7 bytes are 'rotated' was: ABC DEF GHIJ is: ABCG DEFH IJ
|
7029
|
151 */
|
|
152 typedef struct {
|
|
153 #ifdef WORDS_BIGENDIAN
|
15874
|
154 unsigned int btn_coln : 2; /**< button color number */
|
|
155 unsigned int x_start : 10; /**< x start offset within the overlay */
|
|
156 unsigned int zero1 : 2; /**< reserved */
|
|
157 unsigned int x_end : 10; /**< x end offset within the overlay */
|
|
158
|
|
159 unsigned int zero3 : 2; /**< reserved */
|
|
160 unsigned int up : 6; /**< button index when pressing up */
|
7029
|
161
|
15874
|
162 unsigned int auto_action_mode : 2; /**< 0: no, 1: activated if selected */
|
|
163 unsigned int y_start : 10; /**< y start offset within the overlay */
|
|
164 unsigned int zero2 : 2; /**< reserved */
|
|
165 unsigned int y_end : 10; /**< y end offset within the overlay */
|
|
166
|
|
167 unsigned int zero4 : 2; /**< reserved */
|
|
168 unsigned int down : 6; /**< button index when pressing down */
|
|
169 unsigned int zero5 : 2; /**< reserved */
|
|
170 unsigned int left : 6; /**< button index when pressing left */
|
|
171 unsigned int zero6 : 2; /**< reserved */
|
|
172 unsigned int right : 6; /**< button index when pressing right */
|
7029
|
173 #else
|
|
174 unsigned int x_end : 10;
|
|
175 unsigned int zero1 : 2;
|
|
176 unsigned int x_start : 10;
|
|
177 unsigned int btn_coln : 2;
|
15874
|
178
|
|
179 unsigned int up : 6;
|
|
180 unsigned int zero3 : 2;
|
|
181
|
7029
|
182 unsigned int y_end : 10;
|
|
183 unsigned int zero2 : 2;
|
|
184 unsigned int y_start : 10;
|
|
185 unsigned int auto_action_mode : 2;
|
|
186
|
|
187 unsigned int down : 6;
|
|
188 unsigned int zero4 : 2;
|
|
189 unsigned int left : 6;
|
|
190 unsigned int zero5 : 2;
|
|
191 unsigned int right : 6;
|
|
192 unsigned int zero6 : 2;
|
|
193 #endif
|
|
194 vm_cmd_t cmd;
|
|
195 } ATTRIBUTE_PACKED btni_t;
|
|
196
|
|
197 /**
|
|
198 * Highlight Information
|
|
199 */
|
|
200 typedef struct {
|
|
201 hl_gi_t hl_gi;
|
|
202 btn_colit_t btn_colit;
|
|
203 btni_t btnit[36];
|
|
204 } ATTRIBUTE_PACKED hli_t;
|
|
205
|
|
206 /**
|
|
207 * PCI packet
|
|
208 */
|
|
209 typedef struct {
|
|
210 pci_gi_t pci_gi;
|
|
211 nsml_agli_t nsml_agli;
|
|
212 hli_t hli;
|
|
213 uint8_t zero1[189];
|
|
214 } ATTRIBUTE_PACKED pci_t;
|
|
215
|
|
216
|
|
217
|
|
218
|
|
219 /**
|
|
220 * DSI General Information
|
|
221 */
|
|
222 typedef struct {
|
|
223 uint32_t nv_pck_scr;
|
15874
|
224 uint32_t nv_pck_lbn; /**< sector address of this nav pack */
|
|
225 uint32_t vobu_ea; /**< end address of this VOBU */
|
|
226 uint32_t vobu_1stref_ea; /**< end address of the 1st reference image */
|
|
227 uint32_t vobu_2ndref_ea; /**< end address of the 2nd reference image */
|
|
228 uint32_t vobu_3rdref_ea; /**< end address of the 3rd reference image */
|
|
229 uint16_t vobu_vob_idn; /**< VOB Id number that this VOBU is part of */
|
|
230 uint8_t zero1; /**< reserved */
|
|
231 uint8_t vobu_c_idn; /**< Cell Id number that this VOBU is part of */
|
|
232 dvd_time_t c_eltm; /**< Cell elapsed time */
|
7029
|
233 } ATTRIBUTE_PACKED dsi_gi_t;
|
|
234
|
|
235 /**
|
|
236 * Seamless Playback Information
|
|
237 */
|
|
238 typedef struct {
|
15874
|
239 uint16_t category; /**< 'category' of seamless VOBU */
|
|
240 uint32_t ilvu_ea; /**< end address of interleaved Unit */
|
|
241 uint32_t ilvu_sa; /**< start address of next interleaved unit */
|
|
242 uint16_t size; /**< size of next interleaved unit */
|
|
243 uint32_t vob_v_s_s_ptm; /**< video start ptm in vob */
|
|
244 uint32_t vob_v_e_e_ptm; /**< video end ptm in vob */
|
7029
|
245 struct {
|
|
246 uint32_t stp_ptm1;
|
|
247 uint32_t stp_ptm2;
|
|
248 uint32_t gap_len1;
|
|
249 uint32_t gap_len2;
|
|
250 } vob_a[8];
|
|
251 } ATTRIBUTE_PACKED sml_pbi_t;
|
|
252
|
|
253 /**
|
|
254 * Seamless Angle Infromation for one angle
|
|
255 */
|
|
256 typedef struct {
|
15874
|
257 uint32_t address; /**< offset to next ILVU, high bit is before/after */
|
|
258 uint16_t size; /**< byte size of the ILVU pointed to by address */
|
7029
|
259 } ATTRIBUTE_PACKED sml_agl_data_t;
|
|
260
|
|
261 /**
|
|
262 * Seamless Angle Infromation
|
|
263 */
|
|
264 typedef struct {
|
|
265 sml_agl_data_t data[9];
|
|
266 } ATTRIBUTE_PACKED sml_agli_t;
|
|
267
|
|
268 /**
|
|
269 * VOBU Search Information
|
|
270 */
|
|
271 typedef struct {
|
15874
|
272 uint32_t next_video; /**< Next vobu that contains video */
|
|
273 uint32_t fwda[19]; /**< Forwards, time */
|
7029
|
274 uint32_t next_vobu;
|
|
275 uint32_t prev_vobu;
|
15874
|
276 uint32_t bwda[19]; /**< Backwards, time */
|
7029
|
277 uint32_t prev_video;
|
|
278 } ATTRIBUTE_PACKED vobu_sri_t;
|
|
279
|
|
280 #define SRI_END_OF_CELL 0x3fffffff
|
|
281
|
|
282 /**
|
|
283 * Synchronous Information
|
|
284 */
|
|
285 typedef struct {
|
15874
|
286 uint16_t a_synca[8]; /**< offset to first audio packet for this VOBU */
|
|
287 uint32_t sp_synca[32]; /**< offset to first subpicture packet */
|
7029
|
288 } ATTRIBUTE_PACKED synci_t;
|
|
289
|
|
290 /**
|
|
291 * DSI packet
|
|
292 */
|
|
293 typedef struct {
|
|
294 dsi_gi_t dsi_gi;
|
|
295 sml_pbi_t sml_pbi;
|
|
296 sml_agli_t sml_agli;
|
|
297 vobu_sri_t vobu_sri;
|
|
298 synci_t synci;
|
|
299 uint8_t zero1[471];
|
|
300 } ATTRIBUTE_PACKED dsi_t;
|
|
301
|
|
302
|
|
303 #if PRAGMA_PACK
|
|
304 #pragma pack()
|
|
305 #endif
|
|
306
|
|
307 #endif /* NAV_TYPES_H_INCLUDED */
|