comparison libmpdvdkit2/ifo_print.c @ 15874:483e955893b8

update libdvdread to v0.9.4
author aurel
date Thu, 30 Jun 2005 22:48:26 +0000
parents 25df9508f9a8
children e1d6fbd607e0
comparison
equal deleted inserted replaced
15873:276da0bb6207 15874:483e955893b8
1 /* 1 /*
2 * Copyright (C) 2000, 2001, 2002 Björn Englund <d4bjorn@dtek.chalmers.se>, 2 * Copyright (C) 2000, 2001, 2002, 2003
3 * Håkan Hjort <d95hjort@dtek.chalmers.se> 3 * Björn Englund <d4bjorn@dtek.chalmers.se>,
4 * 4 * Håkan Hjort <d95hjort@dtek.chalmers.se>
5 * Modified for use with MPlayer, changes contained in libdvdread_changes.diff.
6 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
7 * $Id$
8 * 5 *
9 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 9 * (at your option) any later version.
19 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 19 */
23 20
21 #include "config.h"
22
24 #include <stdio.h> 23 #include <stdio.h>
25 #include <stdlib.h> 24 #include <stdlib.h>
26 #include <unistd.h> 25 #include <unistd.h>
27 #include <inttypes.h> 26 #include <inttypes.h>
28 #include <string.h> 27 #include <string.h>
29 #include <ctype.h> 28 #include <ctype.h>
30 //#include <assert.h> 29
31
32 #include "config.h" // Needed for WORDS_BIGENDIAN
33 #include "ifo_types.h" 30 #include "ifo_types.h"
34 #include "ifo_read.h" 31 #include "ifo_read.h"
35 #include "ifo_print.h" 32 #include "ifo_print.h"
33 #include "dvdread_internal.h"
36 34
37 /* Put this in some other file / package? It's used in nav_print too. */ 35 /* Put this in some other file / package? It's used in nav_print too. */
38 static void ifoPrint_time(int level, dvd_time_t *dtime) { 36 static void ifoPrint_time(dvd_time_t *dtime) {
39 const char *rate; 37 const char *rate;
40 assert((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa); 38 CHECK_VALUE((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa);
41 assert((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa); 39 CHECK_VALUE((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa);
42 assert((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa); 40 CHECK_VALUE((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa);
43 assert((dtime->frame_u&0xf) < 0xa); 41 CHECK_VALUE((dtime->frame_u&0xf) < 0xa);
44 42
45 printf("%02x:%02x:%02x.%02x", 43 printf("%02x:%02x:%02x.%02x",
46 dtime->hour, 44 dtime->hour,
47 dtime->minute, 45 dtime->minute,
48 dtime->second, 46 dtime->second,
77 75
78 //vmcmd(command); 76 //vmcmd(command);
79 printf("\n"); 77 printf("\n");
80 } 78 }
81 79
82 static void ifoPrint_video_attributes(int level, video_attr_t *attr) { 80 static void ifoPrint_video_attributes(video_attr_t *attr) {
83 81
84 /* The following test is shorter but not correct ISO C, 82 /* The following test is shorter but not correct ISO C,
85 memcmp(attr,my_friendly_zeros, sizeof(video_attr_t)) */ 83 memcmp(attr,my_friendly_zeros, sizeof(video_attr_t)) */
86 if(attr->mpeg_version == 0 84 if(attr->mpeg_version == 0
87 && attr->video_format == 0 85 && attr->video_format == 0
88 && attr->display_aspect_ratio == 0 86 && attr->display_aspect_ratio == 0
89 && attr->permitted_df == 0 87 && attr->permitted_df == 0
90 && attr->unknown1 == 0 88 && attr->unknown1 == 0
91 && attr->line21_cc_1 == 0 89 && attr->line21_cc_1 == 0
92 && attr->line21_cc_2 == 0 90 && attr->line21_cc_2 == 0
91 && attr->bit_rate == 0
93 && attr->video_format == 0 92 && attr->video_format == 0
94 && attr->letterboxed == 0 93 && attr->letterboxed == 0
95 && attr->film_mode == 0) { 94 && attr->film_mode == 0) {
96 printf("-- Unspecified --"); 95 printf("-- Unspecified --");
97 return; 96 return;
147 default: 146 default:
148 printf("(please send a bug report)"); 147 printf("(please send a bug report)");
149 } 148 }
150 149
151 printf("U%x ", attr->unknown1); 150 printf("U%x ", attr->unknown1);
152 assert(!attr->unknown1); 151 CHECK_VALUE(!attr->unknown1);
153 152
154 if(attr->line21_cc_1 || attr->line21_cc_2) { 153 if(attr->line21_cc_1 || attr->line21_cc_2) {
155 printf("NTSC CC "); 154 printf("NTSC CC ");
156 if(attr->line21_cc_1) 155 if(attr->line21_cc_1)
157 printf("1 "); 156 printf("1 ");
158 if(attr->line21_cc_2) 157 if(attr->line21_cc_2)
159 printf("2 "); 158 printf("2 ");
159 }
160
161 switch(attr->bit_rate) {
162 case 0:
163 printf("Variable Bit Rate ");
164 break;
165 case 1:
166 printf("Constant Bit Rate ");
167 break;
168 default:
169 printf("(please send a bug report)");
160 } 170 }
161 171
162 { 172 {
163 int height = 480; 173 int height = 480;
164 if(attr->video_format != 0) 174 if(attr->video_format != 0)
190 } else { 200 } else {
191 printf("video"); //camera 201 printf("video"); //camera
192 } 202 }
193 } 203 }
194 204
195 static void ifoPrint_audio_attributes(int level, audio_attr_t *attr) { 205 static void ifoPrint_audio_attributes(audio_attr_t *attr) {
196 206
197 if(attr->audio_format == 0 207 if(attr->audio_format == 0
198 && attr->multichannel_extension == 0 208 && attr->multichannel_extension == 0
199 && attr->lang_type == 0 209 && attr->lang_type == 0
200 && attr->application_mode == 0 210 && attr->application_mode == 0
201 && attr->quantization == 0 211 && attr->quantization == 0
202 && attr->sample_frequency == 0 212 && attr->sample_frequency == 0
203 && attr->channels == 0 213 && attr->channels == 0
214 && attr->lang_code == 0
204 && attr->lang_extension == 0 215 && attr->lang_extension == 0
205 && attr->unknown1 == 0 216 && attr->code_extension == 0
217 && attr->unknown3 == 0
206 && attr->unknown1 == 0) { 218 && attr->unknown1 == 0) {
207 printf("-- Unspecified --"); 219 printf("-- Unspecified --");
208 return; 220 return;
209 } 221 }
210 222
238 printf("multichannel_extension "); 250 printf("multichannel_extension ");
239 251
240 switch(attr->lang_type) { 252 switch(attr->lang_type) {
241 case 0: 253 case 0:
242 // not specified 254 // not specified
243 assert(attr->lang_code == 0 || attr->lang_code == 0xffff); 255 CHECK_VALUE(attr->lang_code == 0 || attr->lang_code == 0xffff);
244 break; 256 break;
245 case 1: 257 case 1:
246 printf("%c%c ", attr->lang_code>>8, attr->lang_code & 0xff); 258 printf("%c%c (%c) ", attr->lang_code>>8, attr->lang_code & 0xff,
259 attr->lang_extension ? attr->lang_extension : ' ');
247 break; 260 break;
248 default: 261 default:
249 printf("(please send a bug report) "); 262 printf("(please send a bug report) ");
250 } 263 }
251 264
292 attr->sample_frequency); 305 attr->sample_frequency);
293 } 306 }
294 307
295 printf("%dCh ", attr->channels + 1); 308 printf("%dCh ", attr->channels + 1);
296 309
297 switch(attr->lang_extension) { 310 switch(attr->code_extension) {
298 case 0: 311 case 0:
299 printf("Not specified "); 312 printf("Not specified ");
300 break; 313 break;
301 case 1: // Normal audio 314 case 1: // Normal audio
302 printf("Normal Caption "); 315 printf("Normal Caption ");
313 //case 4: // Music score ? 326 //case 4: // Music score ?
314 default: 327 default:
315 printf("(please send a bug report) "); 328 printf("(please send a bug report) ");
316 } 329 }
317 330
318 printf("%d ", attr->unknown1); 331 printf("%d ", attr->unknown3);
319 printf("%d ", attr->unknown2); 332 if(attr->application_mode == 1) {
320 } 333 printf("ca=%d ", attr->app_info.karaoke.channel_assignment);
321 334 printf("%d ", attr->app_info.karaoke.version);
322 static void ifoPrint_subp_attributes(int level, subp_attr_t *attr) { 335 if(attr->app_info.karaoke.mc_intro)
336 printf("mc intro ");
337 printf("%s ", attr->app_info.karaoke.mode ? "duet" : "solo");
338 printf("%d ", attr->app_info.karaoke.unknown4);
339 }
340 if(attr->application_mode == 2) {
341 if(attr->app_info.surround.dolby_encoded) {
342 printf("dolby surround ");
343 }
344 printf("%d ", attr->app_info.surround.unknown5);
345 printf("%d ", attr->app_info.surround.unknown6);
346 }
347 }
348
349 static void ifoPrint_subp_attributes(subp_attr_t *attr) {
323 350
324 if(attr->type == 0 351 if(attr->type == 0
352 && attr->code_mode == 0
325 && attr->lang_code == 0 353 && attr->lang_code == 0
354 && attr->lang_extension == 0
326 && attr->zero1 == 0 355 && attr->zero1 == 0
327 && attr->zero2 == 0 356 && attr->zero2 == 0
328 && attr->lang_extension== 0) { 357 && attr->code_extension == 0) {
329 printf("-- Unspecified --"); 358 printf("-- Unspecified --");
330 return; 359 return;
331 } 360 }
332 361
333 printf("type %02x ", attr->type); 362 switch(attr->code_mode) {
334 363 case 0:
335 if(isalpha((int)(attr->lang_code >> 8)) 364 printf("Coding Mode RLE ");
336 && isalpha((int)(attr->lang_code & 0xff))) { 365 break;
337 printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff); 366 case 1:
367 printf("Coding Mode Extended ");
368 break;
369 default:
370 printf("(please send a bug report) ");
371 }
372
373 if(attr->type == 1) {
374 if(isalpha((int)(attr->lang_code >> 8))
375 && isalpha((int)(attr->lang_code & 0xff))) {
376 printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff);
377 } else {
378 printf("%02x%02x ", attr->lang_code >> 8, attr->lang_code & 0xff);
379 }
338 } else { 380 } else {
339 printf("%02x%02x ", 0xff & (unsigned)(attr->lang_code >> 8), 381 printf("lang not specified ");
340 0xff & (unsigned)(attr->lang_code & 0xff));
341 } 382 }
342 383
343 printf("%d ", attr->zero1); 384 printf("%d ", attr->zero1);
344 printf("%d ", attr->zero2); 385 printf("%d ", attr->zero2);
345 386 printf("%d ", attr->code_extension);
387
388 /* Is this correct? should it not be subp_code_ext here instead? */
346 switch(attr->lang_extension) { 389 switch(attr->lang_extension) {
347 case 0: 390 case 0:
348 printf("Not specified "); 391 printf("Not specified ");
349 break; 392 break;
350 case 1: 393 case 1:
496 printf("Start sector of TXTDT_MG: %08x\n", vmgi_mat->txtdt_mgi); 539 printf("Start sector of TXTDT_MG: %08x\n", vmgi_mat->txtdt_mgi);
497 printf("Start sector of VMGM_C_ADT: %08x\n", vmgi_mat->vmgm_c_adt); 540 printf("Start sector of VMGM_C_ADT: %08x\n", vmgi_mat->vmgm_c_adt);
498 printf("Start sector of VMGM_VOBU_ADMAP: %08x\n", 541 printf("Start sector of VMGM_VOBU_ADMAP: %08x\n",
499 vmgi_mat->vmgm_vobu_admap); 542 vmgi_mat->vmgm_vobu_admap);
500 printf("Video attributes of VMGM_VOBS: "); 543 printf("Video attributes of VMGM_VOBS: ");
501 ifoPrint_video_attributes(5, &vmgi_mat->vmgm_video_attr); 544 ifoPrint_video_attributes(&vmgi_mat->vmgm_video_attr);
502 printf("\n"); 545 printf("\n");
503 printf("VMGM Number of Audio attributes: %i\n", 546 printf("VMGM Number of Audio attributes: %i\n",
504 vmgi_mat->nr_of_vmgm_audio_streams); 547 vmgi_mat->nr_of_vmgm_audio_streams);
505 if(vmgi_mat->nr_of_vmgm_audio_streams > 0) { 548 if(vmgi_mat->nr_of_vmgm_audio_streams > 0) {
506 printf("\tstream %i status: ", 1); 549 printf("\tstream %i status: ", 1);
507 ifoPrint_audio_attributes(5, &vmgi_mat->vmgm_audio_attr); 550 ifoPrint_audio_attributes(&vmgi_mat->vmgm_audio_attr);
508 printf("\n"); 551 printf("\n");
509 } 552 }
510 printf("VMGM Number of Sub-picture attributes: %i\n", 553 printf("VMGM Number of Sub-picture attributes: %i\n",
511 vmgi_mat->nr_of_vmgm_subp_streams); 554 vmgi_mat->nr_of_vmgm_subp_streams);
512 if(vmgi_mat->nr_of_vmgm_subp_streams > 0) { 555 if(vmgi_mat->nr_of_vmgm_subp_streams > 0) {
513 printf("\tstream %2i status: ", 1); 556 printf("\tstream %2i status: ", 1);
514 ifoPrint_subp_attributes(5, &vmgi_mat->vmgm_subp_attr); 557 ifoPrint_subp_attributes(&vmgi_mat->vmgm_subp_attr);
515 printf("\n"); 558 printf("\n");
516 } 559 }
517 } 560 }
518 561
519 562
538 printf("Start sector of VTSM_VOBU_ADMAP: %08x\n",vtsi_mat->vtsm_vobu_admap); 581 printf("Start sector of VTSM_VOBU_ADMAP: %08x\n",vtsi_mat->vtsm_vobu_admap);
539 printf("Start sector of VTS_C_ADT: %08x\n", vtsi_mat->vts_c_adt); 582 printf("Start sector of VTS_C_ADT: %08x\n", vtsi_mat->vts_c_adt);
540 printf("Start sector of VTS_VOBU_ADMAP: %08x\n", vtsi_mat->vts_vobu_admap); 583 printf("Start sector of VTS_VOBU_ADMAP: %08x\n", vtsi_mat->vts_vobu_admap);
541 584
542 printf("Video attributes of VTSM_VOBS: "); 585 printf("Video attributes of VTSM_VOBS: ");
543 ifoPrint_video_attributes(5, &vtsi_mat->vtsm_video_attr); 586 ifoPrint_video_attributes(&vtsi_mat->vtsm_video_attr);
544 printf("\n"); 587 printf("\n");
545 588
546 printf("VTSM Number of Audio attributes: %i\n", 589 printf("VTSM Number of Audio attributes: %i\n",
547 vtsi_mat->nr_of_vtsm_audio_streams); 590 vtsi_mat->nr_of_vtsm_audio_streams);
548 if(vtsi_mat->nr_of_vtsm_audio_streams > 0) { 591 if(vtsi_mat->nr_of_vtsm_audio_streams > 0) {
549 printf("\tstream %i status: ", 1); 592 printf("\tstream %i status: ", 1);
550 ifoPrint_audio_attributes(5, &vtsi_mat->vtsm_audio_attr); 593 ifoPrint_audio_attributes(&vtsi_mat->vtsm_audio_attr);
551 printf("\n"); 594 printf("\n");
552 } 595 }
553 596
554 printf("VTSM Number of Sub-picture attributes: %i\n", 597 printf("VTSM Number of Sub-picture attributes: %i\n",
555 vtsi_mat->nr_of_vtsm_subp_streams); 598 vtsi_mat->nr_of_vtsm_subp_streams);
556 if(vtsi_mat->nr_of_vtsm_subp_streams > 0) { 599 if(vtsi_mat->nr_of_vtsm_subp_streams > 0) {
557 printf("\tstream %2i status: ", 1); 600 printf("\tstream %2i status: ", 1);
558 ifoPrint_subp_attributes(5, &vtsi_mat->vtsm_subp_attr); 601 ifoPrint_subp_attributes(&vtsi_mat->vtsm_subp_attr);
559 printf("\n"); 602 printf("\n");
560 } 603 }
561 604
562 printf("Video attributes of VTS_VOBS: "); 605 printf("Video attributes of VTS_VOBS: ");
563 ifoPrint_video_attributes(5, &vtsi_mat->vts_video_attr); 606 ifoPrint_video_attributes(&vtsi_mat->vts_video_attr);
564 printf("\n"); 607 printf("\n");
565 608
566 printf("VTS Number of Audio attributes: %i\n", 609 printf("VTS Number of Audio attributes: %i\n",
567 vtsi_mat->nr_of_vts_audio_streams); 610 vtsi_mat->nr_of_vts_audio_streams);
568 for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) { 611 for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) {
569 printf("\tstream %i status: ", i); 612 printf("\tstream %i status: ", i);
570 ifoPrint_audio_attributes(5, &vtsi_mat->vts_audio_attr[i]); 613 ifoPrint_audio_attributes(&vtsi_mat->vts_audio_attr[i]);
571 printf("\n"); 614 printf("\n");
572 } 615 }
573 616
574 printf("VTS Number of Subpicture attributes: %i\n", 617 printf("VTS Number of Subpicture attributes: %i\n",
575 vtsi_mat->nr_of_vts_subp_streams); 618 vtsi_mat->nr_of_vts_subp_streams);
576 for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) { 619 for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) {
577 printf("\tstream %2i status: ", i); 620 printf("\tstream %2i status: ", i);
578 ifoPrint_subp_attributes(5, &vtsi_mat->vts_subp_attr[i]); 621 ifoPrint_subp_attributes(&vtsi_mat->vts_subp_attr[i]);
579 printf("\n"); 622 printf("\n");
580 } 623 }
624
625 /* FIXME: Add printing of MultiChannel Extension */
581 } 626 }
582 627
583 628
584 static void ifoPrint_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) { 629 static void ifoPrint_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
585 int i; 630 int i;
629 } 674 }
630 675
631 for(i=0;i<nr;i++) { 676 for(i=0;i<nr;i++) {
632 printf("Cell: %3i ", i + 1); 677 printf("Cell: %3i ", i + 1);
633 678
634 ifoPrint_time(5, &cell_playback[i].playback_time); 679 ifoPrint_time(&cell_playback[i].playback_time);
635 printf("\t"); 680 printf("\t");
636 681
637 if(cell_playback[i].block_mode || cell_playback[i].block_type) { 682 if(cell_playback[i].block_mode || cell_playback[i].block_type) {
638 const char *s; 683 const char *s;
639 switch(cell_playback[i].block_mode) { 684 switch(cell_playback[i].block_mode) {
707 752
708 printf("Number of Programs: %i\n", pgc->nr_of_programs); 753 printf("Number of Programs: %i\n", pgc->nr_of_programs);
709 printf("Number of Cells: %i\n", pgc->nr_of_cells); 754 printf("Number of Cells: %i\n", pgc->nr_of_cells);
710 /* Check that time is 0:0:0:0 also if nr_of_programs==0 */ 755 /* Check that time is 0:0:0:0 also if nr_of_programs==0 */
711 printf("Playback time: "); 756 printf("Playback time: ");
712 ifoPrint_time(5, &pgc->playback_time); printf("\n"); 757 ifoPrint_time(&pgc->playback_time); printf("\n");
713 758
714 /* If no programs/no time then does this mean anything? */ 759 /* If no programs/no time then does this mean anything? */
715 printf("Prohibited user operations: "); 760 printf("Prohibited user operations: ");
716 ifoPrint_USER_OPS(&pgc->prohibited_ops); 761 ifoPrint_USER_OPS(&pgc->prohibited_ops);
717 762
732 printf("Next PGC number: %i\n", pgc->next_pgc_nr); 777 printf("Next PGC number: %i\n", pgc->next_pgc_nr);
733 printf("Prev PGC number: %i\n", pgc->prev_pgc_nr); 778 printf("Prev PGC number: %i\n", pgc->prev_pgc_nr);
734 printf("GoUp PGC number: %i\n", pgc->goup_pgc_nr); 779 printf("GoUp PGC number: %i\n", pgc->goup_pgc_nr);
735 if(pgc->nr_of_programs != 0) { 780 if(pgc->nr_of_programs != 0) {
736 printf("Still time: %i seconds (255=inf)\n", pgc->still_time); 781 printf("Still time: %i seconds (255=inf)\n", pgc->still_time);
737 printf("PG Playback mode %02x\n", pgc->pg_playback_mode); 782 if(pgc->pg_playback_mode == 0)
783 printf("PG Playback mode: Sequential\n");
784 else if(!(pgc->pg_playback_mode & 0x80))
785 printf("PG Playback mode: Random %i\n", pgc->pg_playback_mode);
786 else
787 printf("PG Playback mode: Shuffle %i\n", pgc->pg_playback_mode & 0x7f );
738 } 788 }
739 789
740 if(pgc->nr_of_programs != 0) { 790 if(pgc->nr_of_programs != 0) {
741 for(i = 0; i < 16; i++) { 791 for(i = 0; i < 16; i++) {
742 printf("Color %2i: %08x\n", i, pgc->palette[i]); 792 printf("Color %2i: %08x\n", i, pgc->palette[i]);
762 tt_srpt->title[i].title_set_nr); 812 tt_srpt->title[i].title_set_nr);
763 printf("\tVTS_TTN: %i\n", tt_srpt->title[i].vts_ttn); 813 printf("\tVTS_TTN: %i\n", tt_srpt->title[i].vts_ttn);
764 printf("\tNumber of PTTs: %i\n", tt_srpt->title[i].nr_of_ptts); 814 printf("\tNumber of PTTs: %i\n", tt_srpt->title[i].nr_of_ptts);
765 printf("\tNumber of angles: %i\n", 815 printf("\tNumber of angles: %i\n",
766 tt_srpt->title[i].nr_of_angles); 816 tt_srpt->title[i].nr_of_angles);
767 printf("\tTitle playback type: %02x\n", /* XXX: TODO FIXME */ 817 printf("\tTitle playback type: %s%s%s%s%s%s%s\n",
768 *(uint8_t *)&(tt_srpt->title[i].pb_ty)); 818 tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ?
819 " One Random PGC Title or Multi PGC Title" :
820 " One Sequential PGC Title",
821 tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd ?
822 "" : ", No Link/Jump/Call exists in Cell command",
823 tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd ?
824 "" : ", No Link/Jump/Call exists in Pre- and/or Post-command",
825 tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd ?
826 "" : ", No Link/Jump/Call exists in Button command",
827 tt_srpt->title[i].pb_ty.jlc_exists_in_tt_dom ?
828 "" : ", No Link/Jump/Call exists in TT_DOM",
829 tt_srpt->title[i].pb_ty.chapter_search_or_play ?
830 ", UOP1 (TT_Play and PTT_Search) prohibited" : "",
831 tt_srpt->title[i].pb_ty.title_or_time_play ?
832 ", UOP0 (Time_Play and Time_Search) prohibited" : ""
833 );
769 printf("\tParental ID field: %04x\n", 834 printf("\tParental ID field: %04x\n",
770 tt_srpt->title[i].parental_id); 835 tt_srpt->title[i].parental_id);
771 printf("\tTitle set starting sector %08x\n", 836 printf("\tTitle set starting sector %08x\n",
772 tt_srpt->title[i].title_set_sector); 837 tt_srpt->title[i].title_set_sector);
773 } 838 }
778 int i, j; 843 int i, j;
779 printf(" nr_of_srpts %i last byte %i\n", 844 printf(" nr_of_srpts %i last byte %i\n",
780 vts_ptt_srpt->nr_of_srpts, 845 vts_ptt_srpt->nr_of_srpts,
781 vts_ptt_srpt->last_byte); 846 vts_ptt_srpt->last_byte);
782 for(i=0;i<vts_ptt_srpt->nr_of_srpts;i++) { 847 for(i=0;i<vts_ptt_srpt->nr_of_srpts;i++) {
848 printf("\nVTS_PTT number %d has a offset %d relative to VTS_PTT_SRPT\n",
849 i + 1, vts_ptt_srpt->ttu_offset[i]);
783 for(j=0;j<vts_ptt_srpt->title[i].nr_of_ptts;j++) { 850 for(j=0;j<vts_ptt_srpt->title[i].nr_of_ptts;j++) {
784 printf("VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n", 851 printf("VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n",
785 i + 1, j + 1, 852 i + 1, j + 1,
786 vts_ptt_srpt->title[i].ptt[j].pgcn, 853 vts_ptt_srpt->title[i].ptt[j].pgcn,
787 vts_ptt_srpt->title[i].ptt[j].pgn ); 854 vts_ptt_srpt->title[i].ptt[j].pgn );
788 } 855 }
789 } 856 }
790 } 857 }
791 858
792 859
793 static void hexdump(uint8_t *ptr, int len) {
794 while(len--)
795 printf("%02x ", *ptr++);
796 }
797
798 void ifoPrint_PTL_MAIT(ptl_mait_t *ptl_mait) { 860 void ifoPrint_PTL_MAIT(ptl_mait_t *ptl_mait) {
799 int i, j; 861 int i, level, vts;
800 862
801 printf("Number of Countries: %i\n", ptl_mait->nr_of_countries); 863 printf("Number of Countries: %i\n", ptl_mait->nr_of_countries);
802 printf("Number of VTSs: %i\n", ptl_mait->nr_of_vtss); 864 printf("Number of VTSs: %i\n", ptl_mait->nr_of_vtss);
803 //printf("Last byte: %i\n", ptl_mait->last_byte); 865 printf("Last byte: %i\n", ptl_mait->last_byte);
804 866
805 for(i = 0; i < ptl_mait->nr_of_countries; i++) { 867 for(i = 0; i < ptl_mait->nr_of_countries; i++) {
806 printf("Country code: %c%c\n", 868
869 printf("Start byte: %i\n", ptl_mait->countries[i].pf_ptl_mai_start_byte);
870 printf("Parental Masks for country: %c%c\n",
807 ptl_mait->countries[i].country_code >> 8, 871 ptl_mait->countries[i].country_code >> 8,
808 ptl_mait->countries[i].country_code & 0xff); 872 ptl_mait->countries[i].country_code & 0xff);
809 /* 873
810 printf("Start byte: %04x %i\n", 874 for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) {
811 ptl_mait->countries[i].pf_ptl_mai_start_byte, 875 if( vts == 0 ) {
812 ptl_mait->countries[i].pf_ptl_mai_start_byte); 876 printf("VMG ");
813 */ 877 } else {
814 /* This seems to be pointing at a array with 8 2byte fields per VTS 878 printf("VTS %2d ", vts);
815 ? and one extra for the menu? always an odd number of VTSs on 879 }
816 all the dics I tested so it might be padding to even also. 880 for(level = 0; level < 8; level++) {
817 If it is for the menu it probably the first entry. */ 881 printf("%d: %04x ", level,
818 for(j=0;j<8;j++) { 882 ptl_mait->countries[i].pf_ptl_mai[vts][level] );
819 hexdump( (uint8_t *)ptl_mait->countries - PTL_MAIT_COUNTRY_SIZE 883 }
820 + ptl_mait->countries[i].pf_ptl_mai_start_byte
821 + j*(ptl_mait->nr_of_vtss+1)*2, (ptl_mait->nr_of_vtss+1)*2);
822 printf("\n"); 884 printf("\n");
823 } 885 }
824 } 886 }
825 } 887 }
826 888
889 void ifoPrint_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
890 unsigned int timeunit;
891 int i, j;
892
893 printf("Number of VTS_TMAPS: %i\n", vts_tmapt->nr_of_tmaps);
894 printf("Last byte: %i\n", vts_tmapt->last_byte);
895
896 for(i = 0; i < vts_tmapt->nr_of_tmaps; i++) {
897 printf("TMAP %i\n", i + 1);
898 printf(" offset %d relative to VTS_TMAPTI\n", vts_tmapt->tmap_offset[i]);
899 printf(" Time unit (seconds): %i\n", vts_tmapt->tmap[i].tmu);
900 printf(" Number of entries: %i\n", vts_tmapt->tmap[i].nr_of_entries);
901 timeunit = vts_tmapt->tmap[i].tmu;
902 for(j = 0; j < vts_tmapt->tmap[i].nr_of_entries; j++) {
903 unsigned int ac_time = timeunit * (j + 1);
904 printf("Time: %2i:%02i:%02i VOBU Sector: 0x%08x %s\n",
905 ac_time / (60 * 60), (ac_time / 60) % 60, ac_time % 60,
906 vts_tmapt->tmap[i].map_ent[j] & 0x7fffffff,
907 (vts_tmapt->tmap[i].map_ent[j] >> 31) ? "discontinuity" : "");
908 }
909 }
910 }
827 911
828 void ifoPrint_C_ADT(c_adt_t *c_adt) { 912 void ifoPrint_C_ADT(c_adt_t *c_adt) {
829 int i, entries; 913 int i, entries;
830 914
831 printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs); 915 printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs);
868 void ifoPrint_PGCI_UT(pgci_ut_t *pgci_ut) { 952 void ifoPrint_PGCI_UT(pgci_ut_t *pgci_ut) {
869 int i; 953 int i;
870 954
871 printf("Number of Menu Language Units (PGCI_LU): %3i\n", pgci_ut->nr_of_lus); 955 printf("Number of Menu Language Units (PGCI_LU): %3i\n", pgci_ut->nr_of_lus);
872 for(i = 0; i < pgci_ut->nr_of_lus; i++) { 956 for(i = 0; i < pgci_ut->nr_of_lus; i++) {
873 printf("\nMenu Language Code: %c%c\n", 957 printf("\nMenu Language Code: %c%c (%c)\n",
874 pgci_ut->lu[i].lang_code >> 8, 958 pgci_ut->lu[i].lang_code >> 8,
875 pgci_ut->lu[i].lang_code & 0xff); 959 pgci_ut->lu[i].lang_code & 0xff,
960 pgci_ut->lu[i].lang_extension ? pgci_ut->lu[i].lang_extension :' ');
876 printf("Menu Existence: %02x\n", pgci_ut->lu[i].exists); 961 printf("Menu Existence: %02x\n", pgci_ut->lu[i].exists);
877 ifoPrint_PGCIT(pgci_ut->lu[i].pgcit); 962 ifoPrint_PGCIT(pgci_ut->lu[i].pgcit);
878 } 963 }
879 } 964 }
880 965
883 int i; 968 int i;
884 969
885 printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat); 970 printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat);
886 971
887 printf("Video attributes of VTSM_VOBS: "); 972 printf("Video attributes of VTSM_VOBS: ");
888 ifoPrint_video_attributes(5, &vts_attributes->vtsm_vobs_attr); 973 ifoPrint_video_attributes(&vts_attributes->vtsm_vobs_attr);
889 printf("\n"); 974 printf("\n");
890 printf("Number of Audio streams: %i\n", 975 printf("Number of Audio streams: %i\n",
891 vts_attributes->nr_of_vtsm_audio_streams); 976 vts_attributes->nr_of_vtsm_audio_streams);
892 if(vts_attributes->nr_of_vtsm_audio_streams > 0) { 977 if(vts_attributes->nr_of_vtsm_audio_streams > 0) {
893 printf("\tstream %i attributes: ", 1); 978 printf("\tstream %i attributes: ", 1);
894 ifoPrint_audio_attributes(5, &vts_attributes->vtsm_audio_attr); 979 ifoPrint_audio_attributes(&vts_attributes->vtsm_audio_attr);
895 printf("\n"); 980 printf("\n");
896 } 981 }
897 printf("Number of Subpicture streams: %i\n", 982 printf("Number of Subpicture streams: %i\n",
898 vts_attributes->nr_of_vtsm_subp_streams); 983 vts_attributes->nr_of_vtsm_subp_streams);
899 if(vts_attributes->nr_of_vtsm_subp_streams > 0) { 984 if(vts_attributes->nr_of_vtsm_subp_streams > 0) {
900 printf("\tstream %2i attributes: ", 1); 985 printf("\tstream %2i attributes: ", 1);
901 ifoPrint_subp_attributes(5, &vts_attributes->vtsm_subp_attr); 986 ifoPrint_subp_attributes(&vts_attributes->vtsm_subp_attr);
902 printf("\n"); 987 printf("\n");
903 } 988 }
904 989
905 printf("Video attributes of VTSTT_VOBS: "); 990 printf("Video attributes of VTSTT_VOBS: ");
906 ifoPrint_video_attributes(5, &vts_attributes->vtstt_vobs_video_attr); 991 ifoPrint_video_attributes(&vts_attributes->vtstt_vobs_video_attr);
907 printf("\n"); 992 printf("\n");
908 printf("Number of Audio streams: %i\n", 993 printf("Number of Audio streams: %i\n",
909 vts_attributes->nr_of_vtstt_audio_streams); 994 vts_attributes->nr_of_vtstt_audio_streams);
910 for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) { 995 for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) {
911 printf("\tstream %i attributes: ", i); 996 printf("\tstream %i attributes: ", i);
912 ifoPrint_audio_attributes(5, &vts_attributes->vtstt_audio_attr[i]); 997 ifoPrint_audio_attributes(&vts_attributes->vtstt_audio_attr[i]);
913 printf("\n"); 998 printf("\n");
914 } 999 }
915 1000
916 printf("Number of Subpicture streams: %i\n", 1001 printf("Number of Subpicture streams: %i\n",
917 vts_attributes->nr_of_vtstt_subp_streams); 1002 vts_attributes->nr_of_vtstt_subp_streams);
918 for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) { 1003 for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) {
919 printf("\tstream %2i attributes: ", i); 1004 printf("\tstream %2i attributes: ", i);
920 ifoPrint_subp_attributes(5, &vts_attributes->vtstt_subp_attr[i]); 1005 ifoPrint_subp_attributes(&vts_attributes->vtstt_subp_attr[i]);
921 printf("\n"); 1006 printf("\n");
922 } 1007 }
923 } 1008 }
924 1009
925 1010
927 int i; 1012 int i;
928 1013
929 printf("Number of Video Title Sets: %3i\n", vts_atrt->nr_of_vtss); 1014 printf("Number of Video Title Sets: %3i\n", vts_atrt->nr_of_vtss);
930 for(i = 0; i < vts_atrt->nr_of_vtss; i++) { 1015 for(i = 0; i < vts_atrt->nr_of_vtss; i++) {
931 printf("\nVideo Title Set %i\n", i + 1); 1016 printf("\nVideo Title Set %i\n", i + 1);
1017 printf(" offset %d relative to VMG_VTS_ATRT\n",
1018 vts_atrt->vts_atrt_offsets[i]);
932 ifoPrint_VTS_ATTRIBUTES(&vts_atrt->vts[i]); 1019 ifoPrint_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
933 } 1020 }
934 } 1021 }
935 1022
936 1023
1020 if(ifohandle->pgci_ut) { 1107 if(ifohandle->pgci_ut) {
1021 ifoPrint_PGCI_UT(ifohandle->pgci_ut); 1108 ifoPrint_PGCI_UT(ifohandle->pgci_ut);
1022 } else { 1109 } else {
1023 printf("No Menu PGCI Unit table present\n"); 1110 printf("No Menu PGCI Unit table present\n");
1024 } 1111 }
1112
1113 printf("\nTime Search table\n");
1114 printf( "-----------------\n");
1115 if(ifohandle->vts_tmapt) {
1116 ifoPrint_VTS_TMAPT(ifohandle->vts_tmapt);
1117 } else {
1118 printf("No Time Search table present\n");
1119 }
1025 1120
1026 printf("\nMenu Cell Adress table\n"); 1121 printf("\nMenu Cell Adress table\n");
1027 printf( "-----------------\n"); 1122 printf( "-----------------\n");
1028 if(ifohandle->menu_c_adt) { 1123 if(ifohandle->menu_c_adt) {
1029 ifoPrint_C_ADT(ifohandle->menu_c_adt); 1124 ifoPrint_C_ADT(ifohandle->menu_c_adt);