diff -Naur vdr-1.5.8.org/dvbplayer.c vdr-1.5.8/dvbplayer.c --- vdr-1.5.8.org/dvbplayer.c 2009-01-09 21:03:52.805620964 -0500 +++ vdr-1.5.8/dvbplayer.c 2009-01-10 09:33:11.129871027 -0500 @@ -584,14 +584,17 @@ uchar *p = NULL; int pc = 0; +// fprintf(stdout,"dvbplayer.c:Action\n"); readIndex = Resume(); - if (readIndex >= 0) + if (readIndex >= 0) { isyslog("resuming replay at index %d (%s)", readIndex, *IndexToHMSF(readIndex, true, GetFramesPerSec())); - +// fprintf(stdout, "resuming replay at index %d (%s)\n", readIndex, *IndexToHMSF(readIndex, true, GetFramesPerSec())); + } nonBlockingFileReader = new cNonBlockingFileReader; int Length = 0; bool Sleep = false; bool WaitingForData = false; + int first_tune = 1; while (Running() && (NextFile() || readIndex >= 0 || ringBuffer->Available() || !DeviceFlush(100))) { if (Sleep) { @@ -616,6 +619,19 @@ Sleep=true; continue; } + if (index->GetLast() >= Setup.Frameswait +1 && playMode != pmPause && first_tune == 1) { + Pause(); +// usleep(250); +// fprintf(stdout,"dvbplayer.c:624 index->GetLast = %d, Setup.Frameswait = %d, playMode = %d\n", index->GetLast(), Setup.Frameswait, playMode); + continue; + } + if (index->GetLast() < Setup.Frameswait + 10 && playMode == pmPause && first_tune == 1) + continue; + if (index->GetLast() >= Setup.Frameswait + 10 && playMode == pmPause && first_tune == 1) { +// fprintf(stdout,"dvbplayer.c:628 index->GetLast = %d, Setup.Frameswait = %d, playMode = %d\n", index->GetLast(), Setup.Frameswait, playMode); + Play(); + first_tune = 0; + } cPoller Poller; if (DevicePoll(Poller, 100)) { @@ -804,14 +820,31 @@ void cDvbPlayer::Play(void) { + fprintf(stdout,"dvbplayer.c:Before Play playMode = %d, playDir = %d, readIndex = %d, writeIndex = %d, index = %d\n", playMode, playDir, readIndex, writeIndex, index); +// if (isLiveRec) +// fprintf(stdout, "isLiveRec = true\n"); +// else +// fprintf(stdout, "isLiveRec = false\n"); if (playMode != pmPlay) { LOCK_THREAD; + int Current, Total; + GetIndex(Current, Total, true); + printf("Current = %d, Total = %d\n", Current, Total); + if (playMode == pmFast && playDir == pdBackward && !isLiveRec && Total > (Current + 2340)) + Goto(SkipFrames(2340), false); + if (playMode == pmFast && playDir == pdForward && !isLiveRec && (Current - 2180) > 0) + Goto(SkipFrames(-2180), false); + if (playMode == pmFast && playDir == pdBackward && isLiveRec && Total > (Current + 2340)) + Goto(SkipFrames(2340), false); + if (playMode == pmFast && playDir == pdForward && isLiveRec && (Current - 2180) > 0) + Goto(SkipFrames(-2180), false); if (playMode == pmStill || playMode == pmFast || (playMode == pmSlow && playDir == pdBackward)) Empty(); DevicePlay(); playMode = pmPlay; playDir = pdForward; } +// fprintf(stdout,"dvbplayer.c:After Play playMode = %d, playDir = %d, readIndex = %d, writeIndex = %d, index = %d\n", playMode, playDir, readIndex, writeIndex, index); } void cDvbPlayer::Forward(void) @@ -878,6 +911,7 @@ LOCK_THREAD; Empty(); DeviceMute(); + Goto(SkipFrames(-330), false); playMode = pmFast; playDir = pdBackward; trickSpeed = NORMAL_SPEED; @@ -911,6 +945,7 @@ int cDvbPlayer::SkipFrames(int Frames) { +// fprintf(stdout, "SkipFrames\n"); if (index && Frames) { int Current, Total; GetIndex(Current, Total, true); @@ -929,7 +964,7 @@ if (index && Seconds) { LOCK_THREAD; Empty(); - int Index = writeIndex; + int Index = max(writeIndex - 11 * GetFramesPerSec(), 0); if (Index >= 0) { Index = max(Index + Seconds * GetFramesPerSec(), 0); if (Index > 0)