From 860a2241842bbf93c056c6b5bf0ca74efec542c4 Mon Sep 17 00:00:00 2001 From: arpi Date: Sun, 15 Sep 2002 18:48:16 +0000 Subject: removed obsolete VCD_CACHE hack git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7407 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/open.c | 6 ----- libmpdemux/stream.c | 15 ------------- libmpdemux/stream.h | 4 ---- libmpdemux/vcd_read.h | 55 ---------------------------------------------- libmpdemux/vcd_read_fbsd.h | 45 ------------------------------------- libmpdemux/vcd_read_nbsd.h | 48 ---------------------------------------- 6 files changed, 173 deletions(-) diff --git a/libmpdemux/open.c b/libmpdemux/open.c index de9a35ce71..0966ad9dfd 100644 --- a/libmpdemux/open.c +++ b/libmpdemux/open.c @@ -83,9 +83,6 @@ stream_t* open_stream(char* filename,int vcd_track,int* file_format){ 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(vcd_track){ 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"); diff --git a/libmpdemux/stream.c b/libmpdemux/stream.c index df90affe22..78cbd847cd 100644 --- a/libmpdemux/stream.c +++ b/libmpdemux/stream.c @@ -69,12 +69,8 @@ int stream_fill_buffer(stream_t *s){ #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); @@ -91,13 +87,6 @@ int stream_fill_buffer(stream_t *s){ } else len=-1; // error 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); @@ -154,11 +143,7 @@ if(newpos==0 || newpos!=s->pos){ #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 diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h index 03ceba1112..08b4a56953 100644 --- a/libmpdemux/stream.h +++ b/libmpdemux/stream.h @@ -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 diff --git a/libmpdemux/vcd_read.h b/libmpdemux/vcd_read.h index 818f99a675..d58946cb31 100644 --- a/libmpdemux/vcd_read.h +++ b/libmpdemux/vcd_read.h @@ -199,61 +199,6 @@ static int sun_vcd_read(int fd, int *offset) } #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)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... diff --git a/libmpdemux/vcd_read_fbsd.h b/libmpdemux/vcd_read_fbsd.h index f21fb10b48..478ed34577 100644 --- a/libmpdemux/vcd_read_fbsd.h +++ b/libmpdemux/vcd_read_fbsd.h @@ -96,48 +96,3 @@ static int vcd_read(int fd,char *mem){ 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)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 diff --git a/libmpdemux/vcd_read_nbsd.h b/libmpdemux/vcd_read_nbsd.h index 0166facd08..a75eebbb36 100644 --- a/libmpdemux/vcd_read_nbsd.h +++ b/libmpdemux/vcd_read_nbsd.h @@ -148,51 +148,3 @@ vcd_read(int fd, char *mem) 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 - -- cgit v1.2.3