~ubuntu-branches/ubuntu/raring/libdvdread/raring-proposed

« back to all changes in this revision

Viewing changes to src/ifo_print.c

  • 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
1
/*
2
 
 * This program is free software; you can redistribute it and/or modify
 
2
 * This file is part of libdvdread.
 
3
 *
 
4
 * libdvdread is free software; you can redistribute it and/or modify
3
5
 * it under the terms of the GNU General Public License as published by
4
6
 * the Free Software Foundation; either version 2 of the License, or
5
7
 * (at your option) any later version.
6
8
 *
7
 
 * This program is distributed in the hope that it will be useful,
 
9
 * libdvdread is distributed in the hope that it will be useful,
8
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
12
 * GNU General Public License for more details.
11
13
 *
12
 
 * You should have received a copy of the GNU General Public License
13
 
 * along with this program; if not, write to the Free Software
14
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15
 
 *
16
 
 * $Id: ifo_print.c 1135 2008-09-06 21:55:51Z rathann $
17
 
 *
 
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.
18
17
 */
19
18
 
20
19
#include <stdio.h>
25
24
#include <ctype.h>
26
25
#include <assert.h>
27
26
 
28
 
#include "ifo_types.h"
29
 
#include "ifo_read.h"
30
 
#include "ifo_print.h"
 
27
#include "dvdread/ifo_types.h"
 
28
#include "dvdread/ifo_read.h"
 
29
#include "dvdread/ifo_print.h"
31
30
 
32
31
/* Put this in some other file / package?  It's used in nav_print too. */
33
32
static void ifo_print_time(int level, dvd_time_t *dtime) {
38
37
  assert((dtime->frame_u&0xf) < 0xa);
39
38
 
40
39
  printf("%02x:%02x:%02x.%02x",
41
 
         dtime->hour,
42
 
         dtime->minute,
43
 
         dtime->second,
44
 
         dtime->frame_u & 0x3f);
 
40
         dtime->hour,
 
41
         dtime->minute,
 
42
         dtime->second,
 
43
         dtime->frame_u & 0x3f);
45
44
  switch((dtime->frame_u & 0xc0) >> 6) {
46
45
  case 1:
47
46
    rate = "25.00";
131
130
    printf("(please send a bug report), ");
132
131
  }
133
132
 
134
 
  // Wide is allways allowed..!!!
 
133
  // Wide is always allowed..!!!
135
134
  switch(attr->permitted_df) {
136
135
  case 0:
137
136
    printf("pan&scan+letterboxed, ");
223
222
  case 3:
224
223
    printf("mpeg2ext ");
225
224
    switch(attr->quantization) {
226
 
      case 0:
227
 
        printf("no drc ");
228
 
        break;
229
 
      case 1:
230
 
        printf("drc ");
231
 
        break;
232
 
      default:
233
 
        printf("(please send a bug report) mpeg reserved quant/drc  (%d)", attr->quantization);
 
225
    case 0:
 
226
      printf("no drc ");
 
227
      break;
 
228
    case 1:
 
229
      printf("drc ");
 
230
      break;
 
231
    default:
 
232
      printf("(please send a bug report) mpeg reserved quant/drc  (%d)", attr->quantization);
234
233
    }
235
234
    break;
236
235
  case 4:
237
236
    printf("lpcm ");
238
237
    switch(attr->quantization) {
239
 
      case 0:
240
 
        printf("16bit ");
241
 
        break;
242
 
      case 1:
243
 
        printf("20bit ");
244
 
        break;
245
 
      case 2:
246
 
        printf("24bit ");
247
 
        break;
248
 
      case 3:
249
 
        printf("(please send a bug report) lpcm reserved quant/drc  (%d)", attr->quantization);
250
 
      break;
 
238
    case 0:
 
239
      printf("16bit ");
 
240
      break;
 
241
    case 1:
 
242
      printf("20bit ");
 
243
      break;
 
244
    case 2:
 
245
      printf("24bit ");
 
246
      break;
 
247
    case 3:
 
248
      printf("(please send a bug report) lpcm reserved quant/drc  (%d)", attr->quantization);
 
249
    break;
251
250
    }
252
251
    break;
253
252
  case 5:
317
316
    break;
318
317
  default:
319
318
    printf("sample_frequency %i (please send a bug report) ",
320
 
           attr->sample_frequency);
 
319
           attr->sample_frequency);
321
320
  }
322
321
 
323
322
  printf("%dCh ", attr->channels + 1);
329
328
  case 1: // Normal audio
330
329
    printf("Normal Caption ");
331
330
    break;
332
 
  case 2: // visually imparied
 
331
  case 2: // visually impaired
333
332
    printf("Audio for visually impaired ");
334
333
    break;
335
334
  case 3: // Directors 1
365
364
    printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff);
366
365
  } else {
367
366
    printf("%02x%02x ", 0xff & (unsigned)(attr->lang_code >> 8),
368
 
           0xff & (unsigned)(attr->lang_code & 0xff));
 
367
           0xff & (unsigned)(attr->lang_code & 0xff));
369
368
  }
370
369
 
371
370
  printf("%d ", attr->zero1);
427
426
}
428
427
 
