diff read_cache.c @ 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 50e0855a2017
children 654705f4e7af
line wrap: on
line diff
--- 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;
 }