From 39f7f187ef8cf17045e2f718ce06f0e052691ec9 Mon Sep 17 00:00:00 2001 From: arpi Date: Tue, 28 Aug 2001 21:35:04 +0000 Subject: [PATCH] gui seekbar position fixed git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1736 b3059339-0415-0410-9bf9-f77b7e298cf2 --- demux_mpg.c | 4 ++-- mplayer.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/demux_mpg.c b/demux_mpg.c index 5f3477c509..74604ca160 100644 --- a/demux_mpg.c +++ b/demux_mpg.c @@ -234,7 +234,7 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){ 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 @@ int demux_mpg_es_fill_buffer(demuxer_t *demux){ // 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; } diff --git a/mplayer.c b/mplayer.c index 975773fc0c..0c177a8e95 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1742,9 +1742,15 @@ if(rel_seek_secs || abs_seek_pos){ #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