From 22cb026e5e3cb12667d6e07db585a41d748bb55a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 22 Dec 2016 11:40:25 +0100 Subject: [PATCH] Fixed replaying recordings to their very end, if they don't end with an I-frame --- CONTRIBUTORS | 1 + HISTORY | 2 ++ dvbplayer.c | 15 ++++++--------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d89a6037..e717e36e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3330,6 +3330,7 @@ Thomas Reufer for fixing resuming replay at a given position, which was off by one frame for improving handling frame numbers to have a smoother progress display during replay of recordings with B-frames + for fixing replaying recordings to their very end, if they don't end with an I-frame Eike Sauer for reporting a problem with channels that need more than 5 TS packets for detecting diff --git a/HISTORY b/HISTORY index 722cebfe..8b8130b2 100644 --- a/HISTORY +++ b/HISTORY @@ -8859,3 +8859,5 @@ Video Disk Recorder Revision History to Thomas Reufer). - Improved handling frame numbers to have a smoother progress display during replay of recordings with B-frames (thanks to Thomas Reufer). +- Fixed replaying recordings to their very end, if they don't end with an I-frame + (thanks to Thomas Reufer). diff --git a/dvbplayer.c b/dvbplayer.c index 6db497e3..ca007353 100644 --- a/dvbplayer.c +++ b/dvbplayer.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbplayer.c 4.3 2016/12/22 10:43:10 kls Exp $ + * $Id: dvbplayer.c 4.4 2016/12/22 11:34:31 kls Exp $ */ #include "dvbplayer.h" @@ -476,7 +476,7 @@ void cDvbPlayer::Action(void) bool WaitingForData = false; time_t StuckAtEof = 0; uint32_t LastStc = 0; - int LastReadIFrame = -1; + int LastReadFrame = -1; int SwitchToPlayFrame = 0; bool CutIn = false; bool AtLastMark = false; @@ -580,12 +580,9 @@ void cDvbPlayer::Action(void) int r = nonBlockingFileReader->Result(&b); if (r > 0) { WaitingForData = false; - uint32_t Pts = 0; - if (readIndependent) { - Pts = isPesRecording ? PesGetPts(b) : TsGetPts(b, r); - LastReadIFrame = readIndex; - } - readFrame = new cFrame(b, -r, ftUnknown, readIndex, Pts); // hands over b to the ringBuffer + LastReadFrame = readIndex; + uint32_t Pts = isPesRecording ? (PesHasPts(b) ? PesGetPts(b) : -1) : TsGetPts(b, r); + readFrame = new cFrame(b, -r, ftUnknown, readIndex, Pts, readIndependent); // hands over b to the ringBuffer } else if (r < 0) { if (errno == EAGAIN) @@ -703,7 +700,7 @@ void cDvbPlayer::Action(void) LastStc = Stc; int Index = ptsIndex.FindIndex(Stc); if (playDir == pdForward && !SwitchToPlayFrame) { - if (Index >= LastReadIFrame) + if (Index >= LastReadFrame) break; // automatically stop at end of recording } else if (Index <= 0 || SwitchToPlayFrame && Index >= SwitchToPlayFrame)