summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-02-27 13:40:43 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2011-02-27 13:40:43 +0100
commit61c6b36bbc2b624dba44082701818d843f4f00b3 (patch)
treefb06594cdd7fd38c4892ef97eec281d400c88046 /recording.c
parentcd3c26b815d5f021670d8476ae8ef04f334ed1ab (diff)
downloadvdr-61c6b36bbc2b624dba44082701818d843f4f00b3.tar.gz
vdr-61c6b36bbc2b624dba44082701818d843f4f00b3.tar.bz2
While replaying, the editing marks are now updated every 10 seconds
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c29
1 files changed, 23 insertions, 6 deletions
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<cMark>::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<cMark>::Load(fileName)) {
+ Sort();
+ return true;
+ }
+ }
}
return false;
}