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

shans at svn.annodex.net shans at svn.annodex.net
Sun Jun 24 18:21:48 PDT 2007


Author: shans
Date: 2007-06-24 18:21:48 -0700 (Sun, 24 Jun 2007)
New Revision: 3035

Modified:
   liboggplay/trunk/src/liboggplay/oggplay_file_reader.c
   liboggplay/trunk/src/liboggplay/oggplay_seek.c
Log:
Made seek function in readers optional ; removed seek function from file_reader



Modified: liboggplay/trunk/src/liboggplay/oggplay_file_reader.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_file_reader.c	2007-06-25 01:19:27 UTC (rev 3034)
+++ liboggplay/trunk/src/liboggplay/oggplay_file_reader.c	2007-06-25 01:21:48 UTC (rev 3035)
@@ -77,19 +77,6 @@
   return E_OGGPLAY_OK;
 }
 
-OggPlayErrorCode
-oggplay_file_reader_seek(OggPlayReader * handle, OGGZ * oggz, 
-                                                ogg_int64_t milliseconds) {
-  ogg_int64_t new_pos;
-
-  new_pos = oggz_seek_units(oggz, milliseconds, SEEK_SET);
-  if (new_pos == -1)
-    return E_OGGPLAY_CANT_SEEK;
-  
-  return E_OGGPLAY_OK;
-  
-}
-
 static size_t
 oggplay_file_reader_io_read(void * user_handle, void * buf, size_t n) {
   
@@ -135,7 +122,7 @@
 
   me->functions.initialise = &oggplay_file_reader_initialise;
   me->functions.destroy = &oggplay_file_reader_destroy;
-  me->functions.seek = &oggplay_file_reader_seek;
+  me->functions.seek = NULL;
   me->functions.io_read = &oggplay_file_reader_io_read; 
   me->functions.io_seek = &oggplay_file_reader_io_seek;
   me->functions.io_tell = &oggplay_file_reader_io_tell;

Modified: liboggplay/trunk/src/liboggplay/oggplay_seek.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_seek.c	2007-06-25 01:19:27 UTC (rev 3034)
+++ liboggplay/trunk/src/liboggplay/oggplay_seek.c	2007-06-25 01:21:48 UTC (rev 3035)
@@ -50,14 +50,20 @@
     return E_OGGPLAY_BAD_OGGPLAY;
   }
 
-  if 
-  (
-    me->reader->seek(me->reader, me->oggz, milliseconds) 
-    == 
-    E_OGGPLAY_CANT_SEEK
-  )
-  {
-    return E_OGGPLAY_CANT_SEEK;
+  if (me->reader->seek != NULL) {
+    if 
+    (
+      me->reader->seek(me->reader, me->oggz, milliseconds) 
+      == 
+      E_OGGPLAY_CANT_SEEK
+    )
+    {
+      return E_OGGPLAY_CANT_SEEK;
+    }
+  } else {
+    if (oggz_seek_units(me->oggz, milliseconds, SEEK_SET) == -1) {
+      return E_OGGPLAY_CANT_SEEK;
+    }
   }
 
   /*



More information about the commits mailing list