summaryrefslogtreecommitdiffstats
path: root/contrib/libdvdread
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libdvdread')
-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
12 files changed, 5 insertions, 634 deletions
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