429
428
 
430
 
static void ifo_print_USER_OPS(user_ops_t *user_ops) {
 
429
static void ifoPrint_USER_OPS(user_ops_t *user_ops) {
431
430
  uint32_t uops;
432
431
  unsigned char *ptr = (unsigned char *)user_ops;
433
432
 
496
495
}
497
496
 
498
497
 
499
 
void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
 
498
static void ifoPrint_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
500
499
 
501
500
  printf("VMG Identifier: %.12s\n", vmgi_mat->vmg_identifier);
502
501
  printf("Last Sector of VMG: %08x\n", vmgi_mat->vmg_last_sector);
503
502
  printf("Last Sector of VMGI: %08x\n", vmgi_mat->vmgi_last_sector);
504
503
  printf("Specification version number: %01x.%01x\n",
505
 
         vmgi_mat->specification_version >> 4,
506
 
         vmgi_mat->specification_version & 0xf);
 
504
         vmgi_mat->specification_version >> 4,
 
505
         vmgi_mat->specification_version & 0xf);
507
506
  /* Byte 2 of 'VMG Category' (00xx0000) is the Region Code */
508
507
  printf("VMG Category: %08x (Region Code=%02x)\n", vmgi_mat->vmg_category, ((vmgi_mat->vmg_category >> 16) & 0xff) ^0xff);
509
508
  printf("VMG Number of Volumes: %i\n", vmgi_mat->vmg_nr_of_volumes);
515
514
  printf("%08x\n", (uint32_t)vmgi_mat->vmg_pos_code);
516
515
  printf("End byte of VMGI_MAT: %08x\n", vmgi_mat->vmgi_last_byte);
517
516
  printf("Start byte of First Play PGC (FP PGC): %08x\n",
518
 
         vmgi_mat->first_play_pgc);
 
517
         vmgi_mat->first_play_pgc);
519
518
  printf("Start sector of VMGM_VOBS: %08x\n", vmgi_mat->vmgm_vobs);
520
519
  printf("Start sector of TT_SRPT: %08x\n", vmgi_mat->tt_srpt);
521
520
  printf("Start sector of VMGM_PGCI_UT: %08x\n", vmgi_mat->vmgm_pgci_ut);
524
523
  printf("Start sector of TXTDT_MG: %08x\n", vmgi_mat->txtdt_mgi);
525
524
  printf("Start sector of VMGM_C_ADT: %08x\n", vmgi_mat->vmgm_c_adt);
526
525
  printf("Start sector of VMGM_VOBU_ADMAP: %08x\n",
527
 
         vmgi_mat->vmgm_vobu_admap);
 
526
         vmgi_mat->vmgm_vobu_admap);
528
527
  printf("Video attributes of VMGM_VOBS: ");
529
528
  ifo_print_video_attributes(5, &vmgi_mat->vmgm_video_attr);
530
529
  printf("\n");
531
530
  printf("VMGM Number of Audio attributes: %i\n",
532
 
         vmgi_mat->nr_of_vmgm_audio_streams);
 
531
         vmgi_mat->nr_of_vmgm_audio_streams);
533
532
  if(vmgi_mat->nr_of_vmgm_audio_streams > 0) {
534
533
    printf("\tstream %i status: ", 1);
535
534
    ifo_print_audio_attributes(5, &vmgi_mat->vmgm_audio_attr);
536
535
    printf("\n");
537
536
  }
538
537
  printf("VMGM Number of Sub-picture attributes: %i\n",
539
 
         vmgi_mat->nr_of_vmgm_subp_streams);
 
538
         vmgi_mat->nr_of_vmgm_subp_streams);
540
539
  if(vmgi_mat->nr_of_vmgm_subp_streams > 0) {
541
540
    printf("\tstream %2i status: ", 1);
542
541
    ifo_print_subp_attributes(5, &vmgi_mat->vmgm_subp_attr);
545
544
}
546
545
 
547
546
 
548
 
void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
 
547
static void ifoPrint_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
549
548
  int i;
550
549
 
551
550
  printf("VTS Identifier: %.12s\n", vtsi_mat->vts_identifier);
552
551
  printf("Last Sector of VTS: %08x\n", vtsi_mat->vts_last_sector);
553
552
  printf("Last Sector of VTSI: %08x\n", vtsi_mat->vtsi_last_sector);
554
553
  printf("Specification version number: %01x.%01x\n",
555
 
         vtsi_mat->specification_version>>4,
556
 
         vtsi_mat->specification_version&0xf);
 
554
         vtsi_mat->specification_version>>4,
 
555
         vtsi_mat->specification_version&0xf);
557
556
  printf("VTS Category: %08x\n", vtsi_mat->vts_category);
558
557
  printf("End byte of VTSI_MAT: %08x\n", vtsi_mat->vtsi_last_byte);
559
558
  printf("Start sector of VTSM_VOBS:  %08x\n", vtsi_mat->vtsm_vobs);
572
571
  printf("\n");
573
572
 
574
573
  printf("VTSM Number of Audio attributes: %i\n",
575
 
         vtsi_mat->nr_of_vtsm_audio_streams);
 
574
         vtsi_mat->nr_of_vtsm_audio_streams);
