2
* Copyright (C) 2000, 2001 Björn Englund <d4bjorn@dtek.chalmers.se>,
3
* Håkan Hjort <d95hjort@dtek.chalmers.se>
5
* This file is part of libdvdread.
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.
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.
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.
22
#ifndef LIBDVDREAD_IFO_TYPES_H
23
#define LIBDVDREAD_IFO_TYPES_H
26
#include "dvdread/dvd_reader.h"
29
#undef ATTRIBUTE_PACKED
30
#undef PRAGMA_PACK_BEGIN
31
#undef PRAGMA_PACK_END
34
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
35
#define ATTRIBUTE_PACKED __attribute__ ((packed))
40
#if !defined(ATTRIBUTE_PACKED)
41
#define ATTRIBUTE_PACKED
53
* The following structures are used in both the VMGI and VTSI.
58
* DVD Time Information.
64
uint8_t frame_u; /* The two high bits are the frame rate. */
65
} ATTRIBUTE_PACKED dvd_time_t;
68
* Type to store per-command data.
72
} ATTRIBUTE_PACKED vm_cmd_t;
73
#define COMMAND_DATA_SIZE 8U
80
unsigned char mpeg_version : 2;
81
unsigned char video_format : 2;
82
unsigned char display_aspect_ratio : 2;
83
unsigned char permitted_df : 2;
85
unsigned char line21_cc_1 : 1;
86
unsigned char line21_cc_2 : 1;
87
unsigned char unknown1 : 1;
88
unsigned char bit_rate : 1;
90
unsigned char picture_size : 2;
91
unsigned char letterboxed : 1;
92
unsigned char film_mode : 1;
93
} ATTRIBUTE_PACKED video_attr_t;
99
unsigned char audio_format : 3;
100
unsigned char multichannel_extension : 1;
101
unsigned char lang_type : 2;
102
unsigned char application_mode : 2;
104
unsigned char quantization : 2;
105
unsigned char sample_frequency : 2;
106
unsigned char unknown1 : 1;
107
unsigned char channels : 3;
109
uint8_t lang_extension;
110
uint8_t code_extension;
113
struct ATTRIBUTE_PACKED {
114
unsigned char unknown4 : 1;
115
unsigned char channel_assignment : 3;
116
unsigned char version : 2;
117
unsigned char mc_intro : 1; /* probably 0: true, 1:false */
118
unsigned char mode : 1; /* Karaoke mode 0: solo 1: duet */
120
struct ATTRIBUTE_PACKED {
121
unsigned char unknown5 : 4;
122
unsigned char dolby_encoded : 1; /* suitable for surround decoding */
123
unsigned char unknown6 : 3;
125
} ATTRIBUTE_PACKED app_info;
126
} ATTRIBUTE_PACKED audio_attr_t;
130
* MultiChannel Extension
133
unsigned int zero1 : 7;
134
unsigned int ach0_gme : 1;
136
unsigned int zero2 : 7;
137
unsigned int ach1_gme : 1;
139
unsigned int zero3 : 4;
140
unsigned int ach2_gv1e : 1;
141
unsigned int ach2_gv2e : 1;
142
unsigned int ach2_gm1e : 1;
143
unsigned int ach2_gm2e : 1;
145
unsigned int zero4 : 4;
146
unsigned int ach3_gv1e : 1;
147
unsigned int ach3_gv2e : 1;
148
unsigned int ach3_gmAe : 1;
149
unsigned int ach3_se2e : 1;
151
unsigned int zero5 : 4;
152
unsigned int ach4_gv1e : 1;
153
unsigned int ach4_gv2e : 1;
154
unsigned int ach4_gmBe : 1;
155
unsigned int ach4_seBe : 1;
157
} ATTRIBUTE_PACKED multichannel_ext_t;
161
* Subpicture Attributes.
165
* type: 0 not specified
168
* coding mode: 0 run length
171
* language: indicates language if type == 1
172
* lang extension: if type == 1 contains the lang extension
174
unsigned char code_mode : 3;
175
unsigned char zero1 : 3;
176
unsigned char type : 2;
179
uint8_t lang_extension;
180
uint8_t code_extension;
181
} ATTRIBUTE_PACKED subp_attr_t;
196
} ATTRIBUTE_PACKED pgc_command_tbl_t;
197
#define PGC_COMMAND_TBL_SIZE 8U
202
typedef uint8_t pgc_program_map_t;
205
* Cell Playback Information.
208
unsigned int block_mode : 2;
209
unsigned int block_type : 2;
210
unsigned int seamless_play : 1;
211
unsigned int interleaved : 1;
212
unsigned int stc_discontinuity: 1;
213
unsigned int seamless_angle : 1;
215
unsigned int playback_mode : 1; /**< When set, enter StillMode after each VOBU */
216
unsigned int restricted : 1; /**< ?? drop out of fastforward? */
217
unsigned int unknown2 : 6;
220
dvd_time_t playback_time;
221
uint32_t first_sector;
222
uint32_t first_ilvu_end_sector;
223
uint32_t last_vobu_start_sector;
224
uint32_t last_sector;
225
} ATTRIBUTE_PACKED cell_playback_t;
227
#define BLOCK_TYPE_NONE 0x0
228
#define BLOCK_TYPE_ANGLE_BLOCK 0x1
230
#define BLOCK_MODE_NOT_IN_BLOCK 0x0
231
#define BLOCK_MODE_FIRST_CELL 0x1
232
#define BLOCK_MODE_IN_BLOCK 0x2
233
#define BLOCK_MODE_LAST_CELL 0x3
236
* Cell Position Information.
242
} ATTRIBUTE_PACKED cell_position_t;
248
unsigned int zero : 7; /* 25-31 */
249
unsigned int video_pres_mode_change : 1; /* 24 */
251
unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */
252
unsigned int angle_change : 1;
253
unsigned int subpic_stream_change : 1;
254
unsigned int audio_stream_change : 1;
255
unsigned int pause_on : 1;
256
unsigned int still_off : 1;
257
unsigned int button_select_or_activate : 1;
258
unsigned int resume : 1; /* 16 */
260
unsigned int chapter_menu_call : 1; /* 15 */
261
unsigned int angle_menu_call : 1;
262
unsigned int audio_menu_call : 1;
263
unsigned int subpic_menu_call : 1;
264
unsigned int root_menu_call : 1;
265
unsigned int title_menu_call : 1;
266
unsigned int backward_scan : 1;
267
unsigned int forward_scan : 1; /* 8 */
269
unsigned int next_pg_search : 1; /* 7 */
270
unsigned int prev_or_top_pg_search : 1;
271
unsigned int time_or_chapter_search : 1;
272
unsigned int go_up : 1;
273
unsigned int stop : 1;
274
unsigned int title_play : 1;
275
unsigned int chapter_search_or_play : 1;
276
unsigned int title_or_time_play : 1; /* 0 */
277
} ATTRIBUTE_PACKED user_ops_t;
280
* Program Chain Information.
284
uint8_t nr_of_programs;
286
dvd_time_t playback_time;
287
user_ops_t prohibited_ops;
288
uint16_t audio_control[8]; /* New type? */
289
uint32_t subp_control[32]; /* New type? */
290
uint16_t next_pgc_nr;
291
uint16_t prev_pgc_nr;
292
uint16_t goup_pgc_nr;
294
uint8_t pg_playback_mode;
295
uint32_t palette[16]; /* New type struct {zero_1, Y, Cr, Cb} ? */
296
uint16_t command_tbl_offset;
297
uint16_t program_map_offset;
298
uint16_t cell_playback_offset;
299
uint16_t cell_position_offset;
300
pgc_command_tbl_t *command_tbl;
301
pgc_program_map_t *program_map;
302
cell_playback_t *cell_playback;
303
cell_position_t *cell_position;
304
} ATTRIBUTE_PACKED pgc_t;
305
#define PGC_SIZE 236U
308
* Program Chain Information Search Pointer.
312
unsigned int block_mode : 2;
313
unsigned int block_type : 2;
314
unsigned int unknown1 : 4;
315
uint16_t ptl_id_mask;
316
uint32_t pgc_start_byte;
318
} ATTRIBUTE_PACKED pgci_srp_t;
319
#define PGCI_SRP_SIZE 8U
322
* Program Chain Information Table.
325
uint16_t nr_of_pgci_srp;
328
pgci_srp_t *pgci_srp;
329
} ATTRIBUTE_PACKED pgcit_t;
330
#define PGCIT_SIZE 8U
333
* Menu PGCI Language Unit.
337
uint8_t lang_extension;
339
uint32_t lang_start_byte;
341
} ATTRIBUTE_PACKED pgci_lu_t;
342
#define PGCI_LU_SIZE 8U
345
* Menu PGCI Unit Table.
352
} ATTRIBUTE_PACKED pgci_ut_t;
353
#define PGCI_UT_SIZE 8U
356
* Cell Address Information.
362
uint32_t start_sector;
363
uint32_t last_sector;
364
} ATTRIBUTE_PACKED cell_adr_t;
367
* Cell Address Table.
370
uint16_t nr_of_vobs; /* VOBs */
373
cell_adr_t *cell_adr_table; /* No explicit size given. */
374
} ATTRIBUTE_PACKED c_adt_t;
375
#define C_ADT_SIZE 8U
382
uint32_t *vobu_start_sectors;
383
} ATTRIBUTE_PACKED vobu_admap_t;
384
#define VOBU_ADMAP_SIZE 4U
392
* The following structures relate to the Video Manager.
396
* Video Manager Information Management Table.
399
char vmg_identifier[12];
400
uint32_t vmg_last_sector;
402
uint32_t vmgi_last_sector;
404
uint8_t specification_version;
405
uint32_t vmg_category;
406
uint16_t vmg_nr_of_volumes;
407
uint16_t vmg_this_volume_nr;
410
uint16_t vmg_nr_of_title_sets; /* Number of VTSs. */
411
char provider_identifier[32];
412
uint64_t vmg_pos_code;
414
uint32_t vmgi_last_byte;
415
uint32_t first_play_pgc;
417
uint32_t vmgm_vobs; /* sector */
418
uint32_t tt_srpt; /* sector */
419
uint32_t vmgm_pgci_ut; /* sector */
420
uint32_t ptl_mait; /* sector */
421
uint32_t vts_atrt; /* sector */
422
uint32_t txtdt_mgi; /* sector */
423
uint32_t vmgm_c_adt; /* sector */
424
uint32_t vmgm_vobu_admap; /* sector */
427
video_attr_t vmgm_video_attr;
429
uint8_t nr_of_vmgm_audio_streams; /* should be 0 or 1 */
430
audio_attr_t vmgm_audio_attr;
431
audio_attr_t zero_8[7];
433
uint8_t nr_of_vmgm_subp_streams; /* should be 0 or 1 */
434
subp_attr_t vmgm_subp_attr;
435
subp_attr_t zero_10[27]; /* XXX: how much 'padding' here? */
436
} ATTRIBUTE_PACKED vmgi_mat_t;
439
unsigned int zero_1 : 1;
440
unsigned int multi_or_random_pgc_title : 1; /* 0: one sequential pgc title */
441
unsigned int jlc_exists_in_cell_cmd : 1;
442
unsigned int jlc_exists_in_prepost_cmd : 1;
443
unsigned int jlc_exists_in_button_cmd : 1;
444
unsigned int jlc_exists_in_tt_dom : 1;
445
unsigned int chapter_search_or_play : 1; /* UOP 1 */
446
unsigned int title_or_time_play : 1; /* UOP 0 */
447
} ATTRIBUTE_PACKED playback_type_t;
453
playback_type_t pb_ty;
454
uint8_t nr_of_angles;
456
uint16_t parental_id;
457
uint8_t title_set_nr;
459
uint32_t title_set_sector;
460
} ATTRIBUTE_PACKED title_info_t;
463
* PartOfTitle Search Pointer Table.
466
uint16_t nr_of_srpts;
470
} ATTRIBUTE_PACKED tt_srpt_t;
471
#define TT_SRPT_SIZE 8U
475
* Parental Management Information Unit Table.
476
* Level 1 (US: G), ..., 7 (US: NC-17), 8
478
#define PTL_MAIT_NUM_LEVEL 8
479
typedef uint16_t pf_level_t[PTL_MAIT_NUM_LEVEL];
482
* Parental Management Information Unit Table.
485
uint16_t country_code;
487
uint16_t pf_ptl_mai_start_byte;
489
pf_level_t *pf_ptl_mai; /* table of (nr_of_vtss + 1), video_ts is first */
490
} ATTRIBUTE_PACKED ptl_mait_country_t;
491
#define PTL_MAIT_COUNTRY_SIZE 8U
494
* Parental Management Information Table.
497
uint16_t nr_of_countries;
500
ptl_mait_country_t *countries;
501
} ATTRIBUTE_PACKED ptl_mait_t;
502
#define PTL_MAIT_SIZE 8U
505
* Video Title Set Attributes.
511
video_attr_t vtsm_vobs_attr;
513
uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */
514
audio_attr_t vtsm_audio_attr;
515
audio_attr_t zero_2[7];
518
uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */
519
subp_attr_t vtsm_subp_attr;
520
subp_attr_t zero_5[27];
524
video_attr_t vtstt_vobs_video_attr;
526
uint8_t nr_of_vtstt_audio_streams;
527
audio_attr_t vtstt_audio_attr[8];
530
uint8_t nr_of_vtstt_subp_streams;
531
subp_attr_t vtstt_subp_attr[32];
532
} ATTRIBUTE_PACKED vts_attributes_t;
533
#define VTS_ATTRIBUTES_SIZE 542U
534
#define VTS_ATTRIBUTES_MIN_SIZE 356U
537
* Video Title Set Attribute Table.
543
vts_attributes_t *vts;
544
uint32_t *vts_atrt_offsets; /* offsets table for each vts_attributes */
545
} ATTRIBUTE_PACKED vts_atrt_t;
546
#define VTS_ATRT_SIZE 8U
549
* Text Data. (Incomplete)
552
uint32_t last_byte; /* offsets are relative here */
553
uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */
555
uint16_t unknown; /* 0x48 ?? 0x48 words (16bit) info following */
558
uint8_t type_of_info; /* ?? 01 == disc, 02 == Title, 04 == Title part */
562
uint8_t unknown4; /* ?? allways 0x30 language?, text format? */
564
uint16_t offset; /* from first */
566
char text[12]; /* ended by 0x09 */
568
} ATTRIBUTE_PACKED txtdt_t;
571
* Text Data Language Unit. (Incomplete)
575
uint16_t unknown; /* 0x0001, title 1? disc 1? side 1? */
576
uint32_t txtdt_start_byte; /* prt, rel start of vmg_txtdt_mgi */
578
} ATTRIBUTE_PACKED txtdt_lu_t;
579
#define TXTDT_LU_SIZE 8U
582
* Text Data Manager Information. (Incomplete)
585
char disc_name[14]; /* how many bytes?? */
586
uint16_t nr_of_language_units; /* 32bit?? */
589
} ATTRIBUTE_PACKED txtdt_mgi_t;
590
#define TXTDT_MGI_SIZE 20U
596
* Structures relating to the Video Title Set (VTS).
600
* Video Title Set Information Management Table.
603
char vts_identifier[12];
604
uint32_t vts_last_sector;
606
uint32_t vtsi_last_sector;
608
uint8_t specification_version;
609
uint32_t vts_category;
618
uint32_t vtsi_last_byte;
621
uint32_t vtsm_vobs; /* sector */
622
uint32_t vtstt_vobs; /* sector */
623
uint32_t vts_ptt_srpt; /* sector */
624
uint32_t vts_pgcit; /* sector */
625
uint32_t vtsm_pgci_ut; /* sector */
626
uint32_t vts_tmapt; /* sector */
627
uint32_t vtsm_c_adt; /* sector */
628
uint32_t vtsm_vobu_admap; /* sector */
629
uint32_t vts_c_adt; /* sector */
630
uint32_t vts_vobu_admap; /* sector */
633
video_attr_t vtsm_video_attr;
635
uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */
636
audio_attr_t vtsm_audio_attr;
637
audio_attr_t zero_15[7];
639
uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */
640
subp_attr_t vtsm_subp_attr;
641
subp_attr_t zero_17[27];
644
video_attr_t vts_video_attr;
646
uint8_t nr_of_vts_audio_streams;
647
audio_attr_t vts_audio_attr[8];
649
uint8_t nr_of_vts_subp_streams;
650
subp_attr_t vts_subp_attr[32];
652
multichannel_ext_t vts_mu_audio_attr[8];
653
/* XXX: how much 'padding' here, if any? */
654
} ATTRIBUTE_PACKED vtsi_mat_t;
657
* PartOfTitle Unit Information.
662
} ATTRIBUTE_PACKED ptt_info_t;
665
* PartOfTitle Information.
670
} ATTRIBUTE_PACKED ttu_t;
673
* PartOfTitle Search Pointer Table.
676
uint16_t nr_of_srpts;
680
uint32_t *ttu_offset; /* offset table for each ttu */
681
} ATTRIBUTE_PACKED vts_ptt_srpt_t;
682
#define VTS_PTT_SRPT_SIZE 8U
688
/* Should this be bit field at all or just the uint32_t? */
689
typedef uint32_t map_ent_t;
695
uint8_t tmu; /* Time unit, in seconds */
697
uint16_t nr_of_entries;
699
} ATTRIBUTE_PACKED vts_tmap_t;
700
#define VTS_TMAP_SIZE 4U
706
uint16_t nr_of_tmaps;
710
uint32_t *tmap_offset; /* offset table for each tmap */
711
} ATTRIBUTE_PACKED vts_tmapt_t;
712
#define VTS_TMAPT_SIZE 8U
721
* The following structure defines an IFO file. The structure is divided into
722
* two parts, the VMGI, or Video Manager Information, which is read from the
723
* VIDEO_TS.[IFO,BUP] file, and the VTSI, or Video Title Set Information, which
724
* is read in from the VTS_XX_0.[IFO,BUP] files.
730
vmgi_mat_t *vmgi_mat;
732
pgc_t *first_play_pgc;
733
ptl_mait_t *ptl_mait;
734
vts_atrt_t *vts_atrt;
735
txtdt_mgi_t *txtdt_mgi;
740
vobu_admap_t *menu_vobu_admap;
743
vtsi_mat_t *vtsi_mat;
744
vts_ptt_srpt_t *vts_ptt_srpt;
746
vts_tmapt_t *vts_tmapt;
748
vobu_admap_t *vts_vobu_admap;
751
#endif /* LIBDVDREAD_IFO_TYPES_H */