Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dvdplayer: ff/rw/seek was broken for inputs implementing IDisplayTime
This affected PVR with file based inputs and BluRay.
  • Loading branch information
elupus committed Jan 6, 2013
1 parent 5cf13fd commit 4c90033
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
14 changes: 12 additions & 2 deletions xbmc/cores/dvdplayer/DVDPlayer.cpp
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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)
Expand All @@ -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))
Expand All @@ -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;
}
}

Expand All @@ -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)
{
Expand Down
9 changes: 9 additions & 0 deletions xbmc/cores/dvdplayer/DVDPlayer.h
Expand Up @@ -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(); }
Expand All @@ -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;
Expand All @@ -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
Expand Down

5 comments on commit 4c90033

@da-anda
Copy link
Member

@da-anda da-anda commented on 4c90033 Jan 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

@elupus elupus commented on 4c90033 Jan 7, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@da-anda
Copy link
Member

@da-anda da-anda commented on 4c90033 Jan 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Please sign in to comment.