Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dvdplayer: ff/rw/seek was broken for inputs implementing IDisplayTime

This affected PVR with file based inputs and BluRay.
  • Loading branch information...
commit 4c90033e6987d512c1925ab6a5e31ef88bcdb28c 1 parent 5cf13fd
@elupus elupus authored
View
14 xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -2016,6 +2016,11 @@ void CDVDPlayer::HandleMessages()
double start = DVD_NOPTS_VALUE;
int time = msg.GetRestore() ? (int)m_Edl.RestoreCutTime(msg.GetTime()) : msg.GetTime();
+
+ // if input streams doesn't support seektime we must convert back to clock
+ if(dynamic_cast<CDVDInputStream::ISeekTime*>(m_pInputStream) == NULL)
+ time -= m_State.time_offset;
+
CLog::Log(LOGDEBUG, "demuxer seek to: %d", time);
if (m_pDemuxer && m_pDemuxer->SeekTime(time, msg.GetBackward(), &start))
{
@@ -3814,6 +3819,7 @@ void CDVDPlayer::UpdatePlayState(double timeout)
state.time = DVD_TIME_TO_MSEC(m_clock.GetClock() + m_offset_pts);
state.time_total = m_pDemuxer->GetStreamLength();
+ state.time_src = ETIMESOURCE_CLOCK;
}
if(m_pInputStream)
@@ -3831,6 +3837,7 @@ void CDVDPlayer::UpdatePlayState(double timeout)
{
state.time = pDisplayTime->GetTime();
state.time_total = pDisplayTime->GetTotalTime();
+ state.time_src = ETIMESOURCE_INPUT;
}
if (dynamic_cast<CDVDInputStream::IMenus*>(m_pInputStream))
@@ -3839,6 +3846,7 @@ void CDVDPlayer::UpdatePlayState(double timeout)
{
state.time = XbmcThreads::SystemClockMillis() - m_dvd.iDVDStillStartTime;
state.time_total = m_dvd.iDVDStillTime;
+ state.time_src = ETIMESOURCE_MENU;
}
}
@@ -3864,12 +3872,14 @@ void CDVDPlayer::UpdatePlayState(double timeout)
state.player_state = "";
if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD))
{
- state.time_offset = DVD_MSEC_TO_TIME(state.time) - state.dts;
if(!((CDVDInputStreamNavigator*)m_pInputStream)->GetNavigatorState(state.player_state))
state.player_state = "";
}
- else
+
+ if (state.time_src == ETIMESOURCE_CLOCK)
state.time_offset = 0;
+ else
+ state.time_offset = DVD_MSEC_TO_TIME(state.time) - state.dts;
if (m_CurrentAudio.id >= 0 && m_pDemuxer)
{
View
9 xbmc/cores/dvdplayer/DVDPlayer.h
@@ -400,6 +400,13 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
int iSelectedAudioStream; // mpeg stream id, or -1 if disabled
} m_dvd;
+ enum ETimeSource
+ {
+ ETIMESOURCE_CLOCK,
+ ETIMESOURCE_INPUT,
+ ETIMESOURCE_MENU,
+ };
+
struct SPlayerState
{
SPlayerState() { Clear(); }
@@ -409,6 +416,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
time = 0;
time_total = 0;
time_offset = 0;
+ time_src = ETIMESOURCE_CLOCK;
dts = DVD_NOPTS_VALUE;
player_state = "";
chapter = 0;
@@ -431,6 +439,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
double time; // current playback time
double time_total; // total playback time
+ ETimeSource time_src; // current time source
double dts; // last known dts
std::string player_state; // full player state

5 comments on commit 4c90033

@da-anda
Collaborator

did a quick test on how PVR behaves after this. Jump forward/back still don't work (which was expected).

I'm not entirely sure about FFW/FRW, which AFAIK is atm the only reliable way to "skip" in the timeshift buffer of backends using XBMCs demuxer. It's kinda still working, but I think not as reliable as before. But I can't really tell because I'm not using PVR in XBMC due to missing stepforward/-back which is essential for me. So I only did a quick test, and sometimes it worked, sometimes it was caught in some sort of loop. The loop looked like this: I started ffw, and at a fixed position it jumped to the beginning of the timeshift buffer and started all over again. The jump occured somewhere in the middle of the buffer - so for sure not at the end. Will compare to earlier behavior later and report again if the issue wasn't there.

@elupus
Collaborator
@da-anda
Collaborator

ffwd/frwd work fine for blurays, but are for sure broken now for PVR addons using XBMCs demuxer. At least it didn't work at all for me now (XBMC always tried to ffwd/frwd at the end position of the buffer). Also step forward/back now jumped to the end of the buffer instead of the beginning like it did a few hours ago with the same XBMC version/install which is kinda odd. It probably depends on how far the TV show already progressed when you start watching it - that's at least the only explanation I can think of atm.

@opdenkamp
Collaborator

@da-anda which backend? and there is at least one bug in that code when no epg tag is present for the channel or when the epg tag changed.

@opdenkamp
Collaborator

oh nvm, you're talking about xbmc's demuxer, not one in the add-on

Please sign in to comment.
Something went wrong with that request. Please try again.