diff options
Diffstat (limited to 'src/input/libdvdnav')
-rw-r--r-- | src/input/libdvdnav/bswap.h | 2 | ||||
-rw-r--r-- | src/input/libdvdnav/diff_against_cvs.patch | 2 | ||||
-rw-r--r-- | src/input/libdvdnav/dvd_reader.c | 24 | ||||
-rw-r--r-- | src/input/libdvdnav/dvd_reader.h | 4 | ||||
-rw-r--r-- | src/input/libdvdnav/ifo_read.c | 6 | ||||
-rw-r--r-- | src/input/libdvdnav/md5.c | 2 | ||||
-rw-r--r-- | src/input/libdvdnav/remap.c | 1 |
7 files changed, 35 insertions, 6 deletions
diff --git a/src/input/libdvdnav/bswap.h b/src/input/libdvdnav/bswap.h index 2a2d222fe..23f0251d6 100644 --- a/src/input/libdvdnav/bswap.h +++ b/src/input/libdvdnav/bswap.h @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <config.h> +#include "config.h" #if defined(WORDS_BIGENDIAN) /* All bigendian systems are fine, just ignore the swaps. */ diff --git a/src/input/libdvdnav/diff_against_cvs.patch b/src/input/libdvdnav/diff_against_cvs.patch index 202474fef..6df704e2a 100644 --- a/src/input/libdvdnav/diff_against_cvs.patch +++ b/src/input/libdvdnav/diff_against_cvs.patch @@ -323,7 +323,7 @@ diff -u -p -u -r1.5 dvd_reader.h -#ifdef _MSC_VER +#ifdef HAVE_CONFIG_H - #include <config.h> + #include "config.h" +#endif +#ifdef _MSC_VER diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c index 200a1dbec..eff1977fc 100644 --- a/src/input/libdvdnav/dvd_reader.c +++ b/src/input/libdvdnav/dvd_reader.c @@ -1037,6 +1037,28 @@ int32_t DVDFileSeek( dvd_file_t *dvd_file, int32_t offset ) return offset; } +int32_t 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; +} + ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size ) { unsigned char *secbuf_base, *secbuf; @@ -1077,7 +1099,7 @@ ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size ) memcpy( data, &(secbuf[ seek_byte ]), byte_size ); free( secbuf_base ); - dvd_file->seek_pos += byte_size; + DVDFileSeekForce(dvd_file, dvd_file->seek_pos + byte_size, -1); return byte_size; } diff --git a/src/input/libdvdnav/dvd_reader.h b/src/input/libdvdnav/dvd_reader.h index bb3f5053b..c7b3f9df8 100644 --- a/src/input/libdvdnav/dvd_reader.h +++ b/src/input/libdvdnav/dvd_reader.h @@ -22,7 +22,7 @@ */ #ifdef HAVE_CONFIG_H -#include <config.h> +#include "config.h" #endif #ifdef _MSC_VER @@ -171,6 +171,8 @@ ssize_t DVDReadBlocks( dvd_file_t *, int, size_t, unsigned char * ); */ int32_t DVDFileSeek( dvd_file_t *, int32_t ); +int32_t 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 --git a/src/input/libdvdnav/ifo_read.c b/src/input/libdvdnav/ifo_read.c index 8f47d2a54..bc1ba580b 100644 --- a/src/input/libdvdnav/ifo_read.c +++ b/src/input/libdvdnav/ifo_read.c @@ -93,6 +93,10 @@ static inline int DVDFileSeek_( dvd_file_t *dvd_file, uint32_t offset ) { return (DVDFileSeek(dvd_file, (int)offset) == (int)offset); } +static inline int32_t 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; @@ -1507,7 +1511,7 @@ static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile, 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))) diff --git a/src/input/libdvdnav/md5.c b/src/input/libdvdnav/md5.c index 2bfdddee4..16b7b0690 100644 --- a/src/input/libdvdnav/md5.c +++ b/src/input/libdvdnav/md5.c @@ -21,7 +21,7 @@ /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <sys/types.h> diff --git a/src/input/libdvdnav/remap.c b/src/input/libdvdnav/remap.c index 43c81c66f..df0be29ce 100644 --- a/src/input/libdvdnav/remap.c +++ b/src/input/libdvdnav/remap.c @@ -216,6 +216,7 @@ remap_t* remap_loadmap( char *title) { remap_add_node( map, tmp); } } + close (fp); /* ignoring errors... */ if (map->nblocks == 0 && map->debug == 0) return NULL; return map; |