changeset 1595:1918610d2802

seeking in DVD
author arpi
date Mon, 20 Aug 2001 20:18:27 +0000
parents dbb3496efe01
children fc0e9953bc2d
files stream.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream.c	Mon Aug 20 20:17:44 2001 +0000
+++ b/stream.c	Mon Aug 20 20:18:27 2001 +0000
@@ -20,6 +20,11 @@
 #include "vcd_read.c"
 #endif
 
+#ifdef USE_DVDREAD
+int dvd_read_sector(void* d,void* p2);
+void dvd_seek(void* d,off_t pos);
+#endif
+
 //=================== STREAMER =========================
 
 int stream_fill_buffer(stream_t *s){
@@ -35,6 +40,16 @@
 #else
     len=vcd_read(s->fd,s->buffer);break;
 #endif
+#ifdef USE_DVDREAD
+  case STREAMTYPE_DVD: {
+    off_t pos=dvd_read_sector(s->priv,s->buffer);
+    if(pos>=0){
+	len=2048; // full sector
+	s->pos=2048*pos-len;
+    } else len=-1; // error
+    break;
+  }
+#endif
   default: len=0;
   }
   if(len<=0){ s->eof=1; s->buf_pos=s->buf_len=0; return 0; }
@@ -72,6 +87,8 @@
 #endif
   case STREAMTYPE_VCD:
     newpos=(pos/VCD_SECTOR_DATA)*VCD_SECTOR_DATA;break;
+  case STREAMTYPE_DVD:
+    newpos=pos/2048; newpos*=2048; break;
   }
 
   pos-=newpos;
@@ -90,6 +107,12 @@
     vcd_set_msf(s->pos/VCD_SECTOR_DATA);
 #endif
     break;
+#ifdef USE_DVDREAD
+  case STREAMTYPE_DVD:
+    s->pos=newpos; // real seek
+    dvd_seek(s->priv,s->pos/2048);
+    break;
+#endif
   case STREAMTYPE_STREAM:
     //s->pos=newpos; // real seek
     if(newpos<s->pos){