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