From 0bb20d347c56dd8302d8e945b36c7870ebe3d8f7 Mon Sep 17 00:00:00 2001 From: Voyager1 Date: Fri, 10 May 2013 16:24:10 +0200 Subject: Revert "[libdvd] - added missing patches" This reverts commit 217532dfa495abd883d98b068394fe2452362274. --- lib/libdvd/patches/01-libdvdread.diff | 296 --------------------- lib/libdvd/patches/02-libdvdread_dvd_reader.c.diff | 87 ------ lib/libdvd/patches/libdvdread.diff | 296 +++++++++++++++++++++ 3 files changed, 296 insertions(+), 383 deletions(-) delete mode 100644 lib/libdvd/patches/01-libdvdread.diff delete mode 100644 lib/libdvd/patches/02-libdvdread_dvd_reader.c.diff create mode 100644 lib/libdvd/patches/libdvdread.diff diff --git a/lib/libdvd/patches/01-libdvdread.diff b/lib/libdvd/patches/01-libdvdread.diff deleted file mode 100644 index fbf185f0dd..0000000000 --- a/lib/libdvd/patches/01-libdvdread.diff +++ /dev/null @@ -1,296 +0,0 @@ -diff -uwr libdvdread-4.2.0/Makefile xbmc/lib/libdvd/libdvdread/Makefile ---- libdvdread-4.2.0/Makefile 2008-12-31 09:43:04 +0100 -+++ xbmc/lib/libdvd/libdvdread/Makefile 2013-02-07 14:42:34 +0100 -@@ -121,7 +121,7 @@ - # Clean targets - - clean: -- rm -rf *~ $(.OBJDIR)/* version.h -+ rm -rf *~ $(.OBJDIR)/* - - - distclean: clean -diff -uwr libdvdread-4.2.0/src/dvd_input.h xbmc/lib/libdvd/libdvdread/src/dvd_input.h ---- libdvdread-4.2.0/src/dvd_input.h 2010-06-01 19:07:14 +0200 -+++ xbmc/lib/libdvd/libdvdread/src/dvd_input.h 2013-02-07 14:42:34 +0100 -@@ -34,6 +34,13 @@ - #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 -diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_reader.c ---- libdvdread-4.2.0/src/dvd_reader.c 2011-06-15 20:09:16 +0200 -+++ xbmc/lib/libdvd/libdvdread/src/dvd_reader.c 2013-02-07 14:42:34 +0100 -@@ -32,6 +32,11 @@ - #include - #include - #include -+#ifndef WIN32 -+#include -+#endif -+ -+#define WITH_CACHE - - /* misc win32 helpers */ - #ifdef WIN32 -@@ -105,6 +110,10 @@ - uint32_t lb_start; - uint32_t seek_pos; - -+#ifdef WITH_CACHE -+ char cache[DVD_VIDEO_LB_LEN]; -+ uint32_t lb_cache; -+#endif - /* Information required for a directory path drive. */ - size_t title_sizes[ TITLES_MAX ]; - dvd_input_t title_devs[ TITLES_MAX ]; -@@ -617,6 +626,10 @@ - memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) ); - dvd_file->filesize = len / DVD_VIDEO_LB_LEN; - -+#ifdef WITH_CACHE -+ dvd_file->lb_cache = -1; -+#endif -+ - return dvd_file; - } - -@@ -628,6 +641,18 @@ - */ - static int findDirFile( const char *path, const char *file, char *filename ) - { -+#if defined(_XBMC) -+ struct stat fileinfo; -+ -+ // no emulated opendir function in xbmc, so we'll -+ // check if the file exists by stat'ing it ... -+ sprintf(filename, "%s%s%s", path, -+ ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ), -+ file ); -+ -+ if (stat(filename, &fileinfo) == 0) return 0; -+ -+#else - DIR *dir; - struct dirent *ent; - -@@ -644,6 +669,7 @@ - } - } - closedir(dir); -+#endif // _XBMC - return -1; - } - -@@ -722,6 +748,9 @@ - dvd_file->title_devs[ 0 ] = dev; - dvd_file->filesize = dvd_file->title_sizes[ 0 ]; - -+#ifdef WITH_CACHE -+ dvd_file->lb_cache = -1; -+#endif - return dvd_file; - } - -@@ -749,6 +778,9 @@ - memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) ); - dvd_file->filesize = len / DVD_VIDEO_LB_LEN; - -+#ifdef WITH_CACHE -+ dvd_file->lb_cache = -1; -+#endif - /* Calculate the complete file size for every file in the VOBS */ - if( !menu ) { - int cur; -@@ -792,6 +824,10 @@ - memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) ); - dvd_file->filesize = 0; - -+#ifdef WITH_CACHE -+ dvd_file->lb_cache = -1; -+#endif -+ - if( menu ) { - dvd_input_t dev; - -@@ -1203,6 +1239,100 @@ - return ret + ret2; - } - -+#ifdef WITH_CACHE -+ -+/* returns true aslong as the sector isn't all zeros */ -+int DVDCheckSector(unsigned char *data, int offset) -+{ -+ int i = 0; -+ int32_t *p = (int32_t*)data + (DVD_VIDEO_LB_LEN>>2)*offset; -+ for(;i<(DVD_VIDEO_LB_LEN<<2);i++) { -+ if(*(p+i) != 0) -+ break; -+ } -+ return (i!=(DVD_VIDEO_LB_LEN>>2)); -+} -+ -+int DVDReadBlocksCached( dvd_file_t *dvd_file, int offset, -+ size_t block_count, unsigned char *data, int encrypted ) -+{ -+ int ret=0; -+ /* Check arguments. */ -+ if( dvd_file == NULL || offset < 0 || data == NULL ) -+ return -1; -+ -+ if(encrypted & DVDINPUT_READ_DECRYPT) { -+ /* Hack, and it will still fail for multiple opens in a threaded app ! */ -+ if( dvd_file->dvd->css_title != dvd_file->css_title ) { -+ dvd_file->dvd->css_title = dvd_file->css_title; -+ if( dvd_file->dvd->isImageFile ) { -+ dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start ); -+ } -+ /* Here each vobu has it's own dvdcss handle, so no need to update -+ else { -+ dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start ); -+ }*/ -+ } -+ } -+ -+ /* check if first sector is in cache */ -+ int cachehit = 0; -+ if( offset == dvd_file->lb_cache ) { -+ memcpy( data, dvd_file->cache, DVD_VIDEO_LB_LEN ); -+ block_count--; -+ offset++; -+ data+=DVD_VIDEO_LB_LEN; -+ cachehit = 1; -+ } -+ -+ -+ if( block_count > 0 ) -+ { -+ if( dvd_file->dvd->isImageFile ) -+ ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset, -+ block_count, data, encrypted ); -+ else -+ ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset, -+ block_count, data, encrypted ); -+ -+ if(ret<0) -+ return ret; -+ -+ /* here is a hack for drive wich don't handle layerchange properly */ -+ /* they start returning zero data while laser is shifting position */ -+ /* normally just doing a reread will get the correct data */ -+ if( dvd_file->dvd->isImageFile ) -+ { -+ /* check sectors from the back */ -+ int count = ret; /* previous call could have returned fewer than requested */ -+ int i = count-1; -+ for(;i>=0;i--) -+ if(!DVDCheckSector(data, i)) break; -+ -+ if(i>=0) { -+ fprintf( stderr, "libdvdread: potential layer change. %d zero sectors detected starting at %d!\n", i+1, offset); -+ -+ /* reread the invalid sectors */ -+ count = DVDReadBlocksUDF( dvd_file, (uint32_t)offset+i, -+ count-i, data+DVD_VIDEO_LB_LEN*i, encrypted ); -+ -+ if(count<0) -+ return count; -+ } -+ } -+ -+ } -+ -+ if(ret>0) -+ { /* store last sector read into cache */ -+ dvd_file->lb_cache = offset+ret-1; -+ memcpy( dvd_file->cache, data+(DVD_VIDEO_LB_LEN*(ret-1)), DVD_VIDEO_LB_LEN ); -+ } -+ -+ return (ssize_t)(ret+cachehit); -+} -+#endif -+ - /* This is broken reading more than 2Gb at a time is ssize_t is 32-bit. */ - ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset, - size_t block_count, unsigned char *data ) -@@ -1213,6 +1343,10 @@ - if( dvd_file == NULL || offset < 0 || data == NULL ) - return -1; - -+#ifdef WITH_CACHE -+ return (ssize_t)DVDReadBlocksCached( dvd_file, offset, block_count, data, DVDINPUT_READ_DECRYPT ); -+#endif -+ - /* Hack, and it will still fail for multiple opens in a threaded app ! */ - if( dvd_file->dvd->css_title != dvd_file->css_title ) { - dvd_file->dvd->css_title = dvd_file->css_title; -@@ -1295,6 +1429,10 @@ - return 0; - } - -+#ifdef WITH_CACHE -+ ret = DVDReadBlocksCached( dvd_file, (uint32_t) seek_sector, -+ (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); -+#else - if( dvd_file->dvd->isImageFile ) { - ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector, - (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); -@@ -1302,6 +1440,7 @@ - ret = DVDReadBlocksPath( dvd_file, seek_sector, - (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); - } -+#endif - - if( ret != (int) numsec ) { - free( secbuf_base ); -Only in xbmc/lib/libdvd/libdvdread: version.h -diff -uwr libdvdread-4.2.0/version.sh xbmc/lib/libdvd/libdvdread/version.sh ---- libdvdread-4.2.0/version.sh 2008-05-01 11:27:16 +0200 -+++ xbmc/lib/libdvd/libdvdread/version.sh 2013-02-07 14:42:34 +0100 -@@ -1,18 +1,18 @@ --#!/bin/sh -- --svn_revision=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2` --test $svn_revision || svn_revision=`cd "$1" && grep revision .svn/entries 2>/dev/null | \ -- cut -d '"' -f2 2> /dev/null` --test $svn_revision || svn_revision=UNKNOWN -- --if test "$svn_revision" = UNKNOWN && test -n "$2"; then -- NEW_REVISION="#define VERSION \"$2\"" --else -- NEW_REVISION="#define VERSION \"SVN-r$svn_revision\"" --fi --OLD_REVISION=`cat version.h 2> /dev/null` -- --# Update version.h only on revision changes to avoid spurious rebuilds --if test "$NEW_REVISION" != "$OLD_REVISION"; then -- echo "$NEW_REVISION" > version.h --fi -+##!/bin/sh -+# -+#svn_revision=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2` -+#test $svn_revision || svn_revision=`cd "$1" && grep revision .svn/entries 2>/dev/null | \ -+# cut -d '"' -f2 2> /dev/null` -+#test $svn_revision || svn_revision=UNKNOWN -+# -+#if test "$svn_revision" = UNKNOWN && test -n "$2"; then -+# NEW_REVISION="#define VERSION \"$2\"" -+#else -+# NEW_REVISION="#define VERSION \"SVN-r$svn_revision\"" -+#fi -+#OLD_REVISION=`cat version.h 2> /dev/null` -+# -+## Update version.h only on revision changes to avoid spurious rebuilds -+#if test "$NEW_REVISION" != "$OLD_REVISION"; then -+# echo "$NEW_REVISION" > version.h -+#fi diff --git a/lib/libdvd/patches/02-libdvdread_dvd_reader.c.diff b/lib/libdvd/patches/02-libdvdread_dvd_reader.c.diff deleted file mode 100644 index a49c0e741f..0000000000 --- a/lib/libdvd/patches/02-libdvdread_dvd_reader.c.diff +++ /dev/null @@ -1,87 +0,0 @@ -From 3708d886958258fcf18fe827eb8ab32ecda45943 Mon Sep 17 00:00:00 2001 -From: Voyager1 -Date: Wed, 20 Feb 2013 19:47:34 +0100 -Subject: [PATCH 1/3] Fix inability of libdvd 4.2.0 to read DVDs stored as - VIDEO_TS files on non-Windows OSs. Fixes - http://trac.xbmc.org/ticket/14115. - ---- - lib/libdvd/libdvdread/src/dvd_reader.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/lib/libdvd/libdvdread/src/dvd_reader.c b/lib/libdvd/libdvdread/src/dvd_reader.c -index d9544b3..2b3562f 100644 ---- a/lib/libdvd/libdvdread/src/dvd_reader.c -+++ b/lib/libdvd/libdvdread/src/dvd_reader.c -@@ -445,7 +445,11 @@ dvd_reader_t *DVDOpen( const char *ppath ) - close( cdir ); - cdir = -1; - if( retval == -1 ) { -+#if defined(_XBMC) -+ perror("libdvdread: failed to reset working directory to \".\""); /* but ignore error */ -+#else - goto DVDOpen_error; -+#endif // _XBMC - } - path_copy = new_path; - new_path = NULL; --- -1.7.9.4 - -From cffa18401f642b35a91de7e5b1e184f1dc0bef6d Mon Sep 17 00:00:00 2001 -From: Voyager1 -Date: Thu, 21 Feb 2013 20:07:03 +0100 -Subject: [PATCH 2/3] libdvdread: replace perror by fprintf so that it gets - picked up in xbmc logs - ---- - lib/libdvd/libdvdread/src/dvd_reader.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/libdvd/libdvdread/src/dvd_reader.c b/lib/libdvd/libdvdread/src/dvd_reader.c -index 2b3562f..38a3812 100644 ---- a/lib/libdvd/libdvdread/src/dvd_reader.c -+++ b/lib/libdvd/libdvdread/src/dvd_reader.c -@@ -446,7 +446,7 @@ dvd_reader_t *DVDOpen( const char *ppath ) - cdir = -1; - if( retval == -1 ) { - #if defined(_XBMC) -- perror("libdvdread: failed to reset working directory to \".\""); /* but ignore error */ -+ fprintf( stderr, "libdvdread: failed to reset working directory to \".\": %s\n", strerror(errno)); /* but ignore error */ - #else - goto DVDOpen_error; - #endif // _XBMC --- -1.7.9.4 - -From cb345a7e3cde07506bf3a2d696fcbb3dff44477d Mon Sep 17 00:00:00 2001 -From: Memphiz -Date: Sat, 20 Apr 2013 01:04:53 +0200 -Subject: [PATCH 3/3] [dvdread] - don't check the return value of chdir in - xbmc - this function is not wrapped and might fail (and - so will the whole dvd open in that case). This is non - fatal for our vfs! - ---- - lib/libdvd/libdvdread/src/dvd_reader.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/lib/libdvd/libdvdread/src/dvd_reader.c b/lib/libdvd/libdvdread/src/dvd_reader.c -index 38a3812..d7ff12e 100644 ---- a/lib/libdvd/libdvdread/src/dvd_reader.c -+++ b/lib/libdvd/libdvdread/src/dvd_reader.c -@@ -432,7 +432,11 @@ dvd_reader_t *DVDOpen( const char *ppath ) - { - if( ( cdir = open( ".", O_RDONLY ) ) >= 0 ) { - if( chdir( path_copy ) == -1 ) { -+#if defined(_XBMC) -+ fprintf( stderr, "libdvdread: failed to change working directory to \"%s\": %s\n", path_copy, strerror(errno)); /* but ignore error */ -+#else - goto DVDOpen_error; -+#endif // _XBMC - } - new_path = malloc(PATH_MAX+1); - if(!new_path) { --- -1.7.9.4 - diff --git a/lib/libdvd/patches/libdvdread.diff b/lib/libdvd/patches/libdvdread.diff new file mode 100644 index 0000000000..fbf185f0dd --- /dev/null +++ b/lib/libdvd/patches/libdvdread.diff @@ -0,0 +1,296 @@ +diff -uwr libdvdread-4.2.0/Makefile xbmc/lib/libdvd/libdvdread/Makefile +--- libdvdread-4.2.0/Makefile 2008-12-31 09:43:04 +0100 ++++ xbmc/lib/libdvd/libdvdread/Makefile 2013-02-07 14:42:34 +0100 +@@ -121,7 +121,7 @@ + # Clean targets + + clean: +- rm -rf *~ $(.OBJDIR)/* version.h ++ rm -rf *~ $(.OBJDIR)/* + + + distclean: clean +diff -uwr libdvdread-4.2.0/src/dvd_input.h xbmc/lib/libdvd/libdvdread/src/dvd_input.h +--- libdvdread-4.2.0/src/dvd_input.h 2010-06-01 19:07:14 +0200 ++++ xbmc/lib/libdvd/libdvdread/src/dvd_input.h 2013-02-07 14:42:34 +0100 +@@ -34,6 +34,13 @@ + #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 +diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_reader.c +--- libdvdread-4.2.0/src/dvd_reader.c 2011-06-15 20:09:16 +0200 ++++ xbmc/lib/libdvd/libdvdread/src/dvd_reader.c 2013-02-07 14:42:34 +0100 +@@ -32,6 +32,11 @@ + #include + #include + #include ++#ifndef WIN32 ++#include ++#endif ++ ++#define WITH_CACHE + + /* misc win32 helpers */ + #ifdef WIN32 +@@ -105,6 +110,10 @@ + uint32_t lb_start; + uint32_t seek_pos; + ++#ifdef WITH_CACHE ++ char cache[DVD_VIDEO_LB_LEN]; ++ uint32_t lb_cache; ++#endif + /* Information required for a directory path drive. */ + size_t title_sizes[ TITLES_MAX ]; + dvd_input_t title_devs[ TITLES_MAX ]; +@@ -617,6 +626,10 @@ + memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) ); + dvd_file->filesize = len / DVD_VIDEO_LB_LEN; + ++#ifdef WITH_CACHE ++ dvd_file->lb_cache = -1; ++#endif ++ + return dvd_file; + } + +@@ -628,6 +641,18 @@ + */ + static int findDirFile( const char *path, const char *file, char *filename ) + { ++#if defined(_XBMC) ++ struct stat fileinfo; ++ ++ // no emulated opendir function in xbmc, so we'll ++ // check if the file exists by stat'ing it ... ++ sprintf(filename, "%s%s%s", path, ++ ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ), ++ file ); ++ ++ if (stat(filename, &fileinfo) == 0) return 0; ++ ++#else + DIR *dir; + struct dirent *ent; + +@@ -644,6 +669,7 @@ + } + } + closedir(dir); ++#endif // _XBMC + return -1; + } + +@@ -722,6 +748,9 @@ + dvd_file->title_devs[ 0 ] = dev; + dvd_file->filesize = dvd_file->title_sizes[ 0 ]; + ++#ifdef WITH_CACHE ++ dvd_file->lb_cache = -1; ++#endif + return dvd_file; + } + +@@ -749,6 +778,9 @@ + memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) ); + dvd_file->filesize = len / DVD_VIDEO_LB_LEN; + ++#ifdef WITH_CACHE ++ dvd_file->lb_cache = -1; ++#endif + /* Calculate the complete file size for every file in the VOBS */ + if( !menu ) { + int cur; +@@ -792,6 +824,10 @@ + memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) ); + dvd_file->filesize = 0; + ++#ifdef WITH_CACHE ++ dvd_file->lb_cache = -1; ++#endif ++ + if( menu ) { + dvd_input_t dev; + +@@ -1203,6 +1239,100 @@ + return ret + ret2; + } + ++#ifdef WITH_CACHE ++ ++/* returns true aslong as the sector isn't all zeros */ ++int DVDCheckSector(unsigned char *data, int offset) ++{ ++ int i = 0; ++ int32_t *p = (int32_t*)data + (DVD_VIDEO_LB_LEN>>2)*offset; ++ for(;i<(DVD_VIDEO_LB_LEN<<2);i++) { ++ if(*(p+i) != 0) ++ break; ++ } ++ return (i!=(DVD_VIDEO_LB_LEN>>2)); ++} ++ ++int DVDReadBlocksCached( dvd_file_t *dvd_file, int offset, ++ size_t block_count, unsigned char *data, int encrypted ) ++{ ++ int ret=0; ++ /* Check arguments. */ ++ if( dvd_file == NULL || offset < 0 || data == NULL ) ++ return -1; ++ ++ if(encrypted & DVDINPUT_READ_DECRYPT) { ++ /* Hack, and it will still fail for multiple opens in a threaded app ! */ ++ if( dvd_file->dvd->css_title != dvd_file->css_title ) { ++ dvd_file->dvd->css_title = dvd_file->css_title; ++ if( dvd_file->dvd->isImageFile ) { ++ dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start ); ++ } ++ /* Here each vobu has it's own dvdcss handle, so no need to update ++ else { ++ dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start ); ++ }*/ ++ } ++ } ++ ++ /* check if first sector is in cache */ ++ int cachehit = 0; ++ if( offset == dvd_file->lb_cache ) { ++ memcpy( data, dvd_file->cache, DVD_VIDEO_LB_LEN ); ++ block_count--; ++ offset++; ++ data+=DVD_VIDEO_LB_LEN; ++ cachehit = 1; ++ } ++ ++ ++ if( block_count > 0 ) ++ { ++ if( dvd_file->dvd->isImageFile ) ++ ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset, ++ block_count, data, encrypted ); ++ else ++ ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset, ++ block_count, data, encrypted ); ++ ++ if(ret<0) ++ return ret; ++ ++ /* here is a hack for drive wich don't handle layerchange properly */ ++ /* they start returning zero data while laser is shifting position */ ++ /* normally just doing a reread will get the correct data */ ++ if( dvd_file->dvd->isImageFile ) ++ { ++ /* check sectors from the back */ ++ int count = ret; /* previous call could have returned fewer than requested */ ++ int i = count-1; ++ for(;i>=0;i--) ++ if(!DVDCheckSector(data, i)) break; ++ ++ if(i>=0) { ++ fprintf( stderr, "libdvdread: potential layer change. %d zero sectors detected starting at %d!\n", i+1, offset); ++ ++ /* reread the invalid sectors */ ++ count = DVDReadBlocksUDF( dvd_file, (uint32_t)offset+i, ++ count-i, data+DVD_VIDEO_LB_LEN*i, encrypted ); ++ ++ if(count<0) ++ return count; ++ } ++ } ++ ++ } ++ ++ if(ret>0) ++ { /* store last sector read into cache */ ++ dvd_file->lb_cache = offset+ret-1; ++ memcpy( dvd_file->cache, data+(DVD_VIDEO_LB_LEN*(ret-1)), DVD_VIDEO_LB_LEN ); ++ } ++ ++ return (ssize_t)(ret+cachehit); ++} ++#endif ++ + /* This is broken reading more than 2Gb at a time is ssize_t is 32-bit. */ + ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset, + size_t block_count, unsigned char *data ) +@@ -1213,6 +1343,10 @@ + if( dvd_file == NULL || offset < 0 || data == NULL ) + return -1; + ++#ifdef WITH_CACHE ++ return (ssize_t)DVDReadBlocksCached( dvd_file, offset, block_count, data, DVDINPUT_READ_DECRYPT ); ++#endif ++ + /* Hack, and it will still fail for multiple opens in a threaded app ! */ + if( dvd_file->dvd->css_title != dvd_file->css_title ) { + dvd_file->dvd->css_title = dvd_file->css_title; +@@ -1295,6 +1429,10 @@ + return 0; + } + ++#ifdef WITH_CACHE ++ ret = DVDReadBlocksCached( dvd_file, (uint32_t) seek_sector, ++ (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); ++#else + if( dvd_file->dvd->isImageFile ) { + ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector, + (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); +@@ -1302,6 +1440,7 @@ + ret = DVDReadBlocksPath( dvd_file, seek_sector, + (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); + } ++#endif + + if( ret != (int) numsec ) { + free( secbuf_base ); +Only in xbmc/lib/libdvd/libdvdread: version.h +diff -uwr libdvdread-4.2.0/version.sh xbmc/lib/libdvd/libdvdread/version.sh +--- libdvdread-4.2.0/version.sh 2008-05-01 11:27:16 +0200 ++++ xbmc/lib/libdvd/libdvdread/version.sh 2013-02-07 14:42:34 +0100 +@@ -1,18 +1,18 @@ +-#!/bin/sh +- +-svn_revision=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2` +-test $svn_revision || svn_revision=`cd "$1" && grep revision .svn/entries 2>/dev/null | \ +- cut -d '"' -f2 2> /dev/null` +-test $svn_revision || svn_revision=UNKNOWN +- +-if test "$svn_revision" = UNKNOWN && test -n "$2"; then +- NEW_REVISION="#define VERSION \"$2\"" +-else +- NEW_REVISION="#define VERSION \"SVN-r$svn_revision\"" +-fi +-OLD_REVISION=`cat version.h 2> /dev/null` +- +-# Update version.h only on revision changes to avoid spurious rebuilds +-if test "$NEW_REVISION" != "$OLD_REVISION"; then +- echo "$NEW_REVISION" > version.h +-fi ++##!/bin/sh ++# ++#svn_revision=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2` ++#test $svn_revision || svn_revision=`cd "$1" && grep revision .svn/entries 2>/dev/null | \ ++# cut -d '"' -f2 2> /dev/null` ++#test $svn_revision || svn_revision=UNKNOWN ++# ++#if test "$svn_revision" = UNKNOWN && test -n "$2"; then ++# NEW_REVISION="#define VERSION \"$2\"" ++#else ++# NEW_REVISION="#define VERSION \"SVN-r$svn_revision\"" ++#fi ++#OLD_REVISION=`cat version.h 2> /dev/null` ++# ++## Update version.h only on revision changes to avoid spurious rebuilds ++#if test "$NEW_REVISION" != "$OLD_REVISION"; then ++# echo "$NEW_REVISION" > version.h ++#fi -- cgit v1.2.3