1 /*****************************************************************************
2 * dvd_ifo.h: Structures for ifo parsing
3 *****************************************************************************
4 * Copyright (C) 1999-2001 VideoLAN
5 * $Id: dvd_ifo.h,v 1.2 2001/02/08 17:44:12 massiot Exp $
7 * Author: Stéphane Borel <stef@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
25 * Common structures for Video Management and Video Title sets
26 *****************************************************************************/
29 * Program Chain structures
32 /* Ifo vitual machine Commands */
33 typedef struct ifo_command_s
46 /* Program Chain Command Table
47 - start at i_pgc_com_tab_sbyte */
48 typedef struct pgc_com_tab_s
50 u16 i_pre_com_nb; // 2 bytes
51 u16 i_post_com_nb; // 2 bytes
52 u16 i_cell_com_nb; // 2 bytes
54 ifo_command_t* p_pre_com; // i_pre_com_nb * 8 bytes
55 ifo_command_t* p_post_com; // i_post_com_nb * 8 bytes
56 ifo_command_t* p_cell_com; // i_cell_com_nb * 8 bytes
59 /* Program Chain Map Table
60 * - start at "i_pgc_prg_map_sbyte" */
61 typedef struct pgc_prg_map_s
63 u8* pi_entry_cell; // i_prg_nb * 1 byte
66 /* Cell Playback Information Table
67 * we have a pointer to such a structure for each cell
68 * - first start at "i_cell_play_inf_sbyte" */
69 typedef struct cell_play_inf_s
71 /* This information concerns the currently selected cell */
73 u8 i_still_time; // 1 byte; in seconds; ff=inf
74 u8 i_com_nb; // 1 byte; 0 = no com
75 u32 i_play_time; // 4 bytes
76 u32 i_entry_sector; // 4 bytes
77 u32 i_first_ilvu_vobu_esector; // 4 bytes; ???
78 u32 i_lvobu_ssector; // 4 bytes
79 u32 i_lsector; // 4 bytes
82 /* Cell Position Information Table
83 * we have a pointer to such a structure for each cell
84 * - first start at "i_cell_pos_inf_sbyte" */
85 typedef struct cell_pos_inf_s
87 /* This information concerns the currently selected cell */
88 u16 i_vob_id; // 2 bytes
90 u8 i_cell_id; // 1 byte
93 /* Main structure for Program Chain
94 * - start at i_fp_pgc_sbyte
95 * - or at i_vmgm_pgci_sbyte in vmgm_pgci_srp_t */
98 /* Global features of program chain */
100 u8 i_prg_nb; // 1 byte
101 u8 i_cell_nb; // 1 byte
102 u32 i_play_time; // 4 bytes
103 u32 i_prohibited_user_op; // 4 bytes
104 u16 pi_audio_status[8]; // 8*2 bytes
105 u32 pi_subpic_status[32]; // 32*4 bytes
106 u16 i_next_pgc_nb; // 2 bytes
107 u16 i_prev_pgc_nb; // 2 bytes
108 u16 i_goup_pgc_nb; // 2 bytes
109 u8 i_still_time; // 1 byte ; in seconds
110 u8 i_play_mode; // 1 byte
111 /* In video_ts.ifo, the 3 significant bytes of each color are
112 * preceded by 1 unsignificant byte */
113 u32 pi_yuv_color[16]; // 16*3 bytes
114 /* Here come the start bytes of the following structures */
115 u16 i_com_tab_sbyte; // 2 bytes
116 u16 i_prg_map_sbyte; // 2 bytes
117 u16 i_cell_play_inf_sbyte; // 2 bytes
118 u16 i_cell_pos_inf_sbyte; // 2 bytes
119 /* Predefined structures */
120 pgc_com_tab_t com_tab;
121 pgc_prg_map_t prg_map;
122 cell_play_inf_t* p_cell_play_inf; // i_cell_nb * 24 bytes
123 cell_pos_inf_t* p_cell_pos_inf; // i_cell_nb * 4 bytes
127 * Menu PGCI Unit Table
130 /* Menu PGCI Language unit Descriptor */
131 typedef struct pgci_lu_s
133 char ps_lang_code[2]; // 2 bytes (ISO-xx)
135 u8 i_existence_mask; // 1 byte
136 u32 i_lu_sbyte; // 4 bytes
139 typedef struct pgci_srp_s
141 u8 i_pgc_cat_mask; // 1 byte
142 u8 i_pgc_cat; // 1 byte
143 u16 i_par_mask; // 2 bytes
144 u32 i_pgci_sbyte; // 4 bytes
148 /* Menu PGCI Language Unit Table
149 * - start at i_lu_sbyte */
150 typedef struct pgci_inf_s
152 u16 i_srp_nb; // 2 bytes
154 u32 i_lu_ebyte; // 4 bytes
155 pgci_srp_t* p_srp; // i_srp_nb * 8 bytes
158 /* Main Struct for Menu PGCI
159 * - start at i_*_pgci_ut_ssector */
160 typedef struct pgci_ut_s
162 u16 i_lu_nb; // 2 bytes; ???
164 u32 i_ebyte; // 4 bytes
165 pgci_lu_t* p_lu; // i_lu_nb * 8 bytes
166 pgci_inf_t* p_pgci_inf; // i_lu_nb * 8 bytes
170 * Cell Adress Table Information
172 typedef struct cell_inf_s
174 u16 i_vob_id; // 2 bytes
175 u8 i_cell_id; // 1 byte
177 u32 i_ssector; // 4 bytes
178 u32 i_esector; // 4 bytes
181 typedef struct c_adt_s
183 u16 i_vob_nb; // 2 bytes
185 u32 i_ebyte; // 4 bytes
186 cell_inf_t* p_cell_inf;
191 * VOBU Adress Map Table
193 typedef struct vobu_admap_s
195 u32 i_ebyte; // 4 bytes
196 u32* pi_vobu_ssector; // (nb of vobu) * 4 bytes
199 /*****************************************************************************
200 * Structures for Video Management (cf video_ts.ifo)
201 *****************************************************************************/
204 * Video Manager Information Management Table
206 typedef struct vmgi_mat_s
208 char psz_id[13]; // 12 bytes (DVDVIDEO-VMG)
209 u32 i_lsector; // 4 bytes
211 u32 i_i_lsector; // 4 bytes
213 u8 i_spec_ver; // 1 byte
214 u32 i_cat; // 4 bytes
215 u16 i_vol_nb; // 2 bytes
216 u16 i_vol; // 2 bytes
217 u8 i_disc_side; // 1 bytes
219 u16 i_tts_nb; // 2 bytes
220 char ps_provider_id[32]; // 32 bytes
221 u64 i_pos_code; // 8 bytes
223 u32 i_i_mat_ebyte; // 4 bytes
224 u32 i_fp_pgc_sbyte; // 4 bytes
226 u32 i_vobs_ssector; // 4 bytes
227 u32 i_ptt_srpt_ssector; // 4 bytes
228 u32 i_pgci_ut_ssector; // 4 bytes
229 u32 i_ptl_mait_ssector; // 4 bytes
230 u32 i_vts_atrt_ssector; // 4 bytes
231 u32 i_txtdt_mg_ssector; // 4 bytes
232 u32 i_c_adt_ssector; // 4 bytes
233 u32 i_vobu_admap_ssector; // 4 bytes
235 u16 i_video_atrt; // 2 bytes
237 u8 i_audio_nb; // 1 byte
238 u64 pi_audio_atrt[8]; // i_vmgm_audio_nb * 8 bytes
240 u8 i_subpic_nb; // 1 byte
241 u64 pi_subpic_atrt[32]; // i_subpic_nb * 6 bytes
246 * Part Of Title Search Pointer Table Information
249 /* Title sets structure
250 * we have a pointer to this structure for each tts */
253 u8 i_play_type; // 1 byte
254 u8 i_angle_nb; // 1 byte
255 u16 i_ptt_nb; // 2 bytes; Chapters/PGs
256 u16 i_parental_id; // 2 bytes
257 u8 i_tts_nb; // 1 byte (VTS#)
258 u8 i_vts_ttn; // 1 byte ???
259 u32 i_ssector; // 4 bytes
262 /* Main struct for tts
263 * - start at "i_vmg_ptt_srpt_ssector" */
264 typedef struct vmg_ptt_srpt_s
266 u16 i_ttu_nb; // 2 bytes
268 u32 i_ebyte; // 4 bytes
269 tts_t* p_tts; // i_ttu_nb * 12 bytes
273 * Parental Management Information Table
275 typedef struct vmg_ptl_mai_desc_s
277 char ps_country_code[2]; // 2 bytes
279 u16 i_ptl_mai_sbyte; // 2 bytes
281 } vmg_ptl_mai_desc_t;
283 typedef struct vmg_ptl_mask_s
285 u16* ppi_ptl_mask[8]; // (i_vts_nb +1) * 8 * 2 bytes
288 /* Main struct for parental management
289 * - start at i_vmg_ptl_mait_ssector */
290 typedef struct vmg_ptl_mait_s
292 u16 i_country_nb; // 2 bytes
293 u16 i_vts_nb; // 2 bytes
294 u32 i_ebyte; // 4 bytes
295 vmg_ptl_mai_desc_t* p_ptl_desc; // i_country_nb * 8 bytes
296 vmg_ptl_mask_t* p_ptl_mask; // i_country_nb * sizeof(vmg_ptl_mask_t)
300 * Video Title Set Attribute Table
303 /* Attribute structure : one for each vts
304 * - start at pi_atrt_sbyte */
305 typedef struct vts_atrt_s
307 u32 i_ebyte; // 4 bytes
308 u32 i_cat_app_type; // 4 bytes
309 u16 i_vtsm_video_atrt; // 2 bytes
311 u8 i_vtsm_audio_nb; // 1 byte
312 u64 pi_vtsm_audio_atrt[8]; // 8 * 8 bytes
314 u8 i_vtsm_subpic_nb; // 1 byte
315 u64 pi_vtsm_subpic_atrt[28]; // i_vtsm_subpic_nb * 6 bytes
317 u16 i_vtstt_video_atrt; // 2 bytes
319 u8 i_vtstt_audio_nb; // 1 byte
320 u64 pi_vtstt_audio_atrt[8]; // 8 * 8 bytes
322 u8 i_vtstt_subpic_nb; // 1 byte
323 u64 pi_vtstt_subpic_atrt[28]; // i_vtstt_subpic_nb * 6 bytes
326 /* Main struct for vts attributes
327 * - start at i_vmg_vts_atrt_ssector */
328 typedef struct vmg_vts_atrt_s
330 u16 i_vts_nb; // 2 bytes
332 u32 i_ebyte; // 4 bytes
333 u32* pi_vts_atrt_sbyte; // i_vts_nb * 4 bytes
334 vts_atrt_t* p_vts_atrt;
338 * Global Structure for Video Manager
344 vmg_ptt_srpt_t ptt_srpt;
346 vmg_ptl_mait_t ptl_mait;
347 vmg_vts_atrt_t vts_atrt;
349 vobu_admap_t vobu_admap;
352 /*****************************************************************************
353 * Structures for Video Title Sets (cf vts_*.ifo)
354 ****************************************************************************/
357 * Video Title Sets Information Management Table
359 typedef struct vtsi_mat_s
361 char psz_id[13]; // 12 bytes (DVDVIDEO-VTS)
362 u32 i_lsector; // 4 bytes
364 u32 i_i_lsector; // 4 bytes
366 u8 i_spec_ver; // 1 byte
367 u32 i_cat; // 4 bytes
369 u32 i_mat_ebyte; // 4 bytes
371 u32 i_m_vobs_ssector; // 4 bytes
372 u32 i_tt_vobs_ssector; // 4 bytes
373 u32 i_ptt_srpt_ssector; // 4 bytes
374 u32 i_pgcit_ssector; // 4 bytes
375 u32 i_m_pgci_ut_ssector; // 4 bytes
376 u32 i_tmap_ti_ssector; // 4 bytes
377 u32 i_m_c_adt_ssector; // 4 bytes
378 u32 i_m_vobu_admap_ssector; // 4 bytes
379 u32 i_c_adt_ssector; // 4 bytes
380 u32 i_vobu_admap_ssector; // 4 bytes
382 u16 i_m_video_atrt; // 2 bytes
384 u8 i_m_audio_nb; // 1 byte
385 u64 pi_m_audio_atrt[8]; // i_vmgm_audio_nb * 8 bytes
387 u8 i_m_subpic_nb; // 1 byte
388 u64 pi_m_subpic_atrt[32]; // i_subpic_nb * 6 bytes
389 // !!! only 28 subpics ???
391 u16 i_video_atrt; // 2 bytes
393 u8 i_audio_nb; // 1 byte
394 u64 pi_audio_atrt[8]; // i_vmgm_audio_nb * 8 bytes
396 u8 i_subpic_nb; // 1 byte
397 u64 pi_subpic_atrt[32]; // i_subpic_nb * 6 bytes
401 * Part Of Title Search Pointer Table Information
404 /* Title sets structure
405 * we have a pointer to this structure for each tts */
408 u16 i_pgc_nb; // 2 bytes; Chapters/PGs
409 u16 i_prg_nb; // 2 bytes
412 /* Main struct for tts
413 * - start at "i_vts_ptt_srpt_ssector" */
414 typedef struct vts_ptt_srpt_s
416 u16 i_ttu_nb; // 2 bytes
418 u32 i_ebyte; // 4 bytes
420 ttu_t* p_ttu; // i_ttu_nb * 4 bytes
424 * Time Map table information
427 /* Time Map structure */
428 typedef struct tmap_s
430 u8 i_time_unit; // 1 byte
432 u16 i_entry_nb; // 2 bytes
433 u32* pi_sector; // i_entry_nb * 4 bytes
436 /* Main structure for tmap_ti
437 * - start at "i_tmap_ti_ssector" */
438 typedef struct vts_tmap_ti_s
442 u32 i_ebyte; // 4 bytes
443 u32* pi_sbyte; // i_tmap_nb * 4 bytes
454 /* Part Of Title Search Pointer Table Info */
455 vts_ptt_srpt_t ptt_srpt;
456 /* Video Title Set Menu PGCI Unit Table */
458 /* Video Title Set Program Chain Info Table */
460 /* Video Title Set Time Map Table */
461 vts_tmap_ti_t tmap_ti;
462 /* VTSM Cell Adress Table Information */
464 /* VTSM VOBU Adress Map Table */
465 vobu_admap_t m_vobu_admap;
466 /* VTS Cell Adress Table Information */
468 /* VTS VOBU Adress Map Table */
469 vobu_admap_t vobu_admap;
473 * Global Ifo Structure
477 /* File descriptor for the device */
479 /* Offset to video_ts.ifo on the device */
481 /* Position of stream pointer */
483 /* Error Management */
485 /* Structure described in video_ts */
487 /* Table of vts ifos */