Debian Codegraph @

src/ifo_print.c

raw symbols SCIP
1 /*
2 * This file is part of libdvdread.
3 *
4 * libdvdread is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * libdvdread is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with libdvdread; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #include "config.h"
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <inttypes.h>
24 #include <string.h>
25 #include <ctype.h>
26 #include <assert.h>
27
28 #include "dvdread/ifo_types.h"
29 #include "dvdread/ifo_read.h"
30 #include "dvdread/ifo_print.h"
31 #include "dvdread_internal.h"
32 #include "logger.h"
33
34 /* Put this in some other file / package? It's used in nav_print too. */
35 static void ifo_print_time(dvd_time_t *dtime) {
36 const char *rate;
37 assert((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa);
38 assert((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa);
39 assert((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa);
40 assert((dtime->frame_u&0xf) < 0xa);
41
42 printf("%02x:%02x:%02x.%02x",
43 dtime->hour,
44 dtime->minute,
45 dtime->second,
46 dtime->frame_u & 0x3f);
47 switch((dtime->frame_u & 0xc0) >> 6) {
48 case 1:
49 rate = "25.00";
50 break;
51 case 3:
52 rate = "29.97";
53 break;
54 default:
55 if(dtime->hour == 0 && dtime->minute == 0
56 && dtime->second == 0 && dtime->frame_u == 0)
57 rate = "no";
58 else
59 rate = "(please send a bug report)";
60 break;
61 }
62 printf(" @ %s fps", rate);
63 }
64
65 void dvdread_print_time(dvd_time_t *dtime) {
66 ifo_print_time(dtime);
67 }
68
69 /* Put this in some other file / package? It's used in nav_print too.
70 Possibly also by the vm / navigator. */
71 static void ifo_print_cmd(int row, vm_cmd_t *command) {
72 int i;
73
74 printf("(%03d) ", row + 1);
75 for(i=0;i<8;i++)
76 printf("%02x ", command->bytes[i]);
77 printf("| ");
78 #if 0
79 //disabled call of dvdnav function
80 vm_print_mnemonic(command);
81 #endif
82 printf("\n");
83 }
84
85 static void ifo_print_video_attributes(video_attr_t *attr) {
86
87 /* The following test is shorter but not correct ISO C,
88 memcmp(attr,my_friendly_zeros, sizeof(video_attr_t)) */
89 if(attr->mpeg_version == 0
90 && attr->video_format == 0
91 && attr->display_aspect_ratio == 0
92 && attr->permitted_df == 0
93 && attr->line21_cc_1 == 0
94 && attr->line21_cc_2 == 0
95 && attr->unknown1 == 0
96 && attr->letterboxed == 0
97 && attr->film_mode == 0) {
98 printf("-- Unspecified --");
99 return;
100 }
101
102 switch(attr->mpeg_version) {
103 case 0:
104 printf("mpeg1, ");
105 break;
106 case 1:
107 printf("mpeg2, ");
108 break;
109 default:
110 printf("(please send a bug report), ");
111 }
112
113 switch(attr->video_format) {
114 case 0:
115 printf("ntsc, ");
116 break;
117 case 1:
118 printf("pal, ");
119 break;
120 default:
121 printf("(please send a bug report), ");
122 }
123
124 switch(attr->display_aspect_ratio) {
125 case 0:
126 printf("4:3, ");
127 break;
128 case 3:
129 printf("16:9, ");
130 break;
131 default:
132 printf("(please send a bug report), ");
133 }
134
135 // Wide is always allowed..!!!
136 switch(attr->permitted_df) {
137 case 0:
138 printf("pan&scan+letterboxed, ");
139 break;
140 case 1:
141 printf("only pan&scan, "); //??
142 break;
143 case 2:
144 printf("only letterboxed, ");
145 break;
146 case 3:
147 printf("not specified, ");
148 break;
149 default:
150 printf("(please send a bug report), ");
151 }
152
153 if(attr->line21_cc_1 || attr->line21_cc_2) {
154 printf("NTSC CC ");
155 if(attr->line21_cc_1)
156 printf("1, ");
157 if(attr->line21_cc_2)
158 printf("2, ");
159 }
160
161 {
162 int height = 480;
163 if(attr->video_format != 0)
164 height = 576;
165 switch(attr->picture_size) {
166 case 0:
167 printf("720x%d, ", height);
168 break;
169 case 1:
170 printf("704x%d, ", height);
171 break;
172 case 2:
173 printf("352x%d, ", height);
174 break;
175 case 3:
176 printf("352x%d, ", height/2);
177 break;
178 default:
179 printf("(please send a bug report), ");
180 }
181 }
182
183 if(attr->letterboxed) {
184 printf("source letterboxed, ");
185 }
186
187 if(attr->film_mode) {
188 printf("film, ");
189 } else {
190 printf("video, "); //camera
191 }
192
193 printf("Unknown1: %x", attr->unknown1);
194
195 }
196
197 static void ifo_print_audio_attributes(audio_attr_t *attr) {
198
199 if(attr->audio_format == 0
200 && attr->multichannel_extension == 0
201 && attr->lang_type == 0
202 && attr->application_mode == 0
203 && attr->quantization == 0
204 && attr->sample_frequency == 0
205 && attr->unknown1 == 0
206 && attr->channels == 0
207 && attr->lang_extension == 0
208 && attr->unknown3 == 0) {
209 printf("-- Unspecified --");
210 return;
211 }
212
213 switch(attr->audio_format) {
214 case 0:
215 printf("ac3 ");
216 if(attr->quantization != 3)
217 printf("(please send a bug report) ac3 quant/drc not 3 (%d)", attr->quantization);
218 break;
219 case 1:
220 printf("(please send a bug report) ");
221 break;
222 case 2:
223 printf("mpeg1 ");
224 /* Falls Through. */ /* to MPEG-2 */
225 case 3:
226 printf("mpeg2ext ");
227 switch(attr->quantization) {
228 case 0:
229 printf("no drc ");
230 break;
231 case 1:
232 printf("drc ");
233 break;
234 default:
235 printf("(please send a bug report) mpeg reserved quant/drc (%d)", attr->quantization);
236 }
237 break;
238 case 4:
239 printf("lpcm ");
240 switch(attr->quantization) {
241 case 0:
242 printf("16bit ");
243 break;
244 case 1:
245 printf("20bit ");
246 break;
247 case 2:
248 printf("24bit ");
249 break;
250 case 3:
251 printf("(please send a bug report) lpcm reserved quant/drc (%d)", attr->quantization);
252 break;
253 }
254 break;
255 case 5:
256 printf("(please send a bug report) ");
257 break;
258 case 6:
259 printf("dts ");
260 if(attr->quantization != 3)
261 printf("(please send a bug report) dts quant/drc not 3 (%d)", attr->quantization);
262 break;
263 default:
264 printf("(please send a bug report) ");
265 }
266
267 if(attr->multichannel_extension)
268 printf("multichannel_extension ");
269
270 switch(attr->lang_type) {
271 case 0:
272 // not specified
273 if(attr->lang_code != 0 && attr->lang_code != 0xffff)
274 printf("Lang_code 0x%x, please send a bug report!", attr->lang_code);
275 break;
276 case 1:
277 printf("%c%c ", attr->lang_code>>8, attr->lang_code & 0xff);
278 break;
279 default:
280 printf("(please send a bug report) ");
281 }
282
283 switch(attr->application_mode) {
284 case 0:
285 // not specified
286 break;
287 case 1:
288 printf("karaoke mode ");
289 break;
290 case 2:
291 printf("surround sound mode ");
292 break;
293 default:
294 printf("(please send a bug report) ");
295 }
296
297 switch(attr->quantization) {
298 case 0:
299 printf("16bit ");
300 break;
301 case 1:
302 printf("20bit ");
303 break;
304 case 2:
305 printf("24bit ");
306 break;
307 case 3:
308 printf("drc ");
309 break;
310 default:
311 printf("(please send a bug report) ");
312 }
313
314 switch(attr->sample_frequency) {
315 case 0:
316 printf("48kHz ");
317 break;
318 case 1:
319 printf("??kHz ");
320 break;
321 default:
322 printf("sample_frequency %i (please send a bug report) ",
323 attr->sample_frequency);
324 }
325
326 printf("%dCh ", attr->channels + 1);
327
328 switch(attr->lang_extension) {
329 case 0:
330 printf("Not specified ");
331 break;
332 case 1: // Normal audio
333 printf("Normal Caption ");
334 break;
335 case 2: // visually impaired
336 printf("Audio for visually impaired ");
337 break;
338 case 3: // Directors 1
339 printf("Director's comments 1 ");
340 break;
341 case 4: // Directors 2
342 printf("Director's comments 2 ");
343 break;
344 //case 4: // Music score ?
345 default:
346 printf("(please send a bug report) ");
347 }
348
349 printf("Unknown1: %d ", attr->unknown1);
350 printf("Unknown3: %d ", attr->unknown3);
351 }
352
353 static void ifo_print_subp_attributes(subp_attr_t *attr) {
354
355 if(attr->type == 0
356 && attr->zero1 == 0
357 && attr->zero2 == 0
358 && attr->lang_code == 0
359 && attr->lang_extension== 0) {
360 printf("-- Unspecified --");
361 return;
362 }
363
364 printf("type %02x ", attr->type);
365
366 if(isalpha((int)(attr->lang_code >> 8))
367 && isalpha((int)(attr->lang_code & 0xff))) {
368 printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff);
369 } else {
370 printf("%02x%02x ", 0xff & (unsigned)(attr->lang_code >> 8),
371 0xff & (unsigned)(attr->lang_code & 0xff));
372 }
373
374 printf("%d ", attr->zero1);
375 printf("%d ", attr->zero2);
376
377 switch(attr->lang_extension) {
378 case 0:
379 printf("Not specified ");
380 break;
381 case 1:
382 printf("Caption with normal size character ");
383 break;
384 case 2:
385 printf("Caption with bigger size character ");
386 break;
387 case 3:
388 printf("Caption for children ");
389 break;
390 case 4:
391 printf("reserved ");
392 break;
393 case 5:
394 printf("Closed Caption with normal size character ");
395 break;
396 case 6:
397 printf("Closed Caption with bigger size character ");
398 break;
399 case 7:
400 printf("Closed Caption for children ");
401 break;
402 case 8:
403 printf("reserved ");
404 break;
405 case 9:
406 printf("Forced Caption");
407 break;
408 case 10:
409 printf("reserved ");
410 break;
411 case 11:
412 printf("reserved ");
413 break;
414 case 12:
415 printf("reserved ");
416 break;
417 case 13:
418 printf("Director's comments with normal size character ");
419 break;
420 case 14:
421 printf("Director's comments with bigger size character ");
422 break;
423 case 15:
424 printf("Director's comments for children ");
425 break;
426 default:
427 printf("(please send a bug report) ");
428 }
429
430 }
431
432
433 static void ifoPrint_USER_OPS(user_ops_t *user_ops) {
434 uint32_t uops;
435 unsigned char *ptr = (unsigned char *)user_ops;
436
437 uops = (*ptr++ << 24);
438 uops |= (*ptr++ << 16);
439 uops |= (*ptr++ << 8);
440 uops |= (*ptr++);
441
442 if(uops == 0) {
443 printf("None\n");
444 } else if(uops == 0x01ffffff) {
445 printf("All\n");
446 } else {
447 if(user_ops->title_or_time_play)
448 printf("Title or Time Play, ");
449 if(user_ops->chapter_search_or_play)
450 printf("Chapter Search or Play, ");
451 if(user_ops->title_play)
452 printf("Title Play, ");
453 if(user_ops->stop)
454 printf("Stop, ");
455 if(user_ops->go_up)
456 printf("Go Up, ");
457 if(user_ops->time_or_chapter_search)
458 printf("Time or Chapter Search, ");
459 if(user_ops->prev_or_top_pg_search)
460 printf("Prev or Top PG Search, ");
461 if(user_ops->next_pg_search)
462 printf("Next PG Search, ");
463 if(user_ops->forward_scan)
464 printf("Forward Scan, ");
465 if(user_ops->backward_scan)
466 printf("Backward Scan, ");
467 if(user_ops->title_menu_call)
468 printf("Title Menu Call, ");
469 if(user_ops->root_menu_call)
470 printf("Root Menu Call, ");
471 if(user_ops->subpic_menu_call)
472 printf("SubPic Menu Call, ");
473 if(user_ops->audio_menu_call)
474 printf("Audio Menu Call, ");
475 if(user_ops->angle_menu_call)
476 printf("Angle Menu Call, ");
477 if(user_ops->chapter_menu_call)
478 printf("Chapter Menu Call, ");
479 if(user_ops->resume)
480 printf("Resume, ");
481 if(user_ops->button_select_or_activate)
482 printf("Button Select or Activate, ");
483 if(user_ops->still_off)
484 printf("Still Off, ");
485 if(user_ops->pause_on)
486 printf("Pause On, ");
487 if(user_ops->audio_stream_change)
488 printf("Audio Stream Change, ");
489 if(user_ops->subpic_stream_change)
490 printf("SubPic Stream Change, ");
491 if(user_ops->angle_change)
492 printf("Angle Change, ");
493 if(user_ops->karaoke_audio_pres_mode_change)
494 printf("Karaoke Audio Pres Mode Change, ");
495 if(user_ops->video_pres_mode_change)
496 printf("Video Pres Mode Change, ");
497 printf("\n");
498 }
499 }
500
501 void ifoPrint_AMGI_MAT(amgi_mat_t *amgi_mat) {
502
503 printf("AMG Identifier: %.12s\n", amgi_mat->amg_identifier);
504 printf("start Sector of AMG: %08x\n", amgi_mat->amg_start_sector);
505 printf("Last Sector of AMGI: %08x\n", amgi_mat->amgi_last_sector);
506 printf("Specification version number: %01x.%01x\n",
507 amgi_mat->specification_version >> 4,
508 amgi_mat->specification_version & 0xf);
509 printf("AMG Number of Volumes: %i\n", amgi_mat->amg_nr_of_volumes);
510 printf("AMG This Volume: %i\n", amgi_mat->amg_this_volume_nr);
511 printf("Disc side %i\n", amgi_mat->disc_side);
512 printf("Audio_SV ifo relative pointer: %08x\n", amgi_mat->audio_sv_ifo_relative_p);
513 printf("VMG Number of title sets: %i\n", amgi_mat->vmg_nr_of_title_sets);
514 printf("AMG Number of title sets: %i\n", amgi_mat->amg_nr_of_title_sets);
515 printf("End byte address: %08x\n", amgi_mat->amg_end_byte_address);
516 printf("AMG Number of zones: %i\n", amgi_mat->amg_nr_of_zones);
517 printf("Last sector of audio system space: %02x\n", amgi_mat->last_sector_audio_sys_space);
518
519 }
520
521 static void ifoPrint_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
522
523 printf("VMG Identifier: %.12s\n", vmgi_mat->vmg_identifier);
524 printf("Last Sector of VMG: %08x\n", vmgi_mat->vmg_last_sector);
525 printf("Last Sector of VMGI: %08x\n", vmgi_mat->vmgi_last_sector);
526 printf("Specification version number: %01x.%01x\n",
527 vmgi_mat->specification_version >> 4,
528 vmgi_mat->specification_version & 0xf);
529 /* Byte 2 of 'VMG Category' (00xx0000) is the Region Code */
530 printf("VMG Category: %08x (Region Code=%02x)\n", vmgi_mat->vmg_category, ((vmgi_mat->vmg_category >> 16) & 0xff) ^0xff);
531 printf("VMG Number of Volumes: %i\n", vmgi_mat->vmg_nr_of_volumes);
532 printf("VMG This Volume: %i\n", vmgi_mat->vmg_this_volume_nr);
533 printf("Disc side %i\n", vmgi_mat->disc_side);
534 printf("VMG Number of Title Sets %i\n", vmgi_mat->vmg_nr_of_title_sets);
535 printf("Provider ID: %.32s\n", vmgi_mat->provider_identifier);
536 printf("VMG POS Code: %08x", (uint32_t)(vmgi_mat->vmg_pos_code >> 32));
537 printf("%08x\n", (uint32_t)vmgi_mat->vmg_pos_code);
538 printf("End byte of VMGI_MAT: %08x\n", vmgi_mat->vmgi_last_byte);
539 printf("Start byte of First Play PGC (FP PGC): %08x\n",
540 vmgi_mat->first_play_pgc);
541 printf("Start sector of VMGM_VOBS: %08x\n", vmgi_mat->vmgm_vobs);
542 printf("Start sector of TT_SRPT: %08x\n", vmgi_mat->tt_srpt);
543 printf("Start sector of VMGM_PGCI_UT: %08x\n", vmgi_mat->vmgm_pgci_ut);
544 printf("Start sector of PTL_MAIT: %08x\n", vmgi_mat->ptl_mait);
545 printf("Start sector of VTS_ATRT: %08x\n", vmgi_mat->vts_atrt);
546 printf("Start sector of TXTDT_MG: %08x\n", vmgi_mat->txtdt_mgi);
547 printf("Start sector of VMGM_C_ADT: %08x\n", vmgi_mat->vmgm_c_adt);
548 printf("Start sector of VMGM_VOBU_ADMAP: %08x\n",
549 vmgi_mat->vmgm_vobu_admap);
550 printf("Video attributes of VMGM_VOBS: ");
551 ifo_print_video_attributes(&vmgi_mat->vmgm_video_attr);
552 printf("\n");
553 printf("VMGM Number of Audio attributes: %i\n",
554 vmgi_mat->nr_of_vmgm_audio_streams);
555 if(vmgi_mat->nr_of_vmgm_audio_streams > 0) {
556 printf("\tstream %i status: ", 1);
557 ifo_print_audio_attributes(&vmgi_mat->vmgm_audio_attr);
558 printf("\n");
559 }
560 printf("VMGM Number of Sub-picture attributes: %i\n",
561 vmgi_mat->nr_of_vmgm_subp_streams);
562 if(vmgi_mat->nr_of_vmgm_subp_streams > 0) {
563 printf("\tstream %2i status: ", 1);
564 ifo_print_subp_attributes(&vmgi_mat->vmgm_subp_attr);
565 printf("\n");
566 }
567 }
568
569
570 static void ifoPrint_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
571 int i;
572
573 printf("VTS Identifier: %.12s\n", vtsi_mat->vts_identifier);
574 printf("Last Sector of VTS: %08x\n", vtsi_mat->vts_last_sector);
575 printf("Last Sector of VTSI: %08x\n", vtsi_mat->vtsi_last_sector);
576 printf("Specification version number: %01x.%01x\n",
577 vtsi_mat->specification_version>>4,
578 vtsi_mat->specification_version&0xf);
579 printf("VTS Category: %08x\n", vtsi_mat->vts_category );
580 printf("End byte of VTSI_MAT: %08x\n", vtsi_mat->vtsi_last_byte);
581 printf("Start sector of VTSM_VOBS: %08x\n", vtsi_mat->vtsm_vobs);
582 printf("Start sector of VTSTT_VOBS: %08x\n", vtsi_mat->vtstt_vobs);
583 printf("Start sector of VTS_PTT_SRPT: %08x\n", vtsi_mat->vts_ptt_srpt);
584 printf("Start sector of VTS_PGCIT: %08x\n", vtsi_mat->vts_pgcit);
585 printf("Start sector of VTSM_PGCI_UT: %08x\n", vtsi_mat->vtsm_pgci_ut);
586 printf("Start sector of VTS_TMAPT: %08x\n", vtsi_mat->vts_tmapt);
587 printf("Start sector of VTSM_C_ADT: %08x\n", vtsi_mat->vtsm_c_adt);
588 printf("Start sector of VTSM_VOBU_ADMAP: %08x\n",vtsi_mat->vtsm_vobu_admap);
589 printf("Start sector of VTS_C_ADT: %08x\n", vtsi_mat->vts_c_adt);
590 printf("Start sector of VTS_VOBU_ADMAP: %08x\n", vtsi_mat->vts_vobu_admap);
591
592 printf("Video attributes of VTSM_VOBS: ");
593 ifo_print_video_attributes(&vtsi_mat->vtsm_video_attr);
594 printf("\n");
595
596 printf("VTSM Number of Audio attributes: %i\n",
597 vtsi_mat->nr_of_vtsm_audio_streams);
598 if(vtsi_mat->nr_of_vtsm_audio_streams > 0) {
599 printf("\tstream %i status: ", 1);
600 ifo_print_audio_attributes(&vtsi_mat->vtsm_audio_attr);
601 printf("\n");
602 }
603
604 printf("VTSM Number of Sub-picture attributes: %i\n",
605 vtsi_mat->nr_of_vtsm_subp_streams);
606 if(vtsi_mat->nr_of_vtsm_subp_streams > 0) {
607 printf("\tstream %2i status: ", 1);
608 ifo_print_subp_attributes(&vtsi_mat->vtsm_subp_attr);
609 printf("\n");
610 }
611
612 printf("Video attributes of VTS_VOBS: ");
613 ifo_print_video_attributes(&vtsi_mat->vts_video_attr);
614 printf("\n");
615
616 printf("VTS Number of Audio attributes: %i\n",
617 vtsi_mat->nr_of_vts_audio_streams);
618 for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) {
619 printf("\tstream %i status: ", i);
620 ifo_print_audio_attributes(&vtsi_mat->vts_audio_attr[i]);
621 printf("\n");
622 }
623
624 printf("VTS Number of Subpicture attributes: %i\n",
625 vtsi_mat->nr_of_vts_subp_streams);
626 for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) {
627 printf("\tstream %2i status: ", i);
628 ifo_print_subp_attributes(&vtsi_mat->vts_subp_attr[i]);
629 printf("\n");
630 }
631 }
632
633 static void ifo_print_atsi_records(atsi_record_t *records){
634 for (int i =0; i <8; i++){
635 printf("Encoding Format (0x00 for lcpm, 0x01 for mlp, 0x05 for dts: %.02x\n", records[i].encoding);
636 printf("audio_format uknown: %.02x\n", records[i].unknown1);
637 printf("audio_format bitrate: %.02x\n", records[i].bitrate);
638 printf("audio_format sampling frequency: %.02x\n", records[i].sampling_frequency);
639 printf("audio_format number of channels: %.02x\n", records[i].nr_channels);
640 printf("audio_format unknown: %.02x\n", records[i].unknown2);
641 }
642 }
643
644 static void ifo_print_downmix_coefficients(downmix_coeff_t *downmix_coefficients) {
645 for (int i = 0; i < DOWNMIX_COEFF_MAX_SIZE; i++) {
646 printf("DOWNMIX COEFFICIENTS:\n");
647
648 printf("Lf_left, Lf_right: %02x, %02x\n ",
649 downmix_coefficients[i].Lf_left, downmix_coefficients[i].Lf_right);
650
651 printf("Rf_left, Rf_right: %02x, %02x\n ",
652 downmix_coefficients[i].Rf_left, downmix_coefficients[i].Rf_right);
653
654 printf("C_left, C_right: %02x, %02x\n ",
655 downmix_coefficients[i].C_left, downmix_coefficients[i].C_right);
656
657 printf("LFE_left, LFE_right: %02x, %02x\n ",
658 downmix_coefficients[i].LFE_left, downmix_coefficients[i].LFE_right);
659
660 printf("Ls_left, Ls_right: %02x, %02x\n ",
661 downmix_coefficients[i].Ls_left, downmix_coefficients[i].Ls_right);
662
663 printf("Rs_left, Rs_right: %02x, %02x\n ",
664 downmix_coefficients[i].Rs_left, downmix_coefficients[i].Rs_right);
665
666 }
667 }
668
669 void ifoPrint_TT(atsi_title_table_t *atsi_title_table){
670 printf("Number of titles: %04x\n", atsi_title_table->nr_titles);
671 printf("Last byte address: %08x\n", atsi_title_table->last_byte_address);
672
673 for (int i=0; i< atsi_title_table->nr_titles;i++){
674 printf("Offset of record table for entry %d: %08x\n", i, atsi_title_table->atsi_index_rows[i].offset_record_table);
675 }
676
677
678 for (int i=0; i< atsi_title_table->nr_titles;i++){
679 atsi_title_record_t *index=atsi_title_table->atsi_title_row_tables+i;
680 printf("Number of tracks in title %d: %04x\n", i,index->nr_tracks );
681
682 printf("Length PTS of title %d: %08x\n", i, index->length_pts);
683 printf("Start sector of pointers table %d: %04x\n", i, index->start_sector_pointers_table);
684
685 for (int i=0; i<index->nr_tracks ;i++){
686 printf("Track number in title of track %d: %02x\n", i, index->atsi_track_timestamp_rows[i].track_number_in_title );
687 printf("Length PTS of track %d: %08x\n", i, index->atsi_track_timestamp_rows[i].length_pts_of_track);
688 printf("Start PTS of track %d: %08x\n", i, index->atsi_track_timestamp_rows[i].first_pts_of_track);
689 }
690 for (int i=0; i< index->nr_pointer_records;i++){
691 printf("Track start sector %d: %08x\n", i, index->atsi_track_pointer_rows[i].start_sector);
692 printf("Length PTS of track %d: %08x\n", i, index->atsi_track_pointer_rows[i].end_sector);
693 }
694 }
695 }
696
697 void ifoPrint_TIF(tracks_info_table_t *tracks_info_table){
698 printf("Number of titles: %04x\n", tracks_info_table->nr_of_titles);
699 printf("Last byte in table: %04x\n", tracks_info_table->last_byte_in_table);
700
701 for (int i =0; i<tracks_info_table->nr_of_titles;i++){
702
703 printf("Type and rank of track %d: %02x\n",i, tracks_info_table->tracks_info[i].type_and_rank);
704 printf("Number of chapters in title of track %d: %02x\n",i, tracks_info_table->tracks_info[i].nr_chapters_in_title);
705 printf("Length of audio zone pts of track %d: %04x\n",i, tracks_info_table->tracks_info[i].len_audio_zone_pts);
706 printf("Rank of group, or video titleset number of track %d: %02x\n",i, tracks_info_table->tracks_info[i].group_property);
707 printf("video Title number, of rank of title in audio track of track %d: %02x\n",i, tracks_info_table->tracks_info[i].title_property);
708 printf("Title set sector pointer of track %d: %08x\n",i, tracks_info_table->tracks_info[i].ts_pointer_relative_sector);
709 }
710
711
712 }
713
714 void ifoPrint_ATSI_MAT(atsi_mat_t *atsi_mat) {
715 printf("ATS Identifier: %.12s\n", atsi_mat->ats_identifier);
716 printf("Last Sector of ATS: %08x\n", atsi_mat->ats_last_sector);
717 printf("Last Sector of ATSI: %08x\n", atsi_mat->atsi_last_sector);
718 printf("Specification version number: %01x.%01x\n",
719 atsi_mat->specification_version>>4,
720 atsi_mat->specification_version&0xf);
721 printf("End byte of ATSI_MAT: %08x\n", atsi_mat->atsi_last_byte);
722 printf("Start sector of ATSM_VOBS: %08x\n", atsi_mat->vtsm_vobs);
723 printf("Start sector of ATST_AOBS: %08x\n", atsi_mat->atst_aobs);
724 printf("Start sector of VTS_PTT_SRPT: %08x\n", atsi_mat->vts_ptt_srpt);
725 printf("Start sector of ATS_PCGI_UT: %08x\n", atsi_mat->ats_pgci_ut);
726 printf("Start sector of VTSM_PGCI_UT: %08x\n", atsi_mat->vtsm_pgci_ut);
727 printf("Start sector of VTS_TMAPT: %08x\n", atsi_mat->vts_tmapt);
728 printf("Start sector of VTSM_C_ADT: %08x\n", atsi_mat->vtsm_c_adt);
729 printf("Start sector of VTSM_VOBU_ADMAP: %08x\n",atsi_mat->vtsm_vobu_admap);
730 printf("Start sector of VTS_C_ADT: %08x\n", atsi_mat->vts_c_adt);
731 printf("Start sector of VTS_VOBU_ADMAP: %08x\n", atsi_mat->vts_vobu_admap);
732
733 printf("ATSI_RECORDS: ");
734 ifo_print_atsi_records(atsi_mat->atsi_record);
735 printf("\n");
736 ifo_print_downmix_coefficients(atsi_mat->downmix_coefficients);
737
738
739 }
740
741 static void ifoPrint_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
742 int i;
743
744 if(cmd_tbl == NULL) {
745 printf("No Command table present\n");
746 return;
747 }
748
749 printf("Number of Pre commands: %i\n", cmd_tbl->nr_of_pre);
750 for(i = 0; i < cmd_tbl->nr_of_pre; i++) {
751 ifo_print_cmd(i, &cmd_tbl->pre_cmds[i]);
752 }
753
754 printf("Number of Post commands: %i\n", cmd_tbl->nr_of_post);
755 for(i = 0; i < cmd_tbl->nr_of_post; i++) {
756 ifo_print_cmd(i, &cmd_tbl->post_cmds[i]);
757 }
758
759 printf("Number of Cell commands: %i\n", cmd_tbl->nr_of_cell);
760 for(i = 0; i < cmd_tbl->nr_of_cell; i++) {
761 ifo_print_cmd(i, &cmd_tbl->cell_cmds[i]);
762 }
763 }
764
765
766 static void ifoPrint_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
767 int i;
768
769 if(program_map == NULL) {
770 printf("No Program map present\n");
771 return;
772 }
773
774 for(i = 0; i < nr; i++) {
775 printf("Program %3i Entry Cell: %3i\n", i + 1, program_map[i]);
776 }
777 }
778
779
780 static void ifoPrint_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
781 int i;
782
783 if(cell_playback == NULL) {
784 printf("No Cell Playback info present\n");
785 return;
786 }
787
788 for(i=0;i<nr;i++) {
789 printf("Cell: %3i ", i + 1);
790
791 dvdread_print_time(&cell_playback[i].playback_time);
792 printf("\t");
793
794 if(cell_playback[i].block_mode || cell_playback[i].block_type) {
795 const char *s;
796 switch(cell_playback[i].block_mode) {
797 case 0:
798 s = "not a"; break;
799 case 1:
800 s = "the first"; break;
801 case 2:
802 default:
803 s = ""; break;
804 case 3:
805 s = "last"; break;
806 }
807 printf("%s cell in the block ", s);
808
809 switch(cell_playback[i].block_type) {
810 case 0:
811 printf("not part of the block ");
812 break;
813 case 1:
814 printf("angle block ");
815 break;
816 case 2:
817 case 3:
818 printf("(send bug report) ");
819 break;
820 }
821 }
822 if(cell_playback[i].seamless_play)
823 printf("presented seamlessly ");
824 if(cell_playback[i].interleaved)
825 printf("cell is interleaved ");
826 if(cell_playback[i].stc_discontinuity)
827 printf("STC_discontinuty ");
828 if(cell_playback[i].seamless_angle)
829 printf("only seamless angle ");
830 if(cell_playback[i].playback_mode)
831 printf("only still VOBUs ");
832 if(cell_playback[i].restricted)
833 printf("restricted cell ");
834 if(cell_playback[i].cell_type)
835 printf("cell type 0x%x ", cell_playback[i].cell_type);
836 if(cell_playback[i].still_time)
837 printf("still time %d ", cell_playback[i].still_time);
838 if(cell_playback[i].cell_cmd_nr)
839 printf("cell command %d", cell_playback[i].cell_cmd_nr);
840
841 printf("\n\tStart sector: %08x\tFirst ILVU end sector: %08x\n",
842 cell_playback[i].first_sector,
843 cell_playback[i].first_ilvu_end_sector);
844 printf("\tEnd sector: %08x\tLast VOBU start sector: %08x\n",
845 cell_playback[i].last_sector,
846 cell_playback[i].last_vobu_start_sector);
847 }
848 }
849
850 static void ifoPrint_CELL_POSITION(cell_position_t *cell_position, int nr) {
851 int i;
852
853 if(cell_position == NULL) {
854 printf("No Cell Position info present\n");
855 return;
856 }
857
858 for(i=0;i<nr;i++) {
859 printf("Cell: %3i has VOB ID: %3i, Cell ID: %3i\n", i + 1,
860 cell_position[i].vob_id_nr, cell_position[i].cell_nr);
861 }
862 }
863
864
865 static void ifoPrint_PGC(pgc_t *pgc) {
866 int i;
867
868 if (!pgc) {
869 printf("None\n");
870 return;
871 }
872 printf("Number of Programs: %i\n", pgc->nr_of_programs);
873 printf("Number of Cells: %i\n", pgc->nr_of_cells);
874 /* Check that time is 0:0:0:0 also if nr_of_programs==0 */
875 printf("Playback time: ");
876 dvdread_print_time(&pgc->playback_time); printf("\n");
877
878 /* If no programs/no time then does this mean anything? */
879 printf("Prohibited user operations: ");
880 ifoPrint_USER_OPS(&pgc->prohibited_ops);
881
882 for(i = 0; i < 8; i++) {
883 if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
884 printf("Audio stream %i control: %04x\n",
885 i, pgc->audio_control[i]);
886 }
887 }
888
889 for(i = 0; i < 32; i++) {
890 if(pgc->subp_control[i] & 0x80000000) { /* The 'is present' bit */
891 printf("Subpicture stream %2i control: %08x: 4:3=%d, Wide=%d, Letterbox=%d, Pan-Scan=%d\n",
892 i, pgc->subp_control[i],
893 (pgc->subp_control[i] >>24) & 0x1f,
894 (pgc->subp_control[i] >>16) & 0x1f,
895 (pgc->subp_control[i] >>8) & 0x1f,
896 (pgc->subp_control[i] ) & 0x1f);
897 }
898 }
899
900 printf("Next PGC number: %i\n", pgc->next_pgc_nr);
901 printf("Prev PGC number: %i\n", pgc->prev_pgc_nr);
902 printf("GoUp PGC number: %i\n", pgc->goup_pgc_nr);
903 if(pgc->nr_of_programs != 0) {
904 printf("Still time: %i seconds (255=inf)\n", pgc->still_time);
905 printf("PG Playback mode %02x\n", pgc->pg_playback_mode);
906 }
907
908 if(pgc->nr_of_programs != 0) {
909 for(i = 0; i < 16; i++) {
910 printf("Color %2i: %08x\n", i, pgc->palette[i]);
911 }
912 }
913
914 /* Memory offsets to div. tables. */
915 ifoPrint_PGC_COMMAND_TBL(pgc->command_tbl);
916 ifoPrint_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
917 ifoPrint_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells);
918 ifoPrint_CELL_POSITION(pgc->cell_position, pgc->nr_of_cells);
919 }
920
921
922 static void ifoPrint_TT_SRPT(tt_srpt_t *tt_srpt) {
923 int i;
924
925 printf("Number of TitleTrack search pointers: %i\n",
926 tt_srpt->nr_of_srpts);
927 for(i=0;i<tt_srpt->nr_of_srpts;i++) {
928 printf("Title Track index %i\n", i + 1);
929 printf("\tTitle set number (VTS): %i",
930 tt_srpt->title[i].title_set_nr);
931 printf("\tVTS_TTN: %i\n", tt_srpt->title[i].vts_ttn);
932 printf("\tNumber of PTTs: %i\n", tt_srpt->title[i].nr_of_ptts);
933 printf("\tNumber of angles: %i\n",
934 tt_srpt->title[i].nr_of_angles);
935
936 printf("\tTitle playback type: (%02x)\n",
937 *(uint8_t *)&(tt_srpt->title[i].pb_ty));
938 printf("\t\t%s\n",
939 tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequential");
940 if (tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd) printf("\t\tJump/Link/Call exists in cell cmd\n");
941 if (tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd) printf("\t\tJump/Link/Call exists in pre/post cmd\n");
942 if (tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd) printf("\t\tJump/Link/Call exists in button cmd\n");
943 if (tt_srpt->title[i].pb_ty.jlc_exists_in_tt_dom) printf("\t\tJump/Link/Call exists in tt_dom cmd\n");
944 printf("\t\tTitle or time play:%u\n", tt_srpt->title[i].pb_ty.title_or_time_play);
945 printf("\t\tChapter search or play:%u\n", tt_srpt->title[i].pb_ty.chapter_search_or_play);
946
947 printf("\tParental ID field: %04x\n",
948 tt_srpt->title[i].parental_id);
949 printf("\tTitle set starting sector %08x\n",
950 tt_srpt->title[i].title_set_sector);
951 }
952 }
953
954
955 static void ifoPrint_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
956 int i, j;
957 printf(" nr_of_srpts %i last byte %i\n",
958 vts_ptt_srpt->nr_of_srpts,
959 vts_ptt_srpt->last_byte);
960 for(i=0;i<vts_ptt_srpt->nr_of_srpts;i++) {
961 for(j=0;j<vts_ptt_srpt->title[i].nr_of_ptts;j++) {
962 printf("VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n",
963 i + 1, j + 1,
964 vts_ptt_srpt->title[i].ptt[j].pgcn,
965 vts_ptt_srpt->title[i].ptt[j].pgn );
966 }
967 }
968 }
969
970
971 static void hexdump(uint8_t *ptr, int len) {
972 while(len--)
973 printf("%02x ", *ptr++);
974 }
975
976 static void ifoPrint_PTL_MAIT(ptl_mait_t *ptl_mait) {
977 int i, j;
978
979 printf("Number of Countries: %i\n", ptl_mait->nr_of_countries);
980 printf("Number of VTSs: %i\n", ptl_mait->nr_of_vtss);
981 //printf("Last byte: %i\n", ptl_mait->last_byte);
982
983 for(i = 0; i < ptl_mait->nr_of_countries; i++) {
984 printf("Country code: %c%c\n",
985 ptl_mait->countries[i].country_code >> 8,
986 ptl_mait->countries[i].country_code & 0xff);
987 /*
988 printf("Start byte: %04x %i\n",
989 ptl_mait->countries[i].pf_ptl_mai_start_byte,
990 ptl_mait->countries[i].pf_ptl_mai_start_byte);
991 */
992 /* This seems to be pointing at a array with 8 2byte fields per VTS
993 ? and one extra for the menu? always an odd number of VTSs on
994 all the dics I tested so it might be padding to even also.
995 If it is for the menu it probably the first entry. */
996 for(j=0;j<8;j++) {
997 hexdump( (uint8_t *)ptl_mait->countries - PTL_MAIT_COUNTRY_SIZE
998 + ptl_mait->countries[i].pf_ptl_mai_start_byte
999 + j*(ptl_mait->nr_of_vtss+1)*2, (ptl_mait->nr_of_vtss+1)*2);
1000 printf("\n");
1001 }
1002 }
1003 }
1004
1005 static void ifoPrint_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
1006 unsigned int timeunit;
1007 int i, j;
1008
1009 printf("Number of VTS_TMAPS: %i\n", vts_tmapt->nr_of_tmaps);
1010 printf("Last byte: %i\n", vts_tmapt->last_byte);
1011
1012 for(i = 0; i < vts_tmapt->nr_of_tmaps; i++) {
1013 printf("TMAP %i (number matches title PGC number.)\n", i + 1);
1014 printf(" offset %d relative to VTS_TMAPTI\n", vts_tmapt->tmap_offset[i]);
1015 printf(" Time unit (seconds): %i\n", vts_tmapt->tmap[i].tmu);
1016 printf(" Number of entries: %i\n", vts_tmapt->tmap[i].nr_of_entries);
1017 timeunit = vts_tmapt->tmap[i].tmu;
1018 for(j = 0; j < vts_tmapt->tmap[i].nr_of_entries; j++) {
1019 unsigned int ac_time = timeunit * (j + 1);
1020 printf("Time: %2i:%02i:%02i VOBU Sector: 0x%08x %s\n",
1021 ac_time / (60 * 60), (ac_time / 60) % 60, ac_time % 60,
1022 vts_tmapt->tmap[i].map_ent[j] & 0x7fffffff,
1023 (vts_tmapt->tmap[i].map_ent[j] >> 31) ? "discontinuity" : "");
1024 }
1025 }
1026 }
1027
1028 static void ifoPrint_C_ADT(c_adt_t *c_adt) {
1029 int i, entries;
1030
1031 printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs);
1032 //entries = c_adt->nr_of_vobs;
1033 entries = (c_adt->last_byte + 1 - C_ADT_SIZE)/sizeof(c_adt_t);
1034
1035 for(i = 0; i < entries; i++) {
1036 printf("VOB ID: %3i, Cell ID: %3i ",
1037 c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id);
1038 printf("Sector (first): 0x%08x (last): 0x%08x\n",
1039 c_adt->cell_adr_table[i].start_sector,
1040 c_adt->cell_adr_table[i].last_sector);
1041 }
1042 }
1043
1044
1045 static void ifoPrint_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
1046 int i, entries;
1047
1048 entries = (vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE)/4;
1049 for(i = 0; i < entries; i++) {
1050 printf("VOBU %5i First sector: 0x%08x\n", i + 1,
1051 vobu_admap->vobu_start_sectors[i]);
1052 }
1053 }
1054
1055 static const char *ifo_print_menu_name(int type) {
1056 const char *menu_name;
1057 menu_name="";
1058 switch (type) {
1059 case 2:
1060 menu_name="Title";
1061 break;
1062 case 3:
1063 menu_name = "Root";
1064 break;
1065 case 4:
1066 menu_name = "Sub-Picture";
1067 break;
1068 case 5:
1069 menu_name = "Audio";
1070 break;
1071 case 6:
1072 menu_name = "Angle";
1073 break;
1074 case 7:
1075 menu_name = "PTT (Chapter)";
1076 break;
1077 default:
1078 menu_name = "Unknown";
1079 break;
1080 }
1081 return &menu_name[0];
1082 }
1083
1084 /* pgc_type=1 for menu, 0 for title. */
1085 static void ifoPrint_PGCIT(pgcit_t *pgcit, int pgc_type) {
1086 int i;
1087
1088 printf("\nNumber of Program Chains: %3i\n", pgcit->nr_of_pgci_srp);
1089 for(i = 0; i < pgcit->nr_of_pgci_srp; i++) {
1090 printf("\nProgram (PGC): %3i\n", i + 1);
1091 if (pgc_type) {
1092 printf("PGC Category: Entry PGC %d, Menu Type=0x%02x:%s (Entry id 0x%02x), ",
1093 pgcit->pgci_srp[i].entry_id >> 7,
1094 pgcit->pgci_srp[i].entry_id & 0xf,
1095 ifo_print_menu_name(pgcit->pgci_srp[i].entry_id & 0xf),
1096 pgcit->pgci_srp[i].entry_id);
1097 } else {
1098 printf("PGC Category: %s VTS_TTN:0x%02x (Entry id 0x%02x), ",
1099 pgcit->pgci_srp[i].entry_id >> 7 ? "At Start of" : "During",
1100 pgcit->pgci_srp[i].entry_id & 0xf,
1101 pgcit->pgci_srp[i].entry_id);
1102 }
1103 printf("Parental ID mask 0x%04x\n", pgcit->pgci_srp[i].ptl_id_mask);
1104 ifoPrint_PGC(pgcit->pgci_srp[i].pgc);
1105 }
1106 }
1107
1108
1109 static void ifoPrint_PGCI_UT(pgci_ut_t *pgci_ut) {
1110 int i, menu;
1111
1112 printf("Number of Menu Language Units (PGCI_LU): %3i\n", pgci_ut->nr_of_lus);
1113 for(i = 0; i < pgci_ut->nr_of_lus; i++) {
1114 printf("\nMenu Language Unit %d\n", i+1);
1115 printf("\nMenu Language Code: %c%c\n",
1116 pgci_ut->lu[i].lang_code >> 8,
1117 pgci_ut->lu[i].lang_code & 0xff);
1118
1119 menu = pgci_ut->lu[i].exists;
1120 printf("Menu Existence: %02x: ", menu);
1121 if (menu == 0) {
1122 printf("No menus ");
1123 }
1124 if (menu & 0x80) {
1125 printf("Root ");
1126 menu^=0x80;
1127 }
1128 if (menu & 0x40) {
1129 printf("Sub-Picture ");
1130 menu^=0x40;
1131 }
1132 if (menu & 0x20) {
1133 printf("Audio ");
1134 menu^=0x20;
1135 }
1136 if (menu & 0x10) {
1137 printf("Angle ");
1138 menu^=0x10;
1139 }
1140 if (menu & 0x08) {
1141 printf("PTT ");
1142 menu^=0x08;
1143 }
1144 if (menu > 0) {
1145 printf("Unknown extra menus ");
1146 menu^=0x08;
1147 }
1148 printf("\n");
1149 ifoPrint_PGCIT(pgci_ut->lu[i].pgcit, 1);
1150 }
1151 }
1152
1153
1154 static void ifoPrint_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
1155 int i;
1156
1157 printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat);
1158
1159 printf("Video attributes of VTSM_VOBS: ");
1160 ifo_print_video_attributes(&vts_attributes->vtsm_vobs_attr);
1161 printf("\n");
1162 printf("Number of Audio streams: %i\n",
1163 vts_attributes->nr_of_vtsm_audio_streams);
1164 if(vts_attributes->nr_of_vtsm_audio_streams > 0) {
1165 printf("\tstream %i attributes: ", 1);
1166 ifo_print_audio_attributes(&vts_attributes->vtsm_audio_attr);
1167 printf("\n");
1168 }
1169 printf("Number of Subpicture streams: %i\n",
1170 vts_attributes->nr_of_vtsm_subp_streams);
1171 if(vts_attributes->nr_of_vtsm_subp_streams > 0) {
1172 printf("\tstream %2i attributes: ", 1);
1173 ifo_print_subp_attributes(&vts_attributes->vtsm_subp_attr);
1174 printf("\n");
1175 }
1176
1177 printf("Video attributes of VTSTT_VOBS: ");
1178 ifo_print_video_attributes(&vts_attributes->vtstt_vobs_video_attr);
1179 printf("\n");
1180 printf("Number of Audio streams: %i\n",
1181 vts_attributes->nr_of_vtstt_audio_streams);
1182 for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) {
1183 printf("\tstream %i attributes: ", i);
1184 ifo_print_audio_attributes(&vts_attributes->vtstt_audio_attr[i]);
1185 printf("\n");
1186 }
1187
1188 printf("Number of Subpicture streams: %i\n",
1189 vts_attributes->nr_of_vtstt_subp_streams);
1190 for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) {
1191 printf("\tstream %2i attributes: ", i);
1192 ifo_print_subp_attributes(&vts_attributes->vtstt_subp_attr[i]);
1193 printf("\n");
1194 }
1195 }
1196
1197
1198 static void ifoPrint_VTS_ATRT(vts_atrt_t *vts_atrt) {
1199 int i;
1200
1201 printf("Number of Video Title Sets: %3i\n", vts_atrt->nr_of_vtss);
1202 for(i = 0; i < vts_atrt->nr_of_vtss; i++) {
1203 printf("\nVideo Title Set %i\n", i + 1);
1204 ifoPrint_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
1205 }
1206 }
1207
1208 /* DVD-VR Specific Print Functions */
1209
1210 static void ifoPrint_RTAV_VMGI(rtav_vmgi_t *vmgi) {
1211 printf("RTAV Identifier: %.12s\n", vmgi->id);
1212 printf("Specification version number: %01x.%01x\n",
1213 vmgi->version >> 8, vmgi->version & 0xff);
1214 printf("VMG End Address: %08x\n", vmgi->vmg_ea);
1215 printf("VMGI End Address: %08x\n", vmgi->vmgi_ea);
1216
1217 printf("PGCI Start Address: %08x\n", vmgi->org_pgci_sa);
1218 printf("ORG_PGCI Start Address: %08x\n", vmgi->org_pgci_sa);
1219 printf("UD_PGCI Start Address: %08x\n", vmgi->ud_pgcit_sa);
1220
1221 printf("Text Encoding: 0x%02x\n", vmgi->txt_encoding);
1222 printf("Disc Info 1: %.64s\n", vmgi->disc_info1);
1223 printf("Disc Info 2: %.64s\n", vmgi->disc_info2);
1224
1225 }
1226
1227 static void ifoPrint_PGCI(pgci_t *pgci) {
1228 int i;
1229 if (!pgci) {
1230 printf("No PGCI present\n");
1231 return;
1232 }
1233
1234 printf("Program Information Table (pgci)\n");
1235 printf("Number of VOB Formats: %d\n", pgci->nr_of_vob_formats);
1236 printf("ORG_PGCI Length: %08x\n", pgci->len_org_pgci);
1237
1238 for(i = 0; i < pgci->nr_of_vob_formats; i++) {
1239 printf(" Format %2i: Video Attr 0x%04x, Audio Streams: %d\n",
1240 i + 1,
1241 pgci->vob_formats[i].video_attr,
1242 pgci->vob_formats[i].nr_of_audio_streams);
1243 }
1244 }
1245
1246 static void ifoPrint_PGC_GI(pgc_gi_t *pgc_gi) {
1247 int i;
1248 if (!pgc_gi) {
1249 printf("No pgc_gi present\n");
1250 return;
1251 }
1252
1253 printf("Program General Information (PGC_GI)\n");
1254 printf("Number of Programs: %d\n", pgc_gi->nr_of_programs);
1255
1256 for(i = 0; i < pgc_gi->nr_of_programs; i++) {
1257 pgi_t *prog = &pgc_gi->pgi[i];
1258
1259 printf("\n Program %3i:\n", i + 1);
1260 printf(" Start Byte Offset: %08x\n", pgc_gi->program_offsets[i]);
1261 printf(" VOB Attribute: 0x%04x\n", prog->header.vob_attr);
1262
1263 printf(" Timestamp (PGTM): %02x %02x %02x %02x %02x\n",
1264 prog->header.vob_timestamp.pgtm[0],
1265 prog->header.vob_timestamp.pgtm[1],
1266 prog->header.vob_timestamp.pgtm[2],
1267 prog->header.vob_timestamp.pgtm[3],
1268 prog->header.vob_timestamp.pgtm[4]);
1269
1270 printf(" Start PTM: 0x%08x (Extra: 0x%04x)\n",
1271 prog->header.vob_v_s_ptm.ptm,
1272 prog->header.vob_v_s_ptm.ptm_extra);
1273 printf(" End PTM: 0x%08x (Extra: 0x%04x)\n",
1274 prog->header.vob_v_e_ptm.ptm,
1275 prog->header.vob_v_e_ptm.ptm_extra);
1276
1277 printf(" Time Map: %d time entries, %d VOBU entries\n",
1278 prog->map.nr_of_time_info,
1279 prog->map.nr_of_vobu_info);
1280 }
1281 }
1282
1283 static void ifoPrint_ud_pgcit(ud_pgcit_t *ud_pgcit) {
1284 int i;
1285 if (!ud_pgcit) {
1286 printf("No UD_PGCIT present\n");
1287 return;
1288 }
1289
1290 printf("Program Set General Information (UD_PGCIT)\n");
1291 printf("Total Number of Programs on Disc: %d\n", ud_pgcit->total_nr_of_programs);
1292 printf("Number of Program Sets (Playlists): %d\n", ud_pgcit->nr_of_pgci);
1293
1294 for(i = 0; i < ud_pgcit->nr_of_pgci; i++) {
1295 ud_pgci_t *item = &ud_pgcit->ud_pgci_items[i];
1296 printf("\n Playlist %2i:\n", i + 1);
1297 printf(" Label: %.64s\n", item->label);
1298 printf(" Programs in Set: %d\n", item->nr_of_programs);
1299 printf(" First Program ID: %d\n", item->first_prog_id);
1300 printf(" Program Set ID: %d\n", item->prog_set_id);
1301 }
1302 }
1303
1304 void ifo_print(dvd_reader_t *dvd, int title) {
1305 ifo_handle_t *ifohandle;
1306 printf("Local ifo_print\n");
1307 ifohandle = ifoOpen(dvd, title);
1308 if(!ifohandle) {
1309 Log0(dvd, "Can't open info file for title %d", title);
1310 return;
1311 }
1312
1313 switch(ifohandle->ifo_format){
1314 case (IFO_VIDEO):
1315 if(ifohandle->vmgi_mat) {
1316
1317 printf("VMG top level\n-------------\n");
1318 ifoPrint_VMGI_MAT(ifohandle->vmgi_mat);
1319
1320 printf("\nFirst Play PGC\n--------------\n");
1321 if(ifohandle->first_play_pgc)
1322 ifoPrint_PGC(ifohandle->first_play_pgc);
1323 else
1324 printf("No First Play PGC present\n");
1325
1326 printf("\nTitle Track search pointer table\n");
1327 printf( "------------------------------------------------\n");
1328 ifoPrint_TT_SRPT(ifohandle->tt_srpt);
1329
1330 printf("\nMenu PGCI Unit table\n");
1331 printf( "--------------------\n");
1332 if(ifohandle->pgci_ut) {
1333 ifoPrint_PGCI_UT(ifohandle->pgci_ut);
1334 } else {
1335 printf("No PGCI Unit table present\n");
1336 }
1337
1338 printf("\nParental Management Information table\n");
1339 printf( "------------------------------------\n");
1340 if(ifohandle->ptl_mait) {
1341 ifoPrint_PTL_MAIT(ifohandle->ptl_mait);
1342 } else {
1343 printf("No Parental Management Information present\n");
1344 }
1345
1346 printf("\nVideo Title Set Attribute Table\n");
1347 printf( "-------------------------------\n");
1348 ifoPrint_VTS_ATRT(ifohandle->vts_atrt);
1349
1350 printf("\nText Data Manager Information\n");
1351 printf( "-----------------------------\n");
1352 if(ifohandle->txtdt_mgi) {
1353 //ifo_print_TXTDT_MGI(&(vmgi->txtdt_mgi));
1354 } else {
1355 printf("No Text Data Manager Information present\n");
1356 }
1357
1358 printf("\nMenu Cell Address table\n");
1359 printf( "-----------------\n");
1360 if(ifohandle->menu_c_adt) {
1361 ifoPrint_C_ADT(ifohandle->menu_c_adt);
1362 } else {
1363 printf("No Menu Cell Address table present\n");
1364 }
1365
1366 printf("\nVideo Manager Menu VOBU address map\n");
1367 printf( "-----------------\n");
1368 if(ifohandle->menu_vobu_admap) {
1369 ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap);
1370 } else {
1371 printf("No Menu VOBU address map present\n");
1372 }
1373 }
1374
1375
1376 if(ifohandle->vtsi_mat) {
1377
1378 printf("VTS top level\n-------------\n");
1379 ifoPrint_VTSI_MAT(ifohandle->vtsi_mat);
1380
1381 printf("\nPart of Title Track search pointer table\n");
1382 printf( "----------------------------------------------\n");
1383 ifoPrint_VTS_PTT_SRPT(ifohandle->vts_ptt_srpt);
1384
1385 printf("\nPGCI Unit table\n");
1386 printf( "--------------------\n");
1387 ifoPrint_PGCIT(ifohandle->vts_pgcit, 0);
1388
1389 printf("\nMenu PGCI Unit table\n");
1390 printf( "--------------------\n");
1391 if(ifohandle->pgci_ut) {
1392 ifoPrint_PGCI_UT(ifohandle->pgci_ut);
1393 } else {
1394 printf("No Menu PGCI Unit table present\n");
1395 }
1396
1397 printf("\nVTS Time Map table\n");
1398 printf( "-----------------\n");
1399 if(ifohandle->vts_tmapt) {
1400 ifoPrint_VTS_TMAPT(ifohandle->vts_tmapt);
1401 } else {
1402 printf("No VTS Time Map table present\n");
1403 }
1404
1405 printf("\nMenu Cell Address table\n");
1406 printf( "-----------------\n");
1407 if(ifohandle->menu_c_adt) {
1408 ifoPrint_C_ADT(ifohandle->menu_c_adt);
1409 } else {
1410 printf("No Cell Address table present\n");
1411 }
1412
1413 printf("\nVideo Title Set Menu VOBU address map\n");
1414 printf( "-----------------\n");
1415 if(ifohandle->menu_vobu_admap) {
1416 ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap);
1417 } else {
1418 printf("No Menu VOBU address map present\n");
1419 }
1420
1421 printf("\nCell Address table\n");
1422 printf( "-----------------\n");
1423 ifoPrint_C_ADT(ifohandle->vts_c_adt);
1424
1425 printf("\nVideo Title Set VOBU address map\n");
1426 printf( "-----------------\n");
1427 ifoPrint_VOBU_ADMAP(ifohandle->vts_vobu_admap);
1428 }
1429 break;
1430 case(IFO_AUDIO):
1431
1432 if(ifohandle->samg_mat){
1433 printf("\nSimple Audio Manager table\n");
1434 printf( "-----------------\n");
1435 //ifoPrint_SAMG(ifohandle->amgi_mat);
1436 }
1437 if(ifohandle->amgi_mat){
1438 printf("\nAudio Manager table\n");
1439 printf( "-----------------\n");
1440 ifoPrint_AMGI_MAT(ifohandle->amgi_mat);
1441 }
1442 if(ifohandle->info_table_first_sector){
1443 printf("\nInfo table first sector\n");
1444 printf( "-----------------\n");
1445 ifoPrint_TIF(ifohandle->info_table_first_sector);
1446 }
1447
1448 if(ifohandle->info_table_second_sector){
1449 printf("\nInfo table second sector\n");
1450 printf( "-----------------\n");
1451 ifoPrint_TIF(ifohandle->info_table_second_sector);
1452 }
1453
1454 if(ifohandle->atsi_mat){
1455 printf("\nATSI mat\n");
1456 printf( "-----------------\n");
1457 ifoPrint_ATSI_MAT(ifohandle->atsi_mat);
1458 }
1459
1460 if(ifohandle->atsi_title_table){
1461 printf("\nATSI mat\n");
1462 printf( "-----------------\n");
1463 ifoPrint_TT(ifohandle->atsi_title_table);
1464 }
1465 break;
1466 case(IFO_VIDEO_RECORDING):
1467 printf("\nDVD-VR (RTAV) Information\n");
1468 printf("-------------------------\n");
1469
1470 if(ifohandle->rtav_vmgi) {
1471 printf("\nRTAV Manager Information\n");
1472 printf("------------------------\n");
1473 ifoPrint_RTAV_VMGI(ifohandle->rtav_vmgi);
1474 } else {
1475 printf("No RTAV VMGI present\n");
1476 }
1477
1478 if(ifohandle->pgci) {
1479 printf("\nProgram Information Table (Tech Specs)\n");
1480 printf("--------------------------------------\n");
1481 ifoPrint_PGCI(ifohandle->pgci);
1482 }
1483
1484 if(ifohandle->pgc_gi) {
1485 printf("\nProgram General Information (Original Content)\n");
1486 printf("----------------------------------------------\n");
1487 ifoPrint_PGC_GI(ifohandle->pgc_gi);
1488 }
1489
1490 if(ifohandle->ud_pgcit) {
1491 printf("\nProgram Set General Information (Playlists)\n");
1492 printf("-------------------------------------------\n");
1493 ifoPrint_ud_pgcit(ifohandle->ud_pgcit);
1494 }
1495 break;
1496 case(IFO_UNKNOWN):
1497
1498 printf("\nUKNOWN IFO TYPE\n");
1499 break;
1500
1501 }
1502
1503 ifoClose(ifohandle);
1504 }