1
/*****************************************************************************
2
* dvd_ifo.h: Structures for ifo parsing
3
*****************************************************************************
4
* Copyright (C) 1999-2001 VideoLAN
5
* $Id: dvd_ifo.h,v 1.17 2001/06/12 22:14:44 sam Exp $
7
* Author: Stļæ½phane Borel <stef@via.ecp.fr>
10
* - libifo by Thomas Mirlacher <dent@cosy.sbg.ac.at>
11
* - IFO structure documentation by Thomas Mirlacher, Bjļæ½rn Englund,
14
* This program is free software; you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License as published by
16
* the Free Software Foundation; either version 2 of the License, or
17
* (at your option) any later version.
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
27
*****************************************************************************/
29
/*****************************************************************************
30
* Common structures for Video Management and Video Title sets
31
*****************************************************************************/
34
* Program Chain structures
36
typedef struct ifo_video_s
38
u8 i_compression ;// 2;
41
u8 i_perm_displ ;// 2;
45
u8 i_source_res ;// 2;
46
u8 i_letterboxed ;// 1;
50
/* Audio type information */
51
typedef struct ifo_audio_s
53
u8 i_coding_mode ;// 3;
54
u8 i_multichannel_extension ;// 1;
58
u8 i_quantization ;// 2;
59
u8 i_sample_freq ;// 2;
61
u8 i_num_channels ;// 3;
62
u16 i_lang_code ;// 16; // <char> description
63
u8 i_foo ;// 8; // 0x00000000 ?
65
u8 i_bar ;// 8; // 0x00000000 ?
69
typedef struct audio_status_s
76
typedef struct ifo_spu_t
78
u16 i_prefix ;// 16; // 0x0100 ?
79
u16 i_lang_code ;// 16; // <char> description
80
u8 i_foo ;// 8; // dont know
81
u8 i_caption ;// 8; // 0x00 ?
84
/* Subpicture status */
85
typedef struct spu_status_s
89
u8 i_position_wide; //8
90
u8 i_position_letter; //8
91
u8 i_position_pan; //8
95
/* Ifo vitual machine Commands */
96
typedef struct command_desc_s
111
/* Program Chain Command Table
112
- start at i_pgc_com_tab_sbyte */
113
typedef struct command_s
115
u16 i_pre_command_nb; // 2 bytes
116
u16 i_post_command_nb; // 2 bytes
117
u16 i_cell_command_nb; // 2 bytes
119
u64* p_pre_command; // i_pre_com_nb * 8 bytes
120
u64* p_post_command; // i_post_com_nb * 8 bytes
121
u64* p_cell_command; // i_pre_com_nb * 8 bytes
123
// command_desc_t* p_cell_command; // i_cell_com_nb * 8 bytes
124
// command_desc_t* p_post_command; // i_post_com_nb * 8 bytes
125
// command_desc_t* p_cell_command; // i_cell_com_nb * 8 bytes
128
/* Program Chain Map Table
129
* - start at "i_pgc_prg_map_sbyte" */
130
typedef struct chapter_map_s
132
u8* pi_start_cell; // i_prg_nb * 1 byte
135
/* Cell Playback Information Table
136
* we have a pointer to such a structure for each cell
137
* - first start at "i_cell_play_inf_sbyte" */
138
typedef struct cell_play_s
140
/* This information concerns the currently selected cell */
141
u16 i_category; // 2 bytes
142
u8 i_still_time; // 1 byte; in seconds; ff=inf
143
u8 i_command_nb; // 1 byte; 0 = no com
144
u32 i_play_time; // 4 bytes
145
u32 i_start_sector; // 4 bytes
146
u32 i_first_ilvu_vobu_esector; // 4 bytes; ???
147
u32 i_last_vobu_start_sector; // 4 bytes
148
u32 i_end_sector; // 4 bytes
151
/* Cell Position Information Table
152
* we have a pointer to such a structure for each cell
153
* - first start at "i_cell_pos_inf_sbyte" */
154
typedef struct cell_pos_s
156
/* This information concerns the currently selected cell */
157
u16 i_vob_id; // 2 bytes
159
u8 i_cell_id; // 1 byte
162
/* Main structure for Program Chain
163
* - start at i_fp_pgc_sbyte
164
* - or at i_vmgm_pgci_sbyte in vmgm_pgci_srp_t */
165
typedef struct title_s
167
/* Global features of program chain */
169
u8 i_chapter_nb; // 1 byte
170
u8 i_cell_nb; // 1 byte
171
u32 i_play_time; // 4 bytes
172
u32 i_prohibited_user_op; // 4 bytes
173
audio_status_t pi_audio_status[8]; // 8*2 bytes
174
spu_status_t pi_spu_status[32]; // 32*4 bytes
175
u16 i_next_title_num; // 2 bytes
176
u16 i_prev_title_num; // 2 bytes
177
u16 i_go_up_title_num; // 2 bytes
178
u8 i_still_time; // 1 byte ; in seconds
179
u8 i_play_mode; // 1 byte
180
/* In video_ts.ifo, the 3 significant bytes of each color are
181
* preceded by 1 unsignificant byte */
182
u32 pi_yuv_color[16]; // 16*3 bytes
183
/* Here come the start bytes of the following structures */
184
u16 i_command_start_byte; // 2 bytes
185
u16 i_chapter_map_start_byte; // 2 bytes
186
u16 i_cell_play_start_byte; // 2 bytes
187
u16 i_cell_pos_start_byte; // 2 bytes
188
/* Predefined structures */
190
chapter_map_t chapter_map;
191
cell_play_t* p_cell_play; // i_cell_nb * 24 bytes
192
cell_pos_t* p_cell_pos; // i_cell_nb * 4 bytes
196
* Menu PGCI Unit Table
199
/* Menu PGCI Language unit Descriptor */
200
typedef struct unit_s
202
u16 i_lang_code; // 2 bytes (ISO-xx)
204
u8 i_existence_mask; // 1 byte
205
u32 i_unit_inf_start_byte; // 4 bytes
208
typedef struct unit_title_s
210
u8 i_category_mask; // 1 byte
211
u8 i_category; // 1 byte
212
u16 i_parental_mask; // 2 bytes
213
u32 i_title_start_byte; // 4 bytes
217
/* Menu PGCI Language Unit Table
218
* - start at i_lu_sbyte */
219
typedef struct unit_inf_s
221
u16 i_title_nb; // 2 bytes
223
u32 i_end_byte; // 4 bytes
224
unit_title_t * p_title; // i_srp_nb * 8 bytes
227
/* Main Struct for Menu PGCI
228
* - start at i_*_pgci_ut_ssector */
229
typedef struct title_unit_s
231
u16 i_unit_nb; // 2 bytes; ???
233
u32 i_end_byte; // 4 bytes
234
unit_t* p_unit; // i_lu_nb * 8 bytes
235
unit_inf_t* p_unit_inf; // i_lu_nb * 8 bytes
239
* Cell Adress Table Information
241
typedef struct cell_map_s
243
u16 i_vob_id; // 2 bytes
244
u8 i_cell_id; // 1 byte
246
u32 i_start_sector; // 4 bytes
247
u32 i_end_sector; // 4 bytes
250
typedef struct cell_inf_s
252
u16 i_vob_nb; // 2 bytes
254
u32 i_end_byte; // 4 bytes
255
u16 i_cell_nb; // not in ifo; computed
257
cell_map_t* p_cell_map;
262
* VOBU Adress Map Table
264
typedef struct vobu_map_s
266
u32 i_end_byte; // 4 bytes
267
u32* pi_vobu_start_sector; // (nb of vobu) * 4 bytes
270
/*****************************************************************************
271
* Structures for Video Management (cf video_ts.ifo)
272
*****************************************************************************/
275
* Video Manager Information Management Table
277
typedef struct manager_inf_s
279
char psz_id[13]; // 12 bytes (DVDVIDEO-VMG)
280
u32 i_vmg_end_sector; // 4 bytes
282
u32 i_vmg_inf_end_sector; // 4 bytes
284
u8 i_spec_ver; // 1 byte
285
u32 i_cat; // 4 bytes
286
u16 i_volume_nb; // 2 bytes
287
u16 i_volume; // 2 bytes
288
u8 i_disc_side; // 1 bytes
290
u16 i_title_set_nb; // 2 bytes
291
char ps_provider_id[32]; // 32 bytes
292
u64 i_pos_code; // 8 bytes
294
u32 i_vmg_inf_end_byte; // 4 bytes
295
u32 i_first_play_title_start_byte; // 4 bytes
297
u32 i_vob_start_sector; // 4 bytes
298
u32 i_title_inf_start_sector; // 4 bytes
299
u32 i_title_unit_start_sector; // 4 bytes
300
u32 i_parental_inf_start_sector; // 4 bytes
301
u32 i_vts_inf_start_sector; // 4 bytes
302
u32 i_text_data_start_sector; // 4 bytes
303
u32 i_cell_inf_start_sector; // 4 bytes
304
u32 i_vobu_map_start_sector; // 4 bytes
306
ifo_video_t video_attr; // 2 bytes
308
u8 i_audio_nb; // 1 byte
309
ifo_audio_t p_audio_attr[8]; // i_vmgm_audio_nb * 8 bytes
311
u8 i_spu_nb; // 1 byte
312
ifo_spu_t p_spu_attr[32]; // i_subpic_nb * 6 bytes
317
* Part Of Title Search Pointer Table Information
320
/* Title sets structure
321
* we have a pointer to this structure for each tts */
322
typedef struct title_attr_s
324
u8 i_play_type; // 1 byte
325
u8 i_angle_nb; // 1 byte
326
u16 i_chapter_nb; // 2 bytes; Chapters/PGs
327
u16 i_parental_id; // 2 bytes
328
u8 i_title_set_num; // 1 byte (VTS#)
329
u8 i_title_num; // 1 byte ???
330
u32 i_start_sector; // 4 bytes
333
/* Main struct for tts
334
* - start at "i_vmg_ptt_srpt_ssector" */
335
typedef struct title_inf_s
337
u16 i_title_nb; // 2 bytes
339
u32 i_end_byte; // 4 bytes
340
title_attr_t * p_attr; // i_ttu_nb * 12 bytes
344
* Parental Management Information Table
346
typedef struct parental_desc_s
348
char ps_country_code[2]; // 2 bytes
350
u16 i_parental_mask_start_byte; // 2 bytes
354
typedef struct parental_mask_s
356
u16* ppi_mask[8]; // (i_vts_nb +1) * 8 * 2 bytes
359
/* Main struct for parental management
360
* - start at i_vmg_ptl_mait_ssector */
361
typedef struct parental_inf_s
363
u16 i_country_nb; // 2 bytes
364
u16 i_vts_nb; // 2 bytes
365
u32 i_end_byte; // 4 bytes
366
parental_desc_t* p_parental_desc; // i_country_nb * 8 bytes
367
parental_mask_t* p_parental_mask; // i_country_nb * sizeof(vmg_ptl_mask_t)
371
* Video Title Set Attribute Table
374
/* Attribute structure : one for each vts
375
* - start at pi_atrt_sbyte */
376
typedef struct vts_attr_s
378
u32 i_end_byte; // 4 bytes
379
u32 i_cat_app_type; // 4 bytes
380
ifo_video_t vts_menu_video_attr; // 2 bytes
382
u8 i_vts_menu_audio_nb; // 1 byte
383
ifo_audio_t p_vts_menu_audio_attr[8]; // 8 * 8 bytes
385
u8 i_vts_menu_spu_nb; // 1 byte
386
ifo_spu_t p_vts_menu_spu_attr[28]; // i_vtsm_subpic_nb * 6 bytes
388
ifo_video_t vts_title_video_attr; // 2 bytes
390
u8 i_vts_title_audio_nb; // 1 byte
391
ifo_audio_t p_vts_title_audio_attr[8]; // 8 * 8 bytes
393
u8 i_vts_title_spu_nb; // 1 byte
394
ifo_spu_t p_vts_title_spu_attr[28]; // i_vtstt_subpic_nb * 6 bytes
397
/* Main struct for vts attributes
398
* - start at i_vmg_vts_atrt_ssector */
399
typedef struct vts_inf_s
401
u16 i_vts_nb; // 2 bytes
403
u32 i_end_byte; // 4 bytes
404
u32* pi_vts_attr_start_byte; // i_vts_nb * 4 bytes
405
vts_attr_t* p_vts_attr;
409
* Global Structure for Video Manager
413
manager_inf_t manager_inf;
415
title_inf_t title_inf;
416
title_unit_t title_unit;
417
parental_inf_t parental_inf;
423
/*****************************************************************************
424
* Structures for Video Title Sets (cf vts_*.ifo)
425
****************************************************************************/
428
* Video Title Sets Information Management Table
430
typedef struct vts_manager_s
432
char psz_id[13]; // 12 bytes (DVDVIDEO-VTS)
433
u32 i_end_sector; // 4 bytes
435
u32 i_inf_end_sector; // 4 bytes
437
u8 i_spec_ver; // 1 byte
438
u32 i_cat; // 4 bytes
440
u32 i_inf_end_byte; // 4 bytes
442
u32 i_menu_vob_start_sector; // 4 bytes
443
u32 i_title_vob_start_sector; // 4 bytes
444
u32 i_title_inf_start_sector; // 4 bytes
445
u32 i_title_unit_start_sector; // 4 bytes
446
u32 i_menu_unit_start_sector; // 4 bytes
447
u32 i_time_inf_start_sector; // 4 bytes
448
u32 i_menu_cell_inf_start_sector; // 4 bytes
449
u32 i_menu_vobu_map_start_sector; // 4 bytes
450
u32 i_cell_inf_start_sector; // 4 bytes
451
u32 i_vobu_map_start_sector; // 4 bytes
453
ifo_video_t menu_video_attr; // 2 bytes
455
u8 i_menu_audio_nb; // 1 byte
456
ifo_audio_t p_menu_audio_attr[8]; // i_vmgm_audio_nb * 8 bytes
458
u8 i_menu_spu_nb; // 1 byte
459
ifo_spu_t p_menu_spu_attr[32]; // i_subpic_nb * 6 bytes
460
// !!! only 28 subpics ???
462
ifo_video_t video_attr; // 2 bytes
464
u8 i_audio_nb; // 1 byte
465
ifo_audio_t p_audio_attr[8]; // i_vmgm_audio_nb * 8 bytes
467
u8 i_spu_nb; // 1 byte
468
ifo_spu_t p_spu_attr[32]; // i_subpic_nb * 6 bytes
472
* Part Of Title Search Pointer Table Information
475
/* Title sets structure
476
* we have a pointer to this structure for each tts */
477
typedef struct title_start_s
479
u16 i_title_id; // 2 bytes; Chapters/PGs
480
u16 i_chapter; // 2 bytes
483
/* Main struct for tts
484
* - start at "i_vts_ptt_srpt_ssector" */
485
typedef struct vts_title_s
487
u16 i_title_nb; // 2 bytes
489
u32 i_end_byte; // 4 bytes
491
title_start_t * p_title_start; // i_ttu_nb * 4 bytes
495
* Time Map table information
498
/* Time Map structure */
499
typedef struct time_map_s
501
u8 i_time_unit; // 1 byte
503
u16 i_entry_nb; // 2 bytes
504
u32* pi_sector; // i_entry_nb * 4 bytes
507
/* Main structure for tmap_ti
508
* - start at "i_tmap_ti_ssector" */
509
typedef struct time_inf_s
513
u32 i_end_byte; // 4 bytes
514
u32* pi_start_byte; // i_tmap_nb * 4 bytes
515
time_map_t* p_time_map;
523
boolean_t b_initialized;
525
vts_manager_t manager_inf;
526
vts_title_t title_inf;
527
title_unit_t menu_unit;
528
unit_inf_t title_unit;
530
cell_inf_t menu_cell_inf;
531
vobu_map_t menu_vobu_map;
537
* Global Ifo Structure
541
dvdcss_handle dvdhandle; /* File descriptor for the device */
542
int i_start; /* Offset to video_ts.ifo on the device */
543
int i_pos; /* Position of stream pointer */
544
boolean_t b_error; /* Error Management */
545
vmg_t vmg; /* Structure described in video_ts */
546
int i_title; /* Current title number */
547
vts_t vts; /* Vts ifo for current title set */
549
/* Remap buffer for unaligned reads */
550
u8 p_remap[ 2 * DVD_LB_SIZE ];
555
/*****************************************************************************
556
* Prototypes in dvd_ifo.c
557
*****************************************************************************/
558
struct thread_dvd_data_s;
560
int IfoCreate ( struct thread_dvd_data_s * );
561
int IfoInit ( struct ifo_s * );
562
int IfoTitleSet ( struct ifo_s * );
563
void IfoDestroy ( struct ifo_s * );