changeset 75:06cda03dc1e5 src

fix playback of the following dvds - Bram Stoker's Dracula RC2 - The Cell RC2, German FSK16
author mroi
date Wed, 21 Aug 2002 15:25:50 +0000
parents bf89c194f781
children 0e2abe7083de
files vm.c
diffstat 1 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/vm.c	Mon Aug 19 16:52:21 2002 +0000
+++ b/vm.c	Wed Aug 21 15:25:50 2002 +0000
@@ -42,6 +42,10 @@
 #include "vm.h"
 #include "dvdnav_internal.h"
 
+/*
+#define STRICT
+*/
+
 /* Local prototypes */
 
 static void saveRSMinfo(vm_t *vm,int cellN, int blockN);
@@ -987,9 +991,17 @@
     case 1: /*  Angle block */
       /* Loop and check each cell instead? So we don't get outsid the block. */
       (vm->state).cellN += (vm->state).AGL_REG - 1;
+#ifdef STRICT
       assert((vm->state).cellN <= (vm->state).pgc->nr_of_cells);
       assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode != 0);
       assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 1);
+#endif
+      if (!((vm->state).cellN <= (vm->state).pgc->nr_of_cells) ||
+          !((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode != 0) ||
+	  !((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 1)) {
+	fprintf(stderr, "libdvdnav: Invalid angle block\n");
+	(vm->state).cellN -= (vm->state).AGL_REG - 1;
+      }
       break;
     case 2: /*  ?? */
     case 3: /*  ?? */
@@ -1038,17 +1050,24 @@
   if(cell->cell_cmd_nr != 0) {
     link_t link_values;
     
+#ifdef STRICT
     assert((vm->state).pgc->command_tbl != NULL);
     assert((vm->state).pgc->command_tbl->nr_of_cell >= cell->cell_cmd_nr);
+#endif
+    if ((vm->state).pgc->command_tbl != NULL &&
+        (vm->state).pgc->command_tbl->nr_of_cell >= cell->cell_cmd_nr) {
 #ifdef TRACE
-    fprintf(stderr, "Cell command pressent, executing\n");
+      fprintf(stderr, "Cell command pressent, executing\n");
 #endif
-    if(vmEval_CMD(&(vm->state).pgc->command_tbl->cell_cmds[cell->cell_cmd_nr - 1], 1,
-		  &(vm->state).registers, &link_values)) {
-      return link_values;
+      if(vmEval_CMD(&(vm->state).pgc->command_tbl->cell_cmds[cell->cell_cmd_nr - 1], 1,
+		    &(vm->state).registers, &link_values)) {
+        return link_values;
+      } else {
+        fprintf(stderr, "Cell command didn't do a Jump, Link or Call\n");
+        /*  Error ?? goto tail? goto next PG? or what? just continue? */
+      }
     } else {
-       fprintf(stderr, "Cell command didn't do a Jump, Link or Call\n");
-      /*  Error ?? goto tail? goto next PG? or what? just continue? */
+      fprintf(stderr, "libdvdnav: Invalid Cell command\n");
     }
   }
   
@@ -1798,6 +1817,11 @@
 
 /*
  * $Log$
+ * Revision 1.25  2002/08/21 15:25:50  mroi
+ * fix playback of the following dvds
+ *  - Bram Stoker's Dracula RC2
+ *  - The Cell RC2, German FSK16
+ *
  * Revision 1.24  2002/07/05 14:18:55  mroi
  * report all spu types (widescreen, letterbox and pan&scan), not widescreen
  * only and report the stream's scale permissions to detect pan&scan material