summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-11-09 12:43:05 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-11-09 12:43:05 (GMT)
commit4b0803be0c0974c1849c297064eeb96bf7817b9b (patch)
treeff47e71947793ac2c4599ae90a6105b15a160b08
parent99483d603d1ef548ad31579665f85ff8b21bef03 (diff)
Playback: Fix DVD and Blu Ray seeking.
The main problem here was that when paused, the seek position would fallback to the current speed (i.e. 0) and playback would resume from the beginning of the title. With DVD playback, we were also asking the dvdnav object to seek to the nearest cell - which led to some sizeable search discrepancies depending where playback was relative to the nearest cell. We now ask for a more accurate search. N.B. I also tried to use a relative time search to the nearest cell followed by a smaller absolute time search (as outline in the dvdnav api) but this seemed to be even less accurate. Refs #9305
-rw-r--r--mythtv/libs/libmythtv/avformatdecoderbd.cpp14
-rw-r--r--mythtv/libs/libmythtv/avformatdecoderdvd.cpp14
-rw-r--r--mythtv/libs/libmythtv/dvdringbuffer.cpp4
3 files changed, 12 insertions, 20 deletions
diff --git a/mythtv/libs/libmythtv/avformatdecoderbd.cpp b/mythtv/libs/libmythtv/avformatdecoderbd.cpp
index 24823c4..a9c98ad 100644
--- a/mythtv/libs/libmythtv/avformatdecoderbd.cpp
+++ b/mythtv/libs/libmythtv/avformatdecoderbd.cpp
@@ -34,9 +34,8 @@ bool AvFormatDecoderBD::DoRewindSeek(long long desiredFrame)
if (!ringBuffer->IsBD())
return false;
- long long pos = BDFindPosition(desiredFrame);
- ringBuffer->Seek(pos, SEEK_SET);
- lastKey = desiredFrame + 1;
+ ringBuffer->Seek(BDFindPosition(desiredFrame), SEEK_SET);
+ framesPlayed = framesRead = lastKey = desiredFrame + 1;
return true;
}
@@ -45,12 +44,9 @@ void AvFormatDecoderBD::DoFastForwardSeek(long long desiredFrame, bool &needflus
if (!ringBuffer->IsBD())
return;
- long long pos = BDFindPosition(desiredFrame);
- ringBuffer->Seek(pos,SEEK_SET);
+ ringBuffer->Seek(BDFindPosition(desiredFrame), SEEK_SET);
needflush = true;
- lastKey = desiredFrame+1;
- framesPlayed = lastKey;
- framesRead = lastKey;
+ framesPlayed = framesRead = lastKey = desiredFrame + 1;
}
void AvFormatDecoderBD::StreamChangeCheck(void)
@@ -98,7 +94,7 @@ long long AvFormatDecoderBD::BDFindPosition(long long desiredFrame)
current_speed = (int)m_parent->GetNextPlaySpeed();
}
- if (ffrewSkip == 1)
+ if (ffrewSkip == 1 || ffrewSkip == 0)
{
diffTime = (int)ceil((desiredFrame - framesPlayed) / fps);
desiredTimePos = ringBuffer->BD()->GetCurrentTime() +
diff --git a/mythtv/libs/libmythtv/avformatdecoderdvd.cpp b/mythtv/libs/libmythtv/avformatdecoderdvd.cpp
index 9b202df..394c4c0 100644
--- a/mythtv/libs/libmythtv/avformatdecoderdvd.cpp
+++ b/mythtv/libs/libmythtv/avformatdecoderdvd.cpp
@@ -89,9 +89,8 @@ bool AvFormatDecoderDVD::DoRewindSeek(long long desiredFrame)
if (!ringBuffer->IsDVD())
return false;
- long long pos = DVDFindPosition(desiredFrame);
- ringBuffer->Seek(pos, SEEK_SET);
- lastKey = desiredFrame + 1;
+ ringBuffer->Seek(DVDFindPosition(desiredFrame), SEEK_SET);
+ framesPlayed = framesRead = lastKey = desiredFrame + 1;
return true;
}
@@ -100,12 +99,9 @@ void AvFormatDecoderDVD::DoFastForwardSeek(long long desiredFrame, bool &needflu
if (!ringBuffer->IsDVD())
return;
- long long pos = DVDFindPosition(desiredFrame);
- ringBuffer->Seek(pos,SEEK_SET);
+ ringBuffer->Seek(DVDFindPosition(desiredFrame),SEEK_SET);
needflush = true;
- lastKey = desiredFrame+1;
- framesPlayed = lastKey;
- framesRead = lastKey;
+ framesPlayed = framesRead = lastKey = desiredFrame + 1;
}
void AvFormatDecoderDVD::StreamChangeCheck(void)
@@ -157,7 +153,7 @@ long long AvFormatDecoderDVD::DVDFindPosition(long long desiredFrame)
current_speed = (int)m_parent->GetNextPlaySpeed();
}
- if (ffrewSkip == 1)
+ if (ffrewSkip == 1 || ffrewSkip == 0)
{
diffTime = (int)ceil((desiredFrame - framesPlayed) / fps);
desiredTimePos = ringBuffer->DVD()->GetCurrentTime() +
diff --git a/mythtv/libs/libmythtv/dvdringbuffer.cpp b/mythtv/libs/libmythtv/dvdringbuffer.cpp
index 4e83333..1f713ff 100644
--- a/mythtv/libs/libmythtv/dvdringbuffer.cpp
+++ b/mythtv/libs/libmythtv/dvdringbuffer.cpp
@@ -244,7 +244,7 @@ long long DVDRingBuffer::Seek(long long time)
if (m_parent)
ffrewSkip = m_parent->GetFFRewSkip();
- if (ffrewSkip != 1 && time != 0)
+ if (ffrewSkip != 1 && ffrewSkip != 0 && time != 0)
{
QMap<uint, uint>::const_iterator it = m_seekSpeedMap.lowerBound(labs(time));
if (it == m_seekSpeedMap.end())
@@ -258,7 +258,7 @@ long long DVDRingBuffer::Seek(long long time)
else
{
m_seektime = (uint64_t)time;
- dvdRet = dvdnav_absolute_time_search(m_dvdnav, m_seektime, 1);
+ dvdRet = dvdnav_absolute_time_search(m_dvdnav, m_seektime, 0);
}
LOG(VB_PLAYBACK, LOG_DEBUG,