1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Now updating the 'frames per second' data in the list of recordings when a new recording is started that has a frame rate other than the default

This commit is contained in:
Klaus Schmidinger 2010-12-27 12:25:19 +01:00
parent 6c0612546e
commit 9f60bd2fc4
5 changed files with 35 additions and 11 deletions

View File

@ -6515,3 +6515,5 @@ Video Disk Recorder Revision History
to Dominik Strasser). to Dominik Strasser).
- Added LDFLAGS to the linker calls in the Makefiles (thanks to Joerg Bornkessel and - Added LDFLAGS to the linker calls in the Makefiles (thanks to Joerg Bornkessel and
Paul Menzel). Paul Menzel).
- Now updating the 'frames per second' data in the list of recordings when a new
recording is started that has a frame rate other than the default.

View File

@ -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: recorder.c 2.8 2010/01/29 16:37:22 kls Exp $ * $Id: recorder.c 2.9 2010/12/27 11:35:46 kls Exp $
*/ */
#include "recorder.h" #include "recorder.h"
@ -24,8 +24,9 @@
cRecorder::cRecorder(const char *FileName, const cChannel *Channel, int Priority) cRecorder::cRecorder(const char *FileName, const cChannel *Channel, int Priority)
:cReceiver(Channel, Priority) :cReceiver(Channel, Priority)
,cThread("recording") ,cThread("recording")
,recordingInfo(FileName)
{ {
recordingName = strdup(FileName);
// Make sure the disk is up and running: // Make sure the disk is up and running:
SpinUpDisk(FileName); SpinUpDisk(FileName);
@ -69,6 +70,7 @@ cRecorder::~cRecorder()
delete fileName; delete fileName;
delete frameDetector; delete frameDetector;
delete ringBuffer; delete ringBuffer;
free(recordingName);
} }
bool cRecorder::RunningLowOnDiskSpace(void) bool cRecorder::RunningLowOnDiskSpace(void)
@ -127,10 +129,12 @@ void cRecorder::Action(void)
break; break;
if (frameDetector->Synced()) { if (frameDetector->Synced()) {
if (!InfoWritten) { if (!InfoWritten) {
if (recordingInfo.Read()) { cRecordingInfo RecordingInfo(recordingName);
if (frameDetector->FramesPerSecond() > 0 && !DoubleEqual(recordingInfo.FramesPerSecond(), frameDetector->FramesPerSecond())) { if (RecordingInfo.Read()) {
recordingInfo.SetFramesPerSecond(frameDetector->FramesPerSecond()); if (frameDetector->FramesPerSecond() > 0 && !DoubleEqual(RecordingInfo.FramesPerSecond(), frameDetector->FramesPerSecond())) {
recordingInfo.Write(); RecordingInfo.SetFramesPerSecond(frameDetector->FramesPerSecond());
RecordingInfo.Write();
Recordings.UpdateByName(recordingName);
} }
} }
InfoWritten = true; InfoWritten = true;

View File

@ -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: recorder.h 2.2 2010/01/29 16:32:32 kls Exp $ * $Id: recorder.h 2.3 2010/12/27 11:17:04 kls Exp $
*/ */
#ifndef __RECORDER_H #ifndef __RECORDER_H
@ -24,7 +24,7 @@ private:
cFileName *fileName; cFileName *fileName;
cIndexFile *index; cIndexFile *index;
cUnbufferedFile *recordFile; cUnbufferedFile *recordFile;
cRecordingInfo recordingInfo; char *recordingName;
off_t fileSize; off_t fileSize;
time_t lastDiskSpaceCheck; time_t lastDiskSpaceCheck;
bool RunningLowOnDiskSpace(void); bool RunningLowOnDiskSpace(void);

View File

@ -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.23 2010/03/07 14:06:04 kls Exp $ * $Id: recording.c 2.24 2010/12/27 12:02:00 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -678,7 +678,7 @@ cRecording::cRecording(const char *FileName)
const char *p = strrchr(FileName, '/'); const char *p = strrchr(FileName, '/');
name = NULL; name = NULL;
info = new cRecordingInfo; info = new cRecordingInfo(fileName);
if (p) { if (p) {
time_t now = time(NULL); time_t now = time(NULL);
struct tm tm_r; struct tm tm_r;
@ -921,6 +921,14 @@ bool cRecording::IsEdited(void) const
return *s == '%'; return *s == '%';
} }
void cRecording::ReadInfo(void)
{
info->Read();
priority = info->priority;
lifetime = info->lifetime;
framesPerSecond = info->framesPerSecond;
}
bool cRecording::WriteInfo(void) bool cRecording::WriteInfo(void)
{ {
cString InfoFileName = cString::sprintf("%s%s", fileName, isPesRecording ? INFOFILESUFFIX ".vdr" : INFOFILESUFFIX); cString InfoFileName = cString::sprintf("%s%s", fileName, isPesRecording ? INFOFILESUFFIX ".vdr" : INFOFILESUFFIX);
@ -1172,6 +1180,14 @@ void cRecordings::DelByName(const char *FileName)
} }
} }
void cRecordings::UpdateByName(const char *FileName)
{
LOCK_THREAD;
cRecording *recording = GetByName(FileName);
if (recording)
recording->ReadInfo();
}
int cRecordings::TotalFileSizeMB(void) int cRecordings::TotalFileSizeMB(void)
{ {
int size = 0; int size = 0;

View File

@ -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.14 2010/03/07 14:06:15 kls Exp $ * $Id: recording.h 2.15 2010/12/27 10:48:21 kls Exp $
*/ */
#ifndef __RECORDING_H #ifndef __RECORDING_H
@ -117,6 +117,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; }
void ReadInfo(void);
bool WriteInfo(void); bool WriteInfo(void);
bool Delete(void); bool Delete(void);
// Changes the file name so that it will no longer be visible in the "Recordings" menu // Changes the file name so that it will no longer be visible in the "Recordings" menu
@ -165,6 +166,7 @@ public:
cRecording *GetByName(const char *FileName); cRecording *GetByName(const char *FileName);
void AddByName(const char *FileName, bool TriggerUpdate = true); void AddByName(const char *FileName, bool TriggerUpdate = true);
void DelByName(const char *FileName); void DelByName(const char *FileName);
void UpdateByName(const char *FileName);
int TotalFileSizeMB(void); ///< Only for deleted recordings! int TotalFileSizeMB(void); ///< Only for deleted recordings!
}; };