diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-08-24 15:08:25 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-08-24 15:08:25 +0200 |
commit | 02f34ec0bf0d04cf0e6c0900453aae838933c78c (patch) | |
tree | df5128424094b1e0aaa11808fb67734f2e748425 | |
parent | fd682083a4d79d82113f345ac9b56d7afb1ed868 (diff) | |
download | vdr-02f34ec0bf0d04cf0e6c0900453aae838933c78c.tar.gz vdr-02f34ec0bf0d04cf0e6c0900453aae838933c78c.tar.bz2 |
Fixed replaying the last few seconds of a recording
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | config.h | 4 | ||||
-rw-r--r-- | dvbplayer.c | 17 | ||||
-rw-r--r-- | recording.c | 13 |
4 files changed, 27 insertions, 11 deletions
@@ -1415,3 +1415,7 @@ Video Disk Recorder Revision History - VDR no longer gives up if there is no DVB device. It continues to work if there is at least one device, either a DVB device found by the core VDR code itself, or a device implemented by a plugin. + +2002-08-24: Version 1.1.8 + +- Fixed replaying the last few seconds of a recording. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.123 2002/08/11 11:36:36 kls Exp $ + * $Id: config.h 1.124 2002/08/24 10:23:48 kls Exp $ */ #ifndef __CONFIG_H @@ -20,7 +20,7 @@ #include "eit.h" #include "tools.h" -#define VDRVERSION "1.1.7" +#define VDRVERSION "1.1.8" #define MAXPRIORITY 99 #define MAXLIFETIME 99 diff --git a/dvbplayer.c b/dvbplayer.c index 2ca5a62d..7a6d76d3 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 1.11 2002/08/16 09:16:38 kls Exp $ + * $Id: dvbplayer.c 1.12 2002/08/24 14:59:35 kls Exp $ */ #include "dvbplayer.h" @@ -307,7 +307,7 @@ void cDvbPlayer::Action(void) isyslog("resuming replay at index %d (%s)", readIndex, IndexToHMSF(readIndex, true)); running = true; - while (running && NextFile()) { + while (running && (NextFile() || readIndex >= 0 || ringBuffer->Available())) { cPoller Poller; if (!readFrame) Poller.Add(replayFile, false); @@ -317,7 +317,7 @@ void cDvbPlayer::Action(void) // Read the next frame from the file: - if (!readFrame) { + if (!readFrame && (replayFile >= 0 || readIndex >= 0)) { if (playMode != pmStill) { int r = 0; if (playMode == pmFast || (playMode == pmSlow && playDir == pdBackward)) { @@ -326,7 +326,7 @@ void cDvbPlayer::Action(void) int Index = index->GetNextIFrame(readIndex, playDir == pdForward, &FileNumber, &FileOffset, &Length, true); if (Index >= 0) { if (!NextFile(FileNumber, FileOffset)) - break; + continue; } else { // can't call Play() here, because those functions may only be @@ -347,8 +347,11 @@ void cDvbPlayer::Action(void) uchar FileNumber; int FileOffset, Length; readIndex++; - if (!(index->Get(readIndex, &FileNumber, &FileOffset, NULL, &Length) && NextFile(FileNumber, FileOffset))) - break; + if (!(index->Get(readIndex, &FileNumber, &FileOffset, NULL, &Length) && NextFile(FileNumber, FileOffset))) { + readIndex = -1; + eof = true; + continue; + } r = ReadFrame(replayFile, b, Length, sizeof(b)); } else // allows replay even if the index file is missing @@ -557,7 +560,7 @@ void cDvbPlayer::SkipSeconds(int Seconds) if (Index > 0) Index = index->GetNextIFrame(Index, false, NULL, NULL, NULL, true); if (Index >= 0) - readIndex = writeIndex = Index - 1; // Input() will first increment it! + readIndex = writeIndex = Index - 1; // Action() will first increment it! } Play(); } diff --git a/recording.c b/recording.c index be915400..c9234468 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.66 2002/08/11 11:48:11 kls Exp $ + * $Id: recording.c 1.67 2002/08/24 14:09:49 kls Exp $ */ #include "recording.h" @@ -756,6 +756,9 @@ void cRecordingUserCommand::InvokeCommand(const char *State, const char *Recordi // The maximum time to wait before giving up while catching up on an index file: #define MAXINDEXCATCHUP 2 // seconds +// The minimum age of an index file for considering it no longer to be written: +#define MININDEXAGE 10 // seconds + cIndexFile::cIndexFile(const char *FileName, bool Record) :resumeFile(FileName) { @@ -838,6 +841,12 @@ bool cIndexFile::CatchUp(int Index) for (int i = 0; i <= MAXINDEXCATCHUP && (Index < 0 || Index >= last); i++) { struct stat buf; if (fstat(f, &buf) == 0) { + if (time(NULL) - buf.st_mtime > MININDEXAGE) { + // apparently the index file is not being written any more + close(f); + f = -1; + return false; + } int newLast = buf.st_size / sizeof(tIndex) - 1; if (newLast > last) { if (size <= newLast) { @@ -897,7 +906,7 @@ bool cIndexFile::Get(int Index, uchar *FileNumber, int *FileOffset, uchar *Pictu { if (index) { CatchUp(Index); - if (Index >= 0 && Index <= last) { + if (Index >= 0 && Index < last) { *FileNumber = index[Index].number; *FileOffset = index[Index].offset; if (PictureType) |