summaryrefslogtreecommitdiff
path: root/dvbplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'dvbplayer.c')
-rw-r--r--dvbplayer.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/dvbplayer.c b/dvbplayer.c
index 9de7e48..6e00440 100644
--- a/dvbplayer.c
+++ b/dvbplayer.c
@@ -4,10 +4,11 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbplayer.c 2.1 2009/01/05 16:52:40 kls Exp $
+ * $Id: dvbplayer.c 2.3 2009/01/25 11:11:39 kls Exp $
*/
#include "dvbplayer.h"
+#include <math.h>
#include <stdlib.h>
#include "recording.h"
#include "remux.h"
@@ -347,7 +348,7 @@ bool cDvbPlayer::Save(void)
if (index) {
int Index = writeIndex;
if (Index >= 0) {
- Index -= RESUMEBACKUP * framesPerSecond;
+ Index -= int(round(RESUMEBACKUP * framesPerSecond));
if (Index > 0)
Index = index->GetNextIFrame(Index, false);
else
@@ -411,8 +412,12 @@ void cDvbPlayer::Action(void)
if (index->Get(readIndex + 1, &FileNumber, &FileOffset, NULL, &Length))
Index = readIndex + 1;
}
- else
- Index = index->GetNextIFrame(readIndex, playDir == pdForward, &FileNumber, &FileOffset, &Length, TimeShiftMode);
+ else {
+ int d = int(round(0.4 * framesPerSecond));
+ if (playDir != pdForward)
+ d = -d;
+ Index = index->GetNextIFrame(readIndex + d, playDir == pdForward, &FileNumber, &FileOffset, &Length, TimeShiftMode);
+ }
if (Index >= 0) {
if (!NextFile(FileNumber, FileOffset)) {
readIndex = Index;
@@ -515,9 +520,9 @@ void cDvbPlayer::Action(void)
if (p) {
int w;
if (isPesRecording)
- w = PlayPes(p, pc, playMode != pmPlay);
+ w = PlayPes(p, pc, playMode != pmPlay && DeviceIsPlayingVideo());
else
- w = PlayTs(p, TS_SIZE, playMode != pmPlay);
+ w = PlayTs(p, TS_SIZE, playMode != pmPlay && DeviceIsPlayingVideo());
if (w > 0) {
p += w;
pc -= w;
@@ -592,7 +597,8 @@ void cDvbPlayer::Forward(void)
LOCK_THREAD;
if (!(DeviceHasIBPTrickSpeed() && playDir == pdForward))
Empty();
- DeviceMute();
+ if (DeviceIsPlayingVideo())
+ DeviceMute();
playMode = pmFast;
playDir = pdForward;
trickSpeed = NORMAL_SPEED;
@@ -638,7 +644,8 @@ void cDvbPlayer::Backward(void)
case pmPlay: {
LOCK_THREAD;
Empty();
- DeviceMute();
+ if (DeviceIsPlayingVideo())
+ DeviceMute();
playMode = pmFast;
playDir = pdBackward;
trickSpeed = NORMAL_SPEED;