[Mplayer-cvslog] CVS: main/libmpdemux demux_ogg.c,1.42,1.43

Moritz Bunkus CVS mosu at mplayerhq.hu
Sat Jan 31 10:38:03 CET 2004


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv8198

Modified Files:
	demux_ogg.c 
Log Message:
Cleanup and small improvement in seeking if the final_granulepos is known. Patch by Michael Behrisch <behrisch at informatik.hu-berlin.de>

Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ogg.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- demux_ogg.c	6 Jan 2004 11:22:32 -0000	1.42
+++ demux_ogg.c	31 Jan 2004 09:38:01 -0000	1.43
@@ -1090,20 +1090,14 @@
   oss = &os->stream;
 
   if(ogg_d->syncpoints) {
-    float time_pos = flags & 1 ? 0 : os->lastpos/ rate;
-    if(flags & 2) {
-      if(ogg_d->syncpoints)
-	time_pos += ogg_d->syncpoints[ogg_d->num_syncpoint].granulepos / rate * rel_seek_secs;
+    gp = flags & 1 ? 0 : os->lastpos;
+    if(flags & 2)
+      gp += ogg_d->syncpoints[ogg_d->num_syncpoint].granulepos * rel_seek_secs;
       else
-	time_pos += (demuxer->movi_end - demuxer->movi_start) * rel_seek_secs;
-    } else
-      time_pos += rel_seek_secs;
-    
-    gp = time_pos * rate;
+      gp += rel_seek_secs * rate;
 
     for(sp = 0; sp < ogg_d->num_syncpoint ; sp++) {
-      if(ogg_d->syncpoints[sp].granulepos >= gp)
-	break;
+      if(ogg_d->syncpoints[sp].granulepos >= gp) break;
     }
 
     if(sp >= ogg_d->num_syncpoint)
@@ -1114,8 +1108,12 @@
     pos = flags & 1 ? 0 : ogg_d->pos;
     if(flags & 2)
       pos += (demuxer->movi_end - demuxer->movi_start) * rel_seek_secs;
+    else {
+      if (ogg_d->final_granulepos > 0)
+        pos += rel_seek_secs * (demuxer->movi_end - demuxer->movi_start) / (ogg_d->final_granulepos / rate);
     else
       pos += rel_seek_secs * ogg_d->pos / (os->lastpos / rate);
+    }
     if (pos < 0)
       pos = 0;
     else if (pos > (demuxer->movi_end - demuxer->movi_start))




More information about the MPlayer-cvslog mailing list