diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index 0b3643c70a9f0..929f9879e28d6 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -1001,11 +1001,16 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts) { + bool hitEnd = false; + if (!m_pInput) return false; - if(time < 0) + if (time < 0) + { time = 0; + hitEnd = true; + } m_pkt.result = -1; av_packet_unref(&m_pkt.pkt); @@ -1027,8 +1032,8 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts) return true; } - if(!m_pInput->Seek(0, SEEK_POSSIBLE) - && !m_pInput->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) + if (!m_pInput->Seek(0, SEEK_POSSIBLE) && + !m_pInput->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) { CLog::Log(LOGDEBUG, "%s - input stream reports it is not seekable", __FUNCTION__); return false; @@ -1050,7 +1055,7 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts) else if (ret < 0 && m_pInput->IsEOF()) ret = 0; - if(ret >= 0) + if (ret >= 0) UpdateCurrentPTS(); } @@ -1060,10 +1065,18 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts) CLog::Log(LOGDEBUG, "%s - seek ended up on time %d", __FUNCTION__, (int)(m_currentPts / DVD_TIME_BASE * 1000)); // in this case the start time is requested time - if(startpts) + if (startpts) *startpts = DVD_MSEC_TO_TIME(time); - return (ret >= 0); + if (ret >= 0) + { + if (!hitEnd) + return true; + else + return false; + } + else + return false; } bool CDVDDemuxFFmpeg::SeekByte(int64_t pos) diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 5f486b02fbad5..fa6aca13a1cee 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -2517,8 +2517,21 @@ void CVideoPlayer::HandleMessages() FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate(), msg.GetSync()); } - else - CLog::Log(LOGWARNING, "error while seeking"); + else if (m_pDemuxer) + { + CLog::Log(LOGDEBUG, "VideoPlayer: seek failed or hit end of stream"); + // dts after successful seek + if (start == DVD_NOPTS_VALUE) + start = DVD_MSEC_TO_TIME(time) - m_State.time_offset; + + m_State.dts = start; + + FlushBuffers(false, start, false, true); + if (m_playSpeed != DVD_PLAYSPEED_PAUSE) + { + SetPlaySpeed(DVD_PLAYSPEED_NORMAL); + } + } // set flag to indicate we have finished a seeking request if(!msg.GetTrickPlay())