From f01af488e1063871e8392bced356eb7196a5040f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 24 Jan 2009 15:24:19 +0100 Subject: [PATCH] Fixed handling the maximum video file size --- CONTRIBUTORS | 1 + HISTORY | 1 + config.c | 4 ++-- cutter.c | 8 ++++++-- menu.c | 4 ++-- recording.h | 17 +++++++++-------- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 98d5ca42..a3095b9e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1605,6 +1605,7 @@ Udo Richter for fixing error handling in cCuttingThread::Action() for suppressing the automatic shutdown if the remote control is currently disabled for fixing a problem with calling isyslog() from within the SignalHandler() + for reporting a problem with handling the maximum video file size Sven Kreiensen for his help in keeping 'channels.conf.terr' up to date diff --git a/HISTORY b/HISTORY index 51ae4d52..72d290d5 100644 --- a/HISTORY +++ b/HISTORY @@ -5965,3 +5965,4 @@ Video Disk Recorder Revision History it's an I-frame or not. - The PAT/PMT is now only processed if its version changes (reported by Reinhard Nissl). +- Fixed handling the maximum video file size (reported by Udo Richter). diff --git a/config.c b/config.c index 090a6a1d..1132b121 100644 --- a/config.c +++ b/config.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.161 2008/02/17 13:39:00 kls Exp $ + * $Id: config.c 2.1 2009/01/24 15:05:32 kls Exp $ */ #include "config.h" @@ -275,7 +275,7 @@ cSetup::cSetup(void) FontOsdSize = 22; FontSmlSize = 18; FontFixSize = 20; - MaxVideoFileSize = MAXVIDEOFILESIZE; + MaxVideoFileSize = MAXVIDEOFILESIZEDEFAULT; SplitEditedFiles = 0; MinEventTimeout = 30; MinUserInactivity = 300; diff --git a/cutter.c b/cutter.c index 20a9e676..73ac873f 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 2.1 2009/01/06 14:40:48 kls Exp $ + * $Id: cutter.c 2.2 2009/01/24 15:19:26 kls Exp $ */ #include "cutter.h" @@ -22,6 +22,7 @@ private: cFileName *fromFileName, *toFileName; cIndexFile *fromIndex, *toIndex; cMarks fromMarks, toMarks; + off_t maxVideoFileSize; protected: virtual void Action(void); public: @@ -45,6 +46,9 @@ cCuttingThread::cCuttingThread(const char *FromFileName, const char *ToFileName) fromIndex = new cIndexFile(FromFileName, false, isPesRecording); toIndex = new cIndexFile(ToFileName, true, isPesRecording); toMarks.Load(ToFileName, Recording.FramesPerSecond(), isPesRecording); // doesn't actually load marks, just sets the file name + maxVideoFileSize = MEGABYTE(Setup.MaxVideoFileSize); + if (isPesRecording && maxVideoFileSize > MEGABYTE(MAXVIDEOFILESIZEPES)) + maxVideoFileSize = MEGABYTE(MAXVIDEOFILESIZEPES); Start(); } else @@ -125,7 +129,7 @@ void cCuttingThread::Action(void) if (Independent) { // every file shall start with an independent frame if (LastMark) // edited version shall end before next I-frame break; - if (FileSize > MEGABYTE(Setup.MaxVideoFileSize)) { + if (FileSize > maxVideoFileSize) { toFile = toFileName->NextFile(); if (!toFile) { error = "toFile 1"; diff --git a/menu.c b/menu.c index 7e05703d..fa600651 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 2.5 2009/01/24 11:42:24 kls Exp $ + * $Id: menu.c 2.6 2009/01/24 15:05:43 kls Exp $ */ #include "menu.h" @@ -2698,7 +2698,7 @@ cMenuSetupRecord::cMenuSetupRecord(void) Add(new cMenuEditBoolItem(tr("Setup.Recording$Mark instant recording"), &data.MarkInstantRecord)); Add(new cMenuEditStrItem( tr("Setup.Recording$Name instant recording"), data.NameInstantRecord, sizeof(data.NameInstantRecord))); Add(new cMenuEditIntItem( tr("Setup.Recording$Instant rec. time (min)"), &data.InstantRecordTime, 1, MAXINSTANTRECTIME)); - Add(new cMenuEditIntItem( tr("Setup.Recording$Max. video file size (MB)"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZE)); + Add(new cMenuEditIntItem( tr("Setup.Recording$Max. video file size (MB)"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZETS)); Add(new cMenuEditBoolItem(tr("Setup.Recording$Split edited files"), &data.SplitEditedFiles)); } diff --git a/recording.h b/recording.h index 119dd46e..5256a8ee 100644 --- a/recording.h +++ b/recording.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.h 2.3 2009/01/24 13:05:03 kls Exp $ + * $Id: recording.h 2.4 2009/01/24 15:24:19 kls Exp $ */ #ifndef __RECORDING_H @@ -209,13 +209,14 @@ public: #define MAXFRAMESIZE KILOBYTE(512) // The maximum file size is limited by the range that can be covered -// with 'int'. 4GB might be possible (if the range is considered -// 'unsigned'), 2GB should be possible (even if the range is considered -// 'signed'), so let's use 2000MB for absolute safety (the actual file size -// may be slightly higher because we stop recording only before the next -// 'I' frame, to have a complete Group Of Pictures): -#define MAXVIDEOFILESIZE 2000 // MB -#define MINVIDEOFILESIZE 100 // MB +// with a 40 bit 'unsigned int', which is 1TB. The actual maximum value +// used is 6MB below the theoretical maximum, to have some safety (the +// actual file size may be slightly higher because we stop recording only +// before the next independent frame, to have a complete Group Of Pictures): +#define MAXVIDEOFILESIZETS 1048570 // MB +#define MAXVIDEOFILESIZEPES 2000 // MB +#define MINVIDEOFILESIZE 100 // MB +#define MAXVIDEOFILESIZEDEFAULT MAXVIDEOFILESIZEPES struct tIndexTs;