changeset 7406:1394aebaa838

removed obsolete VCD_CACHE hack
author arpi
date Sun, 15 Sep 2002 18:48:16 +0000
parents c1d517db8d95
children 8780415baa87
files libmpdemux/open.c libmpdemux/stream.c libmpdemux/stream.h libmpdemux/vcd_read.h libmpdemux/vcd_read_fbsd.h libmpdemux/vcd_read_nbsd.h
diffstat 6 files changed, 0 insertions(+), 173 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/open.c	Sun Sep 15 15:50:28 2002 +0000
+++ b/libmpdemux/open.c	Sun Sep 15 18:48:16 2002 +0000
@@ -83,9 +83,6 @@
 stream_t* stream=NULL;
 int f=-1;
 off_t len;
-#ifdef VCD_CACHE
-int vcd_cache_size=128;
-#endif
 #ifdef __FreeBSD__
 int bsize = VCD_SECTOR_SIZE;
 #endif
@@ -111,9 +108,6 @@
   if(ret<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n");return NULL;}
 //  seek_to_byte+=ret;
   mp_msg(MSGT_OPEN,MSGL_V,"VCD start byte position: 0x%X  end: 0x%X\n",ret,ret2);
-#ifdef VCD_CACHE
-  vcd_cache_init(vcd_cache_size);
-#endif
 #ifdef __FreeBSD__
   if (ioctl (f, CDRIOCSETBLOCKSIZE, &bsize) == -1) {
         perror ( "Error in CDRIOCSETBLOCKSIZE");
--- a/libmpdemux/stream.c	Sun Sep 15 15:50:28 2002 +0000
+++ b/libmpdemux/stream.c	Sun Sep 15 18:48:16 2002 +0000
@@ -69,12 +69,8 @@
 #endif
 #ifdef HAVE_VCD
   case STREAMTYPE_VCD:
-#ifdef VCD_CACHE
-    len=vcd_cache_read(s->fd,s->buffer);break;
-#else
     len=vcd_read(s->fd,s->buffer);break;
 #endif
-#endif
 #ifdef USE_DVDNAV
   case STREAMTYPE_DVDNAV: {
     dvdnav_stream_read((dvdnav_priv_t*)s->priv,s->buffer,&len);
@@ -92,13 +88,6 @@
     break;
   }
 #endif
-#ifdef USE_TV
-  case STREAMTYPE_TV:
-  {
-    len = 0;
-    break;
-  }
-#endif
   case STREAMTYPE_DS:
     len = demux_read_data((demux_stream_t*)s->priv,s->buffer,STREAM_BUFFER_SIZE);
     break;
@@ -154,11 +143,7 @@
 #ifdef HAVE_VCD
   case STREAMTYPE_VCD:
     s->pos=newpos; // real seek
-#ifdef VCD_CACHE
-    vcd_cache_seek(s->pos/VCD_SECTOR_DATA);
-#else
     vcd_set_msf(s->pos/VCD_SECTOR_DATA);
-#endif
     break;
 #endif
 #ifdef HAVE_CDDA
--- a/libmpdemux/stream.h	Sun Sep 15 15:50:28 2002 +0000
+++ b/libmpdemux/stream.h	Sun Sep 15 18:48:16 2002 +0000
@@ -30,10 +30,6 @@
 int vcd_seek_to_track(int fd,int track);
 void vcd_read_toc(int fd);
 
-#ifdef VCD_CACHE
-void vcd_cache_init(int s);
-#endif
-
 typedef struct {
   int fd;
   int type; // 0=file 1=VCD
--- a/libmpdemux/vcd_read.h	Sun Sep 15 15:50:28 2002 +0000
+++ b/libmpdemux/vcd_read.h	Sun Sep 15 18:48:16 2002 +0000
@@ -199,61 +199,6 @@
 }
 #endif	/*sun*/
 
-
-//================== VCD CACHE =======================
-#ifdef VCD_CACHE
-
-static int vcd_cache_size=0;
-static char *vcd_cache_data=NULL;
-static int *vcd_cache_sectors=NULL;
-static int vcd_cache_index=0; // index to first free (or oldest) cache sector
-static int vcd_cache_current=-1;
-
-void vcd_cache_init(int s){
-  vcd_cache_size=s;
-  vcd_cache_sectors=malloc(s*sizeof(int));
-  vcd_cache_data=malloc(s*VCD_SECTOR_SIZE);
-  memset(vcd_cache_sectors,255,s*sizeof(int));
-}
-
-static inline void vcd_cache_seek(int sect){
-  vcd_cache_current=sect;
-}
-
-int vcd_cache_read(int fd,char* mem){
-  int i;
-  char* vcd_buf;
-
-  for(i=0;i<vcd_cache_size;i++)
-    if(vcd_cache_sectors[i]==vcd_cache_current){
-      // found in the cache! :)
-      vcd_buf=&vcd_cache_data[i*VCD_SECTOR_SIZE];
-      ++vcd_cache_current;
-      memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA);
-      return VCD_SECTOR_DATA;
-    }
-  // NEW cache entry:
-  vcd_buf=&vcd_cache_data[vcd_cache_index*VCD_SECTOR_SIZE];
-  vcd_cache_sectors[vcd_cache_index]=vcd_cache_current;
-  ++vcd_cache_index;if(vcd_cache_index>=vcd_cache_size)vcd_cache_index=0;
-  // read data!
-  vcd_set_msf(vcd_cache_current);
-#if	defined(linux) || defined(__bsdi__)
-  memcpy(vcd_buf,&vcd_entry.cdte_addr.msf,sizeof(struct cdrom_msf));
-  if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; // EOF?
-  memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA);
-#elif	defined(sun)
-  {
-    int offset;
-    if (sun_vcd_read(fd, &offset) <= 0) return 0;
-    memcpy(mem,&vcd_buf[offset],VCD_SECTOR_DATA);
-  }
-#endif
-  ++vcd_cache_current;
-  return VCD_SECTOR_DATA;
-}
-#endif
-
 #else /* linux || sun || __bsdi__ */
 
 #error vcd is not yet supported on this arch...
