summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Engel <dengel@mythtv.org>2011-09-29 16:07:07 (GMT)
committer David Engel <dengel@mythtv.org>2011-09-29 16:07:07 (GMT)
commitf006f90474096f73aedb4f4fdbbe7777e37656cf (patch)
treee89cf62d90ee5a806bf0adfefd9f69299865e166
parent551057947363159f766a686d5ac5cdcce525f68b (diff)
Better handle frame rate changes during fast-forward/rewind.
Backport of 9f871f63 from master to 0.24-fixes. If the frame rate changes while fast-forwarding or rewinding, the frame interval is set incorrectly and the skip values is not changed. This leads to very erratic behavior when such a transition is hit. Fix the problem, updating the frame interval and skip values appropriately when the frame rate changes.
-rw-r--r--mythtv/libs/libmythtv/mythplayer.cpp36
-rw-r--r--mythtv/libs/libmythtv/mythplayer.h4
2 files changed, 30 insertions, 10 deletions
diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index d027511..ee42098 100644
--- a/mythtv/libs/libmythtv/mythplayer.cpp
+++ b/mythtv/libs/libmythtv/mythplayer.cpp
@@ -824,9 +824,17 @@ void MythPlayer::SetVideoParams(int width, int height, double fps,
if (fps > 0.0f && fps < 121.0f)
{
video_frame_rate = fps;
- float temp_speed = (play_speed == 0.0f) ?
- audio.GetStretchFactor() : play_speed;
- frame_interval = (int)(1000000.0f / video_frame_rate / temp_speed);
+ if (ffrew_skip != 0 && ffrew_skip != 1)
+ {
+ UpdateFFRewSkip();
+ videosync->setFrameInterval(frame_interval);
+ }
+ else
+ {
+ float temp_speed = (play_speed == 0.0f) ?
+ audio.GetStretchFactor() : play_speed;
+ frame_interval = (int)(1000000.0f / video_frame_rate / temp_speed);
+ }
}
if (videoOutput)
@@ -3135,15 +3143,12 @@ uint64_t MythPlayer::GetBookmark(void)
return bookmark;
}
-void MythPlayer::ChangeSpeed(void)
+bool MythPlayer::UpdateFFRewSkip(void)
{
- float last_speed = play_speed;
- play_speed = next_play_speed;
- normal_speed = next_normal_speed;
-
- float temp_speed = (play_speed == 0.0) ? audio.GetStretchFactor() : play_speed;
-
bool skip_changed;
+
+ float temp_speed = (play_speed == 0.0) ?
+ audio.GetStretchFactor() : play_speed;
if (play_speed >= 0.0f && play_speed <= 3.0f)
{
skip_changed = (ffrew_skip != 1);
@@ -3170,6 +3175,17 @@ void MythPlayer::ChangeSpeed(void)
ffrew_skip = play_speed < 0.0f ? -ffrew_skip : ffrew_skip;
ffrew_adjust = 0;
}
+
+ return skip_changed;
+}
+
+void MythPlayer::ChangeSpeed(void)
+{
+ float last_speed = play_speed;
+ play_speed = next_play_speed;
+ normal_speed = next_normal_speed;
+
+ bool skip_changed = UpdateFFRewSkip();
videosync->setFrameInterval(frame_interval);
if (skip_changed && videoOutput)
diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
index 3a7655b..d16b70c 100644
--- a/mythtv/libs/libmythtv/mythplayer.h
+++ b/mythtv/libs/libmythtv/mythplayer.h
@@ -479,6 +479,10 @@ class MPUBLIC MythPlayer
bool DecoderGetFrame(DecodeType, bool unsafe = false);
// These actually execute commands requested by public members
+ private:
+ // Make this private in 0.24-fixes so as to not change the ABI.
+ bool UpdateFFRewSkip(void);
+ protected:
virtual void ChangeSpeed(void);
bool DoFastForward(uint64_t frames, bool override_seeks = false,
bool seeks_wanted = false);