changeset 16884:0168bf6042d6

Fix two (loosely) related bugs: massive A-V desync with -audiofile (bugzilla bug #375, sh_audio->delay must only be set when seeking, not at every packet) and not switching to the next file when seeking hits eof.
author reimar
date Tue, 01 Nov 2005 16:12:53 +0000
parents 1f45d7872c56
children 22b27bd37eeb
files libmpdemux/demux_ogg.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ogg.c	Mon Oct 31 23:38:32 2005 +0000
+++ b/libmpdemux/demux_ogg.c	Tue Nov 01 16:12:53 2005 +0000
@@ -554,8 +554,6 @@
   if (ds == d->video && ((sh_audio_t*)ds->sh)->format == FOURCC_THEORA)
      context = ((sh_video_t *)ds->sh)->context;
   data = demux_ogg_read_packet(os,pack,context,&pts,&flags,samplesize);
-  if(d->video->id < 0)
-      ((sh_audio_t*)ds->sh)->delay = pts;
 
   /// Clear subtitles if necessary (for broken files)
   if ((clear_sub > 0) && (pts >= clear_sub)) {
@@ -1471,7 +1469,8 @@
     }
   }
     if (pos < 0) pos = 0;
-    if (pos > (demuxer->movi_end - demuxer->movi_start)) return;
+    if (pos > (demuxer->movi_end - demuxer->movi_start))
+      pos = demuxer->movi_end - demuxer->movi_start;
   } // if(ogg_d->syncpoints)
 
   while(1) {
@@ -1500,8 +1499,8 @@
       char* buf = ogg_sync_buffer(sync,BLOCK_SIZE);
       int len = stream_read(demuxer->stream,buf,BLOCK_SIZE);
        if(len == 0 && demuxer->stream->eof) {
-	mp_msg(MSGT_DEMUX,MSGL_ERR,"EOF while trying to seek !!!!\n");
-	break;
+	mp_msg(MSGT_DEMUX,MSGL_V,"EOF while trying to seek !!!!\n");
+	return;
       }
       ogg_sync_wrote(sync,len);
       continue;
@@ -1556,6 +1555,8 @@
         vo_osd_changed(OSDTYPE_SUBTITLE);
         clear_sub = -1;
 	demux_ogg_add_packet(ds,os,ds->id,&op);
+        if (demuxer->video->id < 0)
+          sh_audio->delay = pts;
 	return;
       }
      }