mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Speeded up opening menus on systems with many (several thousands) of recordings, by caching the information whether a recording is stored on the video directory file system within the cRecording data
This commit is contained in:
parent
47e3b4afe2
commit
3efb79c855
@ -2862,6 +2862,8 @@ Torsten Lang <info@torstenlang.de>
|
|||||||
for suggesting to make BIDI support check at runtime whether the system runs with
|
for suggesting to make BIDI support check at runtime whether the system runs with
|
||||||
UTF-8
|
UTF-8
|
||||||
for reporting a bug in checking for UTF-8 support in cFont::Bidi()
|
for reporting a bug in checking for UTF-8 support in cFont::Bidi()
|
||||||
|
for a patch that was used to implement caching the information whether a recording
|
||||||
|
is stored on the video directory file system within the cRecording data
|
||||||
|
|
||||||
Christian Ruppert <idl0r@gentoo.org>
|
Christian Ruppert <idl0r@gentoo.org>
|
||||||
for some improvements to the Makefiles
|
for some improvements to the Makefiles
|
||||||
|
5
HISTORY
5
HISTORY
@ -7052,7 +7052,7 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank
|
- Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank
|
||||||
Schmirler).
|
Schmirler).
|
||||||
|
|
||||||
2012-06-02: Version 1.7.28
|
2012-06-03: Version 1.7.28
|
||||||
|
|
||||||
- Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4.
|
- Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4.
|
||||||
- Fixed getting the maximum short channel name length in case there are no short names
|
- Fixed getting the maximum short channel name length in case there are no short names
|
||||||
@ -7144,3 +7144,6 @@ Video Disk Recorder Revision History
|
|||||||
Christian Richter).
|
Christian Richter).
|
||||||
- Added DeleteEvent() to the EPG handler interface, so that an EPG handler can trigger
|
- Added DeleteEvent() to the EPG handler interface, so that an EPG handler can trigger
|
||||||
deleting of an event (thanks to Christian Kaiser).
|
deleting of an event (thanks to Christian Kaiser).
|
||||||
|
- Speeded up opening menus on systems with many (several thousands) of recordings, by
|
||||||
|
caching the information whether a recording is stored on the video directory file
|
||||||
|
system within the cRecording data (based on a patch from Torsten Lang).
|
||||||
|
19
recording.c
19
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.55 2012/06/02 13:52:05 kls Exp $
|
* $Id: recording.c 2.56 2012/06/03 09:51:27 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
@ -153,7 +153,7 @@ void AssertFreeDiskSpace(int Priority, bool Force)
|
|||||||
cRecording *r = DeletedRecordings.First();
|
cRecording *r = DeletedRecordings.First();
|
||||||
cRecording *r0 = NULL;
|
cRecording *r0 = NULL;
|
||||||
while (r) {
|
while (r) {
|
||||||
if (IsOnVideoDirectoryFileSystem(r->FileName())) { // only remove recordings that will actually increase the free video disk space
|
if (r->IsOnVideoDirectoryFileSystem()) { // only remove recordings that will actually increase the free video disk space
|
||||||
if (!r0 || r->Start() < r0->Start())
|
if (!r0 || r->Start() < r0->Start())
|
||||||
r0 = r;
|
r0 = r;
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ void AssertFreeDiskSpace(int Priority, bool Force)
|
|||||||
cRecording *r = Recordings.First();
|
cRecording *r = Recordings.First();
|
||||||
cRecording *r0 = NULL;
|
cRecording *r0 = NULL;
|
||||||
while (r) {
|
while (r) {
|
||||||
if (IsOnVideoDirectoryFileSystem(r->FileName())) { // only delete recordings that will actually increase the free video disk space
|
if (r->IsOnVideoDirectoryFileSystem()) { // only delete recordings that will actually increase the free video disk space
|
||||||
if (!r->IsEdited() && r->Lifetime() < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever
|
if (!r->IsEdited() && r->Lifetime() < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever
|
||||||
if ((r->Lifetime() == 0 && Priority > r->Priority()) || // the recording has no guaranteed lifetime and the new recording has higher priority
|
if ((r->Lifetime() == 0 && Priority > r->Priority()) || // the recording has no guaranteed lifetime and the new recording has higher priority
|
||||||
(r->Lifetime() > 0 && (time(NULL) - r->Start()) / SECSINDAY >= r->Lifetime())) { // the recording's guaranteed lifetime has expired
|
(r->Lifetime() > 0 && (time(NULL) - r->Start()) / SECSINDAY >= r->Lifetime())) { // the recording's guaranteed lifetime has expired
|
||||||
@ -617,6 +617,7 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
|
|||||||
channel = Timer->Channel()->Number();
|
channel = Timer->Channel()->Number();
|
||||||
instanceId = InstanceId;
|
instanceId = InstanceId;
|
||||||
isPesRecording = false;
|
isPesRecording = false;
|
||||||
|
isOnVideoDirectoryFileSystem = -1; // unknown
|
||||||
framesPerSecond = DEFAULTFRAMESPERSECOND;
|
framesPerSecond = DEFAULTFRAMESPERSECOND;
|
||||||
numFrames = -1;
|
numFrames = -1;
|
||||||
deleted = 0;
|
deleted = 0;
|
||||||
@ -677,6 +678,7 @@ cRecording::cRecording(const char *FileName)
|
|||||||
priority = MAXPRIORITY; // assume maximum in case there is no info file
|
priority = MAXPRIORITY; // assume maximum in case there is no info file
|
||||||
lifetime = MAXLIFETIME;
|
lifetime = MAXLIFETIME;
|
||||||
isPesRecording = false;
|
isPesRecording = false;
|
||||||
|
isOnVideoDirectoryFileSystem = -1; // unknown
|
||||||
framesPerSecond = DEFAULTFRAMESPERSECOND;
|
framesPerSecond = DEFAULTFRAMESPERSECOND;
|
||||||
numFrames = -1;
|
numFrames = -1;
|
||||||
deleted = 0;
|
deleted = 0;
|
||||||
@ -952,6 +954,13 @@ bool cRecording::IsEdited(void) const
|
|||||||
return *s == '%';
|
return *s == '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cRecording::IsOnVideoDirectoryFileSystem(void) const
|
||||||
|
{
|
||||||
|
if (isOnVideoDirectoryFileSystem < 0)
|
||||||
|
isOnVideoDirectoryFileSystem = ::IsOnVideoDirectoryFileSystem(FileName());
|
||||||
|
return isOnVideoDirectoryFileSystem;
|
||||||
|
}
|
||||||
|
|
||||||
void cRecording::ReadInfo(void)
|
void cRecording::ReadInfo(void)
|
||||||
{
|
{
|
||||||
info->Read();
|
info->Read();
|
||||||
@ -1253,7 +1262,7 @@ int cRecordings::TotalFileSizeMB(void)
|
|||||||
LOCK_THREAD;
|
LOCK_THREAD;
|
||||||
for (cRecording *recording = First(); recording; recording = Next(recording)) {
|
for (cRecording *recording = First(); recording; recording = Next(recording)) {
|
||||||
int FileSizeMB = recording->FileSizeMB();
|
int FileSizeMB = recording->FileSizeMB();
|
||||||
if (FileSizeMB > 0 && IsOnVideoDirectoryFileSystem(recording->FileName()))
|
if (FileSizeMB > 0 && recording->IsOnVideoDirectoryFileSystem())
|
||||||
size += FileSizeMB;
|
size += FileSizeMB;
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
@ -1265,7 +1274,7 @@ double cRecordings::MBperMinute(void)
|
|||||||
int length = 0;
|
int length = 0;
|
||||||
LOCK_THREAD;
|
LOCK_THREAD;
|
||||||
for (cRecording *recording = First(); recording; recording = Next(recording)) {
|
for (cRecording *recording = First(); recording; recording = Next(recording)) {
|
||||||
if (IsOnVideoDirectoryFileSystem(recording->FileName())) {
|
if (recording->IsOnVideoDirectoryFileSystem()) {
|
||||||
int FileSizeMB = recording->FileSizeMB();
|
int FileSizeMB = recording->FileSizeMB();
|
||||||
if (FileSizeMB > 0) {
|
if (FileSizeMB > 0) {
|
||||||
int LengthInSeconds = recording->LengthInSeconds();
|
int LengthInSeconds = recording->LengthInSeconds();
|
||||||
|
@ -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.32 2012/06/02 13:46:55 kls Exp $
|
* $Id: recording.h 2.33 2012/06/03 09:49:09 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RECORDING_H
|
#ifndef __RECORDING_H
|
||||||
@ -91,6 +91,7 @@ private:
|
|||||||
int channel;
|
int channel;
|
||||||
int instanceId;
|
int instanceId;
|
||||||
bool isPesRecording;
|
bool isPesRecording;
|
||||||
|
mutable int isOnVideoDirectoryFileSystem; // -1 = unknown, 0 = no, 1 = yes
|
||||||
double framesPerSecond;
|
double framesPerSecond;
|
||||||
cRecordingInfo *info;
|
cRecordingInfo *info;
|
||||||
cRecording(const cRecording&); // can't copy cRecording
|
cRecording(const cRecording&); // can't copy cRecording
|
||||||
@ -130,6 +131,7 @@ public:
|
|||||||
bool IsNew(void) const { return GetResume() <= 0; }
|
bool IsNew(void) const { return GetResume() <= 0; }
|
||||||
bool IsEdited(void) const;
|
bool IsEdited(void) const;
|
||||||
bool IsPesRecording(void) const { return isPesRecording; }
|
bool IsPesRecording(void) const { return isPesRecording; }
|
||||||
|
bool IsOnVideoDirectoryFileSystem(void) const;
|
||||||
void ReadInfo(void);
|
void ReadInfo(void);
|
||||||
bool WriteInfo(void);
|
bool WriteInfo(void);
|
||||||
void SetStartTime(time_t Start);
|
void SetStartTime(time_t Start);
|
||||||
|
Loading…
Reference in New Issue
Block a user