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