576
575
  if(vtsi_mat->nr_of_vtsm_audio_streams > 0) {
577
576
    printf("\tstream %i status: ", 1);
578
577
    ifo_print_audio_attributes(5, &vtsi_mat->vtsm_audio_attr);
580
579
  }
581
580
 
582
581
  printf("VTSM Number of Sub-picture attributes: %i\n",
583
 
         vtsi_mat->nr_of_vtsm_subp_streams);
 
582
         vtsi_mat->nr_of_vtsm_subp_streams);
584
583
  if(vtsi_mat->nr_of_vtsm_subp_streams > 0) {
585
584
    printf("\tstream %2i status: ", 1);
586
585
    ifo_print_subp_attributes(5, &vtsi_mat->vtsm_subp_attr);
592
591
  printf("\n");
593
592
 
594
593
  printf("VTS Number of Audio attributes: %i\n",
595
 
         vtsi_mat->nr_of_vts_audio_streams);
 
594
         vtsi_mat->nr_of_vts_audio_streams);
596
595
  for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) {
597
596
    printf("\tstream %i status: ", i);
598
597
    ifo_print_audio_attributes(5, &vtsi_mat->vts_audio_attr[i]);
600
599
  }
601
600
 
602
601
  printf("VTS Number of Subpicture attributes: %i\n",
603
 
         vtsi_mat->nr_of_vts_subp_streams);
 
602
         vtsi_mat->nr_of_vts_subp_streams);
604
603
  for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) {
605
604
    printf("\tstream %2i status: ", i);
606
605
    ifo_print_subp_attributes(5, &vtsi_mat->vts_subp_attr[i]);
609
608
}
610
609
 
611
610
 
612
 
static void ifo_print_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
 
611
static void ifoPrint_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
613
612
  int i;
614
613
 
615
614
  if(cmd_tbl == NULL) {
634
633
}
635
634
 
636
635
 
637
 
static void ifo_print_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
 
636
static void ifoPrint_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
638
637
  int i;
639
638
 
640
639
  if(program_map == NULL) {
648
647
}
649
648
 
650
649
 
651
 
static void ifo_print_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
 
650
static void ifoPrint_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
652
651
  int i;
653
652
 
654
653
  if(cell_playback == NULL) {
666
665
      const char *s;
667
666
      switch(cell_playback[i].block_mode) {
668
667
      case 0:
669
 
        s = "not a"; break;
 
668
        s = "not a"; break;
670
669
      case 1:
671
 
        s = "the first"; break;
 
670
        s = "the first"; break;
672
671
      case 2:
673
672
      default:
674
 
        s = ""; break;
 
673
        s = ""; break;
675
674
      case 3:
676
 
        s = "last"; break;
 
675
        s = "last"; break;
677
676
      }
678
677
      printf("%s cell in the block ", s);
679
678
 
680
679
      switch(cell_playback[i].block_type) {
681
680
      case 0:
682
 
        printf("not part of the block ");
683
 
        break;
 
681
        printf("not part of the block ");
 
682
        break;
684
683
      case 1:
685
 
        printf("angle block ");
686
 
        break;
 
684
        printf("angle block ");
 
685
        break;
687
686
      case 2:
688
687
      case 3:
689
 
        printf("(send bug repport) ");
690
 
        break;
 
688
        printf("(send bug report) ");
 
689
        break;
691
690
      }
692
691
    }
693
692
    if(cell_playback[i].seamless_play)
710
709
      printf("cell command %d", cell_playback[i].cell_cmd_nr);
711
710
 
712
711
    printf("\n\tStart sector: %08x\tFirst ILVU end  sector: %08x\n",
713
 
           cell_playback[i].first_sector,
714
 
           cell_playback[i].first_ilvu_end_sector);
 
712
           cell_playback[i].first_sector,
 
713
           cell_playback[i].first_ilvu_end_sector);
715
714
    printf("\tEnd   sector: %08x\tLast VOBU start sector: %08x\n",
716
 
           cell_playback[i].last_sector,
717
 
           cell_playback[i].last_vobu_start_sector);
 
715
           cell_playback[i].last_sector,
 
716
           cell_playback[i].last_vobu_start_sector);
718
717
  }
719
718
}
720
719
 
721
 
