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