~ubuntu-branches/ubuntu/saucy/libdvdread/saucy

« back to all changes in this revision

Viewing changes to src/ifo_types.h

  • Committer: Package Import Robot
  • Author(s): Bryce Harrington
  • Date: 2011-11-28 17:12:51 UTC
  • mfrom: (1.1.4) (3.2.10 sid)
  • Revision ID: package-import@ubuntu.com-20111128171251-fxbi0nd6rrz3lsfb
Tags: 4.2.0-1ubuntu1
* Merge from debian testing.  Remaining changes:
  - Re-add missing install-css.sh. Update the script with patch by Gene Cumm
    for dynamic version calculation.
  - debian/control: add Suggests for install-css.sh on wget, debhelper, etc.
  - debian/rules: install install-css.sh, leave perms executable.
  - 100-quell-vts-tmapt-warning.patch - Don't recommend sending bug
    reports when VTS_TMAPT is missing
  - 102-reorder-linkage.patch - Fix link order for shared library loading.
* Drop 101-fix-msb-unicode.patch; fixed upstream.

Show diffs side-by-side

added added

removed removed

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