static void ifo_print_CELL_POSITION(cell_position_t *cell_position, int nr) {
 
720
static void ifoPrint_CELL_POSITION(cell_position_t *cell_position, int nr) {
722
721
  int i;
723
722
 
724
723
  if(cell_position == NULL) {
728
727
 
729
728
  for(i=0;i<nr;i++) {
730
729
    printf("Cell: %3i has VOB ID: %3i, Cell ID: %3i\n", i + 1,
731
 
           cell_position[i].vob_id_nr, cell_position[i].cell_nr);
 
730
           cell_position[i].vob_id_nr, cell_position[i].cell_nr);
732
731
  }
733
732
}
734
733
 
735
734
 
736
 
void ifo_print_PGC(pgc_t *pgc) {
 
735
static void ifoPrint_PGC(pgc_t *pgc) {
737
736
  int i;
738
737
 
739
738
  if (!pgc) {
748
747
 
749
748
  /* If no programs/no time then does this mean anything? */
750
749
  printf("Prohibited user operations: ");
751
 
  ifo_print_USER_OPS(&pgc->prohibited_ops);
 
750
  ifoPrint_USER_OPS(&pgc->prohibited_ops);
752
751
 
753
 
    for(i = 0; i < 8; i++) {
754
 
      if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
755
 
        printf("Audio stream %i control: %04x\n",
756
 
               i, pgc->audio_control[i]);
757
 
      }
 
752
  for(i = 0; i < 8; i++) {
 
753
    if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
 
754
      printf("Audio stream %i control: %04x\n",
 
755
             i, pgc->audio_control[i]);
758
756
    }
 
757
  }
759
758
 
760
759
  for(i = 0; i < 32; i++) {
761
760
    if(pgc->subp_control[i] & 0x80000000) { /* The 'is present' bit */
762
761
      printf("Subpicture stream %2i control: %08x: 4:3=%d, Wide=%d, Letterbox=%d, Pan-Scan=%d\n",
763
 
             i, pgc->subp_control[i],
764
 
             (pgc->subp_control[i] >>24) & 0x1f,
765
 
             (pgc->subp_control[i] >>16) & 0x1f,
766
 
             (pgc->subp_control[i] >>8) & 0x1f,
767
 
             (pgc->subp_control[i] ) & 0x1f);
 
762
             i, pgc->subp_control[i],
 
763
             (pgc->subp_control[i] >>24) & 0x1f,
 
764
             (pgc->subp_control[i] >>16) & 0x1f,
 
765
             (pgc->subp_control[i] >>8) & 0x1f,
 
766
             (pgc->subp_control[i] ) & 0x1f);
768
767
    }
769
768
  }
770
769
 
782
781
    }
783
782
  }
784
783
 
785
 
  /* Memmory offsets to div. tables. */
786
 
  ifo_print_PGC_COMMAND_TBL(pgc->command_tbl);
787
 
  ifo_print_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
788
 
  ifo_print_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells);
789
 
  ifo_print_CELL_POSITION(pgc->cell_position, pgc->nr_of_cells);
 
784
  /* Memory offsets to div. tables. */
 
785
  ifoPrint_PGC_COMMAND_TBL(pgc->command_tbl);
 
786
  ifoPrint_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
 
787
  ifoPrint_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells);
 
788
  ifoPrint_CELL_POSITION(pgc->cell_position, pgc->nr_of_cells);
790
789
}
791
790
 
792
791
 
793
 
void ifo_print_TT_SRPT(tt_srpt_t *tt_srpt) {
 
792
static void ifoPrint_TT_SRPT(tt_srpt_t *tt_srpt) {
794
793
  int i;
795
794
 
796
795
  printf("Number of TitleTrack search pointers: %i\n",
797
 
         tt_srpt->nr_of_srpts);
 
796
         tt_srpt->nr_of_srpts);
798
797
  for(i=0;i<tt_srpt->nr_of_srpts;i++) {
799
798
    printf("Title Track index %i\n", i + 1);
800
799
    printf("\tTitle set number (VTS): %i",
801
 
           tt_srpt->title[i].title_set_nr);
 
800
           tt_srpt->title[i].title_set_nr);
802
801
    printf("\tVTS_TTN: %i\n", tt_srpt->title[i].vts_ttn);
803
802
    printf("\tNumber of PTTs: %i\n", tt_srpt->title[i].nr_of_ptts);
804
803
    printf("\tNumber of angles: %i\n",
805
 
           tt_srpt->title[i].nr_of_angles);
 
804
           tt_srpt->title[i].nr_of_angles);
806
805
 
807
806
    printf("\tTitle playback type: (%02x)\n",
808
 
           *(uint8_t *)&(tt_srpt->title[i].pb_ty));
 
807
           *(uint8_t *)&(tt_srpt->title[i].pb_ty));
809
808
    printf("\t\t%s\n",
810
 
       tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequencial");
 
809
           tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequential");
811
810
    if (tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd) printf("\t\tJump/Link/Call exists in cell cmd\n");
812
811
    if (tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd) printf("\t\tJump/Link/Call exists in pre/post cmd\n");
813
812
    if (tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd) printf("\t\tJump/Link/Call exists in button cmd\n");
816
815
    printf("\t\tChapter search or play:%d\n", tt_srpt->title[i].pb_ty.chapter_search_or_play);
817
816
 
818
817
    printf("\tParental ID field: %04x\n",
819
 
           tt_srpt->title[i].parental_id);
 
818
           tt_srpt->title[i].parental_id);
820
819
    printf("\tTitle set starting sector %08x\n",
821
 
           tt_srpt->title[i].title_set_sector);
 
820
           tt_srpt->title[i].title_set_sector);
822
821
  }
823
822
}
824
823
 
825
824
 
826
 
void ifo_print_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
 
825
static void ifoPrint_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
827
826
  int i, j;
828
827
  printf(" nr_of_srpts %i last byte %i\n",
829
 
         vts_ptt_srpt->nr_of_srpts,
830
 
         vts_ptt_srpt->last_byte);
 
828
         vts_ptt_srpt->nr_of_srpts,
 
