From d00ae923ab081738ffe6042f2552c62d82e92ebf Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 20 Sep 2024 21:34:18 +0200 Subject: [PATCH] Edited recordings now show error count of original if there are no error indicators in the index --- HISTORY | 4 ++-- cutter.c | 12 ++++++++++-- vdr.5 | 6 ++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index 605dfa2c..d0e94cd6 100644 --- a/HISTORY +++ b/HISTORY @@ -9984,7 +9984,7 @@ Video Disk Recorder Revision History version numbering. Version numbers are simply counted upwards, with each of the three parts ("version", "major", "minor") always being a single digit, and '0' being skipped. -2024-09-19: +2024-09-20: - Fix for compilers that don't like non-constant format strings (thanks to Stefan Hofmann). - Deprecated code is now marked with [[deprecated]] to issue a compile time warning when @@ -10012,5 +10012,5 @@ Video Disk Recorder Revision History - The info file of an edited recording now contains the number of errors in the edited version. Note that this applies only to recordings that have errors stored in their index file. If errors are not stored in the index file, the edited version will have - its number of errors set to zero. + its number of errors set to that of the original recording. APIVERSNUM is now 30005. diff --git a/cutter.c b/cutter.c index e61dec6a..0932b3b5 100644 --- a/cutter.c +++ b/cutter.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: cutter.c 5.2 2024/09/19 20:21:58 kls Exp $ + * $Id: cutter.c 5.3 2024/09/20 21:34:18 kls Exp $ */ #include "cutter.h" @@ -302,6 +302,10 @@ cCuttingThread::cCuttingThread(const char *FromFileName, const char *ToFileName, maxVideoFileSize = MEGABYTE(Setup.MaxVideoFileSize); if (isPesRecording && maxVideoFileSize > MEGABYTE(MAXVIDEOFILESIZEPES)) maxVideoFileSize = MEGABYTE(MAXVIDEOFILESIZEPES); + if (fromIndex->GetErrors()->Size() > 0) { + recordingInfo->SetErrors(0); // the fromIndex has error indicators, so we reset the error count + recordingInfo->Write(); + } Start(); } else @@ -616,6 +620,9 @@ void cCuttingThread::HandleErrors(bool Force) if (frameErrors > recordingInfo->Errors()) { recordingInfo->SetErrors(frameErrors); recordingInfo->Write(); + Force = true; + } + if (Force) { LOCK_RECORDINGS_WRITE; Recordings->UpdateByName(editedRecordingName); } @@ -631,6 +638,7 @@ void cCuttingThread::Action(void) if (!fromFile || !toFile) return; int LastEndIndex = -1; + HandleErrors(true); // to make sure an initially reset error count is displayed correctly while (BeginMark && Running()) { // Suspend cutting if we have severe throughput problems: if (Throttled()) { @@ -706,8 +714,8 @@ bool cCutter::Start(void) cRecordingUserCommand::InvokeCommand(RUC_EDITINGRECORDING, editedVersionName, originalVersionName); if (cVideoDirectory::RemoveVideoFile(editedVersionName) && MakeDirs(editedVersionName, true)) { recordingInfo.Read(); - recordingInfo.SetErrors(0); recordingInfo.SetFileName(editedVersionName); + recordingInfo.Write(); SetRecordingTimerId(editedVersionName, cString::sprintf("%d@%s", 0, Setup.SVDRPHostName)); cuttingThread = new cCuttingThread(originalVersionName, editedVersionName, &recordingInfo); return true; diff --git a/vdr.5 b/vdr.5 index 09cebeae..2dfbd5ff 100644 --- a/vdr.5 +++ b/vdr.5 @@ -8,7 +8,7 @@ .\" License as specified in the file COPYING that comes with the .\" vdr distribution. .\" -.\" $Id: vdr.5 5.11 2024/09/19 20:21:58 kls Exp $ +.\" $Id: vdr.5 5.12 2024/09/20 21:34:18 kls Exp $ .\" .TH vdr 5 "27 Dec 2021" "2.7" "Video Disk Recorder Files" .SH NAME @@ -825,7 +825,9 @@ The 'O' tag contains the number of errors that occurred during recording. If it is zero, the recording can be safely considered error free. The higher the value, the more damaged the recording is. If this is an edited recording, the number of errors is that of the edited -recording. +recording, if the index of the original recording contains error indicators +(i.e. the original recording's index was created with VDR version 2.7.2 or +later). Otherwise it's the number of errors in the original recording. .SS RESUME The file \fIresume\fR (if present in a recording directory) contains the position within the recording where the last replay session left off.