From 0525d1bb780981e63214973b9eb2d60bd84d1dca Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 25 Aug 2001 13:52:38 +0200 Subject: [PATCH] New Setup parameter MaxVideoFileSize --- HISTORY | 2 ++ MANUAL | 5 +++++ config.c | 5 ++++- config.h | 3 ++- dvbapi.c | 20 ++++++++------------ dvbapi.h | 11 ++++++++++- i18n.c | 11 ++++++++++- menu.c | 3 ++- 8 files changed, 43 insertions(+), 17 deletions(-) diff --git a/HISTORY b/HISTORY index 05254bce..cdf94f9d 100644 --- a/HISTORY +++ b/HISTORY @@ -667,3 +667,5 @@ Video Disk Recorder Revision History 2001-08-25: Version 0.93 - The menus and the channel display now show the current date and time. +- The new Setup parameter MaxVideoFileSize can be used to customize the + maximum size of the recorded video files. diff --git a/MANUAL b/MANUAL index 9d774812..5087367f 100644 --- a/MANUAL +++ b/MANUAL @@ -398,6 +398,11 @@ Video Disk Recorder User's Manual OSDwidth = 52 The width and height of the OSD . OSDheight = 18 The valid ranges are width=40...56, height=12...21. + MaxVideoFileSize=2000 The maximum size of a single recorded video file in MB. + The valid range is 100...2000. Default is 2000, but + you may want to use smaller values if you are planning + on archiving a recording to CD. + * Executing system commands The "Main" menu option "Commands" allows you to execute any system commands diff --git a/config.c b/config.c index aed32549..02cad10d 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.55 2001/08/17 13:02:01 kls Exp $ + * $Id: config.c 1.56 2001/08/25 13:37:37 kls Exp $ */ #include "config.h" @@ -783,6 +783,7 @@ cSetup::cSetup(void) ChannelInfoPos = 0; OSDwidth = 52; OSDheight = 18; + MaxVideoFileSize = MAXVIDEOFILESIZE; CurrentChannel = -1; } @@ -814,6 +815,7 @@ bool cSetup::Parse(char *s) else if (!strcasecmp(Name, "ChannelInfoPos")) ChannelInfoPos = atoi(Value); else if (!strcasecmp(Name, "OSDwidth")) OSDwidth = atoi(Value); else if (!strcasecmp(Name, "OSDheight")) OSDheight = atoi(Value); + else if (!strcasecmp(Name, "MaxVideoFileSize")) MaxVideoFileSize = atoi(Value); else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value); else return false; @@ -880,6 +882,7 @@ bool cSetup::Save(const char *FileName) fprintf(f, "ChannelInfoPos = %d\n", ChannelInfoPos); fprintf(f, "OSDwidth = %d\n", OSDwidth); fprintf(f, "OSDheight = %d\n", OSDheight); + fprintf(f, "MaxVideoFileSize = %d\n", MaxVideoFileSize); fprintf(f, "CurrentChannel = %d\n", CurrentChannel); f.Close(); isyslog(LOG_INFO, "saved setup to %s", FileName); diff --git a/config.h b/config.h index 8061dcf3..04ddb8f2 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.62 2001/08/25 11:50:24 kls Exp $ + * $Id: config.h 1.63 2001/08/25 13:30:54 kls Exp $ */ #ifndef __CONFIG_H @@ -287,6 +287,7 @@ public: int VideoFormat; int ChannelInfoPos; int OSDwidth, OSDheight; + int MaxVideoFileSize; int CurrentChannel; cSetup(void); bool Load(const char *FileName); diff --git a/dvbapi.c b/dvbapi.c index 6ff39b3d..51434e12 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz * based on dvdplayer-0.5 by Matjaz Thaler * - * $Id: dvbapi.c 1.109 2001/08/19 15:09:48 kls Exp $ + * $Id: dvbapi.c 1.110 2001/08/25 13:52:38 kls Exp $ */ //#define DVDDEBUG 1 @@ -50,20 +50,16 @@ extern "C" { #define DEV_OST_VIDEO "/dev/ost/video" #define DEV_OST_AUDIO "/dev/ost/audio" +#define KILOBYTE(n) ((n) * 1024) +#define MEGABYTE(n) ((n) * 1024 * 1024) + // The size of the array used to buffer video data: // (must be larger than MINVIDEODATA - see remux.h) -#define VIDEOBUFSIZE (1024*1024) +#define VIDEOBUFSIZE MEGABYTE(1) // The maximum size of a single frame: -#define MAXFRAMESIZE (192*1024) +#define MAXFRAMESIZE KILOBYTE(192) -// 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 1GB 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 (1024*1024*1024) // Byte #define MAXFILESPERRECORDING 255 #define MINFREEDISKSPACE (512) // MB @@ -517,7 +513,7 @@ bool cRecordBuffer::RunningLowOnDiskSpace(void) bool cRecordBuffer::NextFile(void) { if (recordFile >= 0 && pictureType == I_FRAME) { // every file shall start with an I_FRAME - if (fileSize > MAXVIDEOFILESIZE || RunningLowOnDiskSpace()) { + if (fileSize > MEGABYTE(Setup.MaxVideoFileSize) || RunningLowOnDiskSpace()) { recordFile = fileName.NextFile(); fileSize = 0; } @@ -2217,7 +2213,7 @@ void cCuttingBuffer::Action(void) // Write one frame: if (PictureType == I_FRAME) { // every file shall start with an I_FRAME - if (FileSize > MAXVIDEOFILESIZE) { + if (FileSize > MEGABYTE(Setup.MaxVideoFileSize)) { toFile = toFileName->NextFile(); if (toFile < 0) break; diff --git a/dvbapi.h b/dvbapi.h index 2cd57bfa..c93a9f35 100644 --- a/dvbapi.h +++ b/dvbapi.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.h 1.46 2001/08/11 12:22:01 kls Exp $ + * $Id: dvbapi.h 1.47 2001/08/25 13:37:00 kls Exp $ */ #ifndef __DVBAPI_H @@ -42,6 +42,15 @@ typedef struct CRect { #define FRAMESPERSEC 25 +// 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 + const char *IndexToHMSF(int Index, bool WithFrame = false); // Converts the given index to a string, optionally containing the frame number. int HMSFToIndex(const char *HMSF); diff --git a/i18n.c b/i18n.c index 18cb0e32..76e9bb1a 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.33 2001/08/25 12:27:03 kls Exp $ + * $Id: i18n.c 1.34 2001/08/25 13:41:57 kls Exp $ * * Slovenian translations provided by Miha Setina * Italian translations provided by Alberto Carraro @@ -857,6 +857,15 @@ const tPhrase Phrases[] = { "Hauteur affichage", "", // TODO }, + { "MaxVideoFileSize", + "Max. Video Dateigröße", + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + }, // The days of the week: { "MTWTFSS", "MDMDFSS", diff --git a/menu.c b/menu.c index c3c8f91d..14831824 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 1.106 2001/08/25 13:27:26 kls Exp $ + * $Id: menu.c 1.107 2001/08/25 13:37:27 kls Exp $ */ #include "menu.h" @@ -1713,6 +1713,7 @@ void cMenuSetup::Set(void) Add(new cMenuEditBoolItem(tr("ChannelInfoPos"), &data.ChannelInfoPos, tr("bottom"), tr("top"))); Add(new cMenuEditIntItem( tr("OSDwidth"), &data.OSDwidth, MINOSDWIDTH, MAXOSDWIDTH)); Add(new cMenuEditIntItem( tr("OSDheight"), &data.OSDheight, MINOSDHEIGHT, MAXOSDHEIGHT)); + Add(new cMenuEditIntItem( tr("MaxVideoFileSize"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZE)); } eOSState cMenuSetup::ProcessKey(eKeys Key)