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

cRecordingInfo::Errors() now returns -1 for old recordings; added a missing 'const'

This commit is contained in:
Klaus Schmidinger 2021-05-23 15:03:17 +02:00
parent c40fb4b4aa
commit 8f52603665
5 changed files with 17 additions and 8 deletions

View File

@ -2449,6 +2449,8 @@ Christoph Haubrich <christoph1.haubrich@arcor.de>
for reporting an unnecessary double call to Display() in cMenuRecording::RefreshRecording()
for reporting too much memory being allocated in the cImage constructors
for making the 'Edit path' dialog also show the total size of all recordings in that path
for suggesting to make cRecordingInfo::Errors() return -1 for old recordings, and
reporting a missing 'const'
Pekka Mauno <pekka.mauno@iki.fi>
for fixing cSchedule::GetFollowingEvent() in case there is currently no present

View File

@ -9705,3 +9705,8 @@ Video Disk Recorder Revision History
no longer available. You can add 'DEPRECATED_SKIN_SETITEMEVENT=1' when compiling in
order to restore this functionality. However, it is recommended to use the function
with the TimerActive parameter instead.
2021-05-23:
- cRecordingInfo::Errors() now returns -1 for old recordings; added a missing 'const'
(suggested by Christoph Haubrich).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recorder.c 5.1 2021/05/19 11:22:20 kls Exp $
* $Id: recorder.c 5.2 2021/05/23 15:03:17 kls Exp $
*/
#include "recorder.h"
@ -170,7 +170,7 @@ cRecorder::cRecorder(const char *FileName, const cChannel *Channel, int Priority
recordingName = strdup(FileName);
recordingInfo = new cRecordingInfo(recordingName);
recordingInfo->Read();
oldErrors = recordingInfo->Errors(); // in case this is a re-started recording
oldErrors = max(0, recordingInfo->Errors()); // in case this is a re-started recording
errors = oldErrors;
firstIframeSeen = false;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 5.7 2021/05/19 11:22:20 kls Exp $
* $Id: recording.c 5.8 2021/05/23 15:03:17 kls Exp $
*/
#include "recording.h"
@ -359,7 +359,7 @@ cRecordingInfo::cRecordingInfo(const cChannel *Channel, const cEvent *Event)
priority = MAXPRIORITY;
lifetime = MAXLIFETIME;
fileName = NULL;
errors = 0;
errors = -1;
if (Channel) {
// Since the EPG data's component records can carry only a single
// language code, let's see whether the channel's PID data has
@ -415,7 +415,7 @@ cRecordingInfo::cRecordingInfo(const char *FileName)
ownEvent = new cEvent(0);
event = ownEvent;
aux = NULL;
errors = 0;
errors = -1;
framesPerSecond = DEFAULTFRAMESPERSECOND;
priority = MAXPRIORITY;
lifetime = MAXLIFETIME;
@ -1202,7 +1202,9 @@ bool cRecording::WriteInfo(const char *OtherFileName)
// Let's keep the error counter if this is a re-started recording:
cRecordingInfo ExistingInfo(FileName());
if (ExistingInfo.Read())
info->SetErrors(ExistingInfo.Errors());
info->SetErrors(max(0, ExistingInfo.Errors()));
else
info->SetErrors(0);
}
else {
// This is an edited recording, so let's clear the error counter:

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.h 5.4 2021/05/19 11:22:20 kls Exp $
* $Id: recording.h 5.5 2021/05/23 15:03:17 kls Exp $
*/
#ifndef __RECORDING_H
@ -89,7 +89,7 @@ public:
double FramesPerSecond(void) const { return framesPerSecond; }
void SetFramesPerSecond(double FramesPerSecond);
void SetFileName(const char *FileName);
int Errors(void) { return errors; }
int Errors(void) const { return errors; } // returns -1 if undefined
void SetErrors(int Errors);
bool Write(FILE *f, const char *Prefix = "") const;
bool Read(void);