changeset 1735:bdc1ec6fe668

gui seekbar position fixed
author arpi
date Tue, 28 Aug 2001 21:35:04 +0000
parents bf80e7d70bc6
children 1a8e6e3bee3d
files demux_mpg.c mplayer.c
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/demux_mpg.c	Tue Aug 28 19:35:34 2001 +0000
+++ b/demux_mpg.c	Tue Aug 28 21:35:04 2001 +0000
@@ -234,7 +234,7 @@
 		    mp_msg(MSGT_DEMUX,MSGL_WARN,"Encrypted stream but authentication was not requested by you!!\n");
     }
 #endif
-    ds_read_packet(ds,demux->stream,len,pts/90000.0f,0,0);
+    ds_read_packet(ds,demux->stream,len,pts/90000.0f,demux->filepos,0);
 //    if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len);
     return 1;
   }
@@ -252,7 +252,7 @@
   // Elementary video stream
   if(demux->stream->eof) return 0;
   demux->filepos=stream_tell(demux->stream);
-  ds_read_packet(demux->video,demux->stream,STREAM_BUFFER_SIZE,0,0,0);
+  ds_read_packet(demux->video,demux->stream,STREAM_BUFFER_SIZE,0,demux->filepos,0);
   return 1;
 }
 
--- a/mplayer.c	Tue Aug 28 19:35:34 2001 +0000
+++ b/mplayer.c	Tue Aug 28 21:35:04 2001 +0000
@@ -1742,9 +1742,15 @@
 
 #ifdef HAVE_NEW_GUI
       if(use_gui){
-        int len=((demuxer->movi_end-demuxer->movi_start));
-	if ( len > 0 ) mplShMem->Position=(float)(demuxer->filepos-demuxer->movi_start) / len * 100.0f;
-	 else mplShMem->Position=0;
+	if(demuxer->file_format==DEMUXER_TYPE_AVI && sh_video->video.dwLength>2){
+	  // get pos from frame number / total frames
+	  mplShMem->Position=(float)d_video->pack_no*100.0f/sh_video->video.dwLength;
+	} else {
+	  // get pos from file position / filesize
+          int len=((demuxer->movi_end-demuxer->movi_start));
+	  int pos=(demuxer->file_format==DEMUXER_TYPE_AVI)?demuxer->filepos:d_video->pos;
+	  mplShMem->Position=(len<=0)?0:((float)(pos-demuxer->movi_start) / len * 100.0f);
+	}
 	mplShMem->TimeSec=d_video->pts; 
       }
 #endif