Skip to content

Commit

Permalink
Fixed seeking issues on some DVDs where, for example, trying to jump …
Browse files Browse the repository at this point in the history
…backwards could actually cause playback to jump forwards.

dvdnav_absolute_time_search in libdvdnav (renamed from the original dvdnav_time_search but functionally the same) uses a time offset with a start sector, which will only work if all NAV packets are equally spaced.  On at least one DVD that had issues, the distance between consecutive NAV packets ranged from 96 to 457.

The existing mechanism to check whether a seek was successful and, if not, narrow in on the required time was broken when jumping backwards.

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>

Fixes #11572
  • Loading branch information
Richard authored and stuartm committed Jun 3, 2013
1 parent b8b3ad1 commit cb56a7e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
Expand Up @@ -275,8 +275,8 @@ long long DVDRingBuffer::Seek(long long time)
}
else
{
m_seektime = (uint64_t)time;
dvdRet = dvdnav_absolute_time_search(m_dvdnav, m_seektime, 0);
m_seektime = time;
dvdRet = dvdnav_absolute_time_search(m_dvdnav, (uint64_t)m_seektime, 0);
}

LOG(VB_PLAYBACK, LOG_DEBUG,
Expand Down Expand Up @@ -776,15 +776,15 @@ int DVDRingBuffer::safe_read(void *data, uint sz)
}

// update our status
m_currentTime = (uint)dvdnav_get_current_time(m_dvdnav);
m_currentTime = dvdnav_get_current_time(m_dvdnav);
m_currentpos = GetReadPosition();

if (m_seeking)
{

int relativetime =
(int)((m_seektime - m_currentTime)/ 90000);
if (relativetime <= 1)
if (abs(relativetime) <= 1)
{
m_seeking = false;
m_seektime = 0;
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/DVD/dvdringbuffer.h
Expand Up @@ -128,7 +128,7 @@ class MTV_PUBLIC DVDRingBuffer : public RingBuffer

virtual void IgnoreWaitStates(bool ignore) { m_skipstillorwait = ignore; }
void AudioStreamsChanged(bool change) { m_audioStreamsChanged = change; }
uint GetCurrentTime(void) { return (m_currentTime / 90000); }
int64_t GetCurrentTime(void) { return (m_currentTime / 90000); }
uint TitleTimeLeft(void);
void SetTrack(uint type, int trackNo);
int GetTrack(uint type);
Expand Down Expand Up @@ -197,8 +197,8 @@ class MTV_PUBLIC DVDRingBuffer : public RingBuffer
const char *m_dvdname;
const char *m_serialnumber;
bool m_seeking;
uint64_t m_seektime;
uint m_currentTime;
int64_t m_seektime;
int64_t m_currentTime;
QMap<uint, uint> m_seekSpeedMap;
QMap<uint, QList<uint64_t> > m_chapterMap;

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -12945,7 +12945,7 @@ void TV::DVDJumpForward(PlayerContext *ctx)
{
uint titleLength = dvdrb->GetTotalTimeOfTitle();
uint chapterLength = dvdrb->GetChapterLength();
uint currentTime = dvdrb->GetCurrentTime();
uint currentTime = (uint)dvdrb->GetCurrentTime();
if ((titleLength == chapterLength) &&
(currentTime < (chapterLength - (ctx->jumptime * 60))) &&
chapterLength > 300)
Expand Down

0 comments on commit cb56a7e

Please sign in to comment.