summaryrefslogtreecommitdiffstats
path: root/contrib/libdvdnav
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libdvdnav')
-rw-r--r--contrib/libdvdnav/A00-log-stderr.patch12
-rw-r--r--contrib/libdvdnav/A01-program-info.patch214
-rw-r--r--contrib/libdvdnav/A02-mult-pgc.patch22
-rw-r--r--contrib/libdvdnav/A03-quiet.patch21
-rw-r--r--contrib/libdvdnav/A04-m4-uid0.patch28
-rw-r--r--contrib/libdvdnav/A05-forward-seek.patch100
-rw-r--r--contrib/libdvdnav/A06-reset-mutex.patch25
-rw-r--r--contrib/libdvdnav/A07-missing-menu.patch157
-rw-r--r--contrib/libdvdnav/A08-dvdnav-dup.patch137
-rw-r--r--contrib/libdvdnav/P00-mingw-no-examples.patch21
-rw-r--r--contrib/libdvdnav/module.defs2
11 files changed, 1 insertions, 738 deletions
diff --git a/contrib/libdvdnav/A00-log-stderr.patch b/contrib/libdvdnav/A00-log-stderr.patch
deleted file mode 100644
index 36435dce8..000000000
--- a/contrib/libdvdnav/A00-log-stderr.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur libdvdnav.orig/src/dvdnav_internal.h libdvdnav/src/dvdnav_internal.h
---- libdvdnav.orig/src/dvdnav_internal.h 2008-10-03 13:11:43.000000000 -0700
-+++ libdvdnav/src/dvdnav_internal.h 2009-04-24 14:23:04.000000000 -0700
-@@ -60,7 +60,7 @@
- #endif /* WIN32 */
-
- /* where should libdvdnav write its messages (stdout/stderr) */
--#define MSG_OUT stdout
-+#define MSG_OUT stderr
-
- /* Maximum length of an error string */
- #define MAX_ERR_LEN 255
diff --git a/contrib/libdvdnav/A01-program-info.patch b/contrib/libdvdnav/A01-program-info.patch
deleted file mode 100644
index 531741b84..000000000
--- a/contrib/libdvdnav/A01-program-info.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-diff -Naur libdvdnav.orig/src/dvdnav/dvdnav.h libdvdnav/src/dvdnav/dvdnav.h
---- libdvdnav.orig/src/dvdnav/dvdnav.h 2009-03-13 18:28:22.000000000 -0700
-+++ libdvdnav/src/dvdnav/dvdnav.h 2009-04-30 10:56:29.000000000 -0700
-@@ -279,6 +279,11 @@
- dvdnav_status_t dvdnav_part_play(dvdnav_t *self, int32_t title, int32_t part);
-
- /*
-+ * Plays the specified title, starting from the specified program
-+ */
-+dvdnav_status_t dvdnav_program_play(dvdnav_t *this, int32_t title, int32_t pgcn, int32_t pgn);
-+
-+/*
- * Stores in *times an array (that the application *must* free) of
- * dvdtimes corresponding to the chapter times for the chosen title.
- * *duration will have the duration of the title
-@@ -320,6 +325,13 @@
- int32_t *part);
-
- /*
-+ * Return the title number, pgcn and pgn currently being played.
-+ * A title of 0 indicates, we are in a menu.
-+ */
-+dvdnav_status_t dvdnav_current_title_program(dvdnav_t *self, int32_t *title,
-+ int32_t *pgcn, int32_t *pgn);
-+
-+/*
- * Return the current position (in blocks) within the current
- * title and the length (in blocks) of said title.
- *
-diff -Naur libdvdnav.orig/src/navigation.c libdvdnav/src/navigation.c
---- libdvdnav.orig/src/navigation.c 2009-01-08 14:57:11.000000000 -0800
-+++ libdvdnav/src/navigation.c 2009-04-30 10:55:47.000000000 -0700
-@@ -122,10 +122,90 @@
- return DVDNAV_STATUS_ERR;
- }
-
-+dvdnav_status_t dvdnav_current_title_program(dvdnav_t *this, int32_t *title, int32_t *pgcn, int32_t *pgn) {
-+ int32_t retval;
-+ int32_t part;
-+
-+ pthread_mutex_lock(&this->vm_lock);
-+ if (!this->vm->vtsi || !this->vm->vmgi) {
-+ printerr("Bad VM state.");
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+ if (!this->started) {
-+ printerr("Virtual DVD machine not started.");
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+ if (!this->vm->state.pgc) {
-+ printerr("No current PGC.");
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+ if ( (this->vm->state.domain == VTSM_DOMAIN)
-+ || (this->vm->state.domain == VMGM_DOMAIN) ) {
-+ /* Get current Menu ID: into *part. */
-+ if(! vm_get_current_menu(this->vm, &part)) {
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+ if (part > -1) {
-+ *title = 0;
-+ *pgcn = this->vm->state.pgcN;
-+ *pgn = this->vm->state.pgN;
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_OK;
-+ }
-+ }
-+ if (this->vm->state.domain == VTS_DOMAIN) {
-+ retval = vm_get_current_title_part(this->vm, title, &part);
-+ *pgcn = this->vm->state.pgcN;
-+ *pgn = this->vm->state.pgN;
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
-+ }
-+ printerr("Not in a title or menu.");
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+}
-+
- dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int32_t title) {
- return dvdnav_part_play(this, title, 1);
- }
-
-+dvdnav_status_t dvdnav_program_play(dvdnav_t *this, int32_t title, int32_t pgcn, int32_t pgn) {
-+ int32_t retval;
-+
-+ pthread_mutex_lock(&this->vm_lock);
-+ if (!this->vm->vmgi) {
-+ printerr("Bad VM state.");
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+ if (!this->started) {
-+ /* don't report an error but be nice */
-+ vm_start(this->vm);
-+ this->started = 1;
-+ }
-+ if (!this->vm->state.pgc) {
-+ printerr("No current PGC.");
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+ if((title < 1) || (title > this->vm->vmgi->tt_srpt->nr_of_srpts)) {
-+ printerr("Title out of range.");
-+ pthread_mutex_unlock(&this->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+
-+ retval = vm_jump_title_program(this->vm, title, pgcn, pgn);
-+ if (retval)
-+ this->vm->hop_channel++;
-+ pthread_mutex_unlock(&this->vm_lock);
-+
-+ return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
-+}
-+
- dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int32_t title, int32_t part) {
- int32_t retval;
-
-diff -Naur libdvdnav.orig/src/vm/vm.c libdvdnav/src/vm/vm.c
---- libdvdnav.orig/src/vm/vm.c 2009-03-13 18:28:22.000000000 -0700
-+++ libdvdnav/src/vm/vm.c 2009-04-30 11:07:35.000000000 -0700
-@@ -83,6 +83,8 @@
- static int set_PTT(vm_t *vm, int tt, int ptt);
- static int set_VTS_TT(vm_t *vm, int vtsN, int vts_ttn);
- static int set_VTS_PTT(vm_t *vm, int vtsN, int vts_ttn, int part);
-+static int set_PROG(vm_t *vm, int tt, int pgcn, int pgn);
-+static int set_VTS_PROG(vm_t *vm, int vtsN, int vts_ttn, int pgcn, int pgn);
- static int set_FP_PGC(vm_t *vm);
- static int set_MENU(vm_t *vm, int menu);
- static int set_PGCN(vm_t *vm, int pgcN);
-@@ -516,6 +518,24 @@
- return 1;
- }
-
-+int vm_jump_title_program(vm_t *vm, int title, int pgcn, int pgn) {
-+ link_t link;
-+
-+ if(!set_PROG(vm, title, pgcn, pgn))
-+ return 0;
-+ /* Some DVDs do not want us to jump directly into a title and have
-+ * PGC pre commands taking us back to some menu. Since we do not like that,
-+ * we do not execute PGC pre commands that would do a jump. */
-+ /* process_command(vm, play_PGC_PG(vm, (vm->state).pgN)); */
-+ link = play_PGC_PG(vm, (vm->state).pgN);
-+ if (link.command != PlayThis)
-+ /* jump occured -> ignore it and play the PG anyway */
-+ process_command(vm, play_PG(vm));
-+ else
-+ process_command(vm, link);
-+ return 1;
-+}
-+
- int vm_jump_title_part(vm_t *vm, int title, int part) {
- link_t link;
-
-@@ -1644,6 +1664,42 @@
- return res;
- }
-
-+static int set_PROG(vm_t *vm, int tt, int pgcn, int pgn) {
-+ assert(tt <= vm->vmgi->tt_srpt->nr_of_srpts);
-+ return set_VTS_PROG(vm, vm->vmgi->tt_srpt->title[tt - 1].title_set_nr,
-+ vm->vmgi->tt_srpt->title[tt - 1].vts_ttn, pgcn, pgn);
-+}
-+
-+static int set_VTS_PROG(vm_t *vm, int vtsN, int vts_ttn, int pgcn, int pgn) {
-+ int pgcN, pgN, res, title, part;
-+
-+ (vm->state).domain = VTS_DOMAIN;
-+
-+ if (vtsN != (vm->state).vtsN)
-+ if (!ifoOpenNewVTSI(vm, vm->dvd, vtsN)) /* Also sets (vm->state).vtsN */
-+ return 0;
-+
-+ if ((vts_ttn < 1) || (vts_ttn > vm->vtsi->vts_ptt_srpt->nr_of_srpts)) {
-+ return 0;
-+ }
-+
-+ pgcN = pgcn;
-+ pgN = pgn;
-+
-+ (vm->state).TT_PGCN_REG = pgcN;
-+ (vm->state).TTN_REG = get_TT(vm, vtsN, vts_ttn);
-+ assert( (vm->state.TTN_REG) != 0 );
-+ (vm->state).VTS_TTN_REG = vts_ttn;
-+ (vm->state).vtsN = vtsN; /* Not sure about this one. We can get to it easily from TTN_REG */
-+ /* Any other registers? */
-+
-+ res = set_PGCN(vm, pgcN); /* This clobber's state.pgN (sets it to 1), but we don't want clobbering here. */
-+ (vm->state).pgN = pgN;
-+ vm_get_current_title_part(vm, &title, &part);
-+ (vm->state).PTTN_REG = part;
-+ return res;
-+}
-+
- static int set_FP_PGC(vm_t *vm) {
- (vm->state).domain = FP_DOMAIN;
- if (!vm->vmgi->first_play_pgc) {
-diff -Naur libdvdnav.orig/src/vm/vm.h libdvdnav/src/vm/vm.h
---- libdvdnav.orig/src/vm/vm.h 2009-03-13 18:28:22.000000000 -0700
-+++ libdvdnav/src/vm/vm.h 2009-04-30 10:57:02.000000000 -0700
-@@ -139,6 +139,7 @@
- int vm_jump_pg(vm_t *vm, int pg);
- int vm_jump_cell_block(vm_t *vm, int cell, int block);
- int vm_jump_title_part(vm_t *vm, int title, int part);
-+int vm_jump_title_program(vm_t *vm, int title, int pgcn, int pgn);
- int vm_jump_top_pg(vm_t *vm);
- int vm_jump_next_pg(vm_t *vm);
- int vm_jump_prev_pg(vm_t *vm);
diff --git a/contrib/libdvdnav/A02-mult-pgc.patch b/contrib/libdvdnav/A02-mult-pgc.patch
deleted file mode 100644
index 5ccaa689e..000000000
--- a/contrib/libdvdnav/A02-mult-pgc.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-# the bit tested here does not indicate 'random or shuffle' - it only says
-# that the title uses multiple PGCs. Since libdvdnav mostly deals correctly
-# with mult PGC titles (modulo some weirdness when seeking) we need the
-# state to get set correctly.
---- libdvdnav/src/vm/vm.c.orig 2009-05-13 20:44:12.000000000 -0700
-+++ libdvdnav/src/vm/vm.c 2009-05-13 20:46:02.000000000 -0700
-@@ -1758,14 +1758,10 @@
- if((vm->state).TTN_REG > vm->vmgi->tt_srpt->nr_of_srpts)
- return 0; /* ?? */
- pb_ty = &vm->vmgi->tt_srpt->title[(vm->state).TTN_REG - 1].pb_ty;
-- if(pb_ty->multi_or_random_pgc_title == /* One_Sequential_PGC_Title */ 0) {
-+
- int dummy, part;
- vm_get_current_title_part(vm, &dummy, &part);
- (vm->state).PTTN_REG = part;
-- } else {
-- /* FIXME: Handle RANDOM or SHUFFLE titles. */
-- fprintf(MSG_OUT, "libdvdnav: RANDOM or SHUFFLE titles are NOT handled yet.\n");
-- }
- }
- return 1;
- }
diff --git a/contrib/libdvdnav/A03-quiet.patch b/contrib/libdvdnav/A03-quiet.patch
deleted file mode 100644
index 87a7e779b..000000000
--- a/contrib/libdvdnav/A03-quiet.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -Naur libdvdnav.orig/src/vm/vm.c libdvdnav/src/vm/vm.c
---- libdvdnav.orig/src/vm/vm.c 2009-03-13 18:28:22.000000000 -0700
-+++ libdvdnav/src/vm/vm.c 2009-06-02 13:50:06.000000000 -0700
-@@ -354,8 +354,6 @@
- fprintf(MSG_OUT, "libdvdnav: vm: failed to open/read the DVD\n");
- return 0;
- }
-- dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
-- vm->map = remap_loadmap(vm->dvd_name);
- vm->vmgi = ifoOpenVMGI(vm->dvd);
- if(!vm->vmgi) {
- fprintf(MSG_OUT, "libdvdnav: vm: failed to read VIDEO_TS.IFO\n");
-@@ -386,6 +384,8 @@
- /* return 0; Not really used for now.. */
- }
- /* ifoRead_TXTDT_MGI(vmgi); Not implemented yet */
-+ dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
-+ vm->map = remap_loadmap(vm->dvd_name);
- }
- if (vm->vmgi) {
- int i, mask;
diff --git a/contrib/libdvdnav/A04-m4-uid0.patch b/contrib/libdvdnav/A04-m4-uid0.patch
deleted file mode 100644
index 49638279b..000000000
--- a/contrib/libdvdnav/A04-m4-uid0.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -Naur libdvdnav.orig/configure.ac libdvdnav/configure.ac
---- libdvdnav.orig/configure.ac 2009-01-08 14:57:11.000000000 -0800
-+++ libdvdnav/configure.ac 2009-08-24 10:20:16.560743586 -0700
-@@ -206,24 +206,6 @@
-
- AC_SUBST(DEBUG_CFLAGS)
-
--dnl ---------------------------------------------
--dnl Get where .m4 should be installed.
--dnl ---------------------------------------------
--case "`id`" in
-- uid=0\(* )
-- AC_MSG_CHECKING(for aclocal directory)
-- if (aclocal --version) < /dev/null > /dev/null 2>&1; then
-- ACLOCAL_DIR="`eval $ACLOCAL --print-ac-dir`"
-- AC_MSG_RESULT($ACLOCAL_DIR)
-- else
-- ACLOCAL_DIR="/usr/local/share/aclocal"
-- AC_MSG_RESULT(none - will be installed in $ACLOCAL_DIR)
-- fi
-- escapedprefix="`echo $prefix | sed -e 's/\\//\\\\\//g'`"
-- ACLOCAL_DIR="`echo $ACLOCAL_DIR|sed -e 's/^'$escapedprefix/'\${prefix}'/`"
-- AC_SUBST(ACLOCAL_DIR)
-- ;;
--esac
- AM_CONDITIONAL(INSTALL_M4, test x"$ACLOCAL_DIR" != "x")
-
- dnl ---------------------------------------------
diff --git a/contrib/libdvdnav/A05-forward-seek.patch b/contrib/libdvdnav/A05-forward-seek.patch
deleted file mode 100644
index 1c45b8e71..000000000
--- a/contrib/libdvdnav/A05-forward-seek.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-diff -Naur libdvdnav.orig/src/searching.c libdvdnav/src/searching.c
---- libdvdnav.orig/src/searching.c 2009-01-08 14:57:11.000000000 -0800
-+++ libdvdnav/src/searching.c 2009-09-12 15:36:14.403299590 -0700
-@@ -47,7 +47,7 @@
- /* Return placed in vobu. */
- /* Returns error status */
- /* FIXME: Maybe need to handle seeking outside current cell. */
--static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, uint32_t seekto_block, uint32_t *vobu) {
-+static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, uint32_t seekto_block, int next, uint32_t *vobu) {
- vobu_admap_t *admap = NULL;
-
- #ifdef LOG_DEBUG
-@@ -89,7 +89,7 @@
- vobu_start = next_vobu;
- address++;
- }
-- *vobu = vobu_start;
-+ *vobu = next ? next_vobu : vobu_start;
- return DVDNAV_STATUS_OK;
- }
- fprintf(MSG_OUT, "libdvdnav: admap not located\n");
-@@ -160,7 +160,7 @@
- fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n",
- cell_nr, first_cell_nr, last_cell_nr);
- #endif
-- if (dvdnav_scan_admap(this, state->domain, target, &vobu) == DVDNAV_STATUS_OK) {
-+ if (dvdnav_scan_admap(this, state->domain, target, 0, &vobu) == DVDNAV_STATUS_OK) {
- uint32_t start = state->pgc->cell_playback[cell_nr-1].first_sector;
-
- if (vm_jump_cell_block(this->vm, cell_nr, vobu - start)) {
-@@ -184,9 +184,13 @@
- dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
- uint64_t offset, int32_t origin) {
- uint32_t target = 0;
-+ uint32_t current_pos;
-+ uint32_t cur_sector;
-+ uint32_t cur_cell_nr;
- uint32_t length = 0;
- uint32_t first_cell_nr, last_cell_nr, cell_nr;
- int32_t found;
-+ int forward = 0;
- cell_playback_t *cell;
- dvd_state_t *state;
- dvdnav_status_t result;
-@@ -213,6 +217,10 @@
- fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN);
- #endif
-
-+ current_pos = target;
-+ cur_sector = this->vobu.vobu_start + this->vobu.blockN;
-+ cur_cell_nr = state->cellN;
-+
- switch(origin) {
- case SEEK_SET:
- if(offset >= length) {
-@@ -244,6 +252,7 @@
- pthread_mutex_unlock(&this->vm_lock);
- return DVDNAV_STATUS_ERR;
- }
-+ forward = target > current_pos;
-
- this->cur_cell_time = 0;
- if (this->pgc_based) {
-@@ -270,6 +279,27 @@
- } else {
- /* convert the target sector from Cell-relative to absolute physical sector */
- target += cell->first_sector;
-+ if (forward && (cell_nr == cur_cell_nr)) {
-+ uint32_t vobu;
-+ /* if we are seeking forward from the current position, make sure
-+ * we move to a new position that is after our current position.
-+ * simply truncating to the vobu will go backwards */
-+ if (dvdnav_scan_admap(this, state->domain, target, 0, &vobu) != DVDNAV_STATUS_OK)
-+ break;
-+ if (vobu <= cur_sector) {
-+ if (dvdnav_scan_admap(this, state->domain, target, 1, &vobu) != DVDNAV_STATUS_OK)
-+ break;
-+ if (vobu > cell->last_sector) {
-+ if (cell_nr == last_cell_nr)
-+ break;
-+ cell_nr++;
-+ cell = &(state->pgc->cell_playback[cell_nr-1]);
-+ target = cell->first_sector;
-+ } else {
-+ target = vobu;
-+ }
-+ }
-+ }
- found = 1;
- break;
- }
-@@ -281,7 +311,7 @@
- fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n",
- cell_nr, first_cell_nr, last_cell_nr);
- #endif
-- if (dvdnav_scan_admap(this, state->domain, target, &vobu) == DVDNAV_STATUS_OK) {
-+ if (dvdnav_scan_admap(this, state->domain, target, 0, &vobu) == DVDNAV_STATUS_OK) {
- int32_t start = state->pgc->cell_playback[cell_nr-1].first_sector;
-
- if (vm_jump_cell_block(this->vm, cell_nr, vobu - start)) {
diff --git a/contrib/libdvdnav/A06-reset-mutex.patch b/contrib/libdvdnav/A06-reset-mutex.patch
deleted file mode 100644
index 76f55e348..000000000
--- a/contrib/libdvdnav/A06-reset-mutex.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Index: src/dvdnav.c
-===================================================================
---- libdvdnav.orig/src/dvdnav.c (revision 1168)
-+++ libdvdnav/src/dvdnav.c (working copy)
-@@ -178,9 +178,9 @@
- #ifdef LOG_DEBUG
- fprintf(MSG_OUT, "libdvdnav: clearing dvdnav\n");
- #endif
-+ pthread_mutex_unlock(&this->vm_lock);
- result = dvdnav_clear(this);
-
-- pthread_mutex_unlock(&this->vm_lock);
- return result;
- }
-
-@@ -519,7 +519,8 @@
- }
-
- /* Check to see if we need to change the currently opened VOB */
-- if((this->position_current.vts != this->position_next.vts) ||
-+ if((this->file == NULL) ||
-+ (this->position_current.vts != this->position_next.vts) ||
- (this->position_current.domain != this->position_next.domain)) {
- dvd_read_domain_t domain;
- int32_t vtsN;
diff --git a/contrib/libdvdnav/A07-missing-menu.patch b/contrib/libdvdnav/A07-missing-menu.patch
deleted file mode 100644
index 7f035592a..000000000
--- a/contrib/libdvdnav/A07-missing-menu.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-diff -Naur libdvdnav.orig/src/vm/vm.c libdvdnav/src/vm/vm.c
---- libdvdnav.orig/src/vm/vm.c 2009-10-29 09:10:44.836643320 -0700
-+++ libdvdnav/src/vm/vm.c 2009-11-27 11:32:47.475322754 -0800
-@@ -585,6 +585,9 @@
- switch(menuid) {
- case DVD_MENU_Title:
- case DVD_MENU_Escape:
-+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
-+ goto fail;
-+ }
- (vm->state).domain = VMGM_DOMAIN;
- break;
- case DVD_MENU_Root:
-@@ -592,6 +595,9 @@
- case DVD_MENU_Audio:
- case DVD_MENU_Angle:
- case DVD_MENU_Part:
-+ if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
-+ goto fail;
-+ }
- (vm->state).domain = VTSM_DOMAIN;
- break;
- }
-@@ -606,6 +612,7 @@
- break;
- }
-
-+fail:
- return 0;
- }
-
-@@ -1412,8 +1419,9 @@
- if(link_values.data2 != 0)
- (vm->state).HL_BTNN_REG = link_values.data2 << 10;
- if(!set_VTS_PTT(vm, (vm->state).vtsN, (vm->state).VTS_TTN_REG, link_values.data1))
-- assert(0);
-- link_values = play_PG(vm);
-+ link_values.command = Exit;
-+ else
-+ link_values = play_PG(vm);
- break;
- case LinkPGN:
- /* Link to Program Number:data1 */
-@@ -1458,8 +1466,9 @@
- /* Set SPRM1 and SPRM2 */
- assert((vm->state).domain == VTSM_DOMAIN || (vm->state).domain == VTS_DOMAIN); /* ?? */
- if(!set_VTS_TT(vm, (vm->state).vtsN, link_values.data1))
-- assert(0);
-- link_values = play_PGC(vm);
-+ link_values.command = Exit;
-+ else
-+ link_values = play_PGC(vm);
- break;
- case JumpVTS_PTT:
- /* Jump to Part:data2 of Title:data1 in same VTS Title Domain */
-@@ -1469,8 +1478,9 @@
- /* Set SPRM1 and SPRM2 */
- assert((vm->state).domain == VTSM_DOMAIN || (vm->state).domain == VTS_DOMAIN); /* ?? */
- if(!set_VTS_PTT(vm, (vm->state).vtsN, link_values.data1, link_values.data2))
-- assert(0);
-- link_values = play_PGC_PG(vm, (vm->state).pgN);
-+ link_values.command = Exit;
-+ else
-+ link_values = play_PGC_PG(vm, (vm->state).pgN);
- break;
-
- case JumpSS_FP:
-@@ -1488,6 +1498,10 @@
- /* Allowed from anywhere except the VTS Title domain */
- /* Stop SPRM9 Timer and any GPRM counters */
- assert((vm->state).domain != VTS_DOMAIN); /* ?? */
-+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
-+ link_values.command = Exit;
-+ break;
-+ }
- (vm->state).domain = VMGM_DOMAIN;
- if(!set_MENU(vm, link_values.data1))
- assert(0);
-@@ -1504,14 +1518,22 @@
- if (link_values.data1 != (vm->state).vtsN) {
- /* the normal case */
- assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */
-- (vm->state).domain = VTSM_DOMAIN;
- if (!ifoOpenNewVTSI(vm, vm->dvd, link_values.data1)) /* Also sets (vm->state).vtsN */
- assert(0);
-+ if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
-+ link_values.command = Exit;
-+ break;
-+ }
-+ (vm->state).domain = VTSM_DOMAIN;
- } else {
- /* This happens on some discs like "Captain Scarlet & the Mysterons" or
- * the German RC2 of "Anatomie" in VTSM. */
- assert((vm->state).domain == VTSM_DOMAIN ||
- (vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */
-+ if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
-+ link_values.command = Exit;
-+ break;
-+ }
- (vm->state).domain = VTSM_DOMAIN;
- }
- } else {
-@@ -1533,6 +1555,10 @@
- /* set_PGCN:data1 */
- /* Stop SPRM9 Timer and any GPRM counters */
- assert((vm->state).domain != VTS_DOMAIN); /* ?? */
-+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
-+ link_values.command = Exit;
-+ break;
-+ }
- (vm->state).domain = VMGM_DOMAIN;
- if(!set_PGCN(vm, link_values.data1))
- assert(0);
-@@ -1552,6 +1578,10 @@
- /* set_RSMinfo:data2 */
- assert((vm->state).domain == VTS_DOMAIN); /* ?? */
- /* Must be called before domain is changed */
-+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
-+ link_values.command = Exit;
-+ break;
-+ }
- set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
- (vm->state).domain = VMGM_DOMAIN;
- if(!set_MENU(vm, link_values.data1))
-@@ -1563,6 +1593,10 @@
- /* set_RSMinfo:data2 */
- assert((vm->state).domain == VTS_DOMAIN); /* ?? */
- /* Must be called before domain is changed */
-+ if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
-+ link_values.command = Exit;
-+ break;
-+ }
- set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
- (vm->state).domain = VTSM_DOMAIN;
- if(!set_MENU(vm, link_values.data1))
-@@ -1574,6 +1608,10 @@
- /* set_RSMinfo:data2 */
- assert((vm->state).domain == VTS_DOMAIN); /* ?? */
- /* Must be called before domain is changed */
-+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
-+ link_values.command = Exit;
-+ break;
-+ }
- set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
- (vm->state).domain = VMGM_DOMAIN;
- if(!set_PGCN(vm, link_values.data1))
-@@ -1634,7 +1672,9 @@
- (vm->state).TT_PGCN_REG = pgcN;
- (vm->state).PTTN_REG = part;
- (vm->state).TTN_REG = get_TT(vm, vtsN, vts_ttn);
-- assert( (vm->state.TTN_REG) != 0 );
-+ if( (vm->state.TTN_REG) == 0 )
-+ return 0;
-+
- (vm->state).VTS_TTN_REG = vts_ttn;
- (vm->state).vtsN = vtsN; /* Not sure about this one. We can get to it easily from TTN_REG */
- /* Any other registers? */
diff --git a/contrib/libdvdnav/A08-dvdnav-dup.patch b/contrib/libdvdnav/A08-dvdnav-dup.patch
deleted file mode 100644
index ce6072a4c..000000000
--- a/contrib/libdvdnav/A08-dvdnav-dup.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-Index: src/dvdnav.c
-===================================================================
---- libdvdnav.orig/src/dvdnav.c (revision 1168)
-+++ libdvdnav/src/dvdnav.c (working copy)
-@@ -71,6 +71,67 @@
- return DVDNAV_STATUS_OK;
- }
-
-+dvdnav_status_t dvdnav_dup(dvdnav_t **dest, dvdnav_t *src) {
-+ dvdnav_t *this;
-+
-+ (*dest) = NULL;
-+ this = (dvdnav_t*)malloc(sizeof(dvdnav_t));
-+ if(!this)
-+ return DVDNAV_STATUS_ERR;
-+
-+ memcpy(this, src, sizeof(dvdnav_t));
-+ this->file = NULL;
-+
-+ pthread_mutex_init(&this->vm_lock, NULL);
-+
-+ this->vm = vm_new_copy(src->vm);
-+ if(!this->vm) {
-+ printerr("Error initialising the DVD VM.");
-+ pthread_mutex_destroy(&this->vm_lock);
-+ free(this);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+
-+ /* Start the read-ahead cache. */
-+ this->cache = dvdnav_read_cache_new(this);
-+
-+ (*dest) = this;
-+ return DVDNAV_STATUS_OK;
-+}
-+
-+dvdnav_status_t dvdnav_free_dup(dvdnav_t *this) {
-+
-+#ifdef LOG_DEBUG
-+ fprintf(MSG_OUT, "libdvdnav: free_dup:called\n");
-+#endif
-+
-+ if (this->file) {
-+ pthread_mutex_lock(&this->vm_lock);
-+ DVDCloseFile(this->file);
-+#ifdef LOG_DEBUG
-+ fprintf(MSG_OUT, "libdvdnav: close:file closing\n");
-+#endif
-+ this->file = NULL;
-+ pthread_mutex_unlock(&this->vm_lock);
-+ }
-+
-+ /* Free the VM */
-+ if(this->vm)
-+ vm_free_copy(this->vm);
-+
-+ pthread_mutex_destroy(&this->vm_lock);
-+
-+ /* We leave the final freeing of the entire structure to the cache,
-+ * because we don't know, if there are still buffers out in the wild,
-+ * that must return first. */
-+ if(this->cache)
-+ dvdnav_read_cache_free(this->cache);
-+ else
-+ free(this);
-+
-+ return DVDNAV_STATUS_OK;
-+}
-+
- dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path) {
- dvdnav_t *this;
- struct timeval time;
-Index: src/dvdnav/dvdnav.h
-===================================================================
---- libdvdnav.orig/src/dvdnav/dvdnav.h (revision 1168)
-+++ libdvdnav/src/dvdnav/dvdnav.h (working copy)
-@@ -89,6 +89,9 @@
- */
- dvdnav_status_t dvdnav_open(dvdnav_t **dest, const char *path);
-
-+dvdnav_status_t dvdnav_dup(dvdnav_t **dest, dvdnav_t *src);
-+dvdnav_status_t dvdnav_free_dup(dvdnav_t *this);
-+
- /*
- * Closes a dvdnav_t previously opened with dvdnav_open(), freeing any
- * memory associated with it.
-Index: src/vm/vm.c
-===================================================================
---- libdvdnav.orig/src/vm/vm.c (revision 1168)
-+++ libdvdnav/src/vm/vm.c (working copy)
-@@ -96,6 +98,7 @@
-
- static pgcit_t* get_MENU_PGCIT(vm_t *vm, ifo_handle_t *h, uint16_t lang);
- static pgcit_t* get_PGCIT(vm_t *vm);
-+static void vm_close(vm_t *vm);
-
-
- /* Helper functions */
-@@ -262,7 +265,7 @@
- }
-
- void vm_free_vm(vm_t *vm) {
-- vm_stop(vm);
-+ vm_close(vm);
- free(vm);
- }
-
-@@ -289,12 +292,20 @@
-
- int vm_start(vm_t *vm) {
- /* Set pgc to FP (First Play) pgc */
-+ if (vm->stopped) {
-+ vm_reset(vm, NULL);
-+ vm->stopped = 0;
-+ }
- set_FP_PGC(vm);
- process_command(vm, play_PGC(vm));
- return !vm->stopped;
- }
-
- void vm_stop(vm_t *vm) {
-+ vm->stopped = 1;
-+}
-+
-+static void vm_close(vm_t *vm) {
- if(vm->vmgi) {
- ifoClose(vm->vmgi);
- vm->vmgi=NULL;
-@@ -346,7 +357,7 @@
-
- if (vm->dvd && dvdroot) {
- /* a new dvd device has been requested */
-- vm_stop(vm);
-+ vm_close(vm);
- }
- if (!vm->dvd) {
- vm->dvd = DVDOpen(dvdroot);
diff --git a/contrib/libdvdnav/P00-mingw-no-examples.patch b/contrib/libdvdnav/P00-mingw-no-examples.patch
deleted file mode 100644
index 0e0618617..000000000
--- a/contrib/libdvdnav/P00-mingw-no-examples.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -Naur libdvdnav.orig/Makefile.am libdvdnav/Makefile.am
---- libdvdnav.orig/Makefile.am 2008-10-03 16:11:46.000000000 -0400
-+++ libdvdnav/Makefile.am 2009-04-24 02:53:15.000000000 -0400
-@@ -1,7 +1,7 @@
- include $(top_srcdir)/misc/Makefile.common
-
-
--SUBDIRS = src examples doc misc m4
-+SUBDIRS = src doc misc m4
-
- EXTRA_DIST = autogen.sh \
- AUTHORS \
-diff -Naur libdvdnav.orig/configure.ac libdvdnav/configure.ac
---- libdvdnav.orig/configure.ac 2009-01-08 17:57:11.000000000 -0500
-+++ libdvdnav/configure.ac 2009-04-24 02:52:34.000000000 -0400
-@@ -252,5 +252,4 @@
- misc/relchk.sh
- m4/Makefile
- doc/Makefile
--examples/Makefile
- ])
diff --git a/contrib/libdvdnav/module.defs b/contrib/libdvdnav/module.defs
index 473a76237..7e7eb5294 100644
--- a/contrib/libdvdnav/module.defs
+++ b/contrib/libdvdnav/module.defs
@@ -1,7 +1,7 @@
$(eval $(call import.MODULE.defs,LIBDVDNAV,libdvdnav,LIBDVDREAD))
$(eval $(call import.CONTRIB.defs,LIBDVDNAV))
-LIBDVDNAV.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libdvdnav-svn1168.tar.gz
+LIBDVDNAV.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libdvdnav-5c47461.tar.bz2
LIBDVDNAV.EXTRACT.tarbase = libdvdnav
ifneq (max,$(LIBDVDNAV.GCC.g))