829
         vts_ptt_srpt->last_byte);
831
830
  for(i=0;i<vts_ptt_srpt->nr_of_srpts;i++) {
832
831
    for(j=0;j<vts_ptt_srpt->title[i].nr_of_ptts;j++) {
833
832
      printf("VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n",
834
 
             i + 1, j + 1,
835
 
             vts_ptt_srpt->title[i].ptt[j].pgcn,
836
 
             vts_ptt_srpt->title[i].ptt[j].pgn );
 
833
             i + 1, j + 1,
 
834
             vts_ptt_srpt->title[i].ptt[j].pgcn,
 
835
             vts_ptt_srpt->title[i].ptt[j].pgn );
837
836
    }
838
837
  }
839
838
}
844
843
    printf("%02x ", *ptr++);
845
844
}
846
845
 
847
 
void ifo_print_PTL_MAIT(ptl_mait_t *ptl_mait) {
 
846
static void ifoPrint_PTL_MAIT(ptl_mait_t *ptl_mait) {
848
847
  int i, j;
849
848
 
850
849
  printf("Number of Countries: %i\n", ptl_mait->nr_of_countries);
853
852
 
854
853
  for(i = 0; i < ptl_mait->nr_of_countries; i++) {
855
854
    printf("Country code: %c%c\n",
856
 
           ptl_mait->countries[i].country_code >> 8,
857
 
           ptl_mait->countries[i].country_code & 0xff);
 
855
           ptl_mait->countries[i].country_code >> 8,
 
856
           ptl_mait->countries[i].country_code & 0xff);
858
857
    /*
859
858
      printf("Start byte: %04x %i\n",
860
859
      ptl_mait->countries[i].pf_ptl_mai_start_byte,
866
865
       If it is for the menu it probably the first entry.  */
867
866
    for(j=0;j<8;j++) {
868
867
      hexdump( (uint8_t *)ptl_mait->countries - PTL_MAIT_COUNTRY_SIZE
869
 
               + ptl_mait->countries[i].pf_ptl_mai_start_byte
870
 
               + j*(ptl_mait->nr_of_vtss+1)*2, (ptl_mait->nr_of_vtss+1)*2);
 
868
               + ptl_mait->countries[i].pf_ptl_mai_start_byte
 
869
               + j*(ptl_mait->nr_of_vtss+1)*2, (ptl_mait->nr_of_vtss+1)*2);
871
870
      printf("\n");
872
871
    }
873
872
  }
874
873
}
875
874
 
876
 
void ifo_print_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
 
875
static void ifoPrint_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
877
876
  unsigned int timeunit;
878
877
  int i, j;
879
878
 
896
895
  }
897
896
}
898
897
 
899
 
void ifo_print_C_ADT(c_adt_t *c_adt) {
 
898
static void ifoPrint_C_ADT(c_adt_t *c_adt) {
900
899
  int i, entries;
901
900
 
902
901
  printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs);
905
904
 
906
905
  for(i = 0; i < entries; i++) {
907
906
    printf("VOB ID: %3i, Cell ID: %3i   ",
908
 
           c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id);
 
907
           c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id);
909
908
    printf("Sector (first): 0x%08x   (last): 0x%08x\n",
910
 
           c_adt->cell_adr_table[i].start_sector,
911
 
           c_adt->cell_adr_table[i].last_sector);
 
909
           c_adt->cell_adr_table[i].start_sector,
 
910
           c_adt->cell_adr_table[i].last_sector);
912
911
  }
913
912
}
914
913
 
915
914
 
916
 
void ifo_print_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
 
915
static void ifoPrint_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
917
916
  int i, entries;
918
917
 
919
918
  entries = (vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE)/4;
920
919
  for(i = 0; i < entries; i++) {
921
920
    printf("VOBU %5i  First sector: 0x%08x\n", i + 1,
922
 
           vobu_admap->vobu_start_sectors[i]);
 
921
           vobu_admap->vobu_start_sectors[i]);
923
922
  }
924
923
}
925
924
 
926
 
