mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Made updating the editing marks during replay react faster in case the marks file has just been written
This commit is contained in:
parent
d1dd7df17a
commit
31d4abab37
2
HISTORY
2
HISTORY
@ -6564,3 +6564,5 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed some direct comparisons of double values.
|
- Fixed some direct comparisons of double values.
|
||||||
- Fixed detecting frames on channels that broadcast with separate "fields" instead
|
- Fixed detecting frames on channels that broadcast with separate "fields" instead
|
||||||
of complete frames.
|
of complete frames.
|
||||||
|
- Made updating the editing marks during replay react faster in case the marks
|
||||||
|
file has just been written.
|
||||||
|
30
recording.c
30
recording.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: recording.c 2.26 2011/02/27 13:35:20 kls Exp $
|
* $Id: recording.c 2.27 2011/03/20 10:33:30 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
@ -1270,7 +1270,7 @@ bool cMarks::Load(const char *RecordingFileName, double FramesPerSecond, bool Is
|
|||||||
{
|
{
|
||||||
fileName = AddDirectory(RecordingFileName, IsPesRecording ? MARKSFILESUFFIX ".vdr" : MARKSFILESUFFIX);
|
fileName = AddDirectory(RecordingFileName, IsPesRecording ? MARKSFILESUFFIX ".vdr" : MARKSFILESUFFIX);
|
||||||
framesPerSecond = FramesPerSecond;
|
framesPerSecond = FramesPerSecond;
|
||||||
lastUpdate = 0;
|
nextUpdate = 0;
|
||||||
lastFileTime = -1; // the first call to Load() must take place!
|
lastFileTime = -1; // the first call to Load() must take place!
|
||||||
return Update();
|
return Update();
|
||||||
}
|
}
|
||||||
@ -1278,11 +1278,27 @@ bool cMarks::Load(const char *RecordingFileName, double FramesPerSecond, bool Is
|
|||||||
bool cMarks::Update(void)
|
bool cMarks::Update(void)
|
||||||
{
|
{
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
if (t - lastUpdate > MARKSUPDATEDELTA) {
|
if (t > nextUpdate) {
|
||||||
lastUpdate = t;
|
time_t LastModified = LastModifiedTime(fileName);
|
||||||
t = LastModifiedTime(fileName);
|
int d;
|
||||||
if (t > lastFileTime) {
|
if (LastModified > 0) // the file exists
|
||||||
lastFileTime = t;
|
d = t - LastModified;
|
||||||
|
else { // the file doesn't exist
|
||||||
|
if (lastFileTime <= 0) {
|
||||||
|
lastFileTime = t - 2; // -2 makes sure we don't miss an update within the very same second
|
||||||
|
LastModified = t; // make sure we run into the actual Load() below
|
||||||
|
}
|
||||||
|
d = t - lastFileTime;
|
||||||
|
}
|
||||||
|
if (d < 60)
|
||||||
|
d = 1; // check frequently if the file has just been modified
|
||||||
|
else if (d < 3600)
|
||||||
|
d = 10; // older files are checked less frequently
|
||||||
|
else
|
||||||
|
d /= 360; // phase out checking for very old files
|
||||||
|
nextUpdate = t + d;
|
||||||
|
if (LastModified > lastFileTime) {
|
||||||
|
lastFileTime = LastModified;
|
||||||
cMutexLock MutexLock(&MutexMarkFramesPerSecond);
|
cMutexLock MutexLock(&MutexMarkFramesPerSecond);
|
||||||
MarkFramesPerSecond = framesPerSecond;
|
MarkFramesPerSecond = framesPerSecond;
|
||||||
if (cConfig<cMark>::Load(fileName)) {
|
if (cConfig<cMark>::Load(fileName)) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: recording.h 2.16 2011/02/27 12:48:21 kls Exp $
|
* $Id: recording.h 2.17 2011/03/20 10:33:30 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RECORDING_H
|
#ifndef __RECORDING_H
|
||||||
@ -192,7 +192,7 @@ class cMarks : public cConfig<cMark> {
|
|||||||
private:
|
private:
|
||||||
cString fileName;
|
cString fileName;
|
||||||
double framesPerSecond;
|
double framesPerSecond;
|
||||||
time_t lastUpdate;
|
time_t nextUpdate;
|
||||||
time_t lastFileTime;
|
time_t lastFileTime;
|
||||||
public:
|
public:
|
||||||
bool Load(const char *RecordingFileName, double FramesPerSecond = DEFAULTFRAMESPERSECOND, bool IsPesRecording = false);
|
bool Load(const char *RecordingFileName, double FramesPerSecond = DEFAULTFRAMESPERSECOND, bool IsPesRecording = false);
|
||||||
|
Loading…
Reference in New Issue
Block a user