summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2014-01-27 10:34:30 +0000
committerRodeo <[email protected]>2014-01-27 10:34:30 +0000
commitad43544d33d59b431392c8728a710bef43a43bd8 (patch)
tree215b89df57fca0daf09a5aad7f51745c0bbe3d2e
parent96fbc744385ddcc15617ba449d1521c30f66da3d (diff)
Switch to VideoLAN's repositories for libdvdread and libdvdnav.
All our patches have been merged, and they seem to be the only repos for these libs to see any development activity. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6002 b64f7644-9d1e-0410-96f1-a4d463321fa5
-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
-rw-r--r--contrib/libdvdread/A00-volume-name.patch12
-rw-r--r--contrib/libdvdread/A01-bogus-udf-filename.patch37
-rw-r--r--contrib/libdvdread/A02-msc_ver-defs.patch85
-rw-r--r--contrib/libdvdread/A03-m4-uid0.patch28
-rw-r--r--contrib/libdvdread/A04-dup-lut-pgc.patch324
-rw-r--r--contrib/libdvdread/A05-short-ptt-table.patch19
-rw-r--r--contrib/libdvdread/A06-short-ptt-table2.patch21
-rw-r--r--contrib/libdvdread/P00-mingw-dlfcn.patch34
-rw-r--r--contrib/libdvdread/P01-mingw-bitfields.patch19
-rw-r--r--contrib/libdvdread/P05-mingw-large-file.patch28
-rw-r--r--contrib/libdvdread/P06-darwin.patch25
-rw-r--r--contrib/libdvdread/module.defs7
23 files changed, 6 insertions, 1372 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))
diff --git a/contrib/libdvdread/A00-volume-name.patch b/contrib/libdvdread/A00-volume-name.patch
deleted file mode 100644
index af7018e7a..000000000
--- a/contrib/libdvdread/A00-volume-name.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur libdvdread.orig/src/dvd_udf.c libdvdread/src/dvd_udf.c
---- libdvdread.orig/src/dvd_udf.c 2009-01-08 14:57:10.000000000 -0800
-+++ libdvdread/src/dvd_udf.c 2009-04-23 13:36:08.000000000 -0700
-@@ -928,7 +928,7 @@
- if(GetUDFCache(device, PVDCache, 0, pvd))
- return 1;
-
-- if(!UDFGetDescriptor( device, 1, pvd_buf, sizeof(pvd_buf)))
-+ if(!UDFGetDescriptor( device, 1, pvd_buf, DVD_VIDEO_LB_LEN))
- return 0;
-
- memcpy(pvd->VolumeIdentifier, &pvd_buf[24], 32);
diff --git a/contrib/libdvdread/A01-bogus-udf-filename.patch b/contrib/libdvdread/A01-bogus-udf-filename.patch
deleted file mode 100644
index d9a3b2103..000000000
--- a/contrib/libdvdread/A01-bogus-udf-filename.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Index: dvd_udf.c
-===================================================================
---- libdvdread/src/dvd_udf.c (revision 1233)
-+++ libdvdread/src/dvd_udf.c (working copy)
-@@ -329,16 +329,17 @@
- static int Unicodedecode( uint8_t *data, int len, char *target )
- {
- int p = 1, i = 0;
-+ int err = 0;
-
- if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do {
-- if( data[ 0 ] == 16 ) p++; /* Ignore MSB of unicode16 */
-+ if( data[ 0 ] == 16 ) err |= data[p++]; /* character cannot be converted to 8bit, return error */
- if( p < len ) {
- target[ i++ ] = data[ p++ ];
- }
- } while( p < len );
-
- target[ i ] = '\0';
-- return 0;
-+ return !err;
- }
-
- static int UDFDescriptor( uint8_t *data, uint16_t *TagID )
-@@ -490,8 +491,9 @@
- L_FI = GETN1(19);
- UDFLongAD(&data[20], FileICB);
- L_IU = GETN2(36);
-- if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
-- else FileName[0] = '\0';
-+ if (L_FI) {
-+ if (!Unicodedecode(&data[38 + L_IU], L_FI, FileName)) FileName[0] = 0;
-+ } else FileName[0] = '\0';
- return 4 * ((38 + L_FI + L_IU + 3) / 4);
- }
-
-
diff --git a/contrib/libdvdread/A02-msc_ver-defs.patch b/contrib/libdvdread/A02-msc_ver-defs.patch
deleted file mode 100644
index 9d58639b5..000000000
--- a/contrib/libdvdread/A02-msc_ver-defs.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-diff -Naur libdvdread.orig/src/dvd_reader.c libdvdread/src/dvd_reader.c
---- libdvdread.orig/src/dvd_reader.c 2009-03-13 18:28:21.000000000 -0700
-+++ libdvdread/src/dvd_reader.c 2009-09-15 10:15:25.201548319 -0700
-@@ -36,6 +36,7 @@
-
- /* misc win32 helpers */
- #ifdef WIN32
-+#include <windows.h>
- #ifndef HAVE_GETTIMEOFDAY
- /* replacement gettimeofday implementation */
- #include <sys/timeb.h>
-@@ -335,7 +336,7 @@
- char *dev_name = NULL;
- char *path;
-
--#ifdef _MSC_VER
-+#ifdef _WIN32
- int len;
- #endif
-
-@@ -349,7 +350,7 @@
- /* Try to open libdvdcss or fall back to standard functions */
- have_css = dvdinput_setup();
-
--#ifdef _MSC_VER
-+#ifdef _WIN32
- /* Strip off the trailing \ if it is not a drive */
- len = strlen(path);
- if ((len > 1) &&
-@@ -447,6 +448,14 @@
- }
- }
-
-+#ifdef _WIN32
-+ if( strlen( path_copy ) > TITLES_MAX ) {
-+ if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
-+ "\\video_ts" ) ) {
-+ path_copy[ strlen( path_copy ) - (TITLES_MAX-1) ] = '\0';
-+ }
-+ }
-+#else
- if( strlen( path_copy ) > TITLES_MAX ) {
- if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
- "/video_ts" ) ) {
-@@ -458,6 +467,7 @@
- path_copy[0] = '/';
- path_copy[1] = '\0';
- }
-+#endif
-
- #if defined(SYS_BSD)
- if( ( fe = getfsfile( path_copy ) ) ) {
-@@ -508,11 +518,14 @@
- }
- fclose( mntfile );
- }
--#elif defined(_MSC_VER) || defined(__OS2__)
-- auth_drive = DVDOpenImageFile( path, have_css );
-+#elif defined(_WIN32) || defined(__OS2__)
-+ if( GetDriveType( path_copy ) == DRIVE_CDROM ) {
-+ path_copy[2] = '\0';
-+ auth_drive = DVDOpenImageFile( path_copy, have_css );
-+ }
- #endif
-
--#if !defined(_MSC_VER) && !defined(__OS2__)
-+#if !defined(_WIN32) && !defined(__OS2__)
- if( !dev_name ) {
- fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
- } else if( !auth_drive ) {
-diff -Naur libdvdread.orig/src/dvdread_internal.h libdvdread/src/dvdread_internal.h
---- libdvdread.orig/src/dvdread_internal.h 2008-10-03 13:11:30.000000000 -0700
-+++ libdvdread/src/dvdread_internal.h 2009-09-15 09:44:01.788301485 -0700
-@@ -19,9 +19,9 @@
- #ifndef LIBDVDREAD_DVDREAD_INTERNAL_H
- #define LIBDVDREAD_DVDREAD_INTERNAL_H
-
--#ifdef _MSC_VER
-+#ifdef _WIN32
- #include <unistd.h>
--#endif /* _MSC_VER */
-+#endif /* _WIN32 */
-
- #define CHECK_VALUE(arg) \
- if(!(arg)) { \
diff --git a/contrib/libdvdread/A03-m4-uid0.patch b/contrib/libdvdread/A03-m4-uid0.patch
deleted file mode 100644
index eab26177c..000000000
--- a/contrib/libdvdread/A03-m4-uid0.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -Naur libdvdread.orig/configure.ac libdvdread/configure.ac
---- libdvdread.orig/configure.ac 2009-01-08 14:57:10.000000000 -0800
-+++ libdvdread/configure.ac 2009-08-24 10:17:47.036747814 -0700
-@@ -167,24 +167,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/libdvdread/A04-dup-lut-pgc.patch b/contrib/libdvdread/A04-dup-lut-pgc.patch
deleted file mode 100644
index cf34419f7..000000000
--- a/contrib/libdvdread/A04-dup-lut-pgc.patch
+++ /dev/null
@@ -1,324 +0,0 @@
---- libdvdread.orig/src/ifo_read.c 2009-10-29 09:11:32.066743831 -0700
-+++ libdvdread/src/ifo_read.c 2009-11-13 10:27:49.293174360 -0800
-@@ -87,9 +87,9 @@
- static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
- unsigned int offset);
-
--static void ifoFree_PGC(pgc_t *pgc);
-+static void ifoFree_PGC(pgc_t **pgc);
- static void ifoFree_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl);
--static void ifoFree_PGCIT_internal(pgcit_t *pgcit);
-+static void ifoFree_PGCIT_internal(pgcit_t **pgcit);
-
- static inline int DVDFileSeekForce_( dvd_file_t *dvd_file, uint32_t offset, int force_size ) {
- return (DVDFileSeekForce(dvd_file, (int)offset, force_size) == (int)offset);
-@@ -870,7 +870,6 @@
-
- if(!ifoRead_PGC_COMMAND_TBL(ifofile, pgc->command_tbl,
- offset + pgc->command_tbl_offset)) {
-- free(pgc->command_tbl);
- return 0;
- }
- } else {
-@@ -880,13 +879,10 @@
- if(pgc->program_map_offset != 0 && pgc->nr_of_programs>0) {
- pgc->program_map = malloc(pgc->nr_of_programs * sizeof(pgc_program_map_t));
- if(!pgc->program_map) {
-- ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
- return 0;
- }
- if(!ifoRead_PGC_PROGRAM_MAP(ifofile, pgc->program_map,pgc->nr_of_programs,
- offset + pgc->program_map_offset)) {
-- ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
-- free(pgc->program_map);
- return 0;
- }
- } else {
-@@ -896,18 +892,11 @@
- if(pgc->cell_playback_offset != 0 && pgc->nr_of_cells>0) {
- pgc->cell_playback = malloc(pgc->nr_of_cells * sizeof(cell_playback_t));
- if(!pgc->cell_playback) {
-- ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
-- if(pgc->program_map)
-- free(pgc->program_map);
- return 0;
- }
- if(!ifoRead_CELL_PLAYBACK_TBL(ifofile, pgc->cell_playback,
- pgc->nr_of_cells,
- offset + pgc->cell_playback_offset)) {
-- ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
-- if(pgc->program_map)
-- free(pgc->program_map);
-- free(pgc->cell_playback);
- return 0;
- }
- } else {
-@@ -917,13 +906,11 @@
- if(pgc->cell_position_offset != 0 && pgc->nr_of_cells>0) {
- pgc->cell_position = malloc(pgc->nr_of_cells * sizeof(cell_position_t));
- if(!pgc->cell_position) {
-- ifoFree_PGC(pgc);
- return 0;
- }
- if(!ifoRead_CELL_POSITION_TBL(ifofile, pgc->cell_position,
- pgc->nr_of_cells,
- offset + pgc->cell_position_offset)) {
-- ifoFree_PGC(pgc);
- return 0;
- }
- } else {
-@@ -946,29 +933,33 @@
- if(ifofile->vmgi_mat->first_play_pgc == 0)
- return 1;
-
-- ifofile->first_play_pgc = (pgc_t *)malloc(sizeof(pgc_t));
-+ ifofile->first_play_pgc = (pgc_t *)calloc(1, sizeof(pgc_t));
- if(!ifofile->first_play_pgc)
- return 0;
-
-+ ifofile->first_play_pgc->ref_count = 1;
- if(!ifoRead_PGC(ifofile, ifofile->first_play_pgc,
- ifofile->vmgi_mat->first_play_pgc)) {
-- free(ifofile->first_play_pgc);
-- ifofile->first_play_pgc = 0;
-+ ifoFree_PGC(&ifofile->first_play_pgc);
- return 0;
- }
-
- return 1;
- }
-
--static void ifoFree_PGC(pgc_t *pgc) {
-- if(pgc) {
-- ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
-- if(pgc->program_map)
-- free(pgc->program_map);
-- if(pgc->cell_playback)
-- free(pgc->cell_playback);
-- if(pgc->cell_position)
-- free(pgc->cell_position);
-+static void ifoFree_PGC(pgc_t **pgc) {
-+ if(pgc && *pgc && (--(*pgc)->ref_count) <= 0) {
-+ ifoFree_PGC_COMMAND_TBL((*pgc)->command_tbl);
-+ if((*pgc)->program_map)
-+ free((*pgc)->program_map);
-+ if((*pgc)->cell_playback)
-+ free((*pgc)->cell_playback);
-+ if((*pgc)->cell_position)
-+ free((*pgc)->cell_position);
-+ free(*pgc);
-+ }
-+ if (pgc) {
-+ *pgc = NULL;
- }
- }
-
-@@ -977,9 +968,7 @@
- return;
-
- if(ifofile->first_play_pgc) {
-- ifoFree_PGC(ifofile->first_play_pgc);
-- free(ifofile->first_play_pgc);
-- ifofile->first_play_pgc = 0;
-+ ifoFree_PGC(&ifofile->first_play_pgc);
- }
- }
-
-@@ -1202,6 +1191,13 @@
- CHECK_VALUE(vts_ptt_srpt->title[i].ptt[j].pgcn < 1000); /* ?? */
- CHECK_VALUE(vts_ptt_srpt->title[i].ptt[j].pgn != 0);
- CHECK_VALUE(vts_ptt_srpt->title[i].ptt[j].pgn < 100); /* ?? */
-+ if (vts_ptt_srpt->title[i].ptt[j].pgcn == 0 ||
-+ vts_ptt_srpt->title[i].ptt[j].pgcn >= 1000 ||
-+ vts_ptt_srpt->title[i].ptt[j].pgn == 0 ||
-+ vts_ptt_srpt->title[i].ptt[j].pgn >= 100) {
-+ return 0;
-+ }
-+
- }
- }
-
-@@ -1372,7 +1368,6 @@
-
- if(ifofile->vtsi_mat->vts_tmapt == 0) { /* optional(?) */
- ifofile->vts_tmapt = NULL;
-- fprintf(stderr,"Please send bug report - no VTS_TMAPT ?? \n");
- return 1;
- }
-
-@@ -1756,10 +1751,11 @@
- if(ifofile->vtsi_mat->vts_pgcit == 0) /* mandatory */
- return 0;
-
-- ifofile->vts_pgcit = (pgcit_t *)malloc(sizeof(pgcit_t));
-+ ifofile->vts_pgcit = (pgcit_t *)calloc(1, sizeof(pgcit_t));
- if(!ifofile->vts_pgcit)
- return 0;
-
-+ ifofile->vts_pgcit->ref_count = 1;
- if(!ifoRead_PGCIT_internal(ifofile, ifofile->vts_pgcit,
- ifofile->vtsi_mat->vts_pgcit * DVD_BLOCK_LEN)) {
- free(ifofile->vts_pgcit);
-@@ -1770,6 +1766,17 @@
- return 1;
- }
-
-+static int find_dup_pgc(pgci_srp_t *pgci_srp, uint32_t start_byte, int count) {
-+ int i;
-+
-+ for(i = 0; i < count; i++) {
-+ if(pgci_srp[i].pgc_start_byte == start_byte) {
-+ return i;
-+ }
-+ }
-+ return -1;
-+}
-+
- static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
- unsigned int offset) {
- int i, info_length;
-@@ -1818,21 +1825,26 @@
- CHECK_VALUE(pgcit->pgci_srp[i].pgc_start_byte + PGC_SIZE <= pgcit->last_byte+1);
-
- for(i = 0; i < pgcit->nr_of_pgci_srp; i++) {
-- pgcit->pgci_srp[i].pgc = malloc(sizeof(pgc_t));
-+ int dup;
-+ if((dup = find_dup_pgc(pgcit->pgci_srp, pgcit->pgci_srp[i].pgc_start_byte, i)) >= 0) {
-+ pgcit->pgci_srp[i].pgc = pgcit->pgci_srp[dup].pgc;
-+ pgcit->pgci_srp[i].pgc->ref_count++;
-+ continue;
-+ }
-+ pgcit->pgci_srp[i].pgc = calloc(1, sizeof(pgc_t));
- if(!pgcit->pgci_srp[i].pgc) {
- int j;
- for(j = 0; j < i; j++) {
-- ifoFree_PGC(pgcit->pgci_srp[j].pgc);
-- free(pgcit->pgci_srp[j].pgc);
-+ ifoFree_PGC(&pgcit->pgci_srp[j].pgc);
- }
- goto fail;
- }
-+ pgcit->pgci_srp[i].pgc->ref_count = 1;
- if(!ifoRead_PGC(ifofile, pgcit->pgci_srp[i].pgc,
- offset + pgcit->pgci_srp[i].pgc_start_byte)) {
- int j;
-- for(j = 0; j < i; j++) {
-- ifoFree_PGC(pgcit->pgci_srp[j].pgc);
-- free(pgcit->pgci_srp[j].pgc);
-+ for(j = 0; j <= i; j++) {
-+ ifoFree_PGC(&pgcit->pgci_srp[j].pgc);
- }
- goto fail;
- }
-@@ -1845,12 +1857,16 @@
- return 0;
- }
-
--static void ifoFree_PGCIT_internal(pgcit_t *pgcit) {
-- if(pgcit) {
-+static void ifoFree_PGCIT_internal(pgcit_t **pgcit) {
-+ if(pgcit && *pgcit && (--(*pgcit)->ref_count <= 0)) {
- int i;
-- for(i = 0; i < pgcit->nr_of_pgci_srp; i++)
-- ifoFree_PGC(pgcit->pgci_srp[i].pgc);
-- free(pgcit->pgci_srp);
-+ for(i = 0; i < (*pgcit)->nr_of_pgci_srp; i++)
-+ ifoFree_PGC(&(*pgcit)->pgci_srp[i].pgc);
-+ free((*pgcit)->pgci_srp);
-+ free(*pgcit);
-+ }
-+ if (pgcit) {
-+ *pgcit = NULL;
- }
- }
-
-@@ -1859,12 +1875,20 @@
- return;
-
- if(ifofile->vts_pgcit) {
-- ifoFree_PGCIT_internal(ifofile->vts_pgcit);
-- free(ifofile->vts_pgcit);
-- ifofile->vts_pgcit = 0;
-+ ifoFree_PGCIT_internal(&ifofile->vts_pgcit);
- }
- }
-
-+static int find_dup_lut(pgci_lu_t *lu, uint32_t start_byte, int count) {
-+ int i;
-+
-+ for(i = 0; i < count; i++) {
-+ if(lu[i].lang_start_byte == start_byte) {
-+ return i;
-+ }
-+ }
-+ return -1;
-+}
-
- int ifoRead_PGCI_UT(ifo_handle_t *ifofile) {
- pgci_ut_t *pgci_ut;
-@@ -1958,27 +1982,31 @@
- }
-
- for(i = 0; i < pgci_ut->nr_of_lus; i++) {
-+ int dup;
-+ if((dup = find_dup_lut(pgci_ut->lu, pgci_ut->lu[i].lang_start_byte, i)) >= 0) {
-+ pgci_ut->lu[i].pgcit = pgci_ut->lu[dup].pgcit;
-+ pgci_ut->lu[i].pgcit->ref_count++;
-+ continue;
-+ }
- pgci_ut->lu[i].pgcit = malloc(sizeof(pgcit_t));
- if(!pgci_ut->lu[i].pgcit) {
- unsigned int j;
- for(j = 0; j < i; j++) {
-- ifoFree_PGCIT_internal(pgci_ut->lu[j].pgcit);
-- free(pgci_ut->lu[j].pgcit);
-+ ifoFree_PGCIT_internal(&pgci_ut->lu[j].pgcit);
- }
- free(pgci_ut->lu);
- free(pgci_ut);
- ifofile->pgci_ut = 0;
- return 0;
- }
-+ pgci_ut->lu[i].pgcit->ref_count = 1;
- if(!ifoRead_PGCIT_internal(ifofile, pgci_ut->lu[i].pgcit,
- sector * DVD_BLOCK_LEN
- + pgci_ut->lu[i].lang_start_byte)) {
- unsigned int j;
-- for(j = 0; j < i; j++) {
-- ifoFree_PGCIT_internal(pgci_ut->lu[j].pgcit);
-- free(pgci_ut->lu[j].pgcit);
-+ for(j = 0; j <= i; j++) {
-+ ifoFree_PGCIT_internal(&pgci_ut->lu[j].pgcit);
- }
-- free(pgci_ut->lu[i].pgcit);
- free(pgci_ut->lu);
- free(pgci_ut);
- ifofile->pgci_ut = 0;
-@@ -2000,8 +2028,7 @@
-
- if(ifofile->pgci_ut) {
- for(i = 0; i < ifofile->pgci_ut->nr_of_lus; i++) {
-- ifoFree_PGCIT_internal(ifofile->pgci_ut->lu[i].pgcit);
-- free(ifofile->pgci_ut->lu[i].pgcit);
-+ ifoFree_PGCIT_internal(&ifofile->pgci_ut->lu[i].pgcit);
- }
- free(ifofile->pgci_ut->lu);
- free(ifofile->pgci_ut);
---- libdvdread.orig/src/dvdread/ifo_types.h 2009-10-29 09:11:32.161557143 -0700
-+++ libdvdread/src/dvdread/ifo_types.h 2009-11-13 09:13:10.255237710 -0800
-@@ -301,6 +301,7 @@
- pgc_program_map_t *program_map;
- cell_playback_t *cell_playback;
- cell_position_t *cell_position;
-+ int ref_count;
- } ATTRIBUTE_PACKED pgc_t;
- #define PGC_SIZE 236U
-
-@@ -326,6 +327,7 @@
- uint16_t zero_1;
- uint32_t last_byte;
- pgci_srp_t *pgci_srp;
-+ int ref_count;
- } ATTRIBUTE_PACKED pgcit_t;
- #define PGCIT_SIZE 8U
-
diff --git a/contrib/libdvdread/A05-short-ptt-table.patch b/contrib/libdvdread/A05-short-ptt-table.patch
deleted file mode 100644
index edfaec2ab..000000000
--- a/contrib/libdvdread/A05-short-ptt-table.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Index: ifo_read.c
-===================================================================
---- libdvdread.orig/src/ifo_read.c 2009-10-29 09:11:32.066743831 -0700
-+++ libdvdread/src/ifo_read.c 2009-11-13 10:27:49.293174360 -0800
-@@ -1138,6 +1127,14 @@
- return 0;
- }
-
-+ if(vts_ptt_srpt->nr_of_srpts * sizeof(uint32_t) > info_length) {
-+ fprintf(stderr, "libdvdread: PTT search table too small.\n");
-+ free(vts_ptt_srpt);
-+ free(data);
-+ ifofile->vts_ptt_srpt = 0;
-+ return 0;
-+ }
-+
- for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
- B2N_32(data[i]);
- /* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);
diff --git a/contrib/libdvdread/A06-short-ptt-table2.patch b/contrib/libdvdread/A06-short-ptt-table2.patch
deleted file mode 100644
index b9d6aede0..000000000
--- a/contrib/libdvdread/A06-short-ptt-table2.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Index: libdvdread/src/ifo_read.c
-===================================================================
---- libdvdread/src/ifo_read.c (revision 1243)
-+++ libdvdread/src/ifo_read.c (working copy)
-@@ -1190,7 +1190,15 @@
- goto fail;
- }
- for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
-- B2N_32(data[i]);
-+ /* Transformers 3 has PTT start bytes that point outside the SRPT PTT */
-+ uint32_t start = data[i];
-+ B2N_32(start);
-+ if(start + sizeof(ptt_info_t) > vts_ptt_srpt->last_byte + 1) {
-+ /* don't mess with any bytes beyond the end of the allocation */
-+ vts_ptt_srpt->nr_of_srpts = i;
-+ break;
-+ }
-+ data[i] = start;
- /* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);
- Magic Knight Rayearth Daybreak is mastered very strange and has
- Titles with 0 PTTs. They all have a data[i] offsets beyond the end of
diff --git a/contrib/libdvdread/P00-mingw-dlfcn.patch b/contrib/libdvdread/P00-mingw-dlfcn.patch
deleted file mode 100644
index 811c366ab..000000000
--- a/contrib/libdvdread/P00-mingw-dlfcn.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Index: configure.ac
-===================================================================
---- libdvdread/configure.ac (revision 1168)
-+++ libdvdread/configure.ac (working copy)
-@@ -158,6 +158,16 @@
- ;;
- esac
-
-+AC_ARG_ENABLE([local-dlfcn],
-+ [AS_HELP_STRING([--enable-local-dlfcn],
-+ [use local dlfcn for mingw (default is auto)])],
-+ [use_local_dlfcn=$enableval],
-+ [use_local_dlfcn=no])
-+
-+if [[ $use_local_dlfcn = "yes" ]]; then
-+ AC_DEFINE([USING_LOCAL_DLFCN], [1], ["Define to 1 to use local dlfcn"])
-+fi
-+
- dnl ---------------------------------------------
- dnl cflags
- dnl ---------------------------------------------
-Index: src/dvd_input.c
-===================================================================
---- libdvdread/src/dvd_input.c (revision 1168)
-+++ libdvdread/src/dvd_input.c (working copy)
-@@ -50,7 +50,7 @@
- #else
-
- /* dlopening libdvdcss */
--#ifdef HAVE_DLFCN_H
-+#if defined(HAVE_DLFCN_H) && !defined(USING_LOCAL_DLFCN)
- #include <dlfcn.h>
- #else
- /* Only needed on MINGW at the moment */
diff --git a/contrib/libdvdread/P01-mingw-bitfields.patch b/contrib/libdvdread/P01-mingw-bitfields.patch
deleted file mode 100644
index ae852134a..000000000
--- a/contrib/libdvdread/P01-mingw-bitfields.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -Naur libdvdread.orig/configure.ac libdvdread/configure.ac
---- libdvdread.orig/configure.ac 2009-01-08 14:57:10.000000000 -0800
-+++ libdvdread/configure.ac 2013-01-26 10:35:21.366836184 -0800
-@@ -141,6 +141,15 @@
- *mingw32*)
- CFLAGS="-idirafter \$(top_srcdir)/msvc/include $CFLAGS"
- LDFLAGS="-no-undefined $LDFLAGS"
-+ if test "$GCC" = "yes" ; then
-+ gcc_version="`$CC -dumpversion`"
-+ gcc_version_major=$(echo $gcc_version | cut -d"." -f1)
-+ gcc_version_minor=$(echo $gcc_version | cut -d"." -f2)
-+ gcc_version_patch=$(echo $gcc_version | cut -d"." -f3)
-+ if test $gcc_version_major -ge 4 -a $gcc_version_minor -ge 7 ; then
-+ CFLAGS="-mno-ms-bitfields $CFLAGS"
-+ fi
-+ fi
- ;;
- *cygwin*)
- LDFLAGS="-no-undefined $LDFLAGS"
diff --git a/contrib/libdvdread/P05-mingw-large-file.patch b/contrib/libdvdread/P05-mingw-large-file.patch
deleted file mode 100644
index 480d1e955..000000000
--- a/contrib/libdvdread/P05-mingw-large-file.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -Naur libdvdread.orig/src/dvd_input.h libdvdread/src/dvd_input.h
---- libdvdread.orig/src/dvd_input.h 2008-10-03 13:11:30.000000000 -0700
-+++ libdvdread/src/dvd_input.h 2009-04-23 13:47:04.000000000 -0700
-@@ -29,6 +29,24 @@
-
- #define DVDINPUT_READ_DECRYPT (1 << 0)
-
-+#if defined( __MINGW32__ )
-+# undef lseek
-+# define lseek _lseeki64
-+# undef fseeko
-+# define fseeko fseeko64
-+# undef ftello
-+# define ftello ftello64
-+# define flockfile(...)
-+# define funlockfile(...)
-+# define getc_unlocked getc
-+# undef off_t
-+# define off_t off64_t
-+# undef stat
-+# define stat _stati64
-+# define fstat _fstati64
-+# define wstat _wstati64
-+#endif
-+
- typedef struct dvd_input_s *dvd_input_t;
-
- /**
diff --git a/contrib/libdvdread/P06-darwin.patch b/contrib/libdvdread/P06-darwin.patch
deleted file mode 100644
index b6efc2e52..000000000
--- a/contrib/libdvdread/P06-darwin.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-diff -Naur libdvdread.orig/configure.ac libdvdread/configure.ac
---- libdvdread.orig/configure.ac 2009-01-08 17:57:10.000000000 -0500
-+++ libdvdread/configure.ac 2009-04-24 01:50:56.000000000 -0400
-@@ -145,6 +145,9 @@
- *cygwin*)
- LDFLAGS="-no-undefined $LDFLAGS"
- ;;
-+ *darwin*)
-+ CFLAGS="${CFLAGS} -D__DARWIN__"
-+ ;;
- *os2*)
- LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
- ;;
-diff -Naur libdvdread.orig/src/dvd_reader.c libdvdread/src/dvd_reader.c
---- libdvdread.orig/src/dvd_reader.c 2009-03-13 21:28:21.000000000 -0400
-+++ libdvdread/src/dvd_reader.c 2009-04-24 01:35:43.000000000 -0400
-@@ -314,7 +314,7 @@
- char *new_path;
-
- /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */
-- if( !strncmp( path, "/dev/", 5 ) || strncmp( path, "/dev/r", 6 ) )
-+ if( strncmp( path, "/dev/", 5 ) || !strncmp( path, "/dev/r", 6 ) )
- return (char *) strdup( path );
-
- /* Replace "/dev/" with "/dev/r" */
diff --git a/contrib/libdvdread/module.defs b/contrib/libdvdread/module.defs
index acd6717c7..593d2644e 100644
--- a/contrib/libdvdread/module.defs
+++ b/contrib/libdvdread/module.defs
@@ -1,8 +1,11 @@
$(eval $(call import.MODULE.defs,LIBDVDREAD,libdvdread))
$(eval $(call import.CONTRIB.defs,LIBDVDREAD))
-LIBDVDREAD.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libdvdread-svn1168.tar.gz
+LIBDVDREAD.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libdvdread-6005034.tar.bz2
LIBDVDREAD.EXTRACT.tarbase = libdvdread
-LIBDVDREAD.CONFIGURE.extra = --enable-local-dlfcn
LIBDVDREAD.CONFIGURE.bootstrap = rm -fr aclocal.m4 autom4te.cache; autoreconf -fiv;
+
+ifeq (1-mingw,$(BUILD.cross)-$(BUILD.system))
+ LIBDVDREAD.CONFIGURE.extra = --enable-dlfcn
+endif