225
|
1 #ifndef IFO_TYPES_H_INCLUDED
|
|
2 #define IFO_TYPES_H_INCLUDED
|
|
3
|
|
4 /*
|
|
5 * Copyright (C) 2000, 2001 Björn Englund <d4bjorn@dtek.chalmers.se>,
|
|
6 * Håkan Hjort <d95hjort@dtek.chalmers.se>
|
|
7 *
|
|
8 * This program is free software; you can redistribute it and/or modify
|
|
9 * it under the terms of the GNU General Public License as published by
|
|
10 * the Free Software Foundation; either version 2 of the License, or
|
|
11 * (at your option) any later version.
|
|
12 *
|
|
13 * This program is distributed in the hope that it will be useful,
|
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 * GNU General Public License for more details.
|
|
17 *
|
|
18 * You should have received a copy of the GNU General Public License
|
|
19 * along with this program; if not, write to the Free Software
|
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21 */
|
|
22
|
|
23 #include <inttypes.h>
|
|
24 #include "dvd_reader.h"
|
|
25
|
|
26
|
|
27 #undef ATTRIBUTE_PACKED
|
|
28 #undef PRAGMA_PACK_BEGIN
|
|
29 #undef PRAGMA_PACK_END
|
|
30
|
|
31 #if defined(__GNUC__)
|
|
32 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
|
33 #define ATTRIBUTE_PACKED __attribute__ ((packed))
|
|
34 #define PRAGMA_PACK 0
|
|
35 #endif
|
|
36 #endif
|
|
37
|
|
38 #if !defined(ATTRIBUTE_PACKED)
|
|
39 #define ATTRIBUTE_PACKED
|
|
40 #define PRAGMA_PACK 1
|
|
41 #endif
|
|
42
|
|
43 #if PRAGMA_PACK
|
|
44 #pragma pack(1)
|
|
45 #endif
|
|
46
|
|
47
|
|
48 /**
|
|
49 * Common
|
|
50 *
|
|
51 * The following structures are used in both the VMGI and VTSI.
|
|
52 */
|
|
53
|
|
54
|
|
55 /**
|
|
56 * DVD Time Information.
|
|
57 */
|
|
58 typedef struct {
|
|
59 uint8_t hour;
|
|
60 uint8_t minute;
|
|
61 uint8_t second;
|
|
62 uint8_t frame_u; /* The two high bits are the frame rate. */
|
|
63 } ATTRIBUTE_PACKED dvd_time_t;
|
|
64
|
|
65 /**
|
|
66 * Type to store per-command data.
|
|
67 */
|
|
68 typedef struct {
|
|
69 uint8_t bytes[8];
|
|
70 } ATTRIBUTE_PACKED vm_cmd_t;
|
317
|
71 #define COMMAND_DATA_SIZE 8U
|
225
|
72
|
|
73
|
|
74 /**
|
|
75 * Video Attributes.
|
|
76 */
|
|
77 typedef struct {
|
|
78 unsigned char mpeg_version : 2;
|
|
79 unsigned char video_format : 2;
|
|
80 unsigned char display_aspect_ratio : 2;
|
|
81 unsigned char permitted_df : 2;
|
|
82
|
|
83 unsigned char line21_cc_1 : 1;
|
|
84 unsigned char line21_cc_2 : 1;
|
|
85 unsigned char unknown1 : 1;
|
|
86 unsigned char bit_rate : 1;
|
|
87
|
|
88 unsigned char picture_size : 2;
|
|
89 unsigned char letterboxed : 1;
|
|
90 unsigned char film_mode : 1;
|
|
91 } ATTRIBUTE_PACKED video_attr_t;
|
|
92
|
|
93 /**
|
|
94 * Audio Attributes.
|
|
95 */
|
|
96 typedef struct {
|
|
97 #ifdef WORDS_BIGENDIAN
|
|
98 unsigned char audio_format : 3;
|
|
99 unsigned char multichannel_extension : 1;
|
|
100 unsigned char lang_type : 2;
|
|
101 unsigned char application_mode : 2;
|
|
102
|
|
103 unsigned char quantization : 2;
|
|
104 unsigned char sample_frequency : 2;
|
|
105 unsigned char unknown1 : 1;
|
|
106 unsigned char channels : 3;
|
|
107 #else
|
|
108 unsigned char application_mode : 2;
|
|
109 unsigned char lang_type : 2;
|
|
110 unsigned char multichannel_extension : 1;
|
|
111 unsigned char audio_format : 3;
|
|
112
|
|
113 unsigned char channels : 3;
|
|
114 unsigned char unknown1 : 1;
|
|
115 unsigned char sample_frequency : 2;
|
|
116 unsigned char quantization : 2;
|
|
117 #endif
|
|
118 uint16_t lang_code;
|
|
119 uint8_t lang_extension;
|
|
120 uint8_t code_extension;
|
|
121 uint8_t unknown3;
|
|
122 union {
|
|
123 struct ATTRIBUTE_PACKED {
|
|
124 #ifdef WORDS_BIGENDIAN
|
|
125 unsigned char unknown4 : 1;
|
|
126 unsigned char channel_assignment : 3;
|
|
127 unsigned char version : 2;
|
|
128 unsigned char mc_intro : 1; /* probably 0: true, 1:false */
|
|
129 unsigned char mode : 1; /* Karaoke mode 0: solo 1: duet */
|
|
130 #else
|
|
131 unsigned char mode : 1;
|
|
132 unsigned char mc_intro : 1;
|
|
133 unsigned char version : 2;
|
|
134 unsigned char channel_assignment : 3;
|
|
135 unsigned char unknown4 : 1;
|
|
136 #endif
|
|
137 } karaoke;
|
|
138 struct ATTRIBUTE_PACKED {
|
|
139 #ifdef WORDS_BIGENDIAN
|
|
140 unsigned char unknown5 : 4;
|
|
141 unsigned char dolby_encoded : 1; /* suitable for surround decoding */
|
|
142 unsigned char unknown6 : 3;
|
|
143 #else
|
|
144 unsigned char unknown6 : 3;
|
|
145 unsigned char dolby_encoded : 1;
|
|
146 unsigned char unknown5 : 4;
|
|
147 #endif
|
|
148 } surround;
|
|
149 } app_info;
|
|
150 } ATTRIBUTE_PACKED audio_attr_t;
|
|
151
|
|
152
|
|
153 /**
|
|
154 * MultiChannel Extension
|
|
155 */
|
|
156 typedef struct {
|
|
157 #ifdef WORDS_BIGENDIAN
|
|
158 unsigned int zero1 : 7;
|
|
159 unsigned int ach0_gme : 1;
|
|
160
|
|
161 unsigned int zero2 : 7;
|
|
162 unsigned int ach1_gme : 1;
|
|
163
|
|
164 unsigned int zero3 : 4;
|
|
165 unsigned int ach2_gv1e : 1;
|
|
166 unsigned int ach2_gv2e : 1;
|
|
167 unsigned int ach2_gm1e : 1;
|
|
168 unsigned int ach2_gm2e : 1;
|
|
169
|
|
170 unsigned int zero4 : 4;
|
|
171 unsigned int ach3_gv1e : 1;
|
|
172 unsigned int ach3_gv2e : 1;
|
|
173 unsigned int ach3_gmAe : 1;
|
|
174 unsigned int ach3_se2e : 1;
|
|
175
|
|
176 unsigned int zero5 : 4;
|
|
177 unsigned int ach4_gv1e : 1;
|
|
178 unsigned int ach4_gv2e : 1;
|
|
179 unsigned int ach4_gmBe : 1;
|
|
180 unsigned int ach4_seBe : 1;
|
|
181 #else
|
|
182 unsigned char ach0_gme : 1;
|
|
183 unsigned char zero1 : 7;
|
|
184
|
|
185 unsigned char ach1_gme : 1;
|
|
186 unsigned char zero2 : 7;
|
|
187
|
|
188 unsigned char ach2_gm2e : 1;
|
|
189 unsigned char ach2_gm1e : 1;
|
|
190 unsigned char ach2_gv2e : 1;
|
|
191 unsigned char ach2_gv1e : 1;
|
|
192 unsigned char zero3 : 4;
|
|
193
|
|
194 unsigned char ach3_se2e : 1;
|
|
195 unsigned char ach3_gmAe : 1;
|
|
196 unsigned char ach3_gv2e : 1;
|
|
197 unsigned char ach3_gv1e : 1;
|
|
198 unsigned char zero4 : 4;
|
|
199
|
|
200 unsigned char ach4_seBe : 1;
|
|
201 unsigned char ach4_gmBe : 1;
|
|
202 unsigned char ach4_gv2e : 1;
|
|
203 unsigned char ach4_gv1e : 1;
|
|
204 unsigned char zero5 : 4;
|
|
205 #endif
|
|
206 uint8_t zero6[19];
|
|
207 } ATTRIBUTE_PACKED multichannel_ext_t;
|
|
208
|
|
209
|
|
210 /**
|
|
211 * Subpicture Attributes.
|
|
212 */
|
|
213 typedef struct {
|
|
214 /*
|
|
215 * type: 0 not specified
|
|
216 * 1 language
|
|
217 * 2 other
|
|
218 * coding mode: 0 run length
|
|
219 * 1 extended
|
|
220 * 2 other
|
|
221 * language: indicates language if type == 1
|
|
222 * lang extension: if type == 1 contains the lang extension
|
|
223 */
|
|
224 #ifdef WORDS_BIGENDIAN
|
|
225 unsigned char code_mode : 3;
|
|
226 unsigned char zero1 : 3;
|
|
227 unsigned char type : 2;
|
|
228 #else
|
|
229 unsigned char type : 2;
|
|
230 unsigned char zero1 : 3;
|
|
231 unsigned char code_mode : 3;
|
|
232 #endif
|
|
233 uint8_t zero2;
|
|
234 uint16_t lang_code;
|
|
235 uint8_t lang_extension;
|
|
236 uint8_t code_extension;
|
|
237 } ATTRIBUTE_PACKED subp_attr_t;
|
|
238
|
|
239
|
|
240
|
|
241 /**
|
|
242 * PGC Command Table.
|
|
243 */
|
|
244 typedef struct {
|
|
245 uint16_t nr_of_pre;
|
|
246 uint16_t nr_of_post;
|
|
247 uint16_t nr_of_cell;
|
|
248 uint16_t zero_1;
|
|
249 vm_cmd_t *pre_cmds;
|
|
250 vm_cmd_t *post_cmds;
|
|
251 vm_cmd_t *cell_cmds;
|
|
252 } ATTRIBUTE_PACKED pgc_command_tbl_t;
|
317
|
253 #define PGC_COMMAND_TBL_SIZE 8U
|
225
|
254
|
|
255 /**
|
|
256 * PGC Program Map
|
|
257 */
|
|
258 typedef uint8_t pgc_program_map_t;
|
|
259
|
|
260 /**
|
|
261 * Cell Playback Information.
|
|
262 */
|
|
263 typedef struct {
|
|
264 #ifdef WORDS_BIGENDIAN
|
|
265 unsigned int block_mode : 2;
|
|
266 unsigned int block_type : 2;
|
|
267 unsigned int seamless_play : 1;
|
|
268 unsigned int interleaved : 1;
|
|
269 unsigned int stc_discontinuity: 1;
|
|
270 unsigned int seamless_angle : 1;
|
|
271
|
|
272 unsigned int playback_mode : 1; /**< When set, enter StillMode after each VOBU */
|
|
273 unsigned int restricted : 1; /**< ?? drop out of fastforward? */
|
|
274 unsigned int unknown2 : 6;
|
|
275 #else
|
|
276 unsigned char seamless_angle : 1;
|
|
277 unsigned char stc_discontinuity: 1;
|
|
278 unsigned char interleaved : 1;
|
|
279 unsigned char seamless_play : 1;
|
|
280 unsigned char block_type : 2;
|
|
281 unsigned char block_mode : 2;
|
|
282
|
|
283 unsigned char unknown2 : 6;
|
|
284 unsigned char restricted : 1;
|
|
285 unsigned char playback_mode : 1;
|
|
286 #endif
|
|
287 uint8_t still_time;
|
|
288 uint8_t cell_cmd_nr;
|
|
289 dvd_time_t playback_time;
|
|
290 uint32_t first_sector;
|
|
291 uint32_t first_ilvu_end_sector;
|
|
292 uint32_t last_vobu_start_sector;
|
|
293 uint32_t last_sector;
|
|
294 } ATTRIBUTE_PACKED cell_playback_t;
|
|
295
|
|
296 #define BLOCK_TYPE_NONE 0x0
|
|
297 #define BLOCK_TYPE_ANGLE_BLOCK 0x1
|
|
298
|
|
299 #define BLOCK_MODE_NOT_IN_BLOCK 0x0
|
|
300 #define BLOCK_MODE_FIRST_CELL 0x1
|
|
301 #define BLOCK_MODE_IN_BLOCK 0x2
|
|
302 #define BLOCK_MODE_LAST_CELL 0x3
|
|
303
|
|
304 /**
|
|
305 * Cell Position Information.
|
|
306 */
|
|
307 typedef struct {
|
|
308 uint16_t vob_id_nr;
|
|
309 uint8_t zero_1;
|
|
310 uint8_t cell_nr;
|
|
311 } ATTRIBUTE_PACKED cell_position_t;
|
|
312
|
|
313 /**
|
|
314 * User Operations.
|
|
315 */
|
|
316 typedef struct {
|
|
317 #ifdef WORDS_BIGENDIAN
|
|
318 unsigned int zero : 7; /* 25-31 */
|
|
319 unsigned int video_pres_mode_change : 1; /* 24 */
|
|
320
|
|
321 unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */
|
|
322 unsigned int angle_change : 1;
|
|
323 unsigned int subpic_stream_change : 1;
|
|
324 unsigned int audio_stream_change : 1;
|
|
325 unsigned int pause_on : 1;
|
|
326 unsigned int still_off : 1;
|
|
327 unsigned int button_select_or_activate : 1;
|
|
328 unsigned int resume : 1; /* 16 */
|
|
329
|
|
330 unsigned int chapter_menu_call : 1; /* 15 */
|
|
331 unsigned int angle_menu_call : 1;
|
|
332 unsigned int audio_menu_call : 1;
|
|
333 unsigned int subpic_menu_call : 1;
|
|
334 unsigned int root_menu_call : 1;
|
|
335 unsigned int title_menu_call : 1;
|
|
336 unsigned int backward_scan : 1;
|
|
337 unsigned int forward_scan : 1; /* 8 */
|
|
338
|
|
339 unsigned int next_pg_search : 1; /* 7 */
|
|
340 unsigned int prev_or_top_pg_search : 1;
|
|
341 unsigned int time_or_chapter_search : 1;
|
|
342 unsigned int go_up : 1;
|
|
343 unsigned int stop : 1;
|
|
344 unsigned int title_play : 1;
|
|
345 unsigned int chapter_search_or_play : 1;
|
|
346 unsigned int title_or_time_play : 1; /* 0 */
|
|
347 #else
|
|
348 unsigned int video_pres_mode_change : 1; /* 24 */
|
|
349 unsigned int zero : 7; /* 25-31 */
|
|
350
|
|
351 unsigned int resume : 1; /* 16 */
|
|
352 unsigned int button_select_or_activate : 1;
|
|
353 unsigned int still_off : 1;
|
|
354 unsigned int pause_on : 1;
|
|
355 unsigned int audio_stream_change : 1;
|
|
356 unsigned int subpic_stream_change : 1;
|
|
357 unsigned int angle_change : 1;
|
|
358 unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */
|
|
359
|
|
360 unsigned int forward_scan : 1; /* 8 */
|
|
361 unsigned int backward_scan : 1;
|
|
362 unsigned int title_menu_call : 1;
|
|
363 unsigned int root_menu_call : 1;
|
|
364 unsigned int subpic_menu_call : 1;
|
|
365 unsigned int audio_menu_call : 1;
|
|
366 unsigned int angle_menu_call : 1;
|
|
367 unsigned int chapter_menu_call : 1; /* 15 */
|
|
368
|
|
369 unsigned int title_or_time_play : 1; /* 0 */
|
|
370 unsigned int chapter_search_or_play : 1;
|
|
371 unsigned int title_play : 1;
|
|
372 unsigned int stop : 1;
|
|
373 unsigned int go_up : 1;
|
|
374 unsigned int time_or_chapter_search : 1;
|
|
375 unsigned int prev_or_top_pg_search : 1;
|
|
376 unsigned int next_pg_search : 1; /* 7 */
|
|
377 #endif
|
|
378 } ATTRIBUTE_PACKED user_ops_t;
|
|
379
|
|
380 /**
|
|
381 * Program Chain Information.
|
|
382 */
|
|
383 typedef struct {
|
|
384 uint16_t zero_1;
|
|
385 uint8_t nr_of_programs;
|
|
386 uint8_t nr_of_cells;
|
|
387 dvd_time_t playback_time;
|
|
388 user_ops_t prohibited_ops;
|
|
389 uint16_t audio_control[8]; /* New type? */
|
|
390 uint32_t subp_control[32]; /* New type? */
|
|
391 uint16_t next_pgc_nr;
|
|
392 uint16_t prev_pgc_nr;
|
|
393 uint16_t goup_pgc_nr;
|
|
394 uint8_t still_time;
|
|
395 uint8_t pg_playback_mode;
|
|
396 uint32_t palette[16]; /* New type struct {zero_1, Y, Cr, Cb} ? */
|
|
397 uint16_t command_tbl_offset;
|
|
398 uint16_t program_map_offset;
|
|
399 uint16_t cell_playback_offset;
|
|
400 uint16_t cell_position_offset;
|
|
401 pgc_command_tbl_t *command_tbl;
|
|
402 pgc_program_map_t *program_map;
|
|
403 cell_playback_t *cell_playback;
|
|
404 cell_position_t *cell_position;
|
|
405 } ATTRIBUTE_PACKED pgc_t;
|
317
|
406 #define PGC_SIZE 236U
|
225
|
407
|
|
408 /**
|
|
409 * Program Chain Information Search Pointer.
|
|
410 */
|
|
411 typedef struct {
|
|
412 uint8_t entry_id;
|
|
413 #ifdef WORDS_BIGENDIAN
|
|
414 unsigned int block_mode : 2;
|
|
415 unsigned int block_type : 2;
|
|
416 unsigned int unknown1 : 4;
|
|
417 #else
|
|
418 unsigned char unknown1 : 4;
|
|
419 unsigned char block_type : 2;
|
|
420 unsigned char block_mode : 2;
|
|
421 #endif
|
|
422 uint16_t ptl_id_mask;
|
|
423 uint32_t pgc_start_byte;
|
|
424 pgc_t *pgc;
|
|
425 } ATTRIBUTE_PACKED pgci_srp_t;
|
317
|
426 #define PGCI_SRP_SIZE 8U
|
225
|
427
|
|
428 /**
|
|
429 * Program Chain Information Table.
|
|
430 */
|
|
431 typedef struct {
|
|
432 uint16_t nr_of_pgci_srp;
|
|
433 uint16_t zero_1;
|
|
434 uint32_t last_byte;
|
|
435 pgci_srp_t *pgci_srp;
|
|
436 } ATTRIBUTE_PACKED pgcit_t;
|
317
|
437 #define PGCIT_SIZE 8U
|
225
|
438
|
|
439 /**
|
|
440 * Menu PGCI Language Unit.
|
|
441 */
|
|
442 typedef struct {
|
|
443 uint16_t lang_code;
|
|
444 uint8_t lang_extension;
|
|
445 uint8_t exists;
|
|
446 uint32_t lang_start_byte;
|
|
447 pgcit_t *pgcit;
|
|
448 } ATTRIBUTE_PACKED pgci_lu_t;
|
317
|
449 #define PGCI_LU_SIZE 8U
|
225
|
450
|
|
451 /**
|
|
452 * Menu PGCI Unit Table.
|
|
453 */
|
|
454 typedef struct {
|
|
455 uint16_t nr_of_lus;
|
|
456 uint16_t zero_1;
|
|
457 uint32_t last_byte;
|
|
458 pgci_lu_t *lu;
|
|
459 } ATTRIBUTE_PACKED pgci_ut_t;
|
317
|
460 #define PGCI_UT_SIZE 8U
|
225
|
461
|
|
462 /**
|
|
463 * Cell Address Information.
|
|
464 */
|
|
465 typedef struct {
|
|
466 uint16_t vob_id;
|
|
467 uint8_t cell_id;
|
|
468 uint8_t zero_1;
|
|
469 uint32_t start_sector;
|
|
470 uint32_t last_sector;
|
|
471 } ATTRIBUTE_PACKED cell_adr_t;
|
|
472
|
|
473 /**
|
|
474 * Cell Address Table.
|
|
475 */
|
|
476 typedef struct {
|
|
477 uint16_t nr_of_vobs; /* VOBs */
|
|
478 uint16_t zero_1;
|
|
479 uint32_t last_byte;
|
|
480 cell_adr_t *cell_adr_table; /* No explicit size given. */
|
|
481 } ATTRIBUTE_PACKED c_adt_t;
|
317
|
482 #define C_ADT_SIZE 8U
|
225
|
483
|
|
484 /**
|
|
485 * VOBU Address Map.
|
|
486 */
|
|
487 typedef struct {
|
|
488 uint32_t last_byte;
|
|
489 uint32_t *vobu_start_sectors;
|
|
490 } ATTRIBUTE_PACKED vobu_admap_t;
|
317
|
491 #define VOBU_ADMAP_SIZE 4U
|
225
|
492
|
|
493
|
|
494
|
|
495
|
|
496 /**
|
|
497 * VMGI
|
|
498 *
|
|
499 * The following structures relate to the Video Manager.
|
|
500 */
|
|
501
|
|
502 /**
|
|
503 * Video Manager Information Management Table.
|
|
504 */
|
|
505 typedef struct {
|
|
506 char vmg_identifier[12];
|
|
507 uint32_t vmg_last_sector;
|
|
508 uint8_t zero_1[12];
|
|
509 uint32_t vmgi_last_sector;
|
|
510 uint8_t zero_2;
|
|
511 uint8_t specification_version;
|
|
512 uint32_t vmg_category;
|
|
513 uint16_t vmg_nr_of_volumes;
|
|
514 uint16_t vmg_this_volume_nr;
|
|
515 uint8_t disc_side;
|
|
516 uint8_t zero_3[19];
|
|
517 uint16_t vmg_nr_of_title_sets; /* Number of VTSs. */
|
|
518 char provider_identifier[32];
|
|
519 uint64_t vmg_pos_code;
|
|
520 uint8_t zero_4[24];
|
|
521 uint32_t vmgi_last_byte;
|
|
522 uint32_t first_play_pgc;
|
|
523 uint8_t zero_5[56];
|
|
524 uint32_t vmgm_vobs; /* sector */
|
|
525 uint32_t tt_srpt; /* sector */
|
|
526 uint32_t vmgm_pgci_ut; /* sector */
|
|
527 uint32_t ptl_mait; /* sector */
|
|
528 uint32_t vts_atrt; /* sector */
|
|
529 uint32_t txtdt_mgi; /* sector */
|
|
530 uint32_t vmgm_c_adt; /* sector */
|
|
531 uint32_t vmgm_vobu_admap; /* sector */
|
|
532 uint8_t zero_6[32];
|
|
533
|
|
534 video_attr_t vmgm_video_attr;
|
|
535 uint8_t zero_7;
|
|
536 uint8_t nr_of_vmgm_audio_streams; /* should be 0 or 1 */
|
|
537 audio_attr_t vmgm_audio_attr;
|
|
538 audio_attr_t zero_8[7];
|
|
539 uint8_t zero_9[17];
|
|
540 uint8_t nr_of_vmgm_subp_streams; /* should be 0 or 1 */
|
|
541 subp_attr_t vmgm_subp_attr;
|
|
542 subp_attr_t zero_10[27]; /* XXX: how much 'padding' here? */
|
|
543 } ATTRIBUTE_PACKED vmgi_mat_t;
|
|
544
|
|
545 typedef struct {
|
|
546 #ifdef WORDS_BIGENDIAN
|
|
547 unsigned int zero_1 : 1;
|
|
548 unsigned int multi_or_random_pgc_title : 1; /* 0: one sequential pgc title */
|
|
549 unsigned int jlc_exists_in_cell_cmd : 1;
|
|
550 unsigned int jlc_exists_in_prepost_cmd : 1;
|
|
551 unsigned int jlc_exists_in_button_cmd : 1;
|
|
552 unsigned int jlc_exists_in_tt_dom : 1;
|
|
553 unsigned int chapter_search_or_play : 1; /* UOP 1 */
|
|
554 unsigned int title_or_time_play : 1; /* UOP 0 */
|
|
555 #else
|
|
556 unsigned char title_or_time_play : 1;
|
|
557 unsigned char chapter_search_or_play : 1;
|
|
558 unsigned char jlc_exists_in_tt_dom : 1;
|
|
559 unsigned char jlc_exists_in_button_cmd : 1;
|
|
560 unsigned char jlc_exists_in_prepost_cmd : 1;
|
|
561 unsigned char jlc_exists_in_cell_cmd : 1;
|
|
562 unsigned char multi_or_random_pgc_title : 1;
|
|
563 unsigned char zero_1 : 1;
|
|
564 #endif
|
|
565 } ATTRIBUTE_PACKED playback_type_t;
|
|
566
|
|
567 /**
|
|
568 * Title Information.
|
|
569 */
|
|
570 typedef struct {
|
|
571 playback_type_t pb_ty;
|
|
572 uint8_t nr_of_angles;
|
|
573 uint16_t nr_of_ptts;
|
|
574 uint16_t parental_id;
|
|
575 uint8_t title_set_nr;
|
|
576 uint8_t vts_ttn;
|
|
577 uint32_t title_set_sector;
|
|
578 } ATTRIBUTE_PACKED title_info_t;
|
|
579
|
|
580 /**
|
|
581 * PartOfTitle Search Pointer Table.
|
|
582 */
|
|
583 typedef struct {
|
|
584 uint16_t nr_of_srpts;
|
|
585 uint16_t zero_1;
|
|
586 uint32_t last_byte;
|
|
587 title_info_t *title;
|
|
588 } ATTRIBUTE_PACKED tt_srpt_t;
|
317
|
589 #define TT_SRPT_SIZE 8U
|
225
|
590
|
|
591
|
|
592 /**
|
|
593 * Parental Management Information Unit Table.
|
|
594 * Level 1 (US: G), ..., 7 (US: NC-17), 8
|
|
595 */
|
|
596 typedef uint16_t pf_level_t[8];
|
|
597
|
|
598 /**
|
|
599 * Parental Management Information Unit Table.
|
|
600 */
|
|
601 typedef struct {
|
|
602 uint16_t country_code;
|
|
603 uint16_t zero_1;
|
|
604 uint16_t pf_ptl_mai_start_byte;
|
|
605 uint16_t zero_2;
|
|
606 pf_level_t *pf_ptl_mai; /* table of (nr_of_vtss + 1), video_ts is first */
|
|
607 } ATTRIBUTE_PACKED ptl_mait_country_t;
|
317
|
608 #define PTL_MAIT_COUNTRY_SIZE 8U
|
225
|
609
|
|
610 /**
|
|
611 * Parental Management Information Table.
|
|
612 */
|
|
613 typedef struct {
|
|
614 uint16_t nr_of_countries;
|
|
615 uint16_t nr_of_vtss;
|
|
616 uint32_t last_byte;
|
|
617 ptl_mait_country_t *countries;
|
|
618 } ATTRIBUTE_PACKED ptl_mait_t;
|
317
|
619 #define PTL_MAIT_SIZE 8U
|
225
|
620
|
|
621 /**
|
|
622 * Video Title Set Attributes.
|
|
623 */
|
|
624 typedef struct {
|
|
625 uint32_t last_byte;
|
|
626 uint32_t vts_cat;
|
|
627
|
|
628 video_attr_t vtsm_vobs_attr;
|
|
629 uint8_t zero_1;
|
|
630 uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */
|
|
631 audio_attr_t vtsm_audio_attr;
|
|
632 audio_attr_t zero_2[7];
|
|
633 uint8_t zero_3[16];
|
|
634 uint8_t zero_4;
|
|
635 uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */
|
|
636 subp_attr_t vtsm_subp_attr;
|
|
637 subp_attr_t zero_5[27];
|
|
638
|
|
639 uint8_t zero_6[2];
|
|
640
|
|
641 video_attr_t vtstt_vobs_video_attr;
|
|
642 uint8_t zero_7;
|
|
643 uint8_t nr_of_vtstt_audio_streams;
|
|
644 audio_attr_t vtstt_audio_attr[8];
|
|
645 uint8_t zero_8[16];
|
|
646 uint8_t zero_9;
|
|
647 uint8_t nr_of_vtstt_subp_streams;
|
|
648 subp_attr_t vtstt_subp_attr[32];
|
|
649 } ATTRIBUTE_PACKED vts_attributes_t;
|
317
|
650 #define VTS_ATTRIBUTES_SIZE 542U
|
|
651 #define VTS_ATTRIBUTES_MIN_SIZE 356U
|
225
|
652
|
|
653 /**
|
|
654 * Video Title Set Attribute Table.
|
|
655 */
|
|
656 typedef struct {
|
|
657 uint16_t nr_of_vtss;
|
|
658 uint16_t zero_1;
|
|
659 uint32_t last_byte;
|
|
660 vts_attributes_t *vts;
|
|
661 uint32_t *vts_atrt_offsets; /* offsets table for each vts_attributes */
|
|
662 } ATTRIBUTE_PACKED vts_atrt_t;
|
317
|
663 #define VTS_ATRT_SIZE 8U
|
225
|
664
|
|
665 /**
|
|
666 * Text Data. (Incomplete)
|
|
667 */
|
|
668 typedef struct {
|
|
669 uint32_t last_byte; /* offsets are relative here */
|
|
670 uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */
|
|
671 #if 0
|
|
672 uint16_t unknown; /* 0x48 ?? 0x48 words (16bit) info following */
|
|
673 uint16_t zero_1;
|
|
674
|
|
675 uint8_t type_of_info; /* ?? 01 == disc, 02 == Title, 04 == Title part */
|
|
676 uint8_t unknown1;
|
|
677 uint8_t unknown2;
|
|
678 uint8_t unknown3;
|
|
679 uint8_t unknown4; /* ?? allways 0x30 language?, text format? */
|
|
680 uint8_t unknown5;
|
|
681 uint16_t offset; /* from first */
|
|
682
|
|
683 char text[12]; /* ended by 0x09 */
|
|
684 #endif
|
|
685 } ATTRIBUTE_PACKED txtdt_t;
|
|
686
|
|
687 /**
|
|
688 * Text Data Language Unit. (Incomplete)
|
|
689 */
|
|
690 typedef struct {
|
|
691 uint16_t lang_code;
|
|
692 uint16_t unknown; /* 0x0001, title 1? disc 1? side 1? */
|
|
693 uint32_t txtdt_start_byte; /* prt, rel start of vmg_txtdt_mgi */
|
|
694 txtdt_t *txtdt;
|
|
695 } ATTRIBUTE_PACKED txtdt_lu_t;
|
317
|
696 #define TXTDT_LU_SIZE 8U
|
225
|
697
|
|
698 /**
|
|
699 * Text Data Manager Information. (Incomplete)
|
|
700 */
|
|
701 typedef struct {
|
|
702 char disc_name[14]; /* how many bytes?? */
|
|
703 uint16_t nr_of_language_units; /* 32bit?? */
|
|
704 uint32_t last_byte;
|
|
705 txtdt_lu_t *lu;
|
|
706 } ATTRIBUTE_PACKED txtdt_mgi_t;
|
317
|
707 #define TXTDT_MGI_SIZE 20U
|
225
|
708
|
|
709
|
|
710 /**
|
|
711 * VTS
|
|
712 *
|
|
713 * Structures relating to the Video Title Set (VTS).
|
|
714 */
|
|
715
|
|
716 /**
|
|
717 * Video Title Set Information Management Table.
|
|
718 */
|
|
719 typedef struct {
|
|
720 char vts_identifier[12];
|
|
721 uint32_t vts_last_sector;
|
|
722 uint8_t zero_1[12];
|
|
723 uint32_t vtsi_last_sector;
|
|
724 uint8_t zero_2;
|
|
725 uint8_t specification_version;
|
|
726 uint32_t vts_category;
|
|
727 uint16_t zero_3;
|
|
728 uint16_t zero_4;
|
|
729 uint8_t zero_5;
|
|
730 uint8_t zero_6[19];
|
|
731 uint16_t zero_7;
|
|
732 uint8_t zero_8[32];
|
|
733 uint64_t zero_9;
|
|
734 uint8_t zero_10[24];
|
|
735 uint32_t vtsi_last_byte;
|
|
736 uint32_t zero_11;
|
|
737 uint8_t zero_12[56];
|
|
738 uint32_t vtsm_vobs; /* sector */
|
|
739 uint32_t vtstt_vobs; /* sector */
|
|
740 uint32_t vts_ptt_srpt; /* sector */
|
|
741 uint32_t vts_pgcit; /* sector */
|
|
742 uint32_t vtsm_pgci_ut; /* sector */
|
|
743 uint32_t vts_tmapt; /* sector */
|
|
744 uint32_t vtsm_c_adt; /* sector */
|
|
745 uint32_t vtsm_vobu_admap; /* sector */
|
|
746 uint32_t vts_c_adt; /* sector */
|
|
747 uint32_t vts_vobu_admap; /* sector */
|
|
748 uint8_t zero_13[24];
|
|
749
|
|
750 video_attr_t vtsm_video_attr;
|
|
751 uint8_t zero_14;
|
|
752 uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */
|
|
753 audio_attr_t vtsm_audio_attr;
|
|
754 audio_attr_t zero_15[7];
|
|
755 uint8_t zero_16[17];
|
|
756 uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */
|
|
757 subp_attr_t vtsm_subp_attr;
|
|
758 subp_attr_t zero_17[27];
|
|
759 uint8_t zero_18[2];
|
|
760
|
|
761 video_attr_t vts_video_attr;
|
|
762 uint8_t zero_19;
|
|
763 uint8_t nr_of_vts_audio_streams;
|
|
764 audio_attr_t vts_audio_attr[8];
|
|
765 uint8_t zero_20[17];
|
|
766 uint8_t nr_of_vts_subp_streams;
|
|
767 subp_attr_t vts_subp_attr[32];
|
|
768 uint16_t zero_21;
|
|
769 multichannel_ext_t vts_mu_audio_attr[8];
|
|
770 /* XXX: how much 'padding' here, if any? */
|
|
771 } ATTRIBUTE_PACKED vtsi_mat_t;
|
|
772
|
|
773 /**
|
|
774 * PartOfTitle Unit Information.
|
|
775 */
|
|
776 typedef struct {
|
|
777 uint16_t pgcn;
|
|
778 uint16_t pgn;
|
|
779 } ATTRIBUTE_PACKED ptt_info_t;
|
|
780
|
|
781 /**
|
|
782 * PartOfTitle Information.
|
|
783 */
|
|
784 typedef struct {
|
|
785 uint16_t nr_of_ptts;
|
|
786 ptt_info_t *ptt;
|
|
787 } ATTRIBUTE_PACKED ttu_t;
|
|
788
|
|
789 /**
|
|
790 * PartOfTitle Search Pointer Table.
|
|
791 */
|
|
792 typedef struct {
|
|
793 uint16_t nr_of_srpts;
|
|
794 uint16_t zero_1;
|
|
795 uint32_t last_byte;
|
|
796 ttu_t *title;
|
|
797 uint32_t *ttu_offset; /* offset table for each ttu */
|
|
798 } ATTRIBUTE_PACKED vts_ptt_srpt_t;
|
317
|
799 #define VTS_PTT_SRPT_SIZE 8U
|
225
|
800
|
|
801
|
|
802 /**
|
|
803 * Time Map Entry.
|
|
804 */
|
|
805 /* Should this be bit field at all or just the uint32_t? */
|
|
806 typedef uint32_t map_ent_t;
|
|
807
|
|
808 /**
|
|
809 * Time Map.
|
|
810 */
|
|
811 typedef struct {
|
|
812 uint8_t tmu; /* Time unit, in seconds */
|
|
813 uint8_t zero_1;
|
|
814 uint16_t nr_of_entries;
|
|
815 map_ent_t *map_ent;
|
|
816 } ATTRIBUTE_PACKED vts_tmap_t;
|
317
|
817 #define VTS_TMAP_SIZE 4U
|
225
|
818
|
|
819 /**
|
|
820 * Time Map Table.
|
|
821 */
|
|
822 typedef struct {
|
|
823 uint16_t nr_of_tmaps;
|
|
824 uint16_t zero_1;
|
|
825 uint32_t last_byte;
|
|
826 vts_tmap_t *tmap;
|
|
827 uint32_t *tmap_offset; /* offset table for each tmap */
|
|
828 } ATTRIBUTE_PACKED vts_tmapt_t;
|
317
|
829 #define VTS_TMAPT_SIZE 8U
|
225
|
830
|
|
831
|
|
832 #if PRAGMA_PACK
|
|
833 #pragma pack()
|
|
834 #endif
|
|
835
|
|
836
|
|
837 /**
|
|
838 * The following structure defines an IFO file. The structure is divided into
|
|
839 * two parts, the VMGI, or Video Manager Information, which is read from the
|
|
840 * VIDEO_TS.[IFO,BUP] file, and the VTSI, or Video Title Set Information, which
|
|
841 * is read in from the VTS_XX_0.[IFO,BUP] files.
|
|
842 */
|
|
843 typedef struct {
|
|
844 dvd_file_t *file;
|
|
845
|
|
846 /* VMGI */
|
|
847 vmgi_mat_t *vmgi_mat;
|
|
848 tt_srpt_t *tt_srpt;
|
|
849 pgc_t *first_play_pgc;
|
|
850 ptl_mait_t *ptl_mait;
|
|
851 vts_atrt_t *vts_atrt;
|
|
852 txtdt_mgi_t *txtdt_mgi;
|
|
853
|
|
854 /* Common */
|
|
855 pgci_ut_t *pgci_ut;
|
|
856 c_adt_t *menu_c_adt;
|
|
857 vobu_admap_t *menu_vobu_admap;
|
|
858
|
|
859 /* VTSI */
|
|
860 vtsi_mat_t *vtsi_mat;
|
|
861 vts_ptt_srpt_t *vts_ptt_srpt;
|
|
862 pgcit_t *vts_pgcit;
|
|
863 vts_tmapt_t *vts_tmapt;
|
|
864 c_adt_t *vts_c_adt;
|
|
865 vobu_admap_t *vts_vobu_admap;
|
|
866 } ifo_handle_t;
|
|
867
|
|
868 #endif /* IFO_TYPES_H_INCLUDED */
|