[MPlayer-cvslog] r29528 - in trunk: libmpdemux/demuxer.c mencoder.c

reimar subversion at mplayerhq.hu
Mon Aug 17 07:55:40 CEST 2009


Author: reimar
Date: Mon Aug 17 07:55:40 2009
New Revision: 29528

Log:
Handle demuxers that never set filepos by using stream_tell.

Modified:
   trunk/libmpdemux/demuxer.c
   trunk/mencoder.c

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Mon Aug 17 04:06:00 2009	(r29527)
+++ trunk/libmpdemux/demuxer.c	Mon Aug 17 07:55:40 2009	(r29528)
@@ -242,7 +242,7 @@ demuxer_t *new_demuxer(stream_t *stream,
     d->movi_end = stream->end_pos;
     d->seekable = 1;
     d->synced = 0;
-    d->filepos = 0;
+    d->filepos = -1;
     d->audio = new_demuxer_stream(d, a_id);
     d->video = new_demuxer_stream(d, v_id);
     d->sub = new_demuxer_stream(d, s_id);
@@ -1262,8 +1262,9 @@ int demuxer_get_percent_pos(demuxer_t *d
     int res = demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans);
     int len = (demuxer->movi_end - demuxer->movi_start) / 100;
     if (res <= 0) {
+        off_t pos = demuxer->filepos > 0 ? demuxer->filepos : stream_tell(demuxer->stream);
         if (len > 0)
-            ans = (demuxer->filepos - demuxer->movi_start) / len;
+            ans = (pos - demuxer->movi_start) / len;
         else
             ans = 0;
     }

Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c	Mon Aug 17 04:06:00 2009	(r29527)
+++ trunk/mencoder.c	Mon Aug 17 07:55:40 2009	(r29528)
@@ -1399,7 +1399,8 @@ if(sh_audio && !demuxer2){
 
     {	float t=(GetTimerMS()-timer_start)*0.001f;
 	float len=(demuxer->movi_end-demuxer->movi_start);
-	float p=len>1000 ? (float)(demuxer->filepos-demuxer->movi_start) / len :
+	off_t pos = demuxer->filepos >= 0 ? demuxer->filepos : stream_tell(demuxer->stream);
+	float p=len>1000 ? (float)(pos-demuxer->movi_start) / len :
                 (demuxer_get_percent_pos(demuxer) / 100.0);
 #if 0
 	if(!len && sh_audio && sh_audio->audio.dwLength>100){


More information about the MPlayer-cvslog mailing list