Mercurial > mplayer.hg
comparison dvdread/ifo_print.c @ 24047:de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
author | diego |
---|---|
date | Wed, 15 Aug 2007 11:47:22 +0000 |
parents | 22cb9d5f1e21 |
children | 1542693b2a30 |
comparison
equal
deleted
inserted
replaced
24046:7e2808fb1807 | 24047:de28f9e8cb00 |
---|---|
25 #include "config.h" | 25 #include "config.h" |
26 | 26 |
27 #include <stdio.h> | 27 #include <stdio.h> |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 #include <unistd.h> | 29 #include <unistd.h> |
30 #include <inttypes.h> | |
31 #include <string.h> | 30 #include <string.h> |
32 #include <ctype.h> | 31 #include <ctype.h> |
32 | |
33 #if defined(HAVE_INTTYPES_H) | |
34 #include <inttypes.h> | |
35 #elif defined(HAVE_STDINT_H) | |
36 #include <stdint.h> | |
37 #endif | |
33 | 38 |
34 #include "ifo_types.h" | 39 #include "ifo_types.h" |
35 #include "ifo_read.h" | 40 #include "ifo_read.h" |
36 #include "ifo_print.h" | 41 #include "ifo_print.h" |
42 #include "cmd_print.h" | |
37 #include "dvdread_internal.h" | 43 #include "dvdread_internal.h" |
38 | 44 |
39 /* Put this in some other file / package? It's used in nav_print too. */ | 45 /* Put this in some other file / package? It's used in nav_print too. */ |
40 static void ifoPrint_time(dvd_time_t *dtime) { | 46 static void ifoPrint_time(dvd_time_t *dtime) { |
41 const char *rate; | 47 const char *rate; |
63 else | 69 else |
64 rate = "(please send a bug report)"; | 70 rate = "(please send a bug report)"; |
65 break; | 71 break; |
66 } | 72 } |
67 printf(" @ %s fps", rate); | 73 printf(" @ %s fps", rate); |
68 } | |
69 | |
70 /* Put this in some other file / package? It's used in nav_print too. | |
71 Possibly also by the vm / navigator. */ | |
72 static void ifoPrint_CMD(int row, vm_cmd_t *command) { | |
73 int i; | |
74 | |
75 printf("(%03d) ", row + 1); | |
76 for(i=0;i<8;i++) | |
77 printf("%02x ", command->bytes[i]); | |
78 printf("| "); | |
79 | |
80 //vmcmd(command); | |
81 printf("\n"); | |
82 } | 74 } |
83 | 75 |
84 static void ifoPrint_video_attributes(video_attr_t *attr) { | 76 static void ifoPrint_video_attributes(video_attr_t *attr) { |
85 | 77 |
86 /* The following test is shorter but not correct ISO C, | 78 /* The following test is shorter but not correct ISO C, |
259 CHECK_VALUE(attr->lang_code == 0 || attr->lang_code == 0xffff); | 251 CHECK_VALUE(attr->lang_code == 0 || attr->lang_code == 0xffff); |
260 break; | 252 break; |
261 case 1: | 253 case 1: |
262 printf("%c%c (%c) ", attr->lang_code>>8, attr->lang_code & 0xff, | 254 printf("%c%c (%c) ", attr->lang_code>>8, attr->lang_code & 0xff, |
263 attr->lang_extension ? attr->lang_extension : ' '); | 255 attr->lang_extension ? attr->lang_extension : ' '); |
256 if(attr->lang_extension) { | |
257 printf("(please send a bug report) lang_extension != 0"); | |
258 } | |
264 break; | 259 break; |
265 default: | 260 default: |
266 printf("(please send a bug report) "); | 261 printf("(please send a bug report) "); |
267 } | 262 } |
268 | 263 |
278 break; | 273 break; |
279 default: | 274 default: |
280 printf("(please send a bug report) "); | 275 printf("(please send a bug report) "); |
281 } | 276 } |
282 | 277 |
278 switch(attr->audio_format) { | |
279 case 0: //ac3 | |
280 if(attr->quantization != 3) { | |
281 printf("(please send a bug report) ac3 quant/drc not 3 (%d)", | |
282 attr->quantization); | |
283 } | |
284 break; | |
285 case 2: //mpeg 1 or mpeg 2 without extension stream | |
286 case 3: //mpeg 2 with extension stream | |
287 switch(attr->quantization) { | |
288 case 0: //no drc | |
289 printf("no drc "); | |
290 break; | |
291 case 1: | |
292 printf("drc "); | |
293 break; | |
294 default: | |
295 printf("(please send a bug report) mpeg reserved quant/drc (%d)", | |
296 attr->quantization); | |
297 break; | |
298 } | |
299 break; | |
300 case 4: | |
283 switch(attr->quantization) { | 301 switch(attr->quantization) { |
284 case 0: | 302 case 0: |
285 printf("16bit "); | 303 printf("16bit "); |
286 break; | 304 break; |
287 case 1: | 305 case 1: |
289 break; | 307 break; |
290 case 2: | 308 case 2: |
291 printf("24bit "); | 309 printf("24bit "); |
292 break; | 310 break; |
293 case 3: | 311 case 3: |
294 printf("drc "); | 312 printf("(please send a bug report) lpcm reserved quant/drc (%d)", |
295 break; | 313 attr->quantization); |
296 default: | 314 break; |
297 printf("(please send a bug report) "); | 315 } |
316 break; | |
317 case 6: //dts | |
318 if(attr->quantization != 3) { | |
319 printf("(please send a bug report) dts quant/drc not 3 (%d)", | |
320 attr->quantization); | |
321 } | |
322 break; | |
323 default: | |
324 break; | |
298 } | 325 } |
299 | 326 |
300 switch(attr->sample_frequency) { | 327 switch(attr->sample_frequency) { |
301 case 0: | 328 case 0: |
302 printf("48kHz "); | 329 printf("48kHz "); |
303 break; | 330 break; |
304 case 1: | 331 case 1: |
305 printf("??kHz "); | 332 printf("96kHz "); |
306 break; | 333 break; |
307 default: | 334 default: |
308 printf("sample_frequency %i (please send a bug report) ", | 335 printf("sample_frequency %i (please send a bug report) ", |
309 attr->sample_frequency); | 336 attr->sample_frequency); |
310 } | 337 } |
385 printf("lang not specified "); | 412 printf("lang not specified "); |
386 } | 413 } |
387 | 414 |
388 printf("%d ", attr->zero1); | 415 printf("%d ", attr->zero1); |
389 printf("%d ", attr->zero2); | 416 printf("%d ", attr->zero2); |
390 printf("%d ", attr->code_extension); | 417 printf("%d ", attr->lang_extension); |
391 | 418 |
392 /* Is this correct? should it not be subp_code_ext here instead? */ | 419 switch(attr->code_extension) { |
393 switch(attr->lang_extension) { | |
394 case 0: | 420 case 0: |
395 printf("Not specified "); | 421 printf("Not specified "); |
396 break; | 422 break; |
397 case 1: | 423 case 1: |
398 printf("Caption with normal size character "); | 424 printf("Caption with normal size character "); |
638 return; | 664 return; |
639 } | 665 } |
640 | 666 |
641 printf("Number of Pre commands: %i\n", cmd_tbl->nr_of_pre); | 667 printf("Number of Pre commands: %i\n", cmd_tbl->nr_of_pre); |
642 for(i = 0; i < cmd_tbl->nr_of_pre; i++) { | 668 for(i = 0; i < cmd_tbl->nr_of_pre; i++) { |
643 ifoPrint_CMD(i, &cmd_tbl->pre_cmds[i]); | 669 cmdPrint_CMD(i, &cmd_tbl->pre_cmds[i]); |
644 } | 670 } |
645 | 671 |
646 printf("Number of Post commands: %i\n", cmd_tbl->nr_of_post); | 672 printf("Number of Post commands: %i\n", cmd_tbl->nr_of_post); |
647 for(i = 0; i < cmd_tbl->nr_of_post; i++) { | 673 for(i = 0; i < cmd_tbl->nr_of_post; i++) { |
648 ifoPrint_CMD(i, &cmd_tbl->post_cmds[i]); | 674 cmdPrint_CMD(i, &cmd_tbl->post_cmds[i]); |
649 } | 675 } |
650 | 676 |
651 printf("Number of Cell commands: %i\n", cmd_tbl->nr_of_cell); | 677 printf("Number of Cell commands: %i\n", cmd_tbl->nr_of_cell); |
652 for(i = 0; i < cmd_tbl->nr_of_cell; i++) { | 678 for(i = 0; i < cmd_tbl->nr_of_cell; i++) { |
653 ifoPrint_CMD(i, &cmd_tbl->cell_cmds[i]); | 679 cmdPrint_CMD(i, &cmd_tbl->cell_cmds[i]); |
654 } | 680 } |
655 } | 681 } |
656 | 682 |
657 | 683 |
658 static void ifoPrint_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) { | 684 static void ifoPrint_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) { |
752 | 778 |
753 | 779 |
754 void ifoPrint_PGC(pgc_t *pgc) { | 780 void ifoPrint_PGC(pgc_t *pgc) { |
755 int i; | 781 int i; |
756 | 782 |
783 if(pgc == NULL) { | |
784 printf("Error: No PGC present\n"); | |
785 return; | |
786 } | |
787 | |
757 printf("Number of Programs: %i\n", pgc->nr_of_programs); | 788 printf("Number of Programs: %i\n", pgc->nr_of_programs); |
758 printf("Number of Cells: %i\n", pgc->nr_of_cells); | 789 printf("Number of Cells: %i\n", pgc->nr_of_cells); |
759 /* Check that time is 0:0:0:0 also if nr_of_programs==0 */ | 790 /* Check that time is 0:0:0:0 also if nr_of_programs==0 */ |
760 printf("Playback time: "); | 791 printf("Playback time: "); |
761 ifoPrint_time(&pgc->playback_time); printf("\n"); | 792 ifoPrint_time(&pgc->playback_time); printf("\n"); |
763 /* If no programs/no time then does this mean anything? */ | 794 /* If no programs/no time then does this mean anything? */ |
764 printf("Prohibited user operations: "); | 795 printf("Prohibited user operations: "); |
765 ifoPrint_USER_OPS(&pgc->prohibited_ops); | 796 ifoPrint_USER_OPS(&pgc->prohibited_ops); |
766 | 797 |
767 for(i = 0; i < 8; i++) { | 798 for(i = 0; i < 8; i++) { |
768 if(pgc->audio_control[i].present) { | 799 if(pgc->audio_control[i].present) { /* The 'is present' bit */ |
769 printf("Audio stream %i control: %04x\n", | 800 printf("Audio stream %i control: %04x\n", |
770 i, pgc->audio_control[i]); | 801 i, pgc->audio_control[i]); |
771 } | 802 } |
772 } | 803 } |
773 | 804 |
774 for(i = 0; i < 32; i++) { | 805 for(i = 0; i < 32; i++) { |
775 if(pgc->subp_control[i].present) { | 806 if(pgc->subp_control[i].present) { /* The 'is present' bit */ |
776 printf("Subpicture stream %2i control: %08x\n", | 807 printf("Subpicture stream %2i control: %08x\n", |
777 i, pgc->subp_control[i]); | 808 i, pgc->subp_control[i]); |
778 } | 809 } |
779 } | 810 } |
780 | 811 |
916 void ifoPrint_C_ADT(c_adt_t *c_adt) { | 947 void ifoPrint_C_ADT(c_adt_t *c_adt) { |
917 int i, entries; | 948 int i, entries; |
918 | 949 |
919 printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs); | 950 printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs); |
920 //entries = c_adt->nr_of_vobs; | 951 //entries = c_adt->nr_of_vobs; |
921 entries = (c_adt->last_byte + 1 - C_ADT_SIZE)/sizeof(c_adt_t); | 952 entries = (c_adt->last_byte + 1 - C_ADT_SIZE)/sizeof(cell_adr_t); |
922 | 953 |
923 for(i = 0; i < entries; i++) { | 954 for(i = 0; i < entries; i++) { |
924 printf("VOB ID: %3i, Cell ID: %3i ", | 955 printf("VOB ID: %3i, Cell ID: %3i ", |
925 c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id); | 956 c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id); |
926 printf("Sector (first): 0x%08x (last): 0x%08x\n", | 957 printf("Sector (first): 0x%08x (last): 0x%08x\n", |
1028 void ifoPrint(dvd_reader_t *dvd, int title) { | 1059 void ifoPrint(dvd_reader_t *dvd, int title) { |
1029 ifo_handle_t *ifohandle; | 1060 ifo_handle_t *ifohandle; |
1030 | 1061 |
1031 ifohandle = ifoOpen(dvd, title); | 1062 ifohandle = ifoOpen(dvd, title); |
1032 if(!ifohandle) { | 1063 if(!ifohandle) { |
1064 if(dvdread_verbose(dvd) >= 0) { | |
1033 fprintf(stderr, "Can't open info file for title %d\n", title); | 1065 fprintf(stderr, "Can't open info file for title %d\n", title); |
1066 } | |
1034 return; | 1067 return; |
1035 } | 1068 } |
1036 | 1069 |
1037 | 1070 |
1038 if(ifohandle->vmgi_mat) { | 1071 if(ifohandle->vmgi_mat) { |
1039 | 1072 |
1040 printf("VMG top level\n-------------\n"); | 1073 printf("VMG top level\n-------------\n"); |
1041 ifoPrint_VMGI_MAT(ifohandle->vmgi_mat); | 1074 ifoPrint_VMGI_MAT(ifohandle->vmgi_mat); |
1042 | 1075 |
1043 printf("\nFirst Play PGC\n--------------\n"); | 1076 printf("\nFirst Play PGC\n--------------\n"); |
1077 if(ifohandle->first_play_pgc) { | |
1044 ifoPrint_PGC(ifohandle->first_play_pgc); | 1078 ifoPrint_PGC(ifohandle->first_play_pgc); |
1079 } else { | |
1080 printf("No First Play PGC present\n"); | |
1081 } | |
1045 | 1082 |
1046 printf("\nTitle Track search pointer table\n"); | 1083 printf("\nTitle Track search pointer table\n"); |
1047 printf( "------------------------------------------------\n"); | 1084 printf( "------------------------------------------------\n"); |
1048 ifoPrint_TT_SRPT(ifohandle->tt_srpt); | 1085 ifoPrint_TT_SRPT(ifohandle->tt_srpt); |
1049 | 1086 |