Mercurial > mplayer.hg
annotate libmpdvdkit2/ifo_print.c @ 15307:58bd9c33864c
LIBAVCODEC_BUILD >= 4754
author | michael |
---|---|
date | Sat, 30 Apr 2005 22:41:41 +0000 |
parents | 25df9508f9a8 |
children | 483e955893b8 |
rev | line source |
---|---|
7029 | 1 /* |
2 * Copyright (C) 2000, 2001, 2002 Björn Englund <d4bjorn@dtek.chalmers.se>, | |
3 * Håkan Hjort <d95hjort@dtek.chalmers.se> | |
4 * | |
14938
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
7033
diff
changeset
|
5 * Modified for use with MPlayer, changes contained in libdvdread_changes.diff. |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
7033
diff
changeset
|
6 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
7033
diff
changeset
|
7 * $Id$ |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
7033
diff
changeset
|
8 * |
7029 | 9 * 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 | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 | |
24 #include <stdio.h> | |
25 #include <stdlib.h> | |
26 #include <unistd.h> | |
27 #include <inttypes.h> | |
28 #include <string.h> | |
29 #include <ctype.h> | |
7033 | 30 //#include <assert.h> |
7029 | 31 |
32 #include "config.h" // Needed for WORDS_BIGENDIAN | |
33 #include "ifo_types.h" | |
34 #include "ifo_read.h" | |
35 #include "ifo_print.h" | |
36 | |
37 /* 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) { | |
39 const char *rate; | |
40 assert((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa); | |
41 assert((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa); | |
42 assert((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa); | |
43 assert((dtime->frame_u&0xf) < 0xa); | |
44 | |
45 printf("%02x:%02x:%02x.%02x", | |
46 dtime->hour, | |
47 dtime->minute, | |
48 dtime->second, | |
49 dtime->frame_u & 0x3f); | |
50 switch((dtime->frame_u & 0xc0) >> 6) { | |
51 case 1: | |
52 rate = "25.00"; | |
53 break; | |
54 case 3: | |
55 rate = "29.97"; | |
56 break; | |
57 default: | |
58 if(dtime->hour == 0 && dtime->minute == 0 | |
59 && dtime->second == 0 && dtime->frame_u == 0) | |
60 rate = "no"; | |
61 else | |
62 rate = "(please send a bug report)"; | |
63 break; | |
64 } | |
65 printf(" @ %s fps", rate); | |
66 } | |
67 | |
68 /* Put this in some other file / package? It's used in nav_print too. | |
69 Possibly also by the vm / navigator. */ | |
70 static void ifoPrint_CMD(int row, vm_cmd_t *command) { | |
71 int i; | |
72 | |
73 printf("(%03d) ", row + 1); | |
74 for(i=0;i<8;i++) | |
75 printf("%02x ", command->bytes[i]); | |
76 printf("| "); | |
77 | |
78 //vmcmd(command); | |
79 printf("\n"); | |
80 } | |
81 | |
82 static void ifoPrint_video_attributes(int level, video_attr_t *attr) { | |
83 | |
84 /* The following test is shorter but not correct ISO C, | |
85 memcmp(attr,my_friendly_zeros, sizeof(video_attr_t)) */ | |
86 if(attr->mpeg_version == 0 | |
87 && attr->video_format == 0 | |
88 && attr->display_aspect_ratio == 0 | |
89 && attr->permitted_df == 0 | |
90 && attr->unknown1 == 0 | |
91 && attr->line21_cc_1 == 0 | |
92 && attr->line21_cc_2 == 0 | |
93 && attr->video_format == 0 | |
94 && attr->letterboxed == 0 | |
95 && attr->film_mode == 0) { | |
96 printf("-- Unspecified --"); | |
97 return; | |
98 } | |
99 | |
100 switch(attr->mpeg_version) { | |
101 case 0: | |
102 printf("mpeg1 "); | |
103 break; | |
104 case 1: | |
105 printf("mpeg2 "); | |
106 break; | |
107 default: | |
108 printf("(please send a bug report) "); | |
109 } | |
110 | |
111 switch(attr->video_format) { | |
112 case 0: | |
113 printf("ntsc "); | |
114 break; | |
115 case 1: | |
116 printf("pal "); | |
117 break; | |
118 default: | |
119 printf("(please send a bug report) "); | |
120 } | |
121 | |
122 switch(attr->display_aspect_ratio) { | |
123 case 0: | |
124 printf("4:3 "); | |
125 break; | |
126 case 3: | |
127 printf("16:9 "); | |
128 break; | |
129 default: | |
130 printf("(please send a bug report) "); | |
131 } | |
132 | |
133 // Wide is allways allowed..!!! | |
134 switch(attr->permitted_df) { | |
135 case 0: | |
136 printf("pan&scan+letterboxed "); | |
137 break; | |
138 case 1: | |
139 printf("only pan&scan "); //?? | |
140 break; | |
141 case 2: | |
142 printf("only letterboxed "); | |
143 break; | |
144 case 3: | |
145 // not specified | |
146 break; | |
147 default: | |
148 printf("(please send a bug report)"); | |
149 } | |
150 | |
151 printf("U%x ", attr->unknown1); | |
152 assert(!attr->unknown1); | |
153 | |
154 if(attr->line21_cc_1 || attr->line21_cc_2) { | |
155 printf("NTSC CC "); | |
156 if(attr->line21_cc_1) | |
157 printf("1 "); | |
158 if(attr->line21_cc_2) | |
159 printf("2 "); | |
160 } | |
161 | |
162 { | |
163 int height = 480; | |
164 if(attr->video_format != 0) | |
165 height = 576; | |
166 switch(attr->picture_size) { | |
167 case 0: | |
168 printf("720x%d ", height); | |
169 break; | |
170 case 1: | |
171 printf("704x%d ", height); | |
172 break; | |
173 case 2: | |
174 printf("352x%d ", height); | |
175 break; | |
176 case 3: | |
177 printf("352x%d ", height/2); | |
178 break; | |
179 default: | |
180 printf("(please send a bug report) "); | |
181 } | |
182 } | |
183 | |
184 if(attr->letterboxed) { | |
185 printf("source letterboxed "); | |
186 } | |
187 | |
188 if(attr->film_mode) { | |
189 printf("film"); | |
190 } else { | |
191 printf("video"); //camera | |
192 } | |
193 } | |
194 | |
195 static void ifoPrint_audio_attributes(int level, audio_attr_t *attr) { | |
196 | |
197 if(attr->audio_format == 0 | |
198 && attr->multichannel_extension == 0 | |
199 && attr->lang_type == 0 | |
200 && attr->application_mode == 0 | |
201 && attr->quantization == 0 | |
202 && attr->sample_frequency == 0 | |
203 && attr->channels == 0 | |
204 && attr->lang_extension == 0 | |
205 && attr->unknown1 == 0 | |
206 && attr->unknown1 == 0) { | |
207 printf("-- Unspecified --"); | |
208 return; | |
209 } | |
210 | |
211 switch(attr->audio_format) { | |
212 case 0: | |
213 printf("ac3 "); | |
214 break; | |
215 case 1: | |
216 printf("(please send a bug report) "); | |
217 break; | |
218 case 2: | |
219 printf("mpeg1 "); | |
220 break; | |
221 case 3: | |
222 printf("mpeg2ext "); | |
223 break; | |
224 case 4: | |
225 printf("lpcm "); | |
226 break; | |
227 case 5: | |
228 printf("(please send a bug report) "); | |
229 break; | |
230 case 6: | |
231 printf("dts "); | |
232 break; | |
233 default: | |
234 printf("(please send a bug report) "); | |
235 } | |
236 | |
237 if(attr->multichannel_extension) | |
238 printf("multichannel_extension "); | |
239 | |
240 switch(attr->lang_type) { | |
241 case 0: | |
242 // not specified | |
243 assert(attr->lang_code == 0 || attr->lang_code == 0xffff); | |
244 break; | |
245 case 1: | |
246 printf("%c%c ", attr->lang_code>>8, attr->lang_code & 0xff); | |
247 break; | |
248 default: | |
249 printf("(please send a bug report) "); | |
250 } | |
251 | |
252 switch(attr->application_mode) { | |
253 case 0: | |
254 // not specified | |
255 break; | |
256 case 1: | |
257 printf("karaoke mode "); | |
258 break; | |
259 case 2: | |
260 printf("surround sound mode "); | |
261 break; | |
262 default: | |
263 printf("(please send a bug report) "); | |
264 } | |
265 | |
266 switch(attr->quantization) { | |
267 case 0: | |
268 printf("16bit "); | |
269 break; | |
270 case 1: | |
271 printf("20bit "); | |
272 break; | |
273 case 2: | |
274 printf("24bit "); | |
275 break; | |
276 case 3: | |
277 printf("drc "); | |
278 break; | |
279 default: | |
280 printf("(please send a bug report) "); | |
281 } | |
282 | |
283 switch(attr->sample_frequency) { | |
284 case 0: | |
285 printf("48kHz "); | |
286 break; | |
287 case 1: | |
288 printf("??kHz "); | |
289 break; | |
290 default: | |
291 printf("sample_frequency %i (please send a bug report) ", | |
292 attr->sample_frequency); | |
293 } | |
294 | |
295 printf("%dCh ", attr->channels + 1); | |
296 | |
297 switch(attr->lang_extension) { | |
298 case 0: | |
299 printf("Not specified "); | |
300 break; | |
301 case 1: // Normal audio | |
302 printf("Normal Caption "); | |
303 break; | |
304 case 2: // visually imparied | |
305 printf("Audio for visually impaired "); | |
306 break; | |
307 case 3: // Directors 1 | |
308 printf("Director's comments 1 "); | |
309 break; | |
310 case 4: // Directors 2 | |
311 printf("Director's comments 2 "); | |
312 break; | |
313 //case 4: // Music score ? | |
314 default: | |
315 printf("(please send a bug report) "); | |
316 } | |
317 | |
318 printf("%d ", attr->unknown1); | |
319 printf("%d ", attr->unknown2); | |
320 } | |
321 | |
322 static void ifoPrint_subp_attributes(int level, subp_attr_t *attr) { | |
323 | |
324 if(attr->type == 0 | |
325 && attr->lang_code == 0 | |
326 && attr->zero1 == 0 | |
327 && attr->zero2 == 0 | |
328 && attr->lang_extension== 0) { | |
329 printf("-- Unspecified --"); | |
330 return; | |
331 } | |
332 | |
333 printf("type %02x ", attr->type); | |
334 | |
335 if(isalpha((int)(attr->lang_code >> 8)) | |
336 && isalpha((int)(attr->lang_code & 0xff))) { | |
337 printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff); | |
338 } else { | |
339 printf("%02x%02x ", 0xff & (unsigned)(attr->lang_code >> 8), | |
340 0xff & (unsigned)(attr->lang_code & 0xff)); | |
341 } | |
342 | |
343 printf("%d ", attr->zero1); | |
344 printf("%d ", attr->zero2); | |
345 | |
346 switch(attr->lang_extension) { | |
347 case 0: | |
348 printf("Not specified "); | |
349 break; | |
350 case 1: | |
351 printf("Caption with normal size character "); | |
352 break; | |
353 case 2: | |
354 printf("Caption with bigger size character "); | |
355 break; | |
356 case 3: | |
357 printf("Caption for children "); | |
358 break; | |
359 case 4: | |
360 printf("reserved "); | |
361 break; | |
362 case 5: | |
363 printf("Closed Caption with normal size character "); | |
364 break; | |
365 case 6: | |
366 printf("Closed Caption with bigger size character "); | |
367 break; | |
368 case 7: | |
369 printf("Closed Caption for children "); | |
370 break; | |
371 case 8: | |
372 printf("reserved "); | |
373 break; | |
374 case 9: | |
375 printf("Forced Caption"); | |
376 break; | |
377 case 10: | |
378 printf("reserved "); | |
379 break; | |
380 case 11: | |
381 printf("reserved "); | |
382 break; | |
383 case 12: | |
384 printf("reserved "); | |
385 break; | |
386 case 13: | |
387 printf("Director's comments with normal size character "); | |
388 break; | |
389 case 14: | |
390 printf("Director's comments with bigger size character "); | |
391 break; | |
392 case 15: | |
393 printf("Director's comments for children "); | |
394 break; | |
395 default: | |
396 printf("(please send a bug report) "); | |
397 } | |
398 | |
399 } | |
400 | |
401 | |
402 static void ifoPrint_USER_OPS(user_ops_t *user_ops) { | |
403 uint32_t uops; | |
404 unsigned char *ptr = (unsigned char *)user_ops; | |
405 | |
406 uops = (*ptr++ << 24); | |
407 uops |= (*ptr++ << 16); | |
408 uops |= (*ptr++ << 8); | |
409 uops |= (*ptr++); | |
410 | |
411 if(uops == 0) { | |
412 printf("None\n"); | |
413 } else if(uops == 0x01ffffff) { | |
414 printf("All\n"); | |
415 } else { | |
416 if(user_ops->title_or_time_play) | |
417 printf("Title or Time Play, "); | |
418 if(user_ops->chapter_search_or_play) | |
419 printf("Chapter Search or Play, "); | |
420 if(user_ops->title_play) | |
421 printf("Title Play, "); | |
422 if(user_ops->stop) | |
423 printf("Stop, "); | |
424 if(user_ops->go_up) | |
425 printf("Go Up, "); | |
426 if(user_ops->time_or_chapter_search) | |
427 printf("Time or Chapter Search, "); | |
428 if(user_ops->prev_or_top_pg_search) | |
429 printf("Prev or Top PG Search, "); | |
430 if(user_ops->next_pg_search) | |
431 printf("Next PG Search, "); | |
432 if(user_ops->forward_scan) | |
433 printf("Forward Scan, "); | |
434 if(user_ops->backward_scan) | |
435 printf("Backward Scan, "); | |
436 if(user_ops->title_menu_call) | |
437 printf("Title Menu Call, "); | |
438 if(user_ops->root_menu_call) | |
439 printf("Root Menu Call, "); | |
440 if(user_ops->subpic_menu_call) | |
441 printf("SubPic Menu Call, "); | |
442 if(user_ops->audio_menu_call) | |
443 printf("Audio Menu Call, "); | |
444 if(user_ops->angle_menu_call) | |
445 printf("Angle Menu Call, "); | |
446 if(user_ops->chapter_menu_call) | |
447 printf("Chapter Menu Call, "); | |
448 if(user_ops->resume) | |
449 printf("Resume, "); | |
450 if(user_ops->button_select_or_activate) | |
451 printf("Button Select or Activate, "); | |
452 if(user_ops->still_off) | |
453 printf("Still Off, "); | |
454 if(user_ops->pause_on) | |
455 printf("Pause On, "); | |
456 if(user_ops->audio_stream_change) | |
457 printf("Audio Stream Change, "); | |
458 if(user_ops->subpic_stream_change) | |
459 printf("SubPic Stream Change, "); | |
460 if(user_ops->angle_change) | |
461 printf("Angle Change, "); | |
462 if(user_ops->karaoke_audio_pres_mode_change) | |
463 printf("Karaoke Audio Pres Mode Change, "); | |
464 if(user_ops->video_pres_mode_change) | |
465 printf("Video Pres Mode Change, "); | |
466 printf("\n"); | |
467 } | |
468 } | |
469 | |
470 | |
471 void ifoPrint_VMGI_MAT(vmgi_mat_t *vmgi_mat) { | |
472 | |
473 printf("VMG Identifier: %.12s\n", vmgi_mat->vmg_identifier); | |
474 printf("Last Sector of VMG: %08x\n", vmgi_mat->vmg_last_sector); | |
475 printf("Last Sector of VMGI: %08x\n", vmgi_mat->vmgi_last_sector); | |
476 printf("Specification version number: %01x.%01x\n", | |
477 vmgi_mat->specification_version >> 4, | |
478 vmgi_mat->specification_version & 0xf); | |
479 /* Byte 2 of 'VMG Category' (00xx0000) is the Region Code */ | |
480 printf("VMG Category: %08x\n", vmgi_mat->vmg_category); | |
481 printf("VMG Number of Volumes: %i\n", vmgi_mat->vmg_nr_of_volumes); | |
482 printf("VMG This Volume: %i\n", vmgi_mat->vmg_this_volume_nr); | |
483 printf("Disc side %i\n", vmgi_mat->disc_side); | |
484 printf("VMG Number of Title Sets %i\n", vmgi_mat->vmg_nr_of_title_sets); | |
485 printf("Provider ID: %.32s\n", vmgi_mat->provider_identifier); | |
486 printf("VMG POS Code: %08x", (uint32_t)(vmgi_mat->vmg_pos_code >> 32)); | |
487 printf("%08x\n", (uint32_t)vmgi_mat->vmg_pos_code); | |
488 printf("End byte of VMGI_MAT: %08x\n", vmgi_mat->vmgi_last_byte); | |
489 printf("Start byte of First Play PGC FP PGC: %08x\n", | |
490 vmgi_mat->first_play_pgc); | |
491 printf("Start sector of VMGM_VOBS: %08x\n", vmgi_mat->vmgm_vobs); | |
492 printf("Start sector of TT_SRPT: %08x\n", vmgi_mat->tt_srpt); | |
493 printf("Start sector of VMGM_PGCI_UT: %08x\n", vmgi_mat->vmgm_pgci_ut); | |
494 printf("Start sector of PTL_MAIT: %08x\n", vmgi_mat->ptl_mait); | |
495 printf("Start sector of VTS_ATRT: %08x\n", vmgi_mat->vts_atrt); | |
496 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); | |
498 printf("Start sector of VMGM_VOBU_ADMAP: %08x\n", | |
499 vmgi_mat->vmgm_vobu_admap); | |
500 printf("Video attributes of VMGM_VOBS: "); | |
501 ifoPrint_video_attributes(5, &vmgi_mat->vmgm_video_attr); | |
502 printf("\n"); | |
503 printf("VMGM Number of Audio attributes: %i\n", | |
504 vmgi_mat->nr_of_vmgm_audio_streams); | |
505 if(vmgi_mat->nr_of_vmgm_audio_streams > 0) { | |
506 printf("\tstream %i status: ", 1); | |
507 ifoPrint_audio_attributes(5, &vmgi_mat->vmgm_audio_attr); | |
508 printf("\n"); | |
509 } | |
510 printf("VMGM Number of Sub-picture attributes: %i\n", | |
511 vmgi_mat->nr_of_vmgm_subp_streams); | |
512 if(vmgi_mat->nr_of_vmgm_subp_streams > 0) { | |
513 printf("\tstream %2i status: ", 1); | |
514 ifoPrint_subp_attributes(5, &vmgi_mat->vmgm_subp_attr); | |
515 printf("\n"); | |
516 } | |
517 } | |
518 | |
519 | |
520 void ifoPrint_VTSI_MAT(vtsi_mat_t *vtsi_mat) { | |
521 int i; | |
522 | |
523 printf("VTS Identifier: %.12s\n", vtsi_mat->vts_identifier); | |
524 printf("Last Sector of VTS: %08x\n", vtsi_mat->vts_last_sector); | |
525 printf("Last Sector of VTSI: %08x\n", vtsi_mat->vtsi_last_sector); | |
526 printf("Specification version number: %01x.%01x\n", | |
527 vtsi_mat->specification_version>>4, | |
528 vtsi_mat->specification_version&0xf); | |
529 printf("VTS Category: %08x\n", vtsi_mat->vts_category); | |
530 printf("End byte of VTSI_MAT: %08x\n", vtsi_mat->vtsi_last_byte); | |
531 printf("Start sector of VTSM_VOBS: %08x\n", vtsi_mat->vtsm_vobs); | |
532 printf("Start sector of VTSTT_VOBS: %08x\n", vtsi_mat->vtstt_vobs); | |
533 printf("Start sector of VTS_PTT_SRPT: %08x\n", vtsi_mat->vts_ptt_srpt); | |
534 printf("Start sector of VTS_PGCIT: %08x\n", vtsi_mat->vts_pgcit); | |
535 printf("Start sector of VTSM_PGCI_UT: %08x\n", vtsi_mat->vtsm_pgci_ut); | |
536 printf("Start sector of VTS_TMAPT: %08x\n", vtsi_mat->vts_tmapt); | |
537 printf("Start sector of VTSM_C_ADT: %08x\n", vtsi_mat->vtsm_c_adt); | |
538 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); | |
540 printf("Start sector of VTS_VOBU_ADMAP: %08x\n", vtsi_mat->vts_vobu_admap); | |
541 | |
542 printf("Video attributes of VTSM_VOBS: "); | |
543 ifoPrint_video_attributes(5, &vtsi_mat->vtsm_video_attr); | |
544 printf("\n"); | |
545 | |
546 printf("VTSM Number of Audio attributes: %i\n", | |
547 vtsi_mat->nr_of_vtsm_audio_streams); | |
548 if(vtsi_mat->nr_of_vtsm_audio_streams > 0) { | |
549 printf("\tstream %i status: ", 1); | |
550 ifoPrint_audio_attributes(5, &vtsi_mat->vtsm_audio_attr); | |
551 printf("\n"); | |
552 } | |
553 | |
554 printf("VTSM Number of Sub-picture attributes: %i\n", | |
555 vtsi_mat->nr_of_vtsm_subp_streams); | |
556 if(vtsi_mat->nr_of_vtsm_subp_streams > 0) { | |
557 printf("\tstream %2i status: ", 1); | |
558 ifoPrint_subp_attributes(5, &vtsi_mat->vtsm_subp_attr); | |
559 printf("\n"); | |
560 } | |
561 | |
562 printf("Video attributes of VTS_VOBS: "); | |
563 ifoPrint_video_attributes(5, &vtsi_mat->vts_video_attr); | |
564 printf("\n"); | |
565 | |
566 printf("VTS Number of Audio attributes: %i\n", | |
567 vtsi_mat->nr_of_vts_audio_streams); | |
568 for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) { | |
569 printf("\tstream %i status: ", i); | |
570 ifoPrint_audio_attributes(5, &vtsi_mat->vts_audio_attr[i]); | |
571 printf("\n"); | |
572 } | |
573 | |
574 printf("VTS Number of Subpicture attributes: %i\n", | |
575 vtsi_mat->nr_of_vts_subp_streams); | |
576 for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) { | |
577 printf("\tstream %2i status: ", i); | |
578 ifoPrint_subp_attributes(5, &vtsi_mat->vts_subp_attr[i]); | |
579 printf("\n"); | |
580 } | |
581 } | |
582 | |
583 | |
584 static void ifoPrint_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) { | |
585 int i; | |
586 | |
587 if(cmd_tbl == NULL) { | |
588 printf("No Command table present\n"); | |
589 return; | |
590 } | |
591 | |
592 printf("Number of Pre commands: %i\n", cmd_tbl->nr_of_pre); | |
593 for(i = 0; i < cmd_tbl->nr_of_pre; i++) { | |
594 ifoPrint_CMD(i, &cmd_tbl->pre_cmds[i]); | |
595 } | |
596 | |
597 printf("Number of Post commands: %i\n", cmd_tbl->nr_of_post); | |
598 for(i = 0; i < cmd_tbl->nr_of_post; i++) { | |
599 ifoPrint_CMD(i, &cmd_tbl->post_cmds[i]); | |
600 } | |
601 | |
602 printf("Number of Cell commands: %i\n", cmd_tbl->nr_of_cell); | |
603 for(i = 0; i < cmd_tbl->nr_of_cell; i++) { | |
604 ifoPrint_CMD(i, &cmd_tbl->cell_cmds[i]); | |
605 } | |
606 } | |
607 | |
608 | |
609 static void ifoPrint_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) { | |
610 int i; | |
611 | |
612 if(program_map == NULL) { | |
613 printf("No Program map present\n"); | |
614 return; | |
615 } | |
616 | |
617 for(i = 0; i < nr; i++) { | |
618 printf("Program %3i Entry Cell: %3i\n", i + 1, program_map[i]); | |
619 } | |
620 } | |
621 | |
622 | |
623 static void ifoPrint_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) { | |
624 int i; | |
625 | |
626 if(cell_playback == NULL) { | |
627 printf("No Cell Playback info present\n"); | |
628 return; | |
629 } | |
630 | |
631 for(i=0;i<nr;i++) { | |
632 printf("Cell: %3i ", i + 1); | |
633 | |
634 ifoPrint_time(5, &cell_playback[i].playback_time); | |
635 printf("\t"); | |
636 | |
637 if(cell_playback[i].block_mode || cell_playback[i].block_type) { | |
638 const char *s; | |
639 switch(cell_playback[i].block_mode) { | |
640 case 0: | |
641 s = "not a"; break; | |
642 case 1: | |
643 s = "the first"; break; | |
644 case 2: | |
645 default: | |
646 s = ""; break; | |
647 case 3: | |
648 s = "last"; break; | |
649 } | |
650 printf("%s cell in the block ", s); | |
651 | |
652 switch(cell_playback[i].block_type) { | |
653 case 0: | |
654 printf("not part of the block "); | |
655 break; | |
656 case 1: | |
657 printf("angle block "); | |
658 break; | |
659 case 2: | |
660 case 3: | |
661 printf("(send bug repport) "); | |
662 break; | |
663 } | |
664 } | |
665 if(cell_playback[i].seamless_play) | |
666 printf("presented seamlessly "); | |
667 if(cell_playback[i].interleaved) | |
668 printf("cell is interleaved "); | |
669 if(cell_playback[i].stc_discontinuity) | |
670 printf("STC_discontinuty "); | |
671 if(cell_playback[i].seamless_angle) | |
672 printf("only seamless angle "); | |
673 if(cell_playback[i].restricted) | |
674 printf("restricted cell "); | |
675 | |
676 if(cell_playback[i].still_time) | |
677 printf("still time %d ", cell_playback[i].still_time); | |
678 if(cell_playback[i].cell_cmd_nr) | |
679 printf("cell command %d", cell_playback[i].cell_cmd_nr); | |
680 | |
681 printf("\n\tStart sector: %08x\tFirst ILVU end sector: %08x\n", | |
682 cell_playback[i].first_sector, | |
683 cell_playback[i].first_ilvu_end_sector); | |
684 printf("\tEnd sector: %08x\tLast VOBU start sector: %08x\n", | |
685 cell_playback[i].last_sector, | |
686 cell_playback[i].last_vobu_start_sector); | |
687 } | |
688 } | |
689 | |
690 static void ifoPrint_CELL_POSITION(cell_position_t *cell_position, int nr) { | |
691 int i; | |
692 | |
693 if(cell_position == NULL) { | |
694 printf("No Cell Position info present\n"); | |
695 return; | |
696 } | |
697 | |
698 for(i=0;i<nr;i++) { | |
699 printf("Cell: %3i has VOB ID: %3i, Cell ID: %3i\n", i + 1, | |
700 cell_position[i].vob_id_nr, cell_position[i].cell_nr); | |
701 } | |
702 } | |
703 | |
704 | |
705 void ifoPrint_PGC(pgc_t *pgc) { | |
706 int i; | |
707 | |
708 printf("Number of Programs: %i\n", pgc->nr_of_programs); | |
709 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 */ | |
711 printf("Playback time: "); | |
712 ifoPrint_time(5, &pgc->playback_time); printf("\n"); | |
713 | |
714 /* If no programs/no time then does this mean anything? */ | |
715 printf("Prohibited user operations: "); | |
716 ifoPrint_USER_OPS(&pgc->prohibited_ops); | |
717 | |
718 for(i = 0; i < 8; i++) { | |
719 if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */ | |
720 printf("Audio stream %i control: %04x\n", | |
721 i, pgc->audio_control[i]); | |
722 } | |
723 } | |
724 | |
725 for(i = 0; i < 32; i++) { | |
726 if(pgc->subp_control[i] & 0x80000000) { /* The 'is present' bit */ | |
727 printf("Subpicture stream %2i control: %08x\n", | |
728 i, pgc->subp_control[i]); | |
729 } | |
730 } | |
731 | |
732 printf("Next PGC number: %i\n", pgc->next_pgc_nr); | |
733 printf("Prev PGC number: %i\n", pgc->prev_pgc_nr); | |
734 printf("GoUp PGC number: %i\n", pgc->goup_pgc_nr); | |
735 if(pgc->nr_of_programs != 0) { | |
736 printf("Still time: %i seconds (255=inf)\n", pgc->still_time); | |
737 printf("PG Playback mode %02x\n", pgc->pg_playback_mode); | |
738 } | |
739 | |
740 if(pgc->nr_of_programs != 0) { | |
741 for(i = 0; i < 16; i++) { | |
742 printf("Color %2i: %08x\n", i, pgc->palette[i]); | |
743 } | |
744 } | |
745 | |
746 /* Memmory offsets to div. tables. */ | |
747 ifoPrint_PGC_COMMAND_TBL(pgc->command_tbl); | |
748 ifoPrint_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs); | |
749 ifoPrint_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells); | |
750 ifoPrint_CELL_POSITION(pgc->cell_position, pgc->nr_of_cells); | |
751 } | |
752 | |
753 | |
754 void ifoPrint_TT_SRPT(tt_srpt_t *tt_srpt) { | |
755 int i; | |
756 | |
757 printf("Number of TitleTrack search pointers: %i\n", | |
758 tt_srpt->nr_of_srpts); | |
759 for(i=0;i<tt_srpt->nr_of_srpts;i++) { | |
760 printf("Title Track index %i\n", i + 1); | |
761 printf("\tTitle set number (VTS): %i", | |
762 tt_srpt->title[i].title_set_nr); | |
763 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); | |
765 printf("\tNumber of angles: %i\n", | |
766 tt_srpt->title[i].nr_of_angles); | |
767 printf("\tTitle playback type: %02x\n", /* XXX: TODO FIXME */ | |
768 *(uint8_t *)&(tt_srpt->title[i].pb_ty)); | |
769 printf("\tParental ID field: %04x\n", | |
770 tt_srpt->title[i].parental_id); | |
771 printf("\tTitle set starting sector %08x\n", | |
772 tt_srpt->title[i].title_set_sector); | |
773 } | |
774 } | |
775 | |
776 | |
777 void ifoPrint_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) { | |
778 int i, j; | |
779 printf(" nr_of_srpts %i last byte %i\n", | |
780 vts_ptt_srpt->nr_of_srpts, | |
781 vts_ptt_srpt->last_byte); | |
782 for(i=0;i<vts_ptt_srpt->nr_of_srpts;i++) { | |
783 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", | |
785 i + 1, j + 1, | |
786 vts_ptt_srpt->title[i].ptt[j].pgcn, | |
787 vts_ptt_srpt->title[i].ptt[j].pgn ); | |
788 } | |
789 } | |
790 } | |
791 | |
792 | |
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) { | |
799 int i, j; | |
800 | |
801 printf("Number of Countries: %i\n", ptl_mait->nr_of_countries); | |
802 printf("Number of VTSs: %i\n", ptl_mait->nr_of_vtss); | |
803 //printf("Last byte: %i\n", ptl_mait->last_byte); | |
804 | |
805 for(i = 0; i < ptl_mait->nr_of_countries; i++) { | |
806 printf("Country code: %c%c\n", | |
807 ptl_mait->countries[i].country_code >> 8, | |
808 ptl_mait->countries[i].country_code & 0xff); | |
809 /* | |
810 printf("Start byte: %04x %i\n", | |
811 ptl_mait->countries[i].pf_ptl_mai_start_byte, | |
812 ptl_mait->countries[i].pf_ptl_mai_start_byte); | |
813 */ | |
814 /* This seems to be pointing at a array with 8 2byte fields per VTS | |
815 ? and one extra for the menu? always an odd number of VTSs on | |
816 all the dics I tested so it might be padding to even also. | |
817 If it is for the menu it probably the first entry. */ | |
818 for(j=0;j<8;j++) { | |
819 hexdump( (uint8_t *)ptl_mait->countries - PTL_MAIT_COUNTRY_SIZE | |
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"); | |
823 } | |
824 } | |
825 } | |
826 | |
827 | |
828 void ifoPrint_C_ADT(c_adt_t *c_adt) { | |
829 int i, entries; | |
830 | |
831 printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs); | |
832 //entries = c_adt->nr_of_vobs; | |
833 entries = (c_adt->last_byte + 1 - C_ADT_SIZE)/sizeof(c_adt_t); | |
834 | |
835 for(i = 0; i < entries; i++) { | |
836 printf("VOB ID: %3i, Cell ID: %3i ", | |
837 c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id); | |
838 printf("Sector (first): 0x%08x (last): 0x%08x\n", | |
839 c_adt->cell_adr_table[i].start_sector, | |
840 c_adt->cell_adr_table[i].last_sector); | |
841 } | |
842 } | |
843 | |
844 | |
845 void ifoPrint_VOBU_ADMAP(vobu_admap_t *vobu_admap) { | |
846 int i, entries; | |
847 | |
848 entries = (vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE)/4; | |
849 for(i = 0; i < entries; i++) { | |
850 printf("VOBU %5i First sector: 0x%08x\n", i + 1, | |
851 vobu_admap->vobu_start_sectors[i]); | |
852 } | |
853 } | |
854 | |
855 | |
856 void ifoPrint_PGCIT(pgcit_t *pgcit) { | |
857 int i; | |
858 | |
859 for(i = 0; i < pgcit->nr_of_pgci_srp; i++) { | |
860 printf("\nProgram (PGC): %3i\t", i + 1); | |
861 printf("PGC Category: Entry id 0x%02x, ", pgcit->pgci_srp[i].entry_id); | |
862 printf("Parental ID mask 0x%04x\n", pgcit->pgci_srp[i].ptl_id_mask); | |
863 ifoPrint_PGC(pgcit->pgci_srp[i].pgc); | |
864 } | |
865 } | |
866 | |
867 | |
868 void ifoPrint_PGCI_UT(pgci_ut_t *pgci_ut) { | |
869 int i; | |
870 | |
871 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++) { | |
873 printf("\nMenu Language Code: %c%c\n", | |
874 pgci_ut->lu[i].lang_code >> 8, | |
875 pgci_ut->lu[i].lang_code & 0xff); | |
876 printf("Menu Existence: %02x\n", pgci_ut->lu[i].exists); | |
877 ifoPrint_PGCIT(pgci_ut->lu[i].pgcit); | |
878 } | |
879 } | |
880 | |
881 | |
882 static void ifoPrint_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) { | |
883 int i; | |
884 | |
885 printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat); | |
886 | |
887 printf("Video attributes of VTSM_VOBS: "); | |
888 ifoPrint_video_attributes(5, &vts_attributes->vtsm_vobs_attr); | |
889 printf("\n"); | |
890 printf("Number of Audio streams: %i\n", | |
891 vts_attributes->nr_of_vtsm_audio_streams); | |
892 if(vts_attributes->nr_of_vtsm_audio_streams > 0) { | |
893 printf("\tstream %i attributes: ", 1); | |
894 ifoPrint_audio_attributes(5, &vts_attributes->vtsm_audio_attr); | |
895 printf("\n"); | |
896 } | |
897 printf("Number of Subpicture streams: %i\n", | |
898 vts_attributes->nr_of_vtsm_subp_streams); | |
899 if(vts_attributes->nr_of_vtsm_subp_streams > 0) { | |
900 printf("\tstream %2i attributes: ", 1); | |
901 ifoPrint_subp_attributes(5, &vts_attributes->vtsm_subp_attr); | |
902 printf("\n"); | |
903 } | |
904 | |
905 printf("Video attributes of VTSTT_VOBS: "); | |
906 ifoPrint_video_attributes(5, &vts_attributes->vtstt_vobs_video_attr); | |
907 printf("\n"); | |
908 printf("Number of Audio streams: %i\n", | |
909 vts_attributes->nr_of_vtstt_audio_streams); | |
910 for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) { | |
911 printf("\tstream %i attributes: ", i); | |
912 ifoPrint_audio_attributes(5, &vts_attributes->vtstt_audio_attr[i]); | |
913 printf("\n"); | |
914 } | |
915 | |
916 printf("Number of Subpicture streams: %i\n", | |
917 vts_attributes->nr_of_vtstt_subp_streams); | |
918 for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) { | |
919 printf("\tstream %2i attributes: ", i); | |
920 ifoPrint_subp_attributes(5, &vts_attributes->vtstt_subp_attr[i]); | |
921 printf("\n"); | |
922 } | |
923 } | |
924 | |
925 | |
926 void ifoPrint_VTS_ATRT(vts_atrt_t *vts_atrt) { | |
927 int i; | |
928 | |
929 printf("Number of Video Title Sets: %3i\n", vts_atrt->nr_of_vtss); | |
930 for(i = 0; i < vts_atrt->nr_of_vtss; i++) { | |
931 printf("\nVideo Title Set %i\n", i + 1); | |
932 ifoPrint_VTS_ATTRIBUTES(&vts_atrt->vts[i]); | |
933 } | |
934 } | |
935 | |
936 | |
937 void ifoPrint(dvd_reader_t *dvd, int title) { | |
938 ifo_handle_t *ifohandle; | |
939 | |
940 ifohandle = ifoOpen(dvd, title); | |
941 if(!ifohandle) { | |
942 fprintf(stderr, "Can't open info file for title %d\n", title); | |
943 return; | |
944 } | |
945 | |
946 | |
947 if(ifohandle->vmgi_mat) { | |
948 | |
949 printf("VMG top level\n-------------\n"); | |
950 ifoPrint_VMGI_MAT(ifohandle->vmgi_mat); | |
951 | |
952 printf("\nFirst Play PGC\n--------------\n"); | |
953 ifoPrint_PGC(ifohandle->first_play_pgc); | |
954 | |
955 printf("\nTitle Track search pointer table\n"); | |
956 printf( "------------------------------------------------\n"); | |
957 ifoPrint_TT_SRPT(ifohandle->tt_srpt); | |
958 | |
959 printf("\nMenu PGCI Unit table\n"); | |
960 printf( "--------------------\n"); | |
961 if(ifohandle->pgci_ut) { | |
962 ifoPrint_PGCI_UT(ifohandle->pgci_ut); | |
963 } else { | |
964 printf("No PGCI Unit table present\n"); | |
965 } | |
966 | |
967 printf("\nParental Manegment Information table\n"); | |
968 printf( "------------------------------------\n"); | |
969 if(ifohandle->ptl_mait) { | |
970 ifoPrint_PTL_MAIT(ifohandle->ptl_mait); | |
971 } else { | |
972 printf("No Parental Management Information present\n"); | |
973 } | |
974 | |
975 printf("\nVideo Title Set Attribute Table\n"); | |
976 printf( "-------------------------------\n"); | |
977 ifoPrint_VTS_ATRT(ifohandle->vts_atrt); | |
978 | |
979 printf("\nText Data Manager Information\n"); | |
980 printf( "-----------------------------\n"); | |
981 if(ifohandle->txtdt_mgi) { | |
982 //ifoPrint_TXTDT_MGI(&(vmgi->txtdt_mgi)); | |
983 } else { | |
984 printf("No Text Data Manager Information present\n"); | |
985 } | |
986 | |
987 printf("\nMenu Cell Adress table\n"); | |
988 printf( "-----------------\n"); | |
989 if(ifohandle->menu_c_adt) { | |
990 ifoPrint_C_ADT(ifohandle->menu_c_adt); | |
991 } else { | |
992 printf("No Menu Cell Adress table present\n"); | |
993 } | |
994 | |
995 printf("\nVideo Manager Menu VOBU address map\n"); | |
996 printf( "-----------------\n"); | |
997 if(ifohandle->menu_vobu_admap) { | |
998 ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap); | |
999 } else { | |
1000 printf("No Menu VOBU address map present\n"); | |
1001 } | |
1002 } | |
1003 | |
1004 | |
1005 if(ifohandle->vtsi_mat) { | |
1006 | |
1007 printf("VTS top level\n-------------\n"); | |
1008 ifoPrint_VTSI_MAT(ifohandle->vtsi_mat); | |
1009 | |
1010 printf("\nPart of Title Track search pointer table\n"); | |
1011 printf( "----------------------------------------------\n"); | |
1012 ifoPrint_VTS_PTT_SRPT(ifohandle->vts_ptt_srpt); | |
1013 | |
1014 printf("\nPGCI Unit table\n"); | |
1015 printf( "--------------------\n"); | |
1016 ifoPrint_PGCIT(ifohandle->vts_pgcit); | |
1017 | |
1018 printf("\nMenu PGCI Unit table\n"); | |
1019 printf( "--------------------\n"); | |
1020 if(ifohandle->pgci_ut) { | |
1021 ifoPrint_PGCI_UT(ifohandle->pgci_ut); | |
1022 } else { | |
1023 printf("No Menu PGCI Unit table present\n"); | |
1024 } | |
1025 | |
1026 printf("\nMenu Cell Adress table\n"); | |
1027 printf( "-----------------\n"); | |
1028 if(ifohandle->menu_c_adt) { | |
1029 ifoPrint_C_ADT(ifohandle->menu_c_adt); | |
1030 } else { | |
1031 printf("No Cell Adress table present\n"); | |
1032 } | |
1033 | |
1034 printf("\nVideo Title Set Menu VOBU address map\n"); | |
1035 printf( "-----------------\n"); | |
1036 if(ifohandle->menu_vobu_admap) { | |
1037 ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap); | |
1038 } else { | |
1039 printf("No Menu VOBU address map present\n"); | |
1040 } | |
1041 | |
1042 printf("\nCell Adress table\n"); | |
1043 printf( "-----------------\n"); | |
1044 ifoPrint_C_ADT(ifohandle->vts_c_adt); | |
1045 | |
1046 printf("\nVideo Title Set VOBU address map\n"); | |
1047 printf( "-----------------\n"); | |
1048 ifoPrint_VOBU_ADMAP(ifohandle->vts_vobu_admap); | |
1049 } | |
1050 | |
1051 ifoClose(ifohandle); | |
1052 } | |
1053 |