From 61c6b36bbc2b624dba44082701818d843f4f00b3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 27 Feb 2011 13:40:43 +0100 Subject: [PATCH] While replaying, the editing marks are now updated every 10 seconds --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ menu.c | 4 +++- recording.c | 29 +++++++++++++++++++++++------ recording.h | 6 +++++- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 43ac71f6..b12d2db1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2575,6 +2575,8 @@ Manuel Reimer for fixing saving terminal settings when running in background for making the SVDRP port open only for the local host if svdrphosts.conf contains only the address of the local host + for a patch that was used as a base for making editing marks be updated every 10 + seconds during replay Rene van den Braken for reporting a bug in writing the PCR pid into the PMT in diff --git a/HISTORY b/HISTORY index dff32449..9e387a9f 100644 --- a/HISTORY +++ b/HISTORY @@ -6545,3 +6545,5 @@ Video Disk Recorder Revision History (thanks to Anssi Hannula). - Changed the compiler optimization flag to -O3, which gives quite a performance boost in the AlphaBlend() function. +- While replaying, the editing marks are now updated every 10 seconds (based on a + patch from Manuel Reimer). diff --git a/menu.c b/menu.c index d68a724d..2ba1de8e 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 2.27 2011/02/26 15:28:32 kls Exp $ + * $Id: menu.c 2.28 2011/02/27 12:37:48 kls Exp $ */ #include "menu.h" @@ -4742,6 +4742,8 @@ eOSState cReplayControl::ProcessKey(eKeys Key) { if (!Active()) return osEnd; + if (Key == kNone) + marks.Update(); if (visible) { if (timeoutShow && time(NULL) > timeoutShow) { Hide(); diff --git a/recording.c b/recording.c index b86300d2..02a6e612 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 2.25 2011/02/25 14:35:19 kls Exp $ + * $Id: recording.c 2.26 2011/02/27 13:35:20 kls Exp $ */ #include "recording.h" @@ -57,6 +57,7 @@ #define DELETEDLIFETIME 300 // seconds after which a deleted recording will be actually removed #define DISKCHECKDELTA 100 // seconds between checks for free disk space #define REMOVELATENCY 10 // seconds to wait until next check after removing a file +#define MARKSUPDATEDELTA 10 // seconds between checks for updating editing marks #define MAX_SUBTITLE_LENGTH 40 @@ -1267,12 +1268,28 @@ bool cMark::Save(FILE *f) bool cMarks::Load(const char *RecordingFileName, double FramesPerSecond, bool IsPesRecording) { - cMutexLock MutexLock(&MutexMarkFramesPerSecond); + fileName = AddDirectory(RecordingFileName, IsPesRecording ? MARKSFILESUFFIX ".vdr" : MARKSFILESUFFIX); framesPerSecond = FramesPerSecond; - MarkFramesPerSecond = framesPerSecond; - if (cConfig::Load(AddDirectory(RecordingFileName, IsPesRecording ? MARKSFILESUFFIX ".vdr" : MARKSFILESUFFIX))) { - Sort(); - return true; + lastUpdate = 0; + lastFileTime = -1; // the first call to Load() must take place! + return Update(); +} + +bool cMarks::Update(void) +{ + time_t t = time(NULL); + if (t - lastUpdate > MARKSUPDATEDELTA) { + lastUpdate = t; + t = LastModifiedTime(fileName); + if (t > lastFileTime) { + lastFileTime = t; + cMutexLock MutexLock(&MutexMarkFramesPerSecond); + MarkFramesPerSecond = framesPerSecond; + if (cConfig::Load(fileName)) { + Sort(); + return true; + } + } } return false; } diff --git a/recording.h b/recording.h index 7510a6e1..93b5a9cc 100644 --- a/recording.h +++ b/recording.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.h 2.15 2010/12/27 10:48:21 kls Exp $ + * $Id: recording.h 2.16 2011/02/27 12:48:21 kls Exp $ */ #ifndef __RECORDING_H @@ -190,9 +190,13 @@ public: class cMarks : public cConfig { private: + cString fileName; double framesPerSecond; + time_t lastUpdate; + time_t lastFileTime; public: bool Load(const char *RecordingFileName, double FramesPerSecond = DEFAULTFRAMESPERSECOND, bool IsPesRecording = false); + bool Update(void); void Sort(void); cMark *Add(int Position); cMark *Get(int Position);