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 unsigned int zero : 7; /* 25-31 */
|
|
260 unsigned int video_pres_mode_change : 1; /* 24 */
|
|
261
|
|
262 unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */
|
|
263 unsigned int angle_change : 1;
|
|
264 unsigned int subpic_stream_change : 1;
|
|
265 unsigned int audio_stream_change : 1;
|
|
266 unsigned int pause_on : 1;
|
|
267 unsigned int still_off : 1;
|
|
268 unsigned int button_select_or_activate : 1;
|
|
269 unsigned int resume : 1; /* 16 */
|
|
270
|
|
271 unsigned int chapter_menu_call : 1; /* 15 */
|
|
272 unsigned int angle_menu_call : 1;
|
|
273 unsigned int audio_menu_call : 1;
|
|
274 unsigned int subpic_menu_call : 1;
|
|
275 unsigned int root_menu_call : 1;
|
|
276 unsigned int title_menu_call : 1;
|
|
277 unsigned int backward_scan : 1;
|
|
278 unsigned int forward_scan : 1; /* 8 */
|
|
279
|
|
280 unsigned int next_pg_search : 1; /* 7 */
|
|
281 unsigned int prev_or_top_pg_search : 1;
|
|
282 unsigned int time_or_chapter_search : 1;
|
|
283 unsigned int go_up : 1;
|
|
284 unsigned int stop : 1;
|
|
285 unsigned int title_play : 1;
|
|
286 unsigned int chapter_search_or_play : 1;
|
|
287 unsigned int title_or_time_play : 1; /* 0 */
|
|
288 } ATTRIBUTE_PACKED user_ops_t;
|
|
289
|
|
290 /**
|
|
291 * Program Chain Information.
|
|
292 */
|
|
293 typedef struct {
|
|
294 uint16_t zero_1;
|
|
295 uint8_t nr_of_programs;
|
|
296 uint8_t nr_of_cells;
|
|
297 dvd_time_t playback_time;
|
|
298 user_ops_t prohibited_ops;
|
|
299 uint16_t audio_control[8]; /* New type? */
|
|
300 uint32_t subp_control[32]; /* New type? */
|
|
301 uint16_t next_pgc_nr;
|
|
302 uint16_t prev_pgc_nr;
|
|
303 uint16_t goup_pgc_nr;
|
|
304 uint8_t still_time;
|
|
305 uint8_t pg_playback_mode;
|
|
306 uint32_t palette[16]; /* New type struct {zero_1, Y, Cr, Cb} ? */
|
|
307 uint16_t command_tbl_offset;
|
|
308 uint16_t program_map_offset;
|
|
309 uint16_t cell_playback_offset;
|
|
310 uint16_t cell_position_offset;
|
|
311 pgc_command_tbl_t *command_tbl;
|
|
312 pgc_program_map_t *program_map;
|
|
313 cell_playback_t *cell_playback;
|
|
314 cell_position_t *cell_position;
|
|
315 } ATTRIBUTE_PACKED pgc_t;
|
317
|
316 #define PGC_SIZE 236U
|
225
|
317
|
|
318 /**
|
|
319 * Program Chain Information Search Pointer.
|
|
320 */
|
|
321 typedef struct {
|
|
322 uint8_t entry_id;
|
|
323 unsigned int block_mode : 2;
|
|
324 unsigned int block_type : 2;
|
|
325 unsigned int unknown1 : 4;
|
|
326 uint16_t ptl_id_mask;
|
|
327 uint32_t pgc_start_byte;
|
|
328 pgc_t *pgc;
|
|
329 } ATTRIBUTE_PACKED pgci_srp_t;
|
317
|
330 #define PGCI_SRP_SIZE 8U
|
225
|
331
|
|
332 /**
|
|
333 * Program Chain Information Table.
|
|
334 */
|
|
335 typedef struct {
|
|
336 uint16_t nr_of_pgci_srp;
|
|
337 uint16_t zero_1;
|
|
338 uint32_t last_byte;
|
|
339 pgci_srp_t *pgci_srp;
|
|
340 } ATTRIBUTE_PACKED pgcit_t;
|
317
|
341 #define PGCIT_SIZE 8U
|
225
|
342
|
|
343 /**
|
|
344 * Menu PGCI Language Unit.
|
|
345 */
|
|
346 typedef struct {
|
|
347 uint16_t lang_code;
|
|
348 uint8_t lang_extension;
|
|
349 uint8_t exists;
|
|
350 uint32_t lang_start_byte;
|
|
351 pgcit_t *pgcit;
|
|
352 } ATTRIBUTE_PACKED pgci_lu_t;
|
317
|
353 #define PGCI_LU_SIZE 8U
|
225
|
354
|
|
355 /**
|
|
356 * Menu PGCI Unit Table.
|
|
357 */
|
|
358 typedef struct {
|
|
359 uint16_t nr_of_lus;
|
|
360 uint16_t zero_1;
|
|
361 uint32_t last_byte;
|
|
362 pgci_lu_t *lu;
|
|
363 } ATTRIBUTE_PACKED pgci_ut_t;
|
317
|
364 #define PGCI_UT_SIZE 8U
|
225
|
365
|
|
366 /**
|
|
367 * Cell Address Information.
|
|
368 */
|
|
369 typedef struct {
|
|
370 uint16_t vob_id;
|
|
371 uint8_t cell_id;
|
|
372 uint8_t zero_1;
|
|
373 uint32_t start_sector;
|
|
374 uint32_t last_sector;
|
|
375 } ATTRIBUTE_PACKED cell_adr_t;
|
|
376
|
|
377 /**
|
|
378 * Cell Address Table.
|
|
379 */
|
|
380 typedef struct {
|
|
381 uint16_t nr_of_vobs; /* VOBs */
|
|
382 uint16_t zero_1;
|
|
383 uint32_t last_byte;
|
|
384 cell_adr_t *cell_adr_table; /* No explicit size given. */
|
|
385 } ATTRIBUTE_PACKED c_adt_t;
|
317
|
386 #define C_ADT_SIZE 8U
|
225
|
387
|
|
388 /**
|
|
389 * VOBU Address Map.
|
|
390 */
|
|
391 typedef struct {
|
|
392 uint32_t last_byte;
|
|
393 uint32_t *vobu_start_sectors;
|
|
394 } ATTRIBUTE_PACKED vobu_admap_t;
|
317
|
395 #define VOBU_ADMAP_SIZE 4U
|
225
|
396
|
|
397
|
|
398
|
|
399
|
|
400 /**
|
|
401 * VMGI
|
|
402 *
|
|
403 * The following structures relate to the Video Manager.
|
|
404 */
|
|
405
|
|
406 /**
|
|
407 * Video Manager Information Management Table.
|
|
408 */
|
|
409 typedef struct {
|
|
410 char vmg_identifier[12];
|
|
411 uint32_t vmg_last_sector;
|
|
412 uint8_t zero_1[12];
|
|
413 uint32_t vmgi_last_sector;
|
|
414 uint8_t zero_2;
|
|
415 uint8_t specification_version;
|
|
416 uint32_t vmg_category;
|
|
417 uint16_t vmg_nr_of_volumes;
|
|
418 uint16_t vmg_this_volume_nr;
|
|
419 uint8_t disc_side;
|
|
420 uint8_t zero_3[19];
|
|
421 uint16_t vmg_nr_of_title_sets; /* Number of VTSs. */
|
|
422 char provider_identifier[32];
|
|
423 uint64_t vmg_pos_code;
|
|
424 uint8_t zero_4[24];
|
|
425 uint32_t vmgi_last_byte;
|
|
426 uint32_t first_play_pgc;
|
|
427 uint8_t zero_5[56];
|
|
428 uint32_t vmgm_vobs; /* sector */
|
|
429 uint32_t tt_srpt; /* sector */
|
|
430 uint32_t vmgm_pgci_ut; /* sector */
|
|
431 uint32_t ptl_mait; /* sector */
|
|
432 uint32_t vts_atrt; /* sector */
|
|
433 uint32_t txtdt_mgi; /* sector */
|
|
434 uint32_t vmgm_c_adt; /* sector */
|
|
435 uint32_t vmgm_vobu_admap; /* sector */
|
|
436 uint8_t zero_6[32];
|
|
437
|
|
438 video_attr_t vmgm_video_attr;
|
|
439 uint8_t zero_7;
|
|
440 uint8_t nr_of_vmgm_audio_streams; /* should be 0 or 1 */
|
|
441 audio_attr_t vmgm_audio_attr;
|
|
442 audio_attr_t zero_8[7];
|
|
443 uint8_t zero_9[17];
|
|
444 uint8_t nr_of_vmgm_subp_streams; /* should be 0 or 1 */
|
|
445 subp_attr_t vmgm_subp_attr;
|
|
446 subp_attr_t zero_10[27]; /* XXX: how much 'padding' here? */
|
|
447 } ATTRIBUTE_PACKED vmgi_mat_t;
|
|
448
|
|
449 typedef struct {
|
|
450 #ifdef WORDS_BIGENDIAN
|
|
451 unsigned int zero_1 : 1;
|
|
452 unsigned int multi_or_random_pgc_title : 1; /* 0: one sequential pgc title */
|
|
453 unsigned int jlc_exists_in_cell_cmd : 1;
|
|
454 unsigned int jlc_exists_in_prepost_cmd : 1;
|
|
455 unsigned int jlc_exists_in_button_cmd : 1;
|
|
456 unsigned int jlc_exists_in_tt_dom : 1;
|
|
457 unsigned int chapter_search_or_play : 1; /* UOP 1 */
|
|
458 unsigned int title_or_time_play : 1; /* UOP 0 */
|
|
459 #else
|
|
460 unsigned char title_or_time_play : 1;
|
|
461 unsigned char chapter_search_or_play : 1;
|
|
462 unsigned char jlc_exists_in_tt_dom : 1;
|
|
463 unsigned char jlc_exists_in_button_cmd : 1;
|
|
464 unsigned char jlc_exists_in_prepost_cmd : 1;
|
|
465 unsigned char jlc_exists_in_cell_cmd : 1;
|
|
466 unsigned char multi_or_random_pgc_title : 1;
|
|
467 unsigned char zero_1 : 1;
|
|
468 #endif
|
|
469 } ATTRIBUTE_PACKED playback_type_t;
|
|
470
|
|
471 /**
|
|
472 * Title Information.
|
|
473 */
|
|
474 typedef struct {
|
|
475 playback_type_t pb_ty;
|
|
476 uint8_t nr_of_angles;
|
|
477 uint16_t nr_of_ptts;
|
|
478 uint16_t parental_id;
|
|
479 uint8_t title_set_nr;
|
|
480 uint8_t vts_ttn;
|
|
481 uint32_t title_set_sector;
|
|
482 } ATTRIBUTE_PACKED title_info_t;
|
|
483
|
|
484 /**
|
|
485 * PartOfTitle Search Pointer Table.
|
|
486 */
|
|
487 typedef struct {
|
|
488 uint16_t nr_of_srpts;
|
|
489 uint16_t zero_1;
|
|
490 uint32_t last_byte;
|
|
491 title_info_t *title;
|
|
492 } ATTRIBUTE_PACKED tt_srpt_t;
|
317
|
493 #define TT_SRPT_SIZE 8U
|
225
|
494
|
|
495
|
|
496 /**
|
|
497 * Parental Management Information Unit Table.
|
|
498 * Level 1 (US: G), ..., 7 (US: NC-17), 8
|
|
499 */
|
|
500 typedef uint16_t pf_level_t[8];
|
|
501
|
|
502 /**
|
|
503 * Parental Management Information Unit Table.
|
|
504 */
|
|
505 typedef struct {
|
|
506 uint16_t country_code;
|
|
507 uint16_t zero_1;
|
|
508 uint16_t pf_ptl_mai_start_byte;
|
|
509 uint16_t zero_2;
|
|
510 pf_level_t *pf_ptl_mai; /* table of (nr_of_vtss + 1), video_ts is first */
|
|
511 } ATTRIBUTE_PACKED ptl_mait_country_t;
|
317
|
512 #define PTL_MAIT_COUNTRY_SIZE 8U
|
225
|
513
|
|
514 /**
|
|
515 * Parental Management Information Table.
|
|
516 */
|
|
517 typedef struct {
|
|
518 uint16_t nr_of_countries;
|
|
519 uint16_t nr_of_vtss;
|
|
520 uint32_t last_byte;
|
|
521 ptl_mait_country_t *countries;
|
|
522 } ATTRIBUTE_PACKED ptl_mait_t;
|
317
|
523 #define PTL_MAIT_SIZE 8U
|
225
|
524
|
|
525 /**
|
|
526 * Video Title Set Attributes.
|
|
527 */
|
|
528 typedef struct {
|
|
529 uint32_t last_byte;
|
|
530 uint32_t vts_cat;
|
|
531
|
|
532 video_attr_t vtsm_vobs_attr;
|
|
533 uint8_t zero_1;
|
|
534 uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */
|
|
535 audio_attr_t vtsm_audio_attr;
|
|
536 audio_attr_t zero_2[7];
|
|
537 uint8_t zero_3[16];
|
|
538 uint8_t zero_4;
|
|
539 uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */
|
|
540 subp_attr_t vtsm_subp_attr;
|
|
541 subp_attr_t zero_5[27];
|
|
542
|
|
543 uint8_t zero_6[2];
|
|
544
|
|
545 video_attr_t vtstt_vobs_video_attr;
|
|
546 uint8_t zero_7;
|
|
547 uint8_t nr_of_vtstt_audio_streams;
|
|
548 audio_attr_t vtstt_audio_attr[8];
|
|
549 uint8_t zero_8[16];
|
|
550 uint8_t zero_9;
|
|
551 uint8_t nr_of_vtstt_subp_streams;
|
|
552 subp_attr_t vtstt_subp_attr[32];
|
|
553 } ATTRIBUTE_PACKED vts_attributes_t;
|
317
|
554 #define VTS_ATTRIBUTES_SIZE 542U
|
|
555 #define VTS_ATTRIBUTES_MIN_SIZE 356U
|
225
|
556
|
|
557 /**
|
|
558 * Video Title Set Attribute Table.
|
|
559 */
|
|
560 typedef struct {
|
|
561 uint16_t nr_of_vtss;
|
|
562 uint16_t zero_1;
|
|
563 uint32_t last_byte;
|
|
564 vts_attributes_t *vts;
|
|
565 uint32_t *vts_atrt_offsets; /* offsets table for each vts_attributes */
|
|
566 } ATTRIBUTE_PACKED vts_atrt_t;
|
317
|
567 #define VTS_ATRT_SIZE 8U
|
225
|
568
|
|
569 /**
|
|
570 * Text Data. (Incomplete)
|
|
571 */
|
|
572 typedef struct {
|
|
573 uint32_t last_byte; /* offsets are relative here */
|
|
574 uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */
|
|
575 #if 0
|
|
576 uint16_t unknown; /* 0x48 ?? 0x48 words (16bit) info following */
|
|
577 uint16_t zero_1;
|
|
578
|
|
579 uint8_t type_of_info; /* ?? 01 == disc, 02 == Title, 04 == Title part */
|
|
580 uint8_t unknown1;
|
|
581 uint8_t unknown2;
|
|
582 uint8_t unknown3;
|
|
583 uint8_t unknown4; /* ?? allways 0x30 language?, text format? */
|
|
584 uint8_t unknown5;
|
|
585 uint16_t offset; /* from first */
|
|
586
|
|
587 char text[12]; /* ended by 0x09 */
|
|
588 #endif
|
|
589 } ATTRIBUTE_PACKED txtdt_t;
|
|
590
|
|
591 /**
|
|
592 * Text Data Language Unit. (Incomplete)
|
|
593 */
|
|
594 typedef struct {
|
|
595 uint16_t lang_code;
|
|
596 uint16_t unknown; /* 0x0001, title 1? disc 1? side 1? */
|
|
597 uint32_t txtdt_start_byte; /* prt, rel start of vmg_txtdt_mgi */
|
|
598 txtdt_t *txtdt;
|
|
599 } ATTRIBUTE_PACKED txtdt_lu_t;
|
317
|
600 #define TXTDT_LU_SIZE 8U
|
225
|
601
|
|
602 /**
|
|
603 * Text Data Manager Information. (Incomplete)
|
|
604 */
|
|
605 typedef struct {
|
|
606 char disc_name[14]; /* how many bytes?? */
|
|
607 uint16_t nr_of_language_units; /* 32bit?? */
|
|
608 uint32_t last_byte;
|
|
609 txtdt_lu_t *lu;
|
|
610 } ATTRIBUTE_PACKED txtdt_mgi_t;
|
317
|
611 #define TXTDT_MGI_SIZE 20U
|
225
|
612
|
|
613
|
|
614 /**
|
|
615 * VTS
|
|
616 *
|
|
617 * Structures relating to the Video Title Set (VTS).
|
|
618 */
|
|
619
|
|
620 /**
|
|
621 * Video Title Set Information Management Table.
|
|
622 */
|
|
623 typedef struct {
|
|
624 char vts_identifier[12];
|
|
625 uint32_t vts_last_sector;
|
|
626 uint8_t zero_1[12];
|
|
627 uint32_t vtsi_last_sector;
|
|
628 uint8_t zero_2;
|
|
629 uint8_t specification_version;
|
|
630 uint32_t vts_category;
|
|
631 uint16_t zero_3;
|
|
632 uint16_t zero_4;
|
|
633 uint8_t zero_5;
|
|
634 uint8_t zero_6[19];
|
|
635 uint16_t zero_7;
|
|
636 uint8_t zero_8[32];
|
|
637 uint64_t zero_9;
|
|
638 uint8_t zero_10[24];
|
|
639 uint32_t vtsi_last_byte;
|
|
640 uint32_t zero_11;
|
|
641 uint8_t zero_12[56];
|
|
642 uint32_t vtsm_vobs; /* sector */
|
|
643 uint32_t vtstt_vobs; /* sector */
|
|
644 uint32_t vts_ptt_srpt; /* sector */
|
|
645 uint32_t vts_pgcit; /* sector */
|
|
646 uint32_t vtsm_pgci_ut; /* sector */
|
|
647 uint32_t vts_tmapt; /* sector */
|
|
648 uint32_t vtsm_c_adt; /* sector */
|
|
649 uint32_t vtsm_vobu_admap; /* sector */
|
|
650 uint32_t vts_c_adt; /* sector */
|
|
651 uint32_t vts_vobu_admap; /* sector */
|
|
652 uint8_t zero_13[24];
|
|
653
|
|
654 video_attr_t vtsm_video_attr;
|
|
655 uint8_t zero_14;
|
|
656 uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */
|
|
657 audio_attr_t vtsm_audio_attr;
|
|
658 audio_attr_t zero_15[7];
|
|
659 uint8_t zero_16[17];
|
|
660 uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */
|
|
661 subp_attr_t vtsm_subp_attr;
|
|
662 subp_attr_t zero_17[27];
|
|
663 uint8_t zero_18[2];
|
|
664
|
|
665 video_attr_t vts_video_attr;
|
|
666 uint8_t zero_19;
|
|
667 uint8_t nr_of_vts_audio_streams;
|
|
668 audio_attr_t vts_audio_attr[8];
|
|
669 uint8_t zero_20[17];
|
|
670 uint8_t nr_of_vts_subp_streams;
|
|
671 subp_attr_t vts_subp_attr[32];
|
|
672 uint16_t zero_21;
|
|
673 multichannel_ext_t vts_mu_audio_attr[8];
|
|
674 /* XXX: how much 'padding' here, if any? */
|
|
675 } ATTRIBUTE_PACKED vtsi_mat_t;
|
|
676
|
|
677 /**
|
|
678 * PartOfTitle Unit Information.
|
|
679 */
|
|
680 typedef struct {
|
|
681 uint16_t pgcn;
|
|
682 uint16_t pgn;
|
|
683 } ATTRIBUTE_PACKED ptt_info_t;
|
|
684
|
|
685 /**
|
|
686 * PartOfTitle Information.
|
|
687 */
|
|
688 typedef struct {
|
|
689 uint16_t nr_of_ptts;
|
|
690 ptt_info_t *ptt;
|
|
691 } ATTRIBUTE_PACKED ttu_t;
|
|
692
|
|
693 /**
|
|
694 * PartOfTitle Search Pointer Table.
|
|
695 */
|
|
696 typedef struct {
|
|
697 uint16_t nr_of_srpts;
|
|
698 uint16_t zero_1;
|
|
699 uint32_t last_byte;
|
|
700 ttu_t *title;
|
|
701 uint32_t *ttu_offset; /* offset table for each ttu */
|
|
702 } ATTRIBUTE_PACKED vts_ptt_srpt_t;
|
317
|
703 #define VTS_PTT_SRPT_SIZE 8U
|
225
|
704
|
|
705
|
|
706 /**
|
|
707 * Time Map Entry.
|
|
708 */
|
|
709 /* Should this be bit field at all or just the uint32_t? */
|
|
710 typedef uint32_t map_ent_t;
|
|
711
|
|
712 /**
|
|
713 * Time Map.
|
|
714 */
|
|
715 typedef struct {
|
|
716 uint8_t tmu; /* Time unit, in seconds */
|
|
717 uint8_t zero_1;
|
|
718 uint16_t nr_of_entries;
|
|
719 map_ent_t *map_ent;
|
|
720 } ATTRIBUTE_PACKED vts_tmap_t;
|
317
|
721 #define VTS_TMAP_SIZE 4U
|
225
|
722
|
|
723 /**
|
|
724 * Time Map Table.
|
|
725 */
|
|
726 typedef struct {
|
|
727 uint16_t nr_of_tmaps;
|
|
728 uint16_t zero_1;
|
|
729 uint32_t last_byte;
|
|
730 vts_tmap_t *tmap;
|
|
731 uint32_t *tmap_offset; /* offset table for each tmap */
|
|
732 } ATTRIBUTE_PACKED vts_tmapt_t;
|
317
|
733 #define VTS_TMAPT_SIZE 8U
|
225
|
734
|
|
735
|
|
736 #if PRAGMA_PACK
|
|
737 #pragma pack()
|
|
738 #endif
|
|
739
|
|
740
|
|
741 /**
|
|
742 * The following structure defines an IFO file. The structure is divided into
|
|
743 * two parts, the VMGI, or Video Manager Information, which is read from the
|
|
744 * VIDEO_TS.[IFO,BUP] file, and the VTSI, or Video Title Set Information, which
|
|
745 * is read in from the VTS_XX_0.[IFO,BUP] files.
|
|
746 */
|
|
747 typedef struct {
|
|
748 dvd_file_t *file;
|
|
749
|
|
750 /* VMGI */
|
|
751 vmgi_mat_t *vmgi_mat;
|
|
752 tt_srpt_t *tt_srpt;
|
|
753 pgc_t *first_play_pgc;
|
|
754 ptl_mait_t *ptl_mait;
|
|
755 vts_atrt_t *vts_atrt;
|
|
756 txtdt_mgi_t *txtdt_mgi;
|
|
757
|
|
758 /* Common */
|
|
759 pgci_ut_t *pgci_ut;
|
|
760 c_adt_t *menu_c_adt;
|
|
761 vobu_admap_t *menu_vobu_admap;
|
|
762
|
|
763 /* VTSI */
|
|
764 vtsi_mat_t *vtsi_mat;
|
|
765 vts_ptt_srpt_t *vts_ptt_srpt;
|
|
766 pgcit_t *vts_pgcit;
|
|
767 vts_tmapt_t *vts_tmapt;
|
|
768 c_adt_t *vts_c_adt;
|
|
769 vobu_admap_t *vts_vobu_admap;
|
|
770 } ifo_handle_t;
|
|
771
|
|
772 #endif /* IFO_TYPES_H_INCLUDED */
|