All pastes #1060834 Raw Edit

libdvdread patch

public diff v1 · immutable
#1060834 ·published 2008-07-02 21:53 UTC
rendered paste body
Index: contrib/Jamfile===================================================================--- contrib/Jamfile	(revision 1553)+++ contrib/Jamfile	(working copy)@@ -178,11 +178,12 @@     Depends $(<) : $(>) ;     Depends lib  : $(<) ;     +    DVDREAD_PATCH = "$(PATCH) -p0 < ../patch-libdvdread-udf.patch && " ;+         if $(OS) = MACOSX     {-        DVDREAD_PATCH = "$(PATCH) -p0 < ../patch-libdvdread-css-vlc-dylib.patch &&" ;-    }-    +        DVDREAD_PATCH += "$(PATCH) -p0 < ../patch-libdvdread-css-vlc-dylib.patch &&" ;+    }     } if $(CSS) = 1 # Include CSS support in libdvdread if requested {@@ -190,7 +191,7 @@     {         cd `dirname $(>)` && CONTRIB=`pwd` &&         rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) && -        cd libdvdread &&+        cd libdvdread && $(DVDREAD_PATCH)         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --with-libdvdcss=$CONTRIB &&         $(MAKE) && $(MAKE) install &&         $(STRIP) $CONTRIB/lib/libdvdread.aIndex: contrib/patch-libdvdread-udf.patch===================================================================--- contrib/patch-libdvdread-udf.patch	(revision 0)+++ contrib/patch-libdvdread-udf.patch	(revision 0)@@ -0,0 +1,76 @@+diff -Naurp libdvdread-0.9.7.orig/dvdread/dvd_reader.c dvdread/dvd_reader.c+--- libdvdread-0.9.7.orig/dvdread/dvd_reader.c	2006-10-06 07:58:03.000000000 +0000++++ dvdread/dvd_reader.c	2008-02-22 19:42:47.000000000 +0000+@@ -1393,6 +1393,28 @@ int DVDFileSeek( dvd_file_t *dvd_file, i+   return offset;+ }+ ++int DVDFileSeekForce( dvd_file_t *dvd_file, int offset, int force_size )++{++  /* Check arguments. */++  if( dvd_file == NULL || offset < 0 )++    return -1;++++  if( dvd_file->dvd->isImageFile ) {++    if( force_size < 0 )++      force_size = (offset - 1) / DVD_VIDEO_LB_LEN + 1;++    if( dvd_file->filesize < force_size ) {++      dvd_file->filesize = force_size;++      fprintf(stderr, "libdvdread: Ignored UDF provided size of file.\n");++    }++  }++++  if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN ) {++    return -1;++  }++  dvd_file->seek_pos = (uint32_t) offset;++  return offset;++}+++ #ifndef HAVE_UINTPTR_T+ #warning "Assuming that (unsigned long) can hold (void *)"+ typedef unsigned long uintptr_t;+@@ -1444,7 +1466,7 @@ ssize_t DVDReadBytes( dvd_file_t *dvd_fi+   memcpy( data, &(secbuf[ seek_byte ]), byte_size );+   free( secbuf_start );+ +-  dvd_file->seek_pos += byte_size;++  DVDFileSeekForce(dvd_file, dvd_file->seek_pos + byte_size, -1);+   return byte_size;+ }+ +diff -Naurp libdvdread-0.9.7.orig/dvdread/dvd_reader.h dvdread/dvd_reader.h+--- libdvdread-0.9.7.orig/dvdread/dvd_reader.h	2006-10-06 08:12:31.000000000 +0000++++ dvdread/dvd_reader.h	2008-02-22 19:42:28.000000000 +0000+@@ -240,6 +240,8 @@ ssize_t DVDReadBlocks( dvd_file_t *, int+  */+ int DVDFileSeek( dvd_file_t *, int );+ ++int DVDFileSeekForce( dvd_file_t *, int, int );+++ /**+  * Reads the given number of bytes from the file.  This call can only be used+  * on the information files, and may not be used for reading from a VOB.  This+diff -Naurp libdvdread-0.9.7.orig/dvdread/ifo_read.c dvdread/ifo_read.c+--- libdvdread-0.9.7.orig/dvdread/ifo_read.c	2006-01-22 12:19:19.000000000 +0000++++ dvdread/ifo_read.c	2008-02-22 19:42:28.000000000 +0000+@@ -106,6 +106,10 @@ static inline int DVDFileSeek_( dvd_file+   return (DVDFileSeek(dvd_file, (int)offset) == (int)offset);+ }+ ++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);++}+++ + ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {+   ifo_handle_t *ifofile;+@@ -1659,7 +1663,7 @@ static int ifoRead_VOBU_ADMAP_internal(i+   unsigned int i;+   int info_length;+ +-  if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN))++  if(!DVDFileSeekForce_(ifofile->file, sector * DVD_BLOCK_LEN, sector))+     return 0;+ +   if(!(DVDReadBytes(ifofile->file, vobu_admap, VOBU_ADMAP_SIZE)))