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

« back to all changes in this revision

Viewing changes to src/dvdread/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
/*
 
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
#include "dvdread/dvd_reader.h"
 
27
 
 
28
 
 
29
#undef ATTRIBUTE_PACKED
 
30
#undef PRAGMA_PACK_BEGIN
 
31
#undef PRAGMA_PACK_END
 
32
 
 
33
#if defined(__GNUC__)
 
34
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
 
35
#define ATTRIBUTE_PACKED __attribute__ ((packed))
 
36
#define PRAGMA_PACK 0
 
37
#endif
 
38
#endif
 
39
 
 
40
#if !defined(ATTRIBUTE_PACKED)
 
41
#define ATTRIBUTE_PACKED
 
42
#define PRAGMA_PACK 1
 
43
#endif
 
44
 
 
45
#if PRAGMA_PACK
 
46
#pragma pack(1)
 
47
#endif
 
48
 
 
49
 
 
50
/**
 
51
 * Common
 
52
 *
 
53
 * The following structures are used in both the VMGI and VTSI.
 
54
 */
 
55
 
 
56
 
 
57
/**
 
58
 * DVD Time Information.
 
59
 */
 
60
typedef struct {
 
61
  uint8_t hour;
 
62
  uint8_t minute;
 
63
  uint8_t second;
 
64
  uint8_t frame_u; /* The two high bits are the frame rate. */
 
65
} ATTRIBUTE_PACKED dvd_time_t;
 
66
 
 
67
/**
 
68
 * Type to store per-command data.
 
69
 */
 
70
typedef struct {
 
71
  uint8_t bytes[8];
 
72
} ATTRIBUTE_PACKED vm_cmd_t;
 
73
#define COMMAND_DATA_SIZE 8U
 
74
 
 
75
 
 
76
/**
 
77
 * Video Attributes.
 
78
 */
 
79
typedef struct {
 
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;
 
84
 
 
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;
 
89
 
 
90
  unsigned char picture_size         : 2;
 
91
  unsigned char letterboxed          : 1;
 
92
  unsigned char film_mode            : 1;
 
93
} ATTRIBUTE_PACKED video_attr_t;
 
94
 
 
95
/**
 
96
 * Audio Attributes.
 
97
 */
 
98
typedef struct {
 
99
  unsigned char audio_format           : 3;
 
100
  unsigned char multichannel_extension : 1;
 
101
  unsigned char lang_type              : 2;
 
102
  unsigned char application_mode       : 2;
 
103
 
 
104
  unsigned char quantization           : 2;
 
105
  unsigned char sample_frequency       : 2;
 
106
  unsigned char unknown1               : 1;
 
107
  unsigned char channels               : 3;
 
108
  uint16_t lang_code;
 
109
  uint8_t  lang_extension;
 
110
  uint8_t  code_extension;
 
111
  uint8_t unknown3;
 
112
  union {
 
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 */
 
119
    } karaoke;
 
120
    struct ATTRIBUTE_PACKED {
 
121
      unsigned char unknown5           : 4;
 
122
      unsigned char dolby_encoded      : 1; /* suitable for surround decoding */
 
123
      unsigned char unknown6           : 3;
 
124
    } surround;
 
125
  } ATTRIBUTE_PACKED app_info;
 
126
} ATTRIBUTE_PACKED audio_attr_t;
 
127
 
 
128
 
 
129
/**
 
130
 * MultiChannel Extension
 
131
 */
 
132
typedef struct {
 
133
  unsigned int zero1      : 7;
 
134
  unsigned int ach0_gme   : 1;
 
135
 
 
136
  unsigned int zero2      : 7;
 
137
  unsigned int ach1_gme   : 1;
 
138
 
 
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;
 
144
 
 
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;
 
150
 
 
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;
 
156
  uint8_t zero6[19];
 
157
} ATTRIBUTE_PACKED multichannel_ext_t;
 
158
 
 
159
 
 
160
/**
 
161
 * Subpicture Attributes.
 
162
 */
 
163
typedef struct {
 
164
  /*
 
165
   * type: 0 not specified
 
166
   *       1 language
 
167
   *       2 other
 
168
   * coding mode: 0 run length
 
169
   *              1 extended
 
170
   *              2 other
 
171
   * language: indicates language if type == 1
 
172
   * lang extension: if type == 1 contains the lang extension
 
173
   */
 
174
  unsigned char code_mode : 3;
 
175
  unsigned char zero1     : 3;
 
176
  unsigned char type      : 2;
 
177
  uint8_t  zero2;
 
178
  uint16_t lang_code;
 
179
  uint8_t  lang_extension;
 
180
  uint8_t  code_extension;
 
181
} ATTRIBUTE_PACKED subp_attr_t;
 
