[libdvdnav-devel] [Git][videolan/libdvdnav][master] Handle random playback mode by choosing our initial program number

Jean-Baptiste Kempf gitlab at videolan.org
Sat Aug 10 13:03:30 CEST 2019



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdnav


Commits:
7b854581 by John Sullivan at 2019-08-10T10:58:21Z
Handle random playback mode by choosing our initial program number
randomly - some discs end up jumping to nowhere if you always choose
the first cell.

- - - - -


1 changed file:

- src/vm/play.c


Changes:

=====================================
src/vm/play.c
=====================================
@@ -63,6 +63,21 @@ link_t play_PGC(vm_t *vm) {
   (vm->state).cellN = 0;
   (vm->state).blockN = 0;
 
+  /* Handle random playback mode by choosing our initial program
+   * number randomly - some discs end up jumping to nowhere if you
+   * always choose the first cell.
+   */
+  if ((vm->state).pgc->pg_playback_mode!=0 &&
+      ((vm->state).pgc->pg_playback_mode & 0x80)==0) {
+    int pgCnt = ((vm->state).pgc->pg_playback_mode & 0x7f) + 1;
+    if (pgCnt > (vm->state).pgc->nr_of_programs) {
+      pgCnt = (vm->state).pgc->nr_of_programs;
+    }
+    if (pgCnt>1) {
+      (vm->state).pgN = 1 + ((int) ((float) pgCnt * rand()/(RAND_MAX+1.0)));
+    }
+  }
+
   /* eval -> updates the state and returns either
      - some kind of jump (Jump(TT/SS/VTS_TTN/CallSS/link C/PG/PGC/PTTN)
      - just play video i.e first PG



View it on GitLab: https://code.videolan.org/videolan/libdvdnav/commit/7b854581b320bf6fab4895e072693c731a4bbaa0

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdnav/commit/7b854581b320bf6fab4895e072693c731a4bbaa0
You're receiving this email because of your account on code.videolan.org.




More information about the libdvdnav-devel mailing list