mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed a long delay at the end when replaying a recording that has stopped recording less than an hour ago
This commit is contained in:
parent
e64ab2a2a7
commit
f7a1954fe3
4
HISTORY
4
HISTORY
@ -7191,7 +7191,7 @@ Video Disk Recorder Revision History
|
||||
turn on adding the source character to channel names whenever they are displayed
|
||||
(suggested by Ludi Kaleni).
|
||||
|
||||
2012-09-02: Version 1.7.30
|
||||
2012-09-05: Version 1.7.30
|
||||
|
||||
- Fixed sorting recordings in the top level video directory.
|
||||
- Fixed handling control characters in SI data in case of UTF-8 encoded strings
|
||||
@ -7221,3 +7221,5 @@ Video Disk Recorder Revision History
|
||||
Christopher Reimer and Udo Richter for contributing to the patch).
|
||||
- By default (without FHS support) the config directory is now set to the value
|
||||
given in the -v option if only -v and no -c is given.
|
||||
- Fixed a long delay at the end when replaying a recording that has stopped recording
|
||||
less than an hour ago (typically time shift mode or a freshly edited recording).
|
||||
|
44
recording.c
44
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.58 2012/07/15 10:47:58 kls Exp $
|
||||
* $Id: recording.c 2.59 2012/09/05 11:45:55 kls Exp $
|
||||
*/
|
||||
|
||||
#include "recording.h"
|
||||
@ -1607,6 +1607,9 @@ struct tIndexTs {
|
||||
#define INDEXFILECHECKINTERVAL 500 // ms between checks for existence of the regenerated index file
|
||||
#define INDEXFILETESTINTERVAL 10 // ms between tests for the size of the index file in case of pausing live video
|
||||
|
||||
cMutex cIndexFile::indexListMutex;
|
||||
cVector<const cIndexFile *> cIndexFile::indexList;
|
||||
|
||||
cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording, bool PauseLive)
|
||||
:resumeFile(FileName, IsPesRecording)
|
||||
{
|
||||
@ -1687,10 +1690,13 @@ cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording, b
|
||||
LOG_ERROR_STR(*fileName);
|
||||
}
|
||||
}
|
||||
if (Record)
|
||||
AddToIndexList(this);
|
||||
}
|
||||
|
||||
cIndexFile::~cIndexFile()
|
||||
{
|
||||
RemoveFromIndexList(this);
|
||||
if (f >= 0)
|
||||
close(f);
|
||||
free(index);
|
||||
@ -1735,8 +1741,7 @@ 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
|
||||
if (!IsInIndexList(this)) {
|
||||
close(f);
|
||||
f = -1;
|
||||
break;
|
||||
@ -1902,6 +1907,39 @@ int cIndexFile::GetLength(const char *FileName, bool IsPesRecording)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void cIndexFile::AddToIndexList(const cIndexFile *IndexFile)
|
||||
{
|
||||
cMutexLock MutexLock(&indexListMutex);
|
||||
for (int i = 0; i < indexList.Size(); i++) {
|
||||
if (!indexList[i]) {
|
||||
indexList[i] = IndexFile;
|
||||
return;
|
||||
}
|
||||
}
|
||||
indexList.Append(IndexFile);
|
||||
}
|
||||
|
||||
void cIndexFile::RemoveFromIndexList(const cIndexFile *IndexFile)
|
||||
{
|
||||
cMutexLock MutexLock(&indexListMutex);
|
||||
for (int i = 0; i < indexList.Size(); i++) {
|
||||
if (indexList[i] == IndexFile) {
|
||||
indexList[i] = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool cIndexFile::IsInIndexList(const cIndexFile *IndexFile)
|
||||
{
|
||||
cMutexLock MutexLock(&indexListMutex);
|
||||
for (int i = 0; i < indexList.Size(); i++) {
|
||||
if (indexList[i] && !strcmp(indexList[i]->fileName, IndexFile->fileName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GenerateIndex(const char *FileName)
|
||||
{
|
||||
if (DirectoryOk(FileName)) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: recording.h 2.34 2012/06/09 13:55:22 kls Exp $
|
||||
* $Id: recording.h 2.35 2012/09/05 11:25:33 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __RECORDING_H
|
||||
@ -275,6 +275,11 @@ private:
|
||||
cResumeFile resumeFile;
|
||||
cIndexFileGenerator *indexFileGenerator;
|
||||
cMutex mutex;
|
||||
static cMutex indexListMutex;
|
||||
static cVector<const cIndexFile *> indexList;
|
||||
static void AddToIndexList(const cIndexFile *IndexFile);
|
||||
static void RemoveFromIndexList(const cIndexFile *IndexFile);
|
||||
static bool IsInIndexList(const cIndexFile *IndexFile);
|
||||
static cString IndexFileName(const char *FileName, bool IsPesRecording);
|
||||
void ConvertFromPes(tIndexTs *IndexTs, int Count);
|
||||
void ConvertToPes(tIndexTs *IndexTs, int Count);
|
||||
|
Loading…
Reference in New Issue
Block a user