const char *ifo_print_menu_name(int type) {
 
925
static const char *ifo_print_menu_name(int type) {
927
926
  const char *menu_name;
928
927
  menu_name="";
929
928
  switch (type) {
953
952
}
954
953
 
955
954
/* pgc_type=1 for menu, 0 for title. */
956
 
void ifo_print_PGCIT(pgcit_t *pgcit, int pgc_type) {
 
955
static void ifoPrint_PGCIT(pgcit_t *pgcit, int pgc_type) {
957
956
  int i;
958
957
 
959
958
  printf("\nNumber of Program Chains: %3i\n", pgcit->nr_of_pgci_srp);
961
960
    printf("\nProgram (PGC): %3i\n", i + 1);
962
961
    if (pgc_type) {
963
962
       printf("PGC Category: Entry PGC %d, Menu Type=0x%02x:%s (Entry id 0x%02x), ",
964
 
            pgcit->pgci_srp[i].entry_id >> 7,
965
 
            pgcit->pgci_srp[i].entry_id & 0xf,
966
 
            ifo_print_menu_name(pgcit->pgci_srp[i].entry_id & 0xf),
967
 
            pgcit->pgci_srp[i].entry_id);
 
963
              pgcit->pgci_srp[i].entry_id >> 7,
 
964
              pgcit->pgci_srp[i].entry_id & 0xf,
 
965
              ifo_print_menu_name(pgcit->pgci_srp[i].entry_id & 0xf),
 
966
              pgcit->pgci_srp[i].entry_id);
968
967
    } else {
969
968
       printf("PGC Category: %s VTS_TTN:0x%02x (Entry id 0x%02x), ",
970
 
            pgcit->pgci_srp[i].entry_id >> 7 ? "At Start of" : "During",
971
 
            pgcit->pgci_srp[i].entry_id & 0xf,
972
 
            pgcit->pgci_srp[i].entry_id);
 
969
              pgcit->pgci_srp[i].entry_id >> 7 ? "At Start of" : "During",
 
970
              pgcit->pgci_srp[i].entry_id & 0xf,
 
971
              pgcit->pgci_srp[i].entry_id);
973
972
    }
974
973
    printf("Parental ID mask 0x%04x\n", pgcit->pgci_srp[i].ptl_id_mask);
975
 
    ifo_print_PGC(pgcit->pgci_srp[i].pgc);
 
974
    ifoPrint_PGC(pgcit->pgci_srp[i].pgc);
976
975
  }
977
976
}
978
977
 
979
978
 
980
 
void ifo_print_PGCI_UT(pgci_ut_t *pgci_ut) {
 
979
static void ifoPrint_PGCI_UT(pgci_ut_t *pgci_ut) {
981
980
  int i, menu;
982
981
 
983
982
  printf("Number of Menu Language Units (PGCI_LU): %3i\n", pgci_ut->nr_of_lus);
984
983
  for(i = 0; i < pgci_ut->nr_of_lus; i++) {
985
984
    printf("\nMenu Language Unit %d\n", i+1);
986
985
    printf("\nMenu Language Code: %c%c\n",
987
 
           pgci_ut->lu[i].lang_code >> 8,
988
 
           pgci_ut->lu[i].lang_code & 0xff);
 
986
           pgci_ut->lu[i].lang_code >> 8,
 
987
           pgci_ut->lu[i].lang_code & 0xff);
989
988
 
990
989
    menu = pgci_ut->lu[i].exists;
991
990
    printf("Menu Existence: %02x: ", menu);
1017
1016
      menu^=0x08;
1018
1017
    }
1019
1018
    printf("\n");
1020
 
    ifo_print_PGCIT(pgci_ut->lu[i].pgcit, 1);
 
1019
    ifoPrint_PGCIT(pgci_ut->lu[i].pgcit, 1);
1021
1020
  }
1022
1021
}
1023
1022
 
1024
1023
 
1025
 
static void ifo_print_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
 
1024
static void ifoPrint_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
1026
1025
  int i;
1027
1026
 
1028
1027
  printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat);
1031
1030
  ifo_print_video_attributes(5, &vts_attributes->vtsm_vobs_attr);
1032
1031
  printf("\n");
1033
1032
  printf("Number of Audio streams: %i\n",
1034
 
         vts_attributes->nr_of_vtsm_audio_streams);
 
1033
         vts_attributes->nr_of_vtsm_audio_streams);
1035
1034
  if(vts_attributes->nr_of_vtsm_audio_streams > 0) {
1036
1035
    printf("\tstream %i attributes: ", 1);
1037
1036
    ifo_print_audio_attributes(5, &vts_attributes->vtsm_audio_attr);
1038
1037
    printf("\n");
1039
1038
  }
1040
1039
  printf("Number of Subpicture streams: %i\n",
1041
 
         vts_attributes->nr_of_vtsm_subp_streams);
 
1040
         vts_attributes->nr_of_vtsm_subp_streams);
1042
1041
  if(vts_attributes->nr_of_vtsm_subp_streams > 0) {
1043
1042
    printf("\tstream %2i attributes: ", 1);
1044
1043
    ifo_print_subp_attributes(5, &vts_attributes->vtsm_subp_attr);
1049
1048
  ifo_print_video_attributes(5, &vts_attributes->vtstt_vobs_video_attr);
1050
1049
  printf("\n");
1051
1050
  printf("Number of Audio streams: %i\n",
1052
 
         vts_attributes->nr_of_vtstt_audio_streams);
 
1051
         vts_attributes->nr_of_vtstt_audio_streams);
1053
1052
  for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) {
1054
1053
    printf("\tstream %i attributes: ", i);
1055
1054
    ifo_print_audio_attributes(5, &vts_attributes->vtstt_audio_attr[i]);
1057
1056
  }
1058
1057
 
1059
1058
  printf("Number of Subpicture streams: %i\n",
1060
 
         vts_attributes->nr_of_vtstt_subp_streams);
 
1059
         vts_attributes->nr_of_vtstt_subp_streams);
1061
1060
  for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) {
1062
1061
    printf("\tstream %2i attributes: ", i);
1063
1062
    ifo_print_subp_attributes(5, &vts_attributes->vtstt_subp_attr[i]);
1066
1065
}
1067
1066
 
1068
1067
 
1069
 
