[xiph-commits] r3037 - liboggplay/trunk/src/liboggplay

shans at svn.annodex.net shans at svn.annodex.net
Sun Jun 24 18:42:38 PDT 2007


Author: shans
Date: 2007-06-24 18:42:38 -0700 (Sun, 24 Jun 2007)
New Revision: 3037

Modified:
   liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
Log:
Seeking, over the tubes!



Modified: liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c	2007-06-25 01:28:30 UTC (rev 3036)
+++ liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c	2007-06-25 01:42:38 UTC (rev 3037)
@@ -562,7 +562,9 @@
       me->mode = TCP_READER_FROM_MEMORY;
       me->current_position = 0;
     } else {
-      return fread(buf, n, 1, me->backing_store);
+      int r = fread(buf, 1, n, me->backing_store);
+      me->current_position += r;
+      return r;
     }
   }
 
@@ -573,21 +575,13 @@
 
   len = MIN(n, me->buffer_size - me->current_position);
   memcpy(buf, me->buffer, len);
-    
+
   me->current_position += len;
 
   return len;
 }
 
 static int
-oggplay_tcp_reader_seek(OggPlayReader * handle, OGGZ * oggz, 
-                                                ogg_int64_t milliseconds) {
-
-  return E_OGGPLAY_CANT_SEEK;
-  
-}
-
-static int
 oggplay_tcp_reader_io_seek(void * user_handle, long offset, int whence) {
 
   OggPlayTCPReader  * me = (OggPlayTCPReader *)user_handle;
@@ -642,6 +636,9 @@
 
   OggPlayTCPReader  * me = (OggPlayTCPReader *)user_handle;
 
+  if (me->mode == TCP_READER_FROM_MEMORY) {
+    return me->current_position + me->stored_offset;
+  }
   return me->current_position;
 
 }
@@ -664,7 +661,7 @@
 
   me->functions.initialise = &oggplay_tcp_reader_initialise;
   me->functions.destroy = &oggplay_tcp_reader_destroy;
-  me->functions.seek = &oggplay_tcp_reader_seek;
+  me->functions.seek = NULL;
   me->functions.io_read = &oggplay_tcp_reader_io_read;
   me->functions.io_seek = &oggplay_tcp_reader_io_seek;
   me->functions.io_tell = &oggplay_tcp_reader_io_tell;



More information about the commits mailing list