182
 
 
183
 
 
184
 
 
185
/**
 
186
 * PGC Command Table.
 
187
 */
 
188
typedef struct {
 
189
  uint16_t nr_of_pre;
 
190
  uint16_t nr_of_post;
 
191
  uint16_t nr_of_cell;
 
192
  uint16_t zero_1;
 
193
  vm_cmd_t *pre_cmds;
 
194
  vm_cmd_t *post_cmds;
 
195
  vm_cmd_t *cell_cmds;
 
196
} ATTRIBUTE_PACKED pgc_command_tbl_t;
 
197
#define PGC_COMMAND_TBL_SIZE 8U
 
198
 
 
199
/**
 
200
 * PGC Program Map
 
201
 */
 
202
typedef uint8_t pgc_program_map_t;
 
203
 
 
204
/**
 
205
 * Cell Playback Information.
 
206
 */
 
207
typedef struct {
 
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;
 
214
 
 
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;
 
218
  uint8_t still_time;
 
219
  uint8_t cell_cmd_nr;
 
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;
 
226
 
 
227
#define BLOCK_TYPE_NONE         0x0
 
228
#define BLOCK_TYPE_ANGLE_BLOCK  0x1
 
229
 
 
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
 
234
 
 
235
/**
 
236
 * Cell Position Information.
 
237
 */
 
238
typedef struct {
 
239
  uint16_t vob_id_nr;
 
240
  uint8_t  zero_1;
 
241
  uint8_t  cell_nr;
 
242
} ATTRIBUTE_PACKED cell_position_t;
 
243
 
 
244
/**
 
245
 * User Operations.
 
246
 */
 
247
typedef struct {
 
248
  unsigned int zero                           : 7; /* 25-31 */
 
249
  unsigned int video_pres_mode_change         : 1; /* 24 */
 
250
 
 
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 */
 
259
 
 
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 */
 
268
 
 
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;
 
278
 
 
279
/**
 
280
 * Program Chain Information.
 
281
 */
 
282
typedef struct {
 
283
  uint16_t zero_1;
 
284
  uint8_t  nr_of_programs;
 
285
  uint8_t  nr_of_cells;
 
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;
 
293
  uint8_t  still_time;
 
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
 
306
 
 
307
/**
 
308
 * Program Chain Information Search Pointer.
 
309
 */
 
310
typedef struct {
 
311
  uint8_t  entry_id;
 
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;
 
317
  pgc_t *pgc;
 
318
} ATTRIBUTE_PACKED pgci_srp_t;
 
319
#define PGCI_SRP_SIZE 8U
 
320
 
 
321
/**
 
322
 * Program Chain Information Table.
 
323
 */
 
324
typedef struct {
 
325
  uint16_t nr_of_pgci_srp;
 
326
  uint16_t zero_1;
 
327
  uint32_t last_byte;
 
328
  pgci_srp_t *pgci_srp;
 
329
} ATTRIBUTE_PACKED pgcit_t;
 
330
#define PGCIT_SIZE 8U
 
331
 
 
332
/**
 
333
 * Menu PGCI Language Unit.
 
334
 */
 
335
typedef struct {
 
336
  uint16_t lang_code;
 
337
  uint8_t  lang_extension;
 
338
  uint8_t  exists;
 
339
  uint32_t lang_start_byte;
 
340
  pgcit_t *pgcit;
 
341
} ATTRIBUTE_PACKED pgci_lu_t;
 
342
#define PGCI_LU_SIZE 8U
 
343
 
 
344
/**
 
345
 * Menu PGCI Unit Table.
 
346
 */
 
347
typedef struct {
 
348
  uint16_t nr_of_lus;
 
349
  uint16_t zero_1;
 
350
  uint32_t last_byte;
 
351
  pgci_lu_t *lu;
 
352
} ATTRIBUTE_PACKED pgci_ut_t;
 
353
#define PGCI_UT_SIZE 8U
 
354
 
 
355
/**
 
356
 * Cell Address Information.
 
357
 */
 
358
typedef struct {
 
359
  uint16_t vob_id;
 
360
  uint8_t  cell_id;
 
361
  uint8_t  zero_1;
 
362
  uint32_t start_sector;
 
363
  uint32_t last_sector;
 
364
} ATTRIBUTE_PACKED cell_adr_t;
 
365
 
 
366
/**
 
367
 * Cell Address Table.
 
368
 */
 
369
typedef struct {
 
370
  uint16_t nr_of_vobs; /* VOBs */
 
371
  uint16_t zero_1;
 
372
  uint32_t last_byte;
 
373
  cell_adr_t *cell_adr_table;  /* No explicit size given. */
 
374
} ATTRIBUTE_PACKED c_adt_t;
 
375
#define C_ADT_SIZE 8U
 
376
 
 
377
/**
 
378
 * VOBU Address Map.
 
379
 */
 
380
typedef struct {
 
381
  uint32_t last_byte;
 
382
  uint32_t *vobu_start_sectors;
 
383
} ATTRIBUTE_PACKED vobu_admap_t;
 
384
#define VOBU_ADMAP_SIZE 4U
 
385
 
 
386
 
 
387
 
 
388
 
 
389
/**
 
390
 * VMGI
 
391
 *
 
392
 * The following structures relate to the Video Manager.
 
393
 */
 
394
 
 
395
/**
 
396
 * Video Manager Information Management Table.
 
397
 */
 
398
typedef struct {
 
399
  char     vmg_identifier[12];
 
400
  uint32_t vmg_last_sector;
 
401
  uint8_t  zero_1[12];
 
402
  uint32_t vmgi_last_sector;
 
403
  uint8_t  zero_2;
 
404
  uint8_t  specification_version;
 
405
  uint32_t vmg_category;
 
406
  uint16_t vmg_nr_of_volumes;
 
407
  uint16_t vmg_this_volume_nr;
 
408
  uint8_t  disc_side;
 
409
  uint8_t  zero_3[19];
 
410
  uint16_t vmg_nr_of_title_sets;  /* Number of VTSs. */
 
411
  char     provider_identifier[32];
 
412
  uint64_t vmg_pos_code;
 
413
  uint8_t  zero_4[24];
 
414
  uint32_t vmgi_last_byte;
 
415
  uint32_t first_play_pgc;
 
416
  uint8_t  zero_5[56];
 
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 */
 
425
  uint8_t  zero_6[32];
 
426
 
 
427
  video_attr_t vmgm_video_attr;
 
428
  uint8_t  zero_7;
 
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];
 
432
  uint8_t  zero_9[17];
 
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;
 
437
 
 
438
typedef struct {
 
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;
 
448
 
 
449
/**
 
450
 * Title Information.
 
451
 */
 
452
typedef struct {
 
453
  playback_type_t pb_ty;
 
454
  uint8_t  nr_of_angles;
 
455
  uint16_t nr_of_ptts;
 
456
  uint16_t parental_id;
 
457
  uint8_t  title_set_nr;
 
458
  uint8_t  vts_ttn;
 
459
  uint32_t title_set_sector;
 
460
} ATTRIBUTE_PACKED title_info_t;
 
461
 
 
462
/**
 
463
 * PartOfTitle Search Pointer Table.
 
464
 */
 
465
typedef struct {
 
466
  uint16_t nr_of_srpts;
 
467
  uint16_t zero_1;
 
468
  uint32_t last_byte;
 
469
  title_info_t *title;
 
470
} ATTRIBUTE_PACKED tt_srpt_t;
 
471
#define TT_SRPT_SIZE 8U
 
472
 
 
473
 
 
474
/**
 
475
 * Parental Management Information Unit Table.
 
476
 * Level 1 (US: G), ..., 7 (US: NC-17), 8
 
477
 */
 
478
#define PTL_MAIT_NUM_LEVEL 8
 
479
typedef uint16_t pf_level_t[PTL_MAIT_NUM_LEVEL];
 
480
 
 
481
/**
 
482
 * Parental Management Information Unit Table.
 
483
 */
 
484
typedef struct {
 
485
  uint16_t country_code;
 
486
  uint16_t zero_1;
 
487
  uint16_t pf_ptl_mai_start_byte;
 
488
  uint16_t zero_2;
 
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
 
492
 
 
493
/**
 
494
 * Parental Management Information Table.
 
495
 */
 
496
typedef struct {
 
497
  uint16_t nr_of_countries;
 
498
  uint16_t nr_of_vtss;
 
499
  uint32_t last_byte;
 
500
  ptl_mait_country_t *countries;
 
501
} ATTRIBUTE_PACKED ptl_mait_t;
 
502
#define PTL_MAIT_SIZE 8U
 
503
 
 
504
/**
 
505
 * Video Title Set Attributes.
 
506
 */
 
507
typedef struct {
 
508
  uint32_t last_byte;
 
509
  uint32_t vts_cat;
 
510
 
 
511
  video_attr_t vtsm_vobs_attr;
 
512
  uint8_t  zero_1;
 
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];
 
516
  uint8_t  zero_3[16];
 
517
  uint8_t  zero_4;
 
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];
 
521
 
 
522
  uint8_t  zero_6[2];
 
523
 
 
524
  video_attr_t vtstt_vobs_video_attr;
 
525
  uint8_t  zero_7;
 
526
  uint8_t  nr_of_vtstt_audio_streams;
 
527
  audio_attr_t vtstt_audio_attr[8];
 
528
  uint8_t  zero_8[16];
 
529
  uint8_t  zero_9;
 
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
 
535
 
 
536
/**
 
537
 * Video Title Set Attribute Table.
 
538
 */
 
539
typedef struct {
 
540
  uint16_t nr_of_vtss;
 
541
  uint16_t zero_1;
 
542
  uint32_t last_byte;
 
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
 
547
 
 
548
/**
 
549
 * Text Data. (Incomplete)
 
550
 */
 
551
typedef struct {
 
552
  uint32_t last_byte;    /* offsets are relative here */
 
553
  uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */
 
554
#if 0
 
555
  uint16_t unknown; /* 0x48 ?? 0x48 words (16bit) info following */
 
556
  uint16_t zero_1;
 
557
 
 
558
  uint8_t type_of_info; /* ?? 01 == disc, 02 == Title, 04 == Title part */
 
559
  uint8_t unknown1;
 
560
  uint8_t unknown2;
 
561
  uint8_t unknown3;
 
562
  uint8_t unknown4; /* ?? allways 0x30 language?, text format? */
 
563
  uint8_t unknown5;
 
564
  uint16_t offset; /* from first */
 
565
 
 
566
  char text[12]; /* ended by 0x09 */
 
567
#endif
 
568
} ATTRIBUTE_PACKED txtdt_t;
 
569
 
 
570
/**
 
571
 * Text Data Language Unit. (Incomplete)
 
572
 */
 
573
typedef struct {
 
574
  uint16_t lang_code;
 
575
  uint16_t unknown;      /* 0x0001, title 1? disc 1? side 1? */
 
576
  uint32_t txtdt_start_byte;  /* prt, rel start of vmg_txtdt_mgi  */
 
577
  txtdt_t  *txtdt;
 
578
} ATTRIBUTE_PACKED txtdt_lu_t;
 
579
#define TXTDT_LU_SIZE 8U
 
580
 
 
581
/**
 
582
 * Text Data Manager Information. (Incomplete)
 
583
 */
 
584
typedef struct {
 
585
  char disc_name[14];            /* how many bytes?? */
 
586
  uint16_t nr_of_language_units; /* 32bit??          */
 
587
  uint32_t last_byte;
 
588
  txtdt_lu_t *lu;
 
589
} ATTRIBUTE_PACKED txtdt_mgi_t;
 
590
#define TXTDT_MGI_SIZE 20U
 
591
 
 
592
 
 
593
/**
 
594
 * VTS
 
595
 *
 
596
 * Structures relating to the Video Title Set (VTS).
 
597
 */
 
598
 
 
599
/**
 
600
 * Video Title Set Information Management Table.
 
601
 */
 
602
typedef struct {
 
603
  char vts_identifier[12];
 
604
  uint32_t vts_last_sector;
 
605
  uint8_t  zero_1[12];
 
606
  uint32_t vtsi_last_sector;
 
607
  uint8_t  zero_2;
 
608
  uint8_t  specification_version;
 
609
  uint32_t vts_category;
 
610
  uint16_t zero_3;
 
611
  uint16_t zero_4;
 
612
  uint8_t  zero_5;
 
613
  uint8_t  zero_6[19];
 
614
  uint16_t zero_7;
 
615
  uint8_t  zero_8[32];
 
616
  uint64_t zero_9;
 
617
  uint8_t  zero_10[24];
 
618
  uint32_t vtsi_last_byte;
 
619
  uint32_t zero_11;
 
620
  uint8_t  zero_12[56];
 
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 */
 
631
  uint8_t  zero_13[24];
 
632
 
 
633
  video_attr_t vtsm_video_attr;
 
634
  uint8_t  zero_14;
 
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];
 
638
  uint8_t  zero_16[17];
 
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];
 
642
  uint8_t  zero_18[2];
 
643
 
 
644
  video_attr_t vts_video_attr;
 
645
  uint8_t  zero_19;
 
646
  uint8_t  nr_of_vts_audio_streams;
 
647
  audio_attr_t vts_audio_attr[8];
 
648
  uint8_t  zero_20[17];
 
649
  uint8_t  nr_of_vts_subp_streams;
 
650
  subp_attr_t vts_subp_attr[32];
 
651
  uint16_t zero_21;
 
652
  multichannel_ext_t vts_mu_audio_attr[8];
 
653
  /* XXX: how much 'padding' here, if any? */
 
654
} ATTRIBUTE_PACKED vtsi_mat_t;
 
655
 
 
656
/**
 
657
 * PartOfTitle Unit Information.
 
658
 */
 
659
typedef struct {
 
660
  uint16_t pgcn;
 
661
  uint16_t pgn;
 
662
} ATTRIBUTE_PACKED ptt_info_t;
 
663
 
 
664
/**
 
665
 * PartOfTitle Information.
 
666
 */
 
667
typedef struct {
 
668
  uint16_t nr_of_ptts;
 
669
  ptt_info_t *ptt;
 
670
} ATTRIBUTE_PACKED ttu_t;
 
671
 
 
672
/**
 
673
 * PartOfTitle Search Pointer Table.
 
674
 */
 
675
typedef struct {
 
676
  uint16_t nr_of_srpts;
 
677
  uint16_t zero_1;
 
678
  uint32_t last_byte;
 
679
  ttu_t  *title;
 
680
  uint32_t *ttu_offset; /* offset table for each ttu */
 
681
} ATTRIBUTE_PACKED vts_ptt_srpt_t;
 
682
#define VTS_PTT_SRPT_SIZE 8U
 
683
 
 
684
 
 
685
/**
 
686
 * Time Map Entry.
 
687
 */
 
688
/* Should this be bit field at all or just the uint32_t? */
 
689
typedef uint32_t map_ent_t;
 
690
 
 
691
/**
 
692
 * Time Map.
 
693
 */
 
694
typedef struct {
 
695
  uint8_t  tmu;   /* Time unit, in seconds */
 
696
  uint8_t  zero_1;
 
697
  uint16_t nr_of_entries;
 
698
  map_ent_t *map_ent;
 
699
} ATTRIBUTE_PACKED vts_tmap_t;
 
700
#define VTS_TMAP_SIZE 4U
 
701
 
 
702
/**
 
703
 * Time Map Table.
 
704
 */
 
705
typedef struct {
 
706
  uint16_t nr_of_tmaps;
 
707
  uint16_t zero_1;
 
708
  uint32_t last_byte;
 
709
  vts_tmap_t *tmap;
 
710
  uint32_t *tmap_offset; /* offset table for each tmap */
 
711
} ATTRIBUTE_PACKED vts_tmapt_t;
 
712
#define VTS_TMAPT_SIZE 8U
 
713
 
 
714
 
 
715
#if PRAGMA_PACK
 
716
#pragma pack()
 
717
#endif
 
718
 
 
719
 
 
720
/**
 
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.
 
725
 */
 
726
typedef struct {
 
727
  dvd_file_t *file;
 
728
 
 
729
  /* VMGI */
 
730
  vmgi_mat_t     *vmgi_mat;
 
731
  tt_srpt_t      *tt_srpt;
 
732
  pgc_t          *first_play_pgc;
 
733
  ptl_mait_t     *ptl_mait;
 
734
  vts_atrt_t     *vts_atrt;
 
735
  txtdt_mgi_t    *txtdt_mgi;
 
736
 
 
737
  /* Common */
 
738
  pgci_ut_t      *pgci_ut;
 
739
  c_adt_t        *menu_c_adt;
 
740
  vobu_admap_t   *menu_vobu_admap;
 
741
 
 
742
  /* VTSI */
 
743
  vtsi_mat_t     *vtsi_mat;
 
744
  vts_ptt_srpt_t *vts_ptt_srpt;
 
745
  pgcit_t        *vts_pgcit;
 
746
  vts_tmapt_t    *vts_tmapt;
 
747
  c_adt_t        *vts_c_adt;
 
748
  vobu_admap_t   *vts_vobu_admap;
 
749
} ifo_handle_t;
 
750
 
 
751
#endif /* LIBDVDREAD_IFO_TYPES_H */