[MPlayer-cvslog] r20764 - trunk/libmpdemux/demuxer.c
nicodvb
subversion at mplayerhq.hu
Tue Nov 7 23:54:28 CET 2006
Author: nicodvb
Date: Tue Nov 7 23:54:28 2006
New Revision: 20764
Modified:
trunk/libmpdemux/demuxer.c
Log:
now demux_seek() tries to seek aided by the stream layer, if possible
Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c (original)
+++ trunk/libmpdemux/demuxer.c Tue Nov 7 23:54:28 2006
@@ -881,6 +881,8 @@
demux_stream_t *d_video=demuxer->video;
sh_audio_t *sh_audio=d_audio->sh;
sh_video_t *sh_video=d_video->sh;
+ unsigned int tmp = 0;
+ double pts;
if(!demuxer->seekable){
if(demuxer->file_format==DEMUXER_TYPE_AVI)
@@ -909,6 +911,27 @@
if(sh_video) sh_video->timer=0; // !!!!!!
#endif
+ if(flags & 1) // absolute seek
+ pts = 0.0f;
+ else {
+ if(stream_control(demuxer->stream, STREAM_CTRL_GET_CURRENT_TIME, &tmp) == STREAM_UNSUPORTED)
+ goto dmx_seek;
+ pts = (double)tmp / 1000.0f;
+ }
+
+ if(flags & 2) { // percent seek
+ if(stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, &tmp) == STREAM_UNSUPORTED)
+ goto dmx_seek;
+ pts += (double)tmp / 1000.0f * rel_seek_secs;
+ } else
+ pts += rel_seek_secs;
+
+ if(stream_control(demuxer->stream, STREAM_CTRL_SEEK_TO_TIME, &pts) != STREAM_UNSUPORTED) {
+ demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
+ return 1;
+ }
+
+dmx_seek:
if (demuxer->desc->seek)
demuxer->desc->seek(demuxer,rel_seek_secs,audio_delay,flags);
More information about the MPlayer-cvslog
mailing list