void ifo_print_VTS_ATRT(vts_atrt_t *vts_atrt) {
 
1068
static void ifoPrint_VTS_ATRT(vts_atrt_t *vts_atrt) {
1070
1069
  int i;
1071
1070
 
1072
1071
  printf("Number of Video Title Sets: %3i\n", vts_atrt->nr_of_vtss);
1073
1072
  for(i = 0; i < vts_atrt->nr_of_vtss; i++) {
1074
1073
    printf("\nVideo Title Set %i\n", i + 1);
1075
 
    ifo_print_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
 
1074
    ifoPrint_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
1076
1075
  }
1077
1076
}
1078
1077
 
1090
1089
  if(ifohandle->vmgi_mat) {
1091
1090
 
1092
1091
    printf("VMG top level\n-------------\n");
1093
 
    ifo_print_VMGI_MAT(ifohandle->vmgi_mat);
 
1092
    ifoPrint_VMGI_MAT(ifohandle->vmgi_mat);
1094
1093
 
1095
1094
    printf("\nFirst Play PGC\n--------------\n");
1096
1095
    if(ifohandle->first_play_pgc)
1097
 
      ifo_print_PGC(ifohandle->first_play_pgc);
 
1096
      ifoPrint_PGC(ifohandle->first_play_pgc);
1098
1097
    else
1099
1098
      printf("No First Play PGC present\n");
1100
1099
 
1101
1100
    printf("\nTitle Track search pointer table\n");
1102
1101
    printf(  "------------------------------------------------\n");
1103
 
    ifo_print_TT_SRPT(ifohandle->tt_srpt);
 
1102
    ifoPrint_TT_SRPT(ifohandle->tt_srpt);
1104
1103
 
1105
1104
    printf("\nMenu PGCI Unit table\n");
1106
1105
    printf(  "--------------------\n");
1107
1106
    if(ifohandle->pgci_ut) {
1108
 
      ifo_print_PGCI_UT(ifohandle->pgci_ut);
 
1107
      ifoPrint_PGCI_UT(ifohandle->pgci_ut);
1109
1108
    } else {
1110
1109
      printf("No PGCI Unit table present\n");
1111
1110
    }
1112
1111
 
1113
 
    printf("\nParental Manegment Information table\n");
 
1112
    printf("\nParental Management Information table\n");
1114
1113
    printf(  "------------------------------------\n");
1115
1114
    if(ifohandle->ptl_mait) {
1116
 
      ifo_print_PTL_MAIT(ifohandle->ptl_mait);
 
1115
      ifoPrint_PTL_MAIT(ifohandle->ptl_mait);
1117
1116
    } else {
1118
1117
      printf("No Parental Management Information present\n");
1119
1118
    }
1120
1119
 
1121
1120
    printf("\nVideo Title Set Attribute Table\n");
1122
1121
    printf(  "-------------------------------\n");
1123
 
    ifo_print_VTS_ATRT(ifohandle->vts_atrt);
 
1122
    ifoPrint_VTS_ATRT(ifohandle->vts_atrt);
1124
1123
 
1125
1124
    printf("\nText Data Manager Information\n");
1126
1125
    printf(  "-----------------------------\n");
1130
1129
      printf("No Text Data Manager Information present\n");
1131
1130
    }
1132
1131
 
1133
 
    printf("\nMenu Cell Adress table\n");
 
1132
    printf("\nMenu Cell Address table\n");
1134
1133
    printf(  "-----------------\n");
1135
1134
    if(ifohandle->menu_c_adt) {
1136
 
      ifo_print_C_ADT(ifohandle->menu_c_adt);
 
1135
      ifoPrint_C_ADT(ifohandle->menu_c_adt);
1137
1136
    } else {
1138
 
      printf("No Menu Cell Adress table present\n");
 
1137
      printf("No Menu Cell Address table present\n");
1139
1138
    }
1140
1139
 
1141
1140
    printf("\nVideo Manager Menu VOBU address map\n");
1142
1141
    printf(  "-----------------\n");
1143
1142
    if(ifohandle->menu_vobu_admap) {
1144
 
      ifo_print_VOBU_ADMAP(ifohandle->menu_vobu_admap);
 
1143
      ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap);
1145
1144
    } else {
1146
1145
      printf("No Menu VOBU address map present\n");
1147
1146
    }
1151
1150
  if(ifohandle->vtsi_mat) {
1152
1151
 
1153
1152
    printf("VTS top level\n-------------\n");
1154
 
    ifo_print_VTSI_MAT(ifohandle->vtsi_mat);
 
1153
    ifoPrint_VTSI_MAT(ifohandle->vtsi_mat);
1155
1154
 
1156
1155
    printf("\nPart of Title Track search pointer table\n");
1157
1156
    printf(  "----------------------------------------------\n");
1158
 
    ifo_print_VTS_PTT_SRPT(ifohandle->vts_ptt_srpt);
 
1157
    ifoPrint_VTS_PTT_SRPT(ifohandle->vts_ptt_srpt);
1159
1158
 
1160
1159
    printf("\nPGCI Unit table\n");
1161
1160
    printf(  "--------------------\n");
1162
 
    ifo_print_PGCIT(ifohandle->vts_pgcit, 0);
 
1161
    ifoPrint_PGCIT(ifohandle->vts_pgcit, 0);
1163
1162
 
1164
1163
    printf("\nMenu PGCI Unit table\n");
1165
1164
    printf(  "--------------------\n");
1166
1165
    if(ifohandle->pgci_ut) {
1167
 
      ifo_print_PGCI_UT(ifohandle->pgci_ut);
 
1166
      ifoPrint_PGCI_UT(ifohandle->pgci_ut);
1168
1167
    } else {
1169
1168
      printf("No Menu PGCI Unit table present\n");
1170
1169
    }
1172
1171
    printf("\nVTS Time Map table\n");
1173
1172
    printf(  "-----------------\n");
1174
1173
    if(ifohandle->vts_tmapt) {
1175
 
      ifo_print_VTS_TMAPT(ifohandle->vts_tmapt);
 
1174
      ifoPrint_VTS_TMAPT(ifohandle->vts_tmapt);
1176
1175
    } else {
1177
1176
      printf("No VTS Time Map table present\n");
1178
1177
    }
1179
1178
 
1180
 
    printf("\nMenu Cell Adress table\n");
 
1179
    printf("\nMenu Cell Address table\n");
1181
1180
    printf(  "-----------------\n");
1182
1181
    if(ifohandle->menu_c_adt) {
1183
 
      ifo_print_C_ADT(ifohandle->menu_c_adt);
 
1182
      ifoPrint_C_ADT(ifohandle->menu_c_adt);
1184
1183
    } else {
1185
 
      printf("No Cell Adress table present\n");
 
1184
      printf("No Cell Address table present\n");
1186
1185
    }
1187
1186
 
1188
1187
    printf("\nVideo Title Set Menu VOBU address map\n");
1189
1188
    printf(  "-----------------\n");
1190
1189
    if(ifohandle->menu_vobu_admap) {
1191
 
      ifo_print_VOBU_ADMAP(ifohandle->menu_vobu_admap);
 
1190
      ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap);
1192
1191
    } else {
1193
1192
      printf("No Menu VOBU address map present\n");
1194
1193
    }
1195
1194
 
1196
1195
    printf("\nCell Adress table\n");
1197
1196
    printf(  "-----------------\n");
1198
 
    ifo_print_C_ADT(ifohandle->vts_c_adt);
 
1197
    ifoPrint_C_ADT(ifohandle->vts_c_adt);
1199
1198
 
1200
1199
    printf("\nVideo Title Set VOBU address map\n");
1201
1200
    printf(  "-----------------\n");
1202
 
    ifo_print_VOBU_ADMAP(ifohandle->vts_vobu_admap);
 
1201
    ifoPrint_VOBU_ADMAP(ifohandle->vts_vobu_admap);
1203
1202
  }
1204
1203
 
1205
1204
  ifoClose(ifohandle);
1206
1205
}
1207
 
 
1208
 
/*
1209
 
 * $Log$
1210
 
 * Revision 1.3  2004/10/22 11:36:19  jcdutton
1211
 
 * Stop seg fault when using ifo_dump.
1212
 
 *
1213
 
 * Revision 1.2  2004/09/27 12:24:01  jcdutton
1214
 
 * Add extra info to printout when using ifo_dump.
1215
 
 *
1216
 
 * Revision 1.1  2004/01/11 21:43:13  mroi
1217
 
 * big build system changes
1218
 
 *  * cleaned up all Makefiles and added a Makefile.common
1219
 
 *  * added relchk script
1220
 
 *  * moved libdvdread files to a dvdread subdir
1221
 
 *  * moved DVD VM to a vm subdir
1222
 
 *  * removed unused code in read_cache.c
1223
 
 *
1224
 
 * Revision 1.4  2004/01/01 15:13:13  jcdutton
1225
 
 * Put ifo_print.c and .h back in.
1226
 
 *
1227
 
 * Revision 1.7  2003/04/28 15:17:17  jcdutton
1228
 
 * Update ifodump to work with new libdvdnav cvs, instead of needing libdvdread.
1229
 
 *
1230
 
 * Revision 1.6  2003/04/05 22:49:04  jcdutton
1231
 
 * Update with more info from the latest libdvdread.
1232
 
 *
1233
 
 * Revision 1.5  2003/04/05 13:03:49  jcdutton
1234
 
 * Small updates.
1235
 
 *
1236
 
 * Revision 1.4  2003/04/01 08:01:03  jcdutton
1237
 
 * Add VTS Time map display. Requires libdvdread 0.9.4. The same version that comes with xine.
1238
 
 *
1239
 
 * Revision 1.3  2003/03/14 15:49:18  mroi
1240
 
 * adjust to new libdvdread version
1241
 
 *
1242
 
 * Revision 1.2  2002/08/30 05:12:33  jcdutton
1243
 
 * Minor update now that I know what PGC Entry IDs are for.
1244
 
 *
1245
 
 * Revision 1.1.1.1  2002/08/28 09:48:35  jcdutton
1246
 
 * Initial import into CVS.
1247
 
 *
1248
 
 *
1249
 
 *
1250
 
 */
1251