]> git.sesse.net Git - vlc/blob - extras/libdvdread/ifo_types.h
-DVD access plugin is only called if specified under windows (no automatic detection)
[vlc] / extras / libdvdread / ifo_types.h
1 /**
2  * Copyright (C) 2000 Björn Englund <d4bjorn@dtek.chalmers.se>,
3  *                    Håkan Hjort <d95hjort@dtek.chalmers.se>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 #ifndef IFO_TYPES_H_INCLUDED
21 #define IFO_TYPES_H_INCLUDED
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;
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             : 2;
87   
88   unsigned int picture_size         : 2;
89   unsigned int letterboxed          : 1;
90   unsigned int film_mode            : 1;
91 #else
92   unsigned int permitted_df         : 2;
93   unsigned int display_aspect_ratio : 2;
94   unsigned int video_format         : 2;
95   unsigned int mpeg_version         : 2;
96   
97   unsigned int film_mode            : 1;
98   unsigned int letterboxed          : 1;
99   unsigned int picture_size         : 2;
100   
101   unsigned int unknown1             : 2;
102   unsigned int line21_cc_2          : 1;
103   unsigned int line21_cc_1          : 1;
104 #endif
105 } ATTRIBUTE_PACKED video_attr_t;
106
107 /**
108  * Audio Attributes. (Incomplete/Wrong?)
109  */
110 typedef struct {
111 #ifdef WORDS_BIGENDIAN
112   unsigned int audio_format           : 3;
113   unsigned int multichannel_extension : 1;
114   unsigned int lang_type              : 2;
115   unsigned int application_mode       : 2;
116   
117   unsigned int quantization           : 2;
118   unsigned int sample_frequency       : 2;
119   unsigned int unknown1               : 1;
120   unsigned int channels               : 3;
121 #else
122   unsigned int application_mode       : 2;
123   unsigned int lang_type              : 2;
124   unsigned int multichannel_extension : 1;
125   unsigned int audio_format           : 3;
126   
127   unsigned int channels               : 3;
128   unsigned int unknown1               : 1;
129   unsigned int sample_frequency       : 2;
130   unsigned int quantization           : 2;
131 #endif
132   uint16_t lang_code;
133   uint8_t  lang_code2; // ??
134   uint8_t  lang_extension;
135   uint16_t unknown2;
136 } ATTRIBUTE_PACKED audio_attr_t;
137
138 /**
139  * Subpicture Attributes.(Incomplete/Wrong)
140  */
141 typedef struct {
142   /*
143    * type: 0 not specified
144    *       1 language
145    *       2 other
146    * coding mode: 0 run length
147    *              1 extended
148    *              2 other
149    * language: indicates language if type == 1
150    * lang extension: if type == 1 contains the lang extension
151    */
152   uint8_t type;
153   uint8_t zero1;
154   uint16_t lang_code;
155   uint8_t lang_extension;
156   uint8_t zero2;
157 } ATTRIBUTE_PACKED subp_attr_t;
158
159
160
161 /**
162  * PGC Command Table.
163  */ 
164 typedef struct {
165   uint16_t nr_of_pre;
166   uint16_t nr_of_post;
167   uint16_t nr_of_cell;
168   uint16_t zero_1;
169   vm_cmd_t *pre_cmds;
170   vm_cmd_t *post_cmds;
171   vm_cmd_t *cell_cmds;
172 } ATTRIBUTE_PACKED pgc_command_tbl_t;
173 #define PGC_COMMAND_TBL_SIZE 8
174
175 /**
176  * PGC Program Map
177  */
178 typedef uint8_t pgc_program_map_t; 
179
180 /**
181  * Cell Playback Information.
182  */
183 typedef struct {
184 #ifdef WORDS_BIGENDIAN
185   unsigned int block_mode       : 2;
186   unsigned int block_type       : 2;
187   unsigned int seamless_play    : 1;
188   unsigned int interleaved      : 1;
189   unsigned int stc_discontinuity: 1;
190   unsigned int seamless_angle   : 1;
191   
192   unsigned int unknown1         : 1;
193   unsigned int restricted       : 1;
194   unsigned int unknown2         : 6;
195 #else
196   unsigned int seamless_angle   : 1;
197   unsigned int stc_discontinuity: 1;
198   unsigned int interleaved      : 1;
199   unsigned int seamless_play    : 1;
200   unsigned int block_type       : 2;
201   unsigned int block_mode       : 2;
202   
203   unsigned int unknown2         : 6;
204   unsigned int restricted       : 1;
205   unsigned int unknown1         : 1;
206 #endif
207   uint8_t still_time;
208   uint8_t cell_cmd_nr;
209   dvd_time_t playback_time;
210   uint32_t first_sector;
211   uint32_t first_ilvu_end_sector;
212   uint32_t last_vobu_start_sector;
213   uint32_t last_sector;
214 } ATTRIBUTE_PACKED cell_playback_t;
215
216 #define BLOCK_TYPE_NONE         0x0
217 #define BLOCK_TYPE_ANGLE_BLOCK  0x1
218
219 #define BLOCK_MODE_NOT_IN_BLOCK 0x0
220 #define BLOCK_MODE_FIRST_CELL   0x1
221 #define BLOCK_MODE_IN_BLOCK     0x2
222 #define BLOCK_MODE_LAST_CELL    0x3
223
224 /**
225  * Cell Position Information.
226  */
227 typedef struct {
228   uint16_t vob_id_nr;
229   uint8_t  zero_1;
230   uint8_t  cell_nr;
231 } ATTRIBUTE_PACKED cell_position_t;
232
233 /**
234  * User Operations.
235  */
236 typedef struct {
237 #ifdef WORDS_BIGENDIAN
238   unsigned int zero                           : 7; // 25-31
239   unsigned int video_pres_mode_change         : 1; // 24
240   
241   unsigned int karaoke_audio_pres_mode_change : 1; // 23
242   unsigned int angle_change                   : 1; // 22
243   unsigned int subpic_stream_change           : 1; // 21
244   unsigned int audio_stream_change            : 1; // 20
245   unsigned int pause_on                       : 1; // 19
246   unsigned int still_off                      : 1; // 18
247   unsigned int button_select_or_activate      : 1; // 17
248   unsigned int resume                         : 1; // 16
249   
250   unsigned int chapter_menu_call              : 1; // 15
251   unsigned int angle_menu_call                : 1; // 14
252   unsigned int audio_menu_call                : 1; // 13
253   unsigned int subpic_menu_call               : 1; // 12
254   unsigned int root_menu_call                 : 1; // 11
255   unsigned int title_menu_call                : 1; // 10
256   unsigned int backward_scan                  : 1; // 9
257   unsigned int forward_scan                   : 1; // 8
258   
259   unsigned int next_pg_search                 : 1; // 7
260   unsigned int prev_or_top_pg_search          : 1; // 6
261   unsigned int time_or_chapter_search         : 1; // 5
262   unsigned int go_up                          : 1; // 4
263   unsigned int stop                           : 1; // 3
264   unsigned int title_play                     : 1; // 2
265   unsigned int chapter_search_or_play         : 1; // 1
266   unsigned int title_or_time_play             : 1; // 0
267 #else
268   unsigned int video_pres_mode_change         : 1; // 24
269   unsigned int zero                           : 7; // 25-31
270   
271   unsigned int resume                         : 1; // 16
272   unsigned int button_select_or_activate      : 1; // 17
273   unsigned int still_off                      : 1; // 18
274   unsigned int pause_on                       : 1; // 19
275   unsigned int audio_stream_change            : 1; // 20
276   unsigned int subpic_stream_change           : 1; // 21
277   unsigned int angle_change                   : 1; // 22
278   unsigned int karaoke_audio_pres_mode_change : 1; // 23
279   
280   unsigned int forward_scan                   : 1; // 8
281   unsigned int backward_scan                  : 1; // 9
282   unsigned int title_menu_call                : 1; // 10
283   unsigned int root_menu_call                 : 1; // 11
284   unsigned int subpic_menu_call               : 1; // 12
285   unsigned int audio_menu_call                : 1; // 13
286   unsigned int angle_menu_call                : 1; // 14
287   unsigned int chapter_menu_call              : 1; // 15
288   
289   unsigned int title_or_time_play             : 1; // 0
290   unsigned int chapter_search_or_play         : 1; // 1
291   unsigned int title_play                     : 1; // 2
292   unsigned int stop                           : 1; // 3
293   unsigned int go_up                          : 1; // 4
294   unsigned int time_or_chapter_search         : 1; // 5
295   unsigned int prev_or_top_pg_search          : 1; // 6
296   unsigned int next_pg_search                 : 1; // 7
297 #endif
298 } ATTRIBUTE_PACKED user_ops_t;
299
300 /**
301  * Program Chain Information.
302  */
303 typedef struct {
304   uint16_t zero_1;
305   uint8_t  nr_of_programs;
306   uint8_t  nr_of_cells;
307   dvd_time_t playback_time;
308   user_ops_t prohibited_ops;
309   uint16_t audio_control[8]; /* New type? */
310   uint32_t subp_control[32]; /* New type? */
311   uint16_t next_pgc_nr;
312   uint16_t prev_pgc_nr;
313   uint16_t goup_pgc_nr;
314   uint8_t  still_time;
315   uint8_t  pg_playback_mode;
316   uint32_t palette[16]; /* New type struct {zero_1, Y, Cr, Cb} ? */
317   uint16_t command_tbl_offset;
318   uint16_t program_map_offset;
319   uint16_t cell_playback_offset;
320   uint16_t cell_position_offset;
321   pgc_command_tbl_t *command_tbl;
322   pgc_program_map_t  *program_map;
323   cell_playback_t *cell_playback;
324   cell_position_t *cell_position;
325 } ATTRIBUTE_PACKED pgc_t;
326 #define PGC_SIZE 236
327
328 /**
329  * Program Chain Information Search Pointer.
330  */
331 typedef struct {
332   uint8_t  entry_id;
333 #ifdef WORDS_BIGENDIAN
334   unsigned int block_mode : 2;
335   unsigned int block_type : 2;
336   unsigned int unknown1   : 4;
337 #else
338   unsigned int unknown1   : 4;
339   unsigned int block_type : 2;
340   unsigned int block_mode : 2;
341 #endif  
342   uint16_t ptl_id_mask;
343   uint32_t pgc_start_byte;
344   pgc_t *pgc;
345 } ATTRIBUTE_PACKED pgci_srp_t;
346 #define PGCI_SRP_SIZE 8
347
348 /**
349  * Program Chain Information Table.
350  */
351 typedef struct {
352   uint16_t nr_of_pgci_srp;
353   uint16_t zero_1;
354   uint32_t last_byte;
355   pgci_srp_t *pgci_srp;
356 } ATTRIBUTE_PACKED pgcit_t;
357 #define PGCIT_SIZE 8
358
359 /**
360  * Menu PGCI Language Unit.
361  */
362 typedef struct {
363   uint16_t lang_code;
364   uint8_t  zero_1;
365   uint8_t  exists;
366   uint32_t lang_start_byte;
367   pgcit_t *pgcit;
368 } ATTRIBUTE_PACKED pgci_lu_t;
369 #define PGCI_LU_SIZE 8
370
371 /**
372  * Menu PGCI Unit Table.
373  */
374 typedef struct {
375   uint16_t nr_of_lus;
376   uint16_t zero_1;
377   uint32_t last_byte;
378   pgci_lu_t *lu;
379 } ATTRIBUTE_PACKED pgci_ut_t;
380 #define PGCI_UT_SIZE 8
381
382 /**
383  * Cell Address Information.
384  */
385 typedef struct {
386   uint16_t vob_id;
387   uint8_t  cell_id;
388   uint8_t  zero_1;
389   uint32_t start_sector;
390   uint32_t last_sector;
391 } ATTRIBUTE_PACKED cell_adr_t;
392
393 /**
394  * Cell Address Table.
395  */
396 typedef struct {
397   uint16_t nr_of_vobs; /* VOBs */
398   uint16_t zero_1;
399   uint32_t last_byte;
400   cell_adr_t *cell_adr_table;
401 } ATTRIBUTE_PACKED c_adt_t;
402 #define C_ADT_SIZE 8
403
404 /**
405  * VOBU Address Map.
406  */
407 typedef struct {
408   uint32_t last_byte;
409   uint32_t *vobu_start_sectors;
410 } ATTRIBUTE_PACKED vobu_admap_t;
411 #define VOBU_ADMAP_SIZE 4
412
413
414
415
416 /**
417  * VMGI
418  *
419  * The following structures relate to the Video Manager.
420  */
421
422 /**
423  * Video Manager Information Management Table.
424  */
425 typedef struct {
426   char     vmg_identifier[12];
427   uint32_t vmg_last_sector;
428   uint8_t  zero_1[12];
429   uint32_t vmgi_last_sector;
430   uint8_t  zero_2;
431   uint8_t  specification_version;
432   uint32_t vmg_category;
433   uint16_t vmg_nr_of_volumes;
434   uint16_t vmg_this_volume_nr;
435   uint8_t  disc_side;
436   uint8_t  zero_3[19];
437   uint16_t vmg_nr_of_title_sets;  /* Number of VTSs. */
438   char     provider_identifier[32];
439   uint64_t vmg_pos_code;
440   uint8_t  zero_4[24];
441   uint32_t vmgi_last_byte;
442   uint32_t first_play_pgc;
443   uint8_t  zero_5[56];
444   uint32_t vmgm_vobs;             /* sector */
445   uint32_t tt_srpt;               /* sector */
446   uint32_t vmgm_pgci_ut;          /* sector */
447   uint32_t ptl_mait;              /* sector */
448   uint32_t vts_atrt;              /* sector */
449   uint32_t txtdt_mgi;             /* sector */
450   uint32_t vmgm_c_adt;            /* sector */
451   uint32_t vmgm_vobu_admap;       /* sector */
452   uint8_t  zero_6[32];
453   
454   video_attr_t vmgm_video_attr;
455   uint8_t  zero_7;
456   uint8_t  nr_of_vmgm_audio_streams; // should be 0 or 1
457   audio_attr_t vmgm_audio_attr;
458   audio_attr_t zero_8[7];
459   uint8_t  zero_9[17];
460   uint8_t  nr_of_vmgm_subp_streams; // should be 0 or 1
461   subp_attr_t  vmgm_subp_attr;
462   subp_attr_t  zero_10[27];  /* XXX: how much 'padding' here? */
463 } ATTRIBUTE_PACKED vmgi_mat_t;
464
465 typedef struct {
466 #ifdef WORDS_BIGENDIAN
467   unsigned int zero_1                    : 1;
468   unsigned int multi_or_random_pgc_title : 1; // 0 == one sequential pgc title
469   unsigned int jlc_exists_in_cell_cmd    : 1;
470   unsigned int jlc_exists_in_prepost_cmd : 1;
471   unsigned int jlc_exists_in_button_cmd  : 1;
472   unsigned int jlc_exists_in_tt_dom      : 1;
473   unsigned int chapter_search_or_play    : 1; // UOP 1
474   unsigned int title_or_time_play        : 1; // UOP 0
475 #else
476   unsigned int title_or_time_play        : 1; // UOP 0
477   unsigned int chapter_search_or_play    : 1; // UOP 1
478   unsigned int jlc_exists_in_tt_dom      : 1;
479   unsigned int jlc_exists_in_button_cmd  : 1;
480   unsigned int jlc_exists_in_prepost_cmd : 1;
481   unsigned int jlc_exists_in_cell_cmd    : 1;
482   unsigned int multi_or_random_pgc_title : 1; // 0 == one sequential pgc title
483   unsigned int zero_1                    : 1;
484 #endif
485 } ATTRIBUTE_PACKED playback_type_t;
486
487 /**
488  * Title Information.
489  */
490 typedef struct {
491   playback_type_t pb_ty;
492   uint8_t  nr_of_angles;
493   uint16_t nr_of_ptts;
494   uint16_t parental_id;
495   uint8_t  title_set_nr;
496   uint8_t  vts_ttn;
497   uint32_t title_set_sector;
498 } ATTRIBUTE_PACKED title_info_t;
499
500 /**
501  * PartOfTitle Search Pointer Table.
502  */
503 typedef struct {
504   uint16_t nr_of_srpts;
505   uint16_t zero_1;
506   uint32_t last_byte;
507   title_info_t *title;
508 } ATTRIBUTE_PACKED tt_srpt_t;
509 #define TT_SRPT_SIZE 8
510
511 /**
512  * Parental Management Information Unit Table.
513  */
514 typedef struct {
515   uint16_t country_code;
516   uint16_t zero_1;
517   uint16_t pf_ptl_mai_start_byte;
518   uint16_t zero_2;
519   /* uint16_t *pf_ptl_mai // table of nr_of_vtss+1 x 8 */
520 } ATTRIBUTE_PACKED ptl_mait_country_t;
521 #define PTL_MAIT_COUNTRY_SIZE 8
522
523 /**
524  * Parental Management Information Table.
525  */
526 typedef struct {
527   uint16_t nr_of_countries;
528   uint16_t nr_of_vtss;
529   uint32_t last_byte;
530   ptl_mait_country_t *countries;
531 } ATTRIBUTE_PACKED ptl_mait_t;
532 #define PTL_MAIT_SIZE 8
533
534 /**
535  * Video Title Set Attributes.
536  */
537 typedef struct {
538   uint32_t last_byte;
539   uint32_t vts_cat;
540   
541   video_attr_t vtsm_vobs_attr;
542   uint8_t  zero_1;
543   uint8_t  nr_of_vtsm_audio_streams; // should be 0 or 1
544   audio_attr_t vtsm_audio_attr;
545   audio_attr_t zero_2[7];  
546   uint8_t  zero_3[16];
547   uint8_t  zero_4;
548   uint8_t  nr_of_vtsm_subp_streams; // should be 0 or 1
549   subp_attr_t vtsm_subp_attr;
550   subp_attr_t zero_5[27];
551   
552   uint8_t  zero_6[2];
553   
554   video_attr_t vtstt_vobs_video_attr;
555   uint8_t  zero_7;
556   uint8_t  nr_of_vtstt_audio_streams;
557   audio_attr_t vtstt_audio_attr[8];
558   uint8_t  zero_8[16];
559   uint8_t  zero_9;
560   uint8_t  nr_of_vtstt_subp_streams;
561   subp_attr_t vtstt_subp_attr[32];
562 } ATTRIBUTE_PACKED vts_attributes_t;
563 #define VTS_ATTRIBUTES_SIZE 542
564 #define VTS_ATTRIBUTES_MIN_SIZE 356
565
566 /**
567  * Video Title Set Attribute Table.
568  */
569 typedef struct {
570   uint16_t nr_of_vtss;
571   uint16_t zero_1;
572   uint32_t last_byte;
573   vts_attributes_t *vts;
574 } ATTRIBUTE_PACKED vts_atrt_t;
575 #define VTS_ATRT_SIZE 8
576
577 /**
578  * Text Data. (Incomplete)
579  */
580 typedef struct {
581   uint32_t last_byte;    /* offsets are relative here */
582   uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */
583 #if 0  
584   uint16_t unknown; // 0x48 ?? 0x48 words (16bit) info following
585   uint16_t zero_1;
586   
587   uint8_t type_of_info;//?? 01 == disc, 02 == Title, 04 == Title part 
588   uint8_t unknown1;
589   uint8_t unknown2;
590   uint8_t unknown3;
591   uint8_t unknown4;//?? allways 0x30 language?, text format?
592   uint8_t unknown5;
593   uint16_t offset; // from first 
594   
595   char text[12]; // ended by 0x09
596 #endif
597 } ATTRIBUTE_PACKED txtdt_t;
598
599 /**
600  * Text Data Language Unit. (Incomplete)
601  */ 
602 typedef struct {
603   uint16_t lang_code;
604   uint16_t unknown;      /* 0x0001, title 1? disc 1? side 1? */
605   uint32_t txtdt_start_byte;  /* prt, rel start of vmg_txtdt_mgi  */
606   txtdt_t  *txtdt;
607 } ATTRIBUTE_PACKED txtdt_lu_t;
608 #define TXTDT_LU_SIZE 8
609
610 /**
611  * Text Data Manager Information. (Incomplete)
612  */
613 typedef struct {
614   char disc_name[14];            /* how many bytes?? */
615   uint16_t nr_of_language_units; /* 32bit??          */
616   uint32_t last_byte;
617   txtdt_lu_t *lu;
618 } ATTRIBUTE_PACKED txtdt_mgi_t;
619 #define TXTDT_MGI_SIZE 20
620
621
622 /**
623  * VTS
624  *
625  * Structures relating to the Video Title Set (VTS).
626  */
627
628 /**
629  * Video Title Set Information Management Table.
630  */
631 typedef struct {
632   char vts_identifier[12];
633   uint32_t vts_last_sector;
634   uint8_t  zero_1[12];
635   uint32_t vtsi_last_sector;
636   uint8_t  zero_2;
637   uint8_t  specification_version;
638   uint32_t vts_category;
639   uint16_t zero_3;
640   uint16_t zero_4;
641   uint8_t  zero_5;
642   uint8_t  zero_6[19];
643   uint16_t zero_7;
644   uint8_t  zero_8[32];
645   uint64_t zero_9;
646   uint8_t  zero_10[24];
647   uint32_t vtsi_last_byte;
648   uint32_t zero_11;
649   uint8_t  zero_12[56];
650   uint32_t vtsm_vobs;       /* sector */
651   uint32_t vtstt_vobs;      /* sector */
652   uint32_t vts_ptt_srpt;    /* sector */
653   uint32_t vts_pgcit;       /* sector */
654   uint32_t vtsm_pgci_ut;    /* sector */
655   uint32_t vts_tmapt;       /* sector */  // XXX: FIXME TODO Implement
656   uint32_t vtsm_c_adt;      /* sector */
657   uint32_t vtsm_vobu_admap; /* sector */
658   uint32_t vts_c_adt;       /* sector */
659   uint32_t vts_vobu_admap;  /* sector */
660   uint8_t  zero_13[24];
661   
662   video_attr_t vtsm_video_attr;
663   uint8_t  zero_14;
664   uint8_t  nr_of_vtsm_audio_streams; // should be 0 or 1
665   audio_attr_t vtsm_audio_attr;
666   audio_attr_t zero_15[7];
667   uint8_t  zero_16[17];
668   uint8_t  nr_of_vtsm_subp_streams; // should be 0 or 1
669   subp_attr_t vtsm_subp_attr;
670   subp_attr_t zero_17[27];
671   uint8_t  zero_18[2];
672   
673   video_attr_t vts_video_attr;
674   uint8_t  zero_19;
675   uint8_t  nr_of_vts_audio_streams;
676   audio_attr_t vts_audio_attr[8];
677   uint8_t  zero_20[17];
678   uint8_t  nr_of_vts_subp_streams;
679   subp_attr_t vts_subp_attr[32];
680   /* XXX: how much 'padding' here, if any? */
681 } ATTRIBUTE_PACKED vtsi_mat_t;
682
683 /**
684  * PartOfTitle Unit Information.
685  */
686 typedef struct {
687   uint16_t pgcn;
688   uint16_t pgn;
689 } ATTRIBUTE_PACKED ptt_info_t;
690
691 /**
692  * PartOfTitle Information.
693  */
694 typedef struct {
695   uint16_t nr_of_ptts;
696   ptt_info_t *ptt;
697 } ATTRIBUTE_PACKED ttu_t;
698
699 /**
700  * PartOfTitle Search Pointer Table.
701  */
702 typedef struct {
703   uint16_t nr_of_srpts;
704   uint16_t zero_1;
705   uint32_t last_byte;
706   ttu_t  *title;
707 } ATTRIBUTE_PACKED vts_ptt_srpt_t;
708 #define VTS_PTT_SRPT_SIZE 8
709
710
711 #if PRAGMA_PACK
712 #pragma pack()
713 #endif
714
715
716 /**
717  * The following structure defines an IFO file.  The structure is divided into
718  * two parts, the VMGI, or Video Manager Information, which is read from the
719  * VIDEO_TS.[IFO,BUP] file, and the VTSI, or Video Title Set Information, which
720  * is read in from the VTS_XX_0.[IFO,BUP] files.
721  */
722 typedef struct {
723   dvd_file_t *file;
724   
725   /* VMGI */
726   vmgi_mat_t     *vmgi_mat;
727   tt_srpt_t      *tt_srpt;
728   pgc_t          *first_play_pgc;    
729   ptl_mait_t     *ptl_mait;
730   vts_atrt_t     *vts_atrt;
731   txtdt_mgi_t    *txtdt_mgi;
732   
733   /* Common */
734   pgci_ut_t      *pgci_ut;
735   c_adt_t        *menu_c_adt;
736   vobu_admap_t   *menu_vobu_admap;
737   
738   /* VTSI */
739   vtsi_mat_t     *vtsi_mat;
740   vts_ptt_srpt_t *vts_ptt_srpt;
741   pgcit_t        *vts_pgcit;
742   int            *vts_tmapt; // FIXME add/correct the type
743   c_adt_t        *vts_c_adt;
744   vobu_admap_t   *vts_vobu_admap;
745 } ifo_handle_t;
746
747 #endif /* IFO_TYPES_H_INCLUDED */