--- a/libmpdemux/vcd_read_fbsd.h	Sun Sep 15 15:50:28 2002 +0000
+++ b/libmpdemux/vcd_read_fbsd.h	Sun Sep 15 18:48:16 2002 +0000
@@ -96,48 +96,3 @@
       return VCD_SECTOR_DATA;
 }
 
-//================== VCD CACHE =======================
-#ifdef VCD_CACHE
-
-static int vcd_cache_size=0;
-static char *vcd_cache_data=NULL;
-static int *vcd_cache_sectors=NULL;
-static int vcd_cache_index=0; // index to first free (or oldest) cache sector
-static int vcd_cache_current=-1;
-
-void vcd_cache_init(int s){
-  vcd_cache_size=s;
-  vcd_cache_sectors=malloc(s*sizeof(int));
-  vcd_cache_data=malloc(s*VCD_SECTOR_SIZE);
-  memset(vcd_cache_sectors,255,s*sizeof(int));
-}
-
-static inline void vcd_cache_seek(int sect){
-  vcd_cache_current=sect;
-}
-
-int vcd_cache_read(int fd,char* mem){
-int i;
-char* vcd_buf;
-  for(i=0;i<vcd_cache_size;i++)
-    if(vcd_cache_sectors[i]==vcd_cache_current){
-      // found in the cache! :)
-      vcd_buf=&vcd_cache_data[i*VCD_SECTOR_SIZE];
-      ++vcd_cache_current;
-      memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA);
-      return VCD_SECTOR_DATA;
-    }
-  // NEW cache entry:
-  vcd_buf=&vcd_cache_data[vcd_cache_index*VCD_SECTOR_SIZE];
-  vcd_cache_sectors[vcd_cache_index]=vcd_cache_current;
-  ++vcd_cache_index;if(vcd_cache_index>=vcd_cache_size)vcd_cache_index=0;
-  // read data!
-  vcd_set_msf(vcd_cache_current);
-  memcpy(vcd_buf,&vcd_entry.entry.addr.msf,sizeof(struct cdrom_msf));
-/*  if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; */ // EOF?
-  ++vcd_cache_current;
-  memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA);
-  return VCD_SECTOR_DATA;
-}
-
-#endif
--- a/libmpdemux/vcd_read_nbsd.h	Sun Sep 15 15:50:28 2002 +0000
+++ b/libmpdemux/vcd_read_nbsd.h	Sun Sep 15 18:48:16 2002 +0000
@@ -148,51 +148,3 @@
   return VCD_SECTOR_DATA;
 }
 
-#ifdef VCD_CACHE
-
-static int      vcd_cache_size = 0;
-static char    *vcd_cache_data = NULL;
-static int     *vcd_cache_sectors = NULL;
-static int      vcd_cache_index = 0;
-static int      vcd_cache_current = -1;
-
-void 
-vcd_cache_init(int s)
-{
-  vcd_cache_size = s;
-  vcd_cache_sectors = malloc(s * sizeof(int));
-  vcd_cache_data = malloc(s * VCD_SECTOR_SIZE);
-  memset(vcd_cache_sectors, 255, s * sizeof(int));
-}
-
-static inline void 
-vcd_cache_seek(int sect)
-{
-  vcd_cache_current = sect;
-}
-
-int 
-vcd_cache_read(int fd, char *mem)
-{
-  int             i;
-  char           *vcd_buf;
-  for (i = 0; i < vcd_cache_size; i++)
-    if (vcd_cache_sectors[i] == vcd_cache_current) {
-      vcd_buf = &vcd_cache_data[i * VCD_SECTOR_SIZE];
-      ++vcd_cache_current;
-      memcpy(mem, &vcd_buf[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
-      return VCD_SECTOR_DATA;
-    }
-  vcd_buf = &vcd_cache_data[vcd_cache_index * VCD_SECTOR_SIZE];
-  vcd_cache_sectors[vcd_cache_index] = vcd_cache_current;
-  ++vcd_cache_index;
-  if (vcd_cache_index >= vcd_cache_size)
-    vcd_cache_index = 0;
-  vcd_set_msf(vcd_cache_current);
-  memcpy(vcd_buf, &vcd_entry_data.addr.msf, sizeof(vcd_entry_data.addr.msf));
-  ++vcd_cache_current;
-  memcpy(mem, &vcd_buf[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
-  return VCD_SECTOR_DATA;
-}
-#endif
-