[mythtv] [PATCH] FF/Rewind/Edit tweaks
David Engel
dlengel at attbi.com
Thu Oct 23 15:53:12 EDT 2003
This patch does a couple of things.
First, it makes it simpler and less error prone to delete ff/rewind
speeds by not having to modify the switch statement for the numeric
keys. Only seek_speed_array and SSPEED_NORMAL need to be changed.
Second, it modifies and abuses the SetPlaySpeed logic to get rid of
the little snippets of sound that sometimes get through in ff/rewind
mode and moving around in edit mode. If desired, I can separate the
play speed and disable audio logic.
David
--
David Engel
dlengel at attbi.com
Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp,v
retrieving revision 1.288
diff -u -r1.288 NuppelVideoPlayer.cpp
--- libs/libmythtv/NuppelVideoPlayer.cpp 13 Oct 2003 21:23:29 -0000 1.288
+++ libs/libmythtv/NuppelVideoPlayer.cpp 23 Oct 2003 19:41:00 -0000
@@ -262,10 +262,10 @@
pausevideo = false;
}
-void NuppelVideoPlayer::SetPlaySpeed(float speed)
+void NuppelVideoPlayer::SetPlaySpeed(float speed, bool normal)
{
play_speed = speed;
- normal_speed = (speed == 1.0);
+ normal_speed = normal;
frame_interval = (int)(1000000.0 / video_frame_rate / speed);
if (osd)
osd->SetFrameInterval(frame_interval);
Index: libs/libmythtv/NuppelVideoPlayer.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoPlayer.h,v
retrieving revision 1.121
diff -u -r1.121 NuppelVideoPlayer.h
--- libs/libmythtv/NuppelVideoPlayer.h 4 Oct 2003 17:20:57 -0000 1.121
+++ libs/libmythtv/NuppelVideoPlayer.h 23 Oct 2003 19:41:00 -0000
@@ -77,7 +77,7 @@
bool GetPause(void);
float GetPlaySpeed(void) { return play_speed; };
- void SetPlaySpeed(float speed);
+ void SetPlaySpeed(float speed, bool normal);
bool FastForward(float seconds);
bool Rewind(float seconds);
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.112
diff -u -r1.112 tv_play.cpp
--- libs/libmythtv/tv_play.cpp 21 Oct 2003 04:46:05 -0000 1.112
+++ libs/libmythtv/tv_play.cpp 23 Oct 2003 19:41:01 -0000
@@ -24,20 +24,6 @@
#include "NuppelVideoPlayer.h"
#include "programinfo.h"
-enum SeekSpeeds {
- SSPEED_NORMAL_WITH_DISPLAY = 0,
- SSPEED_SLOW_1,
- SSPEED_SLOW_2,
- SSPEED_NORMAL,
- SSPEED_FAST_1,
- SSPEED_FAST_2,
- SSPEED_FAST_3,
- SSPEED_FAST_4,
- SSPEED_FAST_5,
- SSPEED_FAST_6,
- SSPEED_MAX
-};
-
struct SeekSpeedInfo {
QString dispString;
float scaling;
@@ -59,6 +45,9 @@
{"16X", 16.72, 132.00, 84.00}
};
+const int SSPEED_NORMAL = 3;
+const int SSPEED_MAX = sizeof seek_speed_array / sizeof seek_speed_array[0];
+
const int kMuteTimeout = 800;
void *SpawnDecode(void *param)
@@ -846,6 +835,8 @@
if (keypressed == Key_Escape ||
keypressed == Key_E || keypressed == Key_M)
editmode = nvp->GetEditMode();
+ if (!editmode)
+ nvp->SetPlaySpeed(1.0, true);
return;
}
@@ -895,6 +886,8 @@
{
playbackinfo->SetEditing(false, m_db);
editmode = nvp->EnableEdit();
+ if (editmode)
+ nvp->SetPlaySpeed(1.0, false);
}
}
if (dialogname == "exitplayoptions")
@@ -1078,24 +1071,13 @@
{
if (doing_ff_rew)
{
- switch (keypressed)
- {
- case Key_0: ff_rew_index = SSPEED_NORMAL_WITH_DISPLAY; break;
- case Key_1: ff_rew_index = SSPEED_SLOW_1; break;
- case Key_2: ff_rew_index = SSPEED_SLOW_2; break;
- case Key_3: ff_rew_index = SSPEED_NORMAL; break;
- case Key_4: ff_rew_index = SSPEED_FAST_1; break;
- case Key_5: ff_rew_index = SSPEED_FAST_2; break;
- case Key_6: ff_rew_index = SSPEED_FAST_3; break;
- case Key_7: ff_rew_index = SSPEED_FAST_4; break;
- case Key_8: ff_rew_index = SSPEED_FAST_5; break;
- case Key_9: ff_rew_index = SSPEED_FAST_6; break;
-
- default:
- float time = StopFFRew();
- UpdatePosOSD(time, tr("Play"));
- was_doing_ff_rew = true;
- break;
+ if (keypressed >= Key_0 && keypressed < Key_0 + SSPEED_MAX)
+ ff_rew_index = keypressed - Key_0;
+ else
+ {
+ float time = StopFFRew();
+ UpdatePosOSD(time, tr("Play"));
+ was_doing_ff_rew = true;
}
}
if (speed_index)
@@ -1195,6 +1177,8 @@
break;
}
editmode = nvp->EnableEdit();
+ if (editmode)
+ nvp->SetPlaySpeed(1.0, false);
break;
}
case Key_Up:
@@ -1422,7 +1406,7 @@
return;
speed_index = 0;
- activenvp->SetPlaySpeed(1.0);
+ activenvp->SetPlaySpeed(1.0, true);
}
void TV::ChangeSpeed(int direction)
@@ -1451,7 +1435,7 @@
default: speed_index = old_speed; return; break;
}
- activenvp->SetPlaySpeed(speed);
+ activenvp->SetPlaySpeed(speed, (speed == 1.0));
UpdatePosOSD(time, mesg);
if (paused)
@@ -1476,6 +1460,8 @@
doing_ff_rew = 0;
ff_rew_index = SSPEED_NORMAL;
+ activenvp->SetPlaySpeed(1.0, true);
+
return time;
}
@@ -1492,6 +1478,8 @@
if (paused)
paused = activenvp->TogglePause();
+
+ activenvp->SetPlaySpeed(1.0, false);
}
}
More information about the mythtv-dev
mailing list