libdvdread 7.0.1
ifo_types.h
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
27#include <dvdread/dvd_reader.h>
28
29#undef ATTRIBUTE_PACKED
30
31#if defined(__GNUC__)
32# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
33# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && !defined(__clang__)
34# define ATTRIBUTE_PACKED __attribute__ ((packed,gcc_struct))
35# else
36# define ATTRIBUTE_PACKED __attribute__ ((packed))
37# endif
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
57
58
62typedef struct {
63 uint8_t hour;
64 uint8_t minute;
65 uint8_t second;
66 uint8_t frame_u; /* The two high bits are the frame rate. */
67} ATTRIBUTE_PACKED dvd_time_t;
68#define DVD_TIME_SIZE 4U
69
73typedef struct {
74 uint8_t bytes[8];
75} ATTRIBUTE_PACKED vm_cmd_t;
76#define COMMAND_DATA_SIZE 8U
77
78
82typedef struct {
83 unsigned char mpeg_version : 2;
84 unsigned char video_format : 2;
85 unsigned char display_aspect_ratio : 2;
86 unsigned char permitted_df : 2;
87
88 unsigned char line21_cc_1 : 1;
89 unsigned char line21_cc_2 : 1;
90 unsigned char unknown1 : 1;
91 unsigned char bit_rate : 1;
92
93 unsigned char picture_size : 2;
94 unsigned char letterboxed : 1;
95 unsigned char film_mode : 1;
96} ATTRIBUTE_PACKED video_attr_t;
97#define VIDEO_ATTR_SIZE 2U
98
102typedef 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#define AUDIO_ATTR_SIZE 8U
132
133
137typedef struct {
138 unsigned char zero1 : 7;
139 unsigned char ach0_gme : 1;
140
141 unsigned char zero2 : 7;
142 unsigned char ach1_gme : 1;
143
144 unsigned char zero3 : 4;
145 unsigned char ach2_gv1e : 1;
146 unsigned char ach2_gv2e : 1;
147 unsigned char ach2_gm1e : 1;
148 unsigned char ach2_gm2e : 1;
149
150 unsigned char zero4 : 4;
151 unsigned char ach3_gv1e : 1;
152 unsigned char ach3_gv2e : 1;
153 unsigned char ach3_gmAe : 1;
154 unsigned char ach3_se2e : 1;
155
156 unsigned char zero5 : 4;
157 unsigned char ach4_gv1e : 1;
158 unsigned char ach4_gv2e : 1;
159 unsigned char ach4_gmBe : 1;
160 unsigned char ach4_seBe : 1;
161 uint8_t zero6[19];
162} ATTRIBUTE_PACKED multichannel_ext_t;
163#define MULTICHANNEL_EXT_SIZE 24U
164
165
169typedef struct {
170 /*
171 * type: 0 not specified
172 * 1 language
173 * 2 other
174 * coding mode: 0 run length
175 * 1 extended
176 * 2 other
177 * language: indicates language if type == 1
178 * lang extension: if type == 1 contains the lang extension
179 */
180 unsigned char code_mode : 3;
181 unsigned char zero1 : 3;
182 unsigned char type : 2;
183 uint8_t zero2;
184 uint16_t lang_code;
185 uint8_t lang_extension;
186 uint8_t code_extension;
187} ATTRIBUTE_PACKED subp_attr_t;
188#define SUBP_ATTR_SIZE 6U
189
190
191
195typedef struct {
196 uint16_t nr_of_pre;
197 uint16_t nr_of_post;
198 uint16_t nr_of_cell;
199 uint16_t last_byte;
200 vm_cmd_t *pre_cmds;
201 vm_cmd_t *post_cmds;
202 vm_cmd_t *cell_cmds;
203} ATTRIBUTE_PACKED pgc_command_tbl_t;
204#define PGC_COMMAND_TBL_SIZE 8U
205
209typedef uint8_t pgc_program_map_t;
210
214typedef struct {
215 unsigned char block_mode : 2;
216 unsigned char block_type : 2;
217 unsigned char seamless_play : 1;
218 unsigned char interleaved : 1;
219 unsigned char stc_discontinuity: 1;
220 unsigned char seamless_angle : 1;
221 unsigned char zero_1 : 1;
222 unsigned char playback_mode : 1;
223 unsigned char restricted : 1;
224 unsigned char cell_type : 5;
225 uint8_t still_time;
226 uint8_t cell_cmd_nr;
227 dvd_time_t playback_time;
228 uint32_t first_sector;
229 uint32_t first_ilvu_end_sector;
230 uint32_t last_vobu_start_sector;
231 uint32_t last_sector;
232} ATTRIBUTE_PACKED cell_playback_t;
233#define CELL_PLAYBACK_SIZE 24U
234
235#define BLOCK_TYPE_NONE 0x0
236#define BLOCK_TYPE_ANGLE_BLOCK 0x1
237
238#define BLOCK_MODE_NOT_IN_BLOCK 0x0
239#define BLOCK_MODE_FIRST_CELL 0x1
240#define BLOCK_MODE_IN_BLOCK 0x2
241#define BLOCK_MODE_LAST_CELL 0x3
242
246typedef struct {
247 uint16_t vob_id_nr;
248 uint8_t zero_1;
249 uint8_t cell_nr;
250} ATTRIBUTE_PACKED cell_position_t;
251#define CELL_POSITION_SIZE 4U
252
256typedef struct {
257 unsigned char zero : 7; /* 25-31 */
258 unsigned char video_pres_mode_change : 1; /* 24 */
259
260 unsigned char karaoke_audio_pres_mode_change : 1; /* 23 */
261 unsigned char angle_change : 1;
262 unsigned char subpic_stream_change : 1;
263 unsigned char audio_stream_change : 1;
264 unsigned char pause_on : 1;
265 unsigned char still_off : 1;
266 unsigned char button_select_or_activate : 1;
267 unsigned char resume : 1; /* 16 */
268
269 unsigned char chapter_menu_call : 1; /* 15 */
270 unsigned char angle_menu_call : 1;
271 unsigned char audio_menu_call : 1;
272 unsigned char subpic_menu_call : 1;
273 unsigned char root_menu_call : 1;
274 unsigned char title_menu_call : 1;
275 unsigned char backward_scan : 1;
276 unsigned char forward_scan : 1; /* 8 */
277
278 unsigned char next_pg_search : 1; /* 7 */
279 unsigned char prev_or_top_pg_search : 1;
280 unsigned char time_or_chapter_search : 1;
281 unsigned char go_up : 1;
282 unsigned char stop : 1;
283 unsigned char title_play : 1;
284 unsigned char chapter_search_or_play : 1;
285 unsigned char title_or_time_play : 1; /* 0 */
286} ATTRIBUTE_PACKED user_ops_t;
287#define USER_OPS_SIZE 4U
288
292typedef struct {
293 uint16_t zero_1;
294 uint8_t nr_of_programs;
295 uint8_t nr_of_cells;
296 dvd_time_t playback_time;
297 user_ops_t prohibited_ops;
298 uint16_t audio_control[8]; /* New type? */
299 uint32_t subp_control[32]; /* New type? */
300 uint16_t next_pgc_nr;
301 uint16_t prev_pgc_nr;
302 uint16_t goup_pgc_nr;
303 uint8_t pg_playback_mode;
304 uint8_t still_time;
305 uint32_t palette[16]; /* New type struct {zero_1, Y, Cr, Cb} ? */
306 uint16_t command_tbl_offset;
307 uint16_t program_map_offset;
308 uint16_t cell_playback_offset;
309 uint16_t cell_position_offset;
310 pgc_command_tbl_t *command_tbl;
311 pgc_program_map_t *program_map;
312 cell_playback_t *cell_playback;
313 cell_position_t *cell_position;
314 int ref_count;
315} ATTRIBUTE_PACKED pgc_t;
316#define PGC_SIZE 236U
317
321typedef struct {
322 uint8_t entry_id;
323 unsigned char block_mode : 2;
324 unsigned char block_type : 2;
325 unsigned char zero_1 : 4;
326 uint16_t ptl_id_mask;
327 uint32_t pgc_start_byte;
328 pgc_t *pgc;
329} ATTRIBUTE_PACKED pgci_srp_t;
330#define PGCI_SRP_SIZE 8U
331
335typedef 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 int ref_count;
341} ATTRIBUTE_PACKED pgcit_t;
342#define PGCIT_SIZE 8U
343
347typedef struct {
348 uint16_t lang_code;
349 uint8_t lang_extension;
350 uint8_t exists;
351 uint32_t lang_start_byte;
352 pgcit_t *pgcit;
353} ATTRIBUTE_PACKED pgci_lu_t;
354#define PGCI_LU_SIZE 8U
355
359typedef struct {
360 uint16_t nr_of_lus;
361 uint16_t zero_1;
362 uint32_t last_byte;
363 pgci_lu_t *lu;
364} ATTRIBUTE_PACKED pgci_ut_t;
365#define PGCI_UT_SIZE 8U
366
370typedef struct {
371 uint16_t vob_id;
372 uint8_t cell_id;
373 uint8_t zero_1;
374 uint32_t start_sector;
375 uint32_t last_sector;
376} ATTRIBUTE_PACKED cell_adr_t;
377#define CELL_ADDR_SIZE 12U
378
382typedef struct {
383 uint16_t nr_of_vobs; /* VOBs */
384 uint16_t zero_1;
385 uint32_t last_byte;
386 cell_adr_t *cell_adr_table; /* No explicit size given. */
387} ATTRIBUTE_PACKED c_adt_t;
388#define C_ADT_SIZE 8U
389
393typedef struct {
394 uint32_t last_byte;
395 uint32_t *vobu_start_sectors;
396} ATTRIBUTE_PACKED vobu_admap_t;
397#define VOBU_ADMAP_SIZE 4U
398
399
400
401
407
411typedef struct {
412 char vmg_identifier[12];
413 uint32_t vmg_last_sector;
414 uint8_t zero_1[12];
415 uint32_t vmgi_last_sector;
416 uint8_t zero_2;
417 uint8_t specification_version;
418 uint32_t vmg_category;
419 uint16_t vmg_nr_of_volumes;
420 uint16_t vmg_this_volume_nr;
421 uint8_t disc_side;
422 uint8_t zero_3[19];
423 uint16_t vmg_nr_of_title_sets; /* Number of VTSs. */
424 char provider_identifier[32];
425 uint64_t vmg_pos_code;
426 uint8_t zero_4[24];
427 uint32_t vmgi_last_byte;
428 uint32_t first_play_pgc;
429 uint8_t zero_5[56];
430 uint32_t vmgm_vobs; /* sector */
431 uint32_t tt_srpt; /* sector */
432 uint32_t vmgm_pgci_ut; /* sector */
433 uint32_t ptl_mait; /* sector */
434 uint32_t vts_atrt; /* sector */
435 uint32_t txtdt_mgi; /* sector */
436 uint32_t vmgm_c_adt; /* sector */
437 uint32_t vmgm_vobu_admap; /* sector */
438 uint8_t zero_6[32];
439
440 video_attr_t vmgm_video_attr;
441 uint8_t zero_7;
442 uint8_t nr_of_vmgm_audio_streams; /* should be 0 or 1 */
443 audio_attr_t vmgm_audio_attr;
444 audio_attr_t zero_8[7];
445 uint8_t zero_9[17];
446 uint8_t nr_of_vmgm_subp_streams; /* should be 0 or 1 */
447 subp_attr_t vmgm_subp_attr;
448 subp_attr_t zero_10[27]; /* XXX: how much 'padding' here? */
449} ATTRIBUTE_PACKED vmgi_mat_t;
450#define VMGI_MAT_SIZE 510U
451
452/* Downmix coefficients can be used to reduce 5.1 channels to stereo in DVD-Audio Discs */
473
474typedef struct {
475 /* it seems each entry is started and ended with padding */
476 uint16_t zero_1;
477 /* each coefficient corresponds to stereo side for a channel in 5.1 */
478 uint8_t Lf_left;
479 uint8_t Lf_right;
480 uint8_t Rf_left;
481 uint8_t Rf_right;
482 uint8_t C_left;
483 uint8_t C_right;
484 uint8_t LFE_left;
485 uint8_t LFE_right;
486 uint8_t Ls_left;
487 uint8_t Ls_right;
488 uint8_t Rs_left;
489 uint8_t Rs_right;
490
491 uint16_t zero_2;
492} ATTRIBUTE_PACKED downmix_coeff_t;
493#define DOWNMIX_COEFF_SIZE 16U
494
495
501
505
506typedef struct {
507 uint16_t zero_1;
508 uint8_t group_num;
509 uint8_t chapter_num; /* chapter number within group*/
510 uint32_t timestamp_pts; /* this is MPEG time, Not DVD time */
511 uint32_t chapter_len;
512 uint32_t zero_2;
513 uint8_t record_code;
514 uint8_t bit_depth;
515 uint8_t sampling_rate;
516 uint8_t nr_channels;
517 /* some DVD's made with authoring software keep downmix coefficients here */
518 /* since I do not have samples of commercial discs that do this, I will not include it */
519 uint8_t zero_3[20];
520 uint32_t start_sector_1; /*aob start sector*/
521 uint32_t start_sector_2; /*aob start sector is repeated again */
522 uint32_t end_sector;
523} ATTRIBUTE_PACKED samg_chapter_t;
524#define SAMG_CHAPTER_SIZE 52U
525
526typedef struct {
527 char samg_identifier[12];
528 uint16_t nr_chapters;
529 uint16_t specification_version;
530 samg_chapter_t *samg_chapters;
531} ATTRIBUTE_PACKED samg_mat_t;
532#define SAMG_MAT_SIZE 16U
533
539
543typedef struct {
544 char amg_identifier[12];
545 uint32_t amg_start_sector;
546 uint8_t zero_1[12];
547 uint32_t amgi_last_sector;
548 uint16_t specification_version;
549 uint8_t zero_2[4];
550 uint16_t amg_nr_of_volumes;
551 uint16_t amg_this_volume_nr;
552 uint8_t disc_side;
553 uint8_t zero_3[4];
554 uint8_t autoplay;
555 uint32_t audio_sv_ifo_relative_p;
556 uint16_t unknown_1; /* some discs have a value here, undocumented in DVD-Audio specs */
557 uint8_t zero_4[8];
558 uint8_t vmg_nr_of_title_sets; /* Number of video titlesets in audio zone. */
559 uint8_t amg_nr_of_title_sets; /* Number of audio titlesets in audio zone. */
560 uint8_t unknown_2[32]; /* may be set to zeros */
561 uint8_t unknown_3[8]; /* may be set to zeros */
562 uint8_t zero_5[24];
563 uint32_t amg_end_byte_address;
564 uint8_t unknown_4[4]; /* may be set to zeros */
565 uint8_t zero_6[56];
566 uint16_t menu_prescence_1; /* may be set to zero, or some other value, optional field*/
567 uint8_t unknown_5[4];
568 uint16_t unknown_6; /* should be 0x01 */
569 uint8_t zero_7[2];
570 uint16_t amg_nr_of_zones; /* may be set to 0x02*/
571 uint8_t zero_8[2];
572 uint16_t menu_prescence_2; /* may be set to 0x03*/
573 uint8_t zero_9[48];
574 uint8_t last_sector_audio_sys_space;
575 uint8_t zero_10[79];
576 uint8_t menu_prescence_3; /* will be set to 0x01*/
577 /* XXX lots of padding after this to complete the sector*/
578} ATTRIBUTE_PACKED amgi_mat_t;
579#define AMGI_MAT_SIZE 337U
580
581/* Sector 2 may have video tracks, sector 3 will not. If there are no video tracks the tables will be the same*/
582
583/*this struct repeats for every audio or video track*/
584typedef struct {
585 uint8_t type_and_rank; /*first nibble is type, second rank, from 1-9*/
586 uint8_t nr_chapters_in_title;
587 uint8_t nr_visible_chapters_in_vts_title; /* this will be zeros in an audio record */
588 uint8_t zero_1;
589 uint32_t len_audio_zone_pts; /* this is MPEG time, Not DVD time */
590
591 uint8_t group_property; /* in a video track, this is video titleset number, in audio its rank of group */
592 uint8_t title_property; /* in video track this is title number , in audio track this is rank of title*/
593 uint32_t ts_pointer_relative_sector; /* for ats or vts*/
594} ATTRIBUTE_PACKED track_info_t;
595#define TRACK_INFO_SIZE 14U
596
597typedef struct {
598 uint16_t nr_of_titles;
599 uint16_t last_byte_in_table;
600 track_info_t *tracks_info;
601} ATTRIBUTE_PACKED tracks_info_table_t;
602#define TRACKS_INFO_TABLE_SIZE 4U
603
604
605typedef struct {
606 unsigned char zero_1 : 1;
607 unsigned char multi_or_random_pgc_title : 1; /* 0: one sequential pgc title */
608 unsigned char jlc_exists_in_cell_cmd : 1;
609 unsigned char jlc_exists_in_prepost_cmd : 1;
610 unsigned char jlc_exists_in_button_cmd : 1;
611 unsigned char jlc_exists_in_tt_dom : 1;
612 unsigned char chapter_search_or_play : 1; /* UOP 1 */
613 unsigned char title_or_time_play : 1; /* UOP 0 */
614} ATTRIBUTE_PACKED playback_type_t;
615#define PLAYBACK_TYPE_SIZE 1U
616
620typedef struct {
621 playback_type_t pb_ty;
622 uint8_t nr_of_angles;
623 uint16_t nr_of_ptts;
624 uint16_t parental_id;
625 uint8_t title_set_nr;
626 uint8_t vts_ttn;
627 uint32_t title_set_sector;
628} ATTRIBUTE_PACKED title_info_t;
629#define TITLE_INFO_SIZE 12U
630
634typedef struct {
635 uint16_t nr_of_srpts;
636 uint16_t zero_1;
637 uint32_t last_byte;
638 title_info_t *title;
639} ATTRIBUTE_PACKED tt_srpt_t;
640#define TT_SRPT_SIZE 8U
641
642
647#define PTL_MAIT_NUM_LEVEL 8
648typedef uint16_t pf_level_t[PTL_MAIT_NUM_LEVEL];
649
653typedef struct {
654 uint16_t country_code;
655 uint16_t zero_1;
656 uint16_t pf_ptl_mai_start_byte;
657 uint16_t zero_2;
658 pf_level_t *pf_ptl_mai; /* table of (nr_of_vtss + 1), video_ts is first */
659} ATTRIBUTE_PACKED ptl_mait_country_t;
660#define PTL_MAIT_COUNTRY_SIZE 8U
661
665typedef struct {
666 uint16_t nr_of_countries;
667 uint16_t nr_of_vtss;
668 uint32_t last_byte;
669 ptl_mait_country_t *countries;
670} ATTRIBUTE_PACKED ptl_mait_t;
671#define PTL_MAIT_SIZE 8U
672
676typedef struct {
677 uint32_t last_byte;
678 uint32_t vts_cat;
679
680 video_attr_t vtsm_vobs_attr;
681 uint8_t zero_1;
682 uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */
683 audio_attr_t vtsm_audio_attr;
684 audio_attr_t zero_2[7];
685 uint8_t zero_3[16];
686 uint8_t zero_4;
687 uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */
688 subp_attr_t vtsm_subp_attr;
689 subp_attr_t zero_5[27];
690
691 uint8_t zero_6[2];
692
693 video_attr_t vtstt_vobs_video_attr;
694 uint8_t zero_7;
695 uint8_t nr_of_vtstt_audio_streams;
696 audio_attr_t vtstt_audio_attr[8];
697 uint8_t zero_8[16];
698 uint8_t zero_9;
699 uint8_t nr_of_vtstt_subp_streams;
700 subp_attr_t vtstt_subp_attr[32];
701} ATTRIBUTE_PACKED vts_attributes_t;
702#define VTS_ATTRIBUTES_SIZE 542U
703#define VTS_ATTRIBUTES_MIN_SIZE 356U
704
708typedef struct {
709 uint16_t nr_of_vtss;
710 uint16_t zero_1;
711 uint32_t last_byte;
712 vts_attributes_t *vts;
713 uint32_t *vts_atrt_offsets; /* offsets table for each vts_attributes */
714} ATTRIBUTE_PACKED vts_atrt_t;
715#define VTS_ATRT_SIZE 8U
716
720typedef struct {
721 uint32_t last_byte; /* offsets are relative here */
722 uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */
723#if 0
724 uint16_t unknown; /* 0x48 ?? 0x48 words (16bit) info following */
725 uint16_t zero_1;
726
727 uint8_t type_of_info; /* ?? 01 == disc, 02 == Title, 04 == Title part */
728 uint8_t unknown1;
729 uint8_t unknown2;
730 uint8_t unknown3;
731 uint8_t unknown4; /* ?? always 0x30 language?, text format? */
732 uint8_t unknown5;
733 uint16_t offset; /* from first */
734
735 char text[12]; /* ended by 0x09 */
736#endif
737} ATTRIBUTE_PACKED txtdt_t;
738#define TXTDT_SIZE 204U
739
743typedef struct {
744 uint16_t lang_code;
745 uint8_t zero_1;
746 uint8_t char_set; /* 0x00 reserved Unicode, 0x01 ISO 646, 0x10 JIS Roman & JIS Kanji, 0x11 ISO 8859-1, 0x12 Shift JIS Kanji */
747 uint32_t txtdt_start_byte; /* prt, rel start of vmg_txtdt_mgi */
748 txtdt_t *txtdt;
749} ATTRIBUTE_PACKED txtdt_lu_t;
750#define TXTDT_LU_SIZE 8U
751
755typedef struct {
756 char disc_name[12];
757 uint16_t unknown1;
758 uint16_t nr_of_language_units;
759 uint32_t last_byte;
760 txtdt_lu_t *lu;
761} ATTRIBUTE_PACKED txtdt_mgi_t;
762#define TXTDT_MGI_SIZE 20U
763
764
770
774typedef struct {
775 char vts_identifier[12];
776 uint32_t vts_last_sector;
777 uint8_t zero_1[12];
778 uint32_t vtsi_last_sector;
779 uint8_t zero_2;
780 uint8_t specification_version;
781 uint32_t vts_category;
782 uint16_t zero_3;
783 uint16_t zero_4;
784 uint8_t zero_5;
785 uint8_t zero_6[19];
786 uint16_t zero_7;
787 uint8_t zero_8[32];
788 uint64_t zero_9;
789 uint8_t zero_10[24];
790 uint32_t vtsi_last_byte;
791 uint32_t zero_11;
792 uint8_t zero_12[56];
793 uint32_t vtsm_vobs; /* sector */
794 uint32_t vtstt_vobs; /* sector */
795 uint32_t vts_ptt_srpt; /* sector */
796 uint32_t vts_pgcit; /* sector */
797 uint32_t vtsm_pgci_ut; /* sector */
798 uint32_t vts_tmapt; /* sector */
799 uint32_t vtsm_c_adt; /* sector */
800 uint32_t vtsm_vobu_admap; /* sector */
801 uint32_t vts_c_adt; /* sector */
802 uint32_t vts_vobu_admap; /* sector */
803 uint8_t zero_13[24];
804
805 video_attr_t vtsm_video_attr;
806 uint8_t zero_14;
807 uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */
808 audio_attr_t vtsm_audio_attr;
809 audio_attr_t zero_15[7];
810 uint8_t zero_16[17];
811 uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */
812 subp_attr_t vtsm_subp_attr;
813 subp_attr_t zero_17[27];
814 uint8_t zero_18[2];
815
816 video_attr_t vts_video_attr;
817 uint8_t zero_19;
818 uint8_t nr_of_vts_audio_streams;
819 audio_attr_t vts_audio_attr[8];
820 uint8_t zero_20[17];
821 uint8_t nr_of_vts_subp_streams;
822 subp_attr_t vts_subp_attr[32];
823 uint16_t zero_21;
824 multichannel_ext_t vts_mu_audio_attr[8];
825 /* XXX: how much 'padding' here, if any? */
826} ATTRIBUTE_PACKED vtsi_mat_t;
827#define VTSI_MAT_SIZE 984U
828
829
830typedef struct {
831 /* 0x0000 for lpcm or 0x0100 for mlp, DTS seems to be 0x0500 and has different fields*/
832 uint8_t encoding;
833 uint8_t unknown1;
834 /* for stereo 0f 16 bit, 1f 20 bit, 2f 24 bit*/
835 /* f is a placeholder for the nibbles that is used for channel groups*/
836 /* otherwise if its 5.1 channels each nibble represents a channel group (G1, G2),*/
837 uint8_t bitrate;
838 /* 8f 44khz, 0f 48khz, 1f 96khz, 2f 192khz*/
839 /* otherwise if its 5.1 channels each nibble represents a channel group (G1, G2)*/
840 uint8_t sampling_frequency;
841 /* 00 1 channel, 01 2 channels, 11 5.1 channels*/
842 uint8_t nr_channels;
843 uint8_t unknown2;
844 uint8_t zero[10];
845} ATTRIBUTE_PACKED atsi_record_t;
846#define ATSI_RECORD_SIZE 16U
847
853
857#define ATSI_RECORD_MAX_SIZE 8
858#define DOWNMIX_COEFF_MAX_SIZE 16
859
860typedef struct {
861 char ats_identifier[12];
862 uint32_t ats_last_sector; /* last sector of ATS_XX_0.BUP*/
863 uint8_t zero_1[12];
864 uint32_t atsi_last_sector; /* last sector of ATS_XX_0.IFO*/
865 uint16_t specification_version;
866 uint32_t unknown_1;
867 uint8_t zero_2[90];
868 uint32_t atsi_last_byte;
869 uint8_t zero_3[60];
870 uint32_t vtsm_vobs; /* may be zeros */
871 uint32_t atst_aobs; /* atst or vtst */
872 uint32_t vts_ptt_srpt; /* may be zeros */
873 uint32_t ats_pgci_ut; /* sector */
874 uint32_t vtsm_pgci_ut; /* may be zeros */
875 uint32_t vts_tmapt; /* sector */
876 uint32_t vtsm_c_adt; /* sector */
877 uint32_t vtsm_vobu_admap; /* sector */
878 uint32_t vts_c_adt; /* sector */
879 uint32_t vts_vobu_admap; /* sector */
880 uint8_t zero_4[24];
881 /* the majority, or even all of these entries may be zero*/
882 atsi_record_t atsi_record[ATSI_RECORD_MAX_SIZE];
883 downmix_coeff_t downmix_coefficients[DOWNMIX_COEFF_MAX_SIZE];
884} ATTRIBUTE_PACKED atsi_mat_t;
885#define ATSI_MAT_SIZE 640U
886
887typedef struct {
888 uint16_t unknown_1; /* appears to be index, +0x100 for each iter*/
889 uint16_t unkown_2; /* either 0x0000 or 0x0100*/
890 uint32_t offset_record_table;
891} ATTRIBUTE_PACKED atsi_title_index_t;
892#define ATSI_TITLE_INDEX_SIZE 8U
893
894/* this will be repeated for each track in each title*/
895typedef struct {
896 uint16_t unknown_1; /* will be 0x0000*/
897 uint16_t unknown_2; /* will be 0x0000*/
898 uint8_t track_number_in_title;
899 uint8_t unknown_3; /* will be 0x00*/
900 uint32_t first_pts_of_track; /* this is MPEG time, Not DVD time */
901
902 uint32_t length_pts_of_track; /* this is MPEG time, Not DVD time */
903
904 uint8_t zero[6];
905} ATTRIBUTE_PACKED atsi_track_timestamp_t;
906#define ATSI_TRACK_TIMESTAMP_SIZE 20U
907
908/* this will come after all of the track timstamps, a set of 12byte sector pointer records. One for each track*/
909typedef struct {
910 uint32_t unknown_1; /* will be 0x01000000*/
911 uint32_t start_sector; /* relative to first AOB file*/
912 uint32_t end_sector; /* relative to first end of AOB file */
913} ATTRIBUTE_PACKED atsi_track_pointer_t;
914#define ATSI_TRACK_POINTER_SIZE 12U
915
916typedef struct {
917 uint16_t unknown_1; /* will be 0x0000*/
918 uint8_t nr_tracks; /* unsure if this holds up for other files*/
919 uint8_t nr_pointer_records; /* unsure if this holds up for other files*/
920 uint32_t length_pts; /* this is MPEG time, Not DVD time */
921
922 uint16_t unknown_3; /* will be 0x0000*/
923 uint16_t unknown_4; /* will be 0x0010*/
924 uint16_t start_sector_pointers_table; /* pointer to start of sector pointers table, relative to start of title record*/
925 uint16_t unknown_5; /* will be 0x0000*/
926 atsi_track_timestamp_t *atsi_track_timestamp_rows; /*length determined by nr_tracks*/
927 atsi_track_pointer_t *atsi_track_pointer_rows;
928} ATTRIBUTE_PACKED atsi_title_record_t;
929#define ATSI_TITLE_ROW_TABLE_SIZE 16U
930
931typedef struct {
932 uint16_t nr_titles;
933 uint16_t zero_1;
934 uint32_t last_byte_address;
935 atsi_title_index_t *atsi_index_rows; /* length determined by nr_titles*/
936 atsi_title_record_t *atsi_title_row_tables; /* length determined by nr_titles*/
937} ATTRIBUTE_PACKED atsi_title_table_t;
938#define ATSI_TITLE_TABLE_SIZE 8U
939
943typedef struct {
944 uint16_t pgcn;
945 uint16_t pgn;
946} ATTRIBUTE_PACKED ptt_info_t;
947#define PTT_INFO_SIZE 4U
948
952typedef struct {
953 uint16_t nr_of_ptts;
954 ptt_info_t *ptt;
955} ATTRIBUTE_PACKED ttu_t;
956#define TTU_SIZE 2U
957
961typedef struct {
962 uint16_t nr_of_srpts;
963 uint16_t zero_1;
964 uint32_t last_byte;
965 ttu_t *title;
966 uint32_t *ttu_offset; /* offset table for each ttu */
967} ATTRIBUTE_PACKED vts_ptt_srpt_t;
968#define VTS_PTT_SRPT_SIZE 8U
969
970
974/* Should this be bit field at all or just the uint32_t? */
975typedef uint32_t map_ent_t;
976
980typedef struct {
981 uint8_t tmu; /* Time unit, in seconds */
982 uint8_t zero_1;
983 uint16_t nr_of_entries;
984 map_ent_t *map_ent;
985} ATTRIBUTE_PACKED vts_tmap_t;
986#define VTS_TMAP_SIZE 4U
987
991typedef struct {
992 uint16_t nr_of_tmaps;
993 uint16_t zero_1;
994 uint32_t last_byte;
995 vts_tmap_t *tmap;
996 uint32_t *tmap_offset; /* offset table for each tmap */
997} ATTRIBUTE_PACKED vts_tmapt_t;
998#define VTS_TMAPT_SIZE 8U
999
1000
1001#if PRAGMA_PACK
1002#pragma pack()
1003#endif
1004
1005
1012
1013typedef enum{
1014 IFO_UNKNOWN,
1015 IFO_VIDEO,
1016 IFO_AUDIO
1017} ifo_format_t;
1018
1019/* format type will be used in order to reduce ammount of code refactoring, hopefully add some
1020 * detection mechanism later as well.
1021 * */
1022typedef struct {
1023
1024
1025 union{
1026 struct{
1027 /* VMGI */
1028 vmgi_mat_t *vmgi_mat;
1029 tt_srpt_t *tt_srpt;
1030 pgc_t *first_play_pgc;
1031 ptl_mait_t *ptl_mait;
1032 vts_atrt_t *vts_atrt;
1033 txtdt_mgi_t *txtdt_mgi;
1034
1035 /* Common */
1036 pgci_ut_t *pgci_ut;
1037 c_adt_t *menu_c_adt;
1038 vobu_admap_t *menu_vobu_admap;
1039
1040 /* VTSI */
1041 vtsi_mat_t *vtsi_mat;
1042 vts_ptt_srpt_t *vts_ptt_srpt;
1043 pgcit_t *vts_pgcit;
1044 vts_tmapt_t *vts_tmapt;
1045 c_adt_t *vts_c_adt;
1046 vobu_admap_t *vts_vobu_admap;
1047 };
1048
1049 struct{
1050 /* SAMG */
1051 samg_mat_t *samg_mat;
1052
1053 /* AMGI */
1054 amgi_mat_t *amgi_mat;
1055 tracks_info_table_t *info_table_first_sector;
1056 tracks_info_table_t *info_table_second_sector;
1057
1058 /* ATSI */
1059 atsi_mat_t *atsi_mat;
1060 atsi_title_table_t *atsi_title_table;
1061 };
1062
1063 };
1064
1065 ifo_format_t ifo_format;
1066
1067} ifo_handle_t;
1068
1069#endif /* LIBDVDREAD_IFO_TYPES_H */
unsigned char zero1
Definition ifo_types.h:138
uint8_t still_time
Definition ifo_types.h:225
unsigned char zero3
Definition ifo_types.h:144
unsigned char zero4
Definition ifo_types.h:150
unsigned char zero2
Definition ifo_types.h:141
unsigned char restricted
Definition ifo_types.h:223
unsigned char playback_mode
Definition ifo_types.h:222
Definition ifo_types.h:1022