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