Mercurial > libdvdnav.hg
changeset 45:7bf97b8922b4 src
Revert back to old read_cache method.
Some new optimizations added to the old read_cache method, thus reducing the amount of calls to read blocks from the DVD device.
author | jcdutton |
---|---|
date | Tue, 25 Jun 2002 13:37:11 +0000 |
parents | c50cb59dbb19 |
children | 654705f4e7af |
files | dvdnav.c read_cache.c |
diffstat | 2 files changed, 27 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/dvdnav.c Sat Jun 15 02:10:18 2002 +0000 +++ b/dvdnav.c Tue Jun 25 13:37:11 2002 +0000 @@ -741,7 +741,8 @@ /* Perform the jump if necessary (this is always a * VOBU boundary). */ - result = DVDReadBlocks(this->file, this->vobu.vobu_start + this->vobu.vobu_next, 1, buf); + //result = DVDReadBlocks(this->file, this->vobu.vobu_start + this->vobu.vobu_next, 1, buf); + result = dvdnav_read_cache_block(this->cache, this->vobu.vobu_start + this->vobu.vobu_next, 1, buf); if(result <= 0) { printerr("Error reading NAV packet."); @@ -761,7 +762,15 @@ * This is so RSM resumes to the VOBU level and not just the CELL level. * This should be implemented with a new Public API call. */ - dvdnav_pre_cache_blocks(this->cache, this->vobu.vobu_start+1, this->vobu.vobu_length); + /* We cache one past the end of the VOBU, + * in the hope it might catch the next NAV packet as well. + * This reduces the amount of read commands sent to the DVD device. + * A cache miss will only happen for 3 reasons. + * 1) Seeking + * 2) Menu change + * 3) The next VOBU does not immeadiately follow the current one. E.g. Multi Angles, ILVU. + */ + dvdnav_pre_cache_blocks(this->cache, this->vobu.vobu_start+1, this->vobu.vobu_length+1); /* Successfully got a NAV packet */ (*event) = DVDNAV_NAV_PACKET; @@ -931,6 +940,10 @@ /* * $Log$ + * Revision 1.22 2002/06/25 13:37:11 jcdutton + * Revert back to old read_cache method. + * Some new optimizations added to the old read_cache method, thus reducing the amount of calls to read blocks from the DVD device. + * * Revision 1.21 2002/06/06 15:03:09 richwareham * Biiiiiiig change to let doxygen generate some docs for the library. Note that I'm in no way sure that the autoconf stuff plays nice. *
--- a/read_cache.c Sat Jun 15 02:10:18 2002 +0000 +++ b/read_cache.c Tue Jun 25 13:37:11 2002 +0000 @@ -30,7 +30,8 @@ #include <pthread.h> /* Read-ahead cache structure. */ -#if _MULTITHREAD_ +#if 0 +/* #if _MULTITHREAD_ */ /* For the multithreaded cache, the cache is a ring buffer + writing * thread that continuously reads data into the buffer until it is @@ -73,16 +74,17 @@ }; #endif -#if _MULTITHREAD_ - -#define _MT_TRACE 0 +#define _MT_TRACE 1 #if _MT_TRACE -#define ddprintf(fmt, args...) fprintf(stderr, __FUNCTION__ ": " fmt, ##args); +#define dprintf(fmt, args...) fprintf(stderr, "%s: " fmt, __FUNCTION__, ##args); #else -#define sdprintf(fmt, args...) /* Nowt */ +#define dprintf(fmt, args...) /* Nowt */ #endif +#if 0 +/* #if _MULTITHREAD_ */ + void * read_cache_read_thread (void * this_gen) { int cont = 1; int32_t diff, start; @@ -387,12 +389,12 @@ return DVD_VIDEO_LB_LEN; } } - } else { - result = DVDReadBlocks( self->dvd_self->file, sector, block_count, buf); - return result; + //} else { + // result = DVDReadBlocks( self->dvd_self->file, sector, block_count, buf); + // return result; } - dprintf("DVD read cache miss! sector=%d, start=%d\n", sector, self->cache_start_sector); + dprintf("DVD read cache miss! sector=%d, start=%d, end=%d\n", sector, self->cache_start_sector, self->cache_block_count + self->cache_start_sector); result = DVDReadBlocks( self->dvd_self->file, sector, block_count, buf); return result; }