From 9279cb21cd311cbb141d506ba9d17c3a057b4d3c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 17 Feb 2008 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.5.15=20-=20Updated=20the=20Italian=20OSD=20?= =?UTF-8?q?texts=20(thanks=20to=20Diego=20Pierotto).=20-=20Added=20option?= =?UTF-8?q?=20-i=20to=20the=20pictures=20plugin's=20pic2mpg=20to=20ignore?= =?UTF-8?q?=20unknown=20file=20types.=20-=20Revoked=20the=20switch=20to=20?= =?UTF-8?q?the=20"multiproto"=20driver=20in=20order=20to=20make=20a=20new?= =?UTF-8?q?=20stable=20=20=20version=20before=20making=20this=20big=20swit?= =?UTF-8?q?ch=20and=20forcing=20all=20users=20to=20install=20a=20=20=20dri?= =?UTF-8?q?ver=20that=20is=20not=20yet=20in=20the=20kernel=20source.=20The?= =?UTF-8?q?=20removed=20code=20will=20reappear=20=20=20in=20version=201.7.?= =?UTF-8?q?0.=20=20=20Note=20that=20you=20may=20need=20to=20switch=20back?= =?UTF-8?q?=20to=20an=20older=20version=20of=20your=20channels.conf=20=20?= =?UTF-8?q?=20file=20if=20you=20have=20already=20used=20version=201.5.14,?= =?UTF-8?q?=20because=20it=20introduced=20new=20parameters.=20-=20Added=20?= =?UTF-8?q?the=20new=20command=20line=20option=20--userdump=20to=20enable?= =?UTF-8?q?=20core=20dumps=20in=20case=20VDR=20=20=20is=20run=20as=20root?= =?UTF-8?q?=20with=20option=20-u=20(thanks=20to=20Hans-Werner=20Hilse).=20?= =?UTF-8?q?-=20Speeded=20up=20anti-aliased=20font=20rendering=20by=20cachi?= =?UTF-8?q?ng=20the=20blend=20indexes=20(based=20on=20=20=20a=20suggestion?= =?UTF-8?q?=20by=20Martin=20Wache).=20-=20Fixed=20setting=20the=20OSD=20ar?= =?UTF-8?q?ea=20in=20the=20pictures=20plugin.=20-=20Ignoring=20"repeat"=20?= =?UTF-8?q?and=20"release"=20keys=20in=20the=20time=20search=20entry=20mod?= =?UTF-8?q?e=20during=20replay,=20=20=20to=20avoid=20inadvertently=20leavi?= =?UTF-8?q?ng=20it=20in=20case=20a=20key=20is=20pressed=20too=20long=20(su?= =?UTF-8?q?ggested=20=20=20by=20Andreas=20Brugger).=20-=20Improved=20sendi?= =?UTF-8?q?ng=20all=20frames=20to=20devices=20that=20can=20handle=20them?= =?UTF-8?q?=20in=20fast=20forward=20=20=20trick=20speeds,=20including=20su?= =?UTF-8?q?btitles=20(thanks=20to=20Timo=20Eskola).=20-=20The=20section=20?= =?UTF-8?q?handler=20is=20now=20stopped=20before=20the=20device=20is=20des?= =?UTF-8?q?troyed,=20to=20avoid=20=20=20accessing=20file=20handles=20after?= =?UTF-8?q?=20they=20have=20become=20invalid=20(thanks=20to=20Reinhard=20?= =?UTF-8?q?=20=20Nissl=20for=20reporting=20an=20invalid=20access=20when=20?= =?UTF-8?q?ending=20VDR,=20and=20to=20Deti=20Fliegl=20for=20=20=20a=20patc?= =?UTF-8?q?h=20that=20was=20used=20to=20implement=20StopSectionHandler()).?= =?UTF-8?q?=20-=20Fixed=20setting=20the=20date=20in=20the=20channel=20disp?= =?UTF-8?q?lay=20of=20the=20classic=20and=20sttng=20skins,=20=20=20to=20av?= =?UTF-8?q?oid=20unnecessary=20OSD=20access=20(thanks=20to=20Marco=20Schl?= =?UTF-8?q?=C3=BC=C3=9Fler).=20-=20The=20free=20disk=20space=20is=20now=20?= =?UTF-8?q?also=20displayed=20in=20the=20title=20of=20the=20"Recordings"?= =?UTF-8?q?=20=20=20menu=20(suggested=20by=20Walter=20Koch).=20-=20Changed?= =?UTF-8?q?=20the=20message=20"Upcoming=20VPS=20recording!"=20to=20"Upcomi?= =?UTF-8?q?ng=20recording!"=20because=20=20=20it=20applies=20to=20non-VPS?= =?UTF-8?q?=20recordings=20as=20well.=20-=20Fixed=20a=20loss=20of=20a=20ti?= =?UTF-8?q?mer's=20'recording'=20flag=20after=20modifying=20it=20via=20MOD?= =?UTF-8?q?T.=20-=20Fixed=20detecting=20directories=20in=20cFileNameList::?= =?UTF-8?q?Load().=20-=20Running=20the=20thread=20that=20removes=20deleted?= =?UTF-8?q?=20recordings=20at=20a=20low=20priority=20to=20(maybe)=20=20=20?= =?UTF-8?q?avoid=20stuttering=20replay=20in=20case=20the=20thread=20is=20r?= =?UTF-8?q?un=20during=20replay.=20-=20Limiting=20the=20length=20of=20the?= =?UTF-8?q?=20recording=20name=20in=20timers=20in=20case=20VDR=20is=20run?= =?UTF-8?q?=20with=20=20=20--vfat,=20in=20order=20to=20avoid=20names=20tha?= =?UTF-8?q?t=20are=20too=20long=20for=20Windows=20(suggested=20by=20Rolf?= =?UTF-8?q?=20=20=20Ahrenberg).=20-=20Using=20cString::sprintf()=20instead?= =?UTF-8?q?=20of=20asprintf()=20(thanks=20to=20Wolfgang=20Rohdewald=20=20?= =?UTF-8?q?=20for=20pointing=20out=20a=20possible=20problem=20if=20the=20r?= =?UTF-8?q?eturn=20value=20is=20not=20checked).=20=20=20Plugin=20authors?= =?UTF-8?q?=20may=20want=20to=20consider=20doing=20the=20same.=20For=20con?= =?UTF-8?q?venience=20there=20is=20now=20=20=20an=20additional=20version?= =?UTF-8?q?=20of=20cString::sprintf()=20that=20accepts=20a=20va=5Flist=20p?= =?UTF-8?q?arameter.=20-=20When=20deleting=20the=20recording=20that=20is?= =?UTF-8?q?=20currently=20replayed,=20the=20replay=20is=20now=20=20=20stop?= =?UTF-8?q?ped=20immediately=20(thanks=20to=20Mikko=20Matilainen=20for=20r?= =?UTF-8?q?eporting=20a=20possible=20crash=20=20=20if=20the=20Info=20key?= =?UTF-8?q?=20is=20pressed=20after=20deleting=20the=20currently=20replayed?= =?UTF-8?q?=20recording).=20-=20Updated=20the=20Russian=20OSD=20texts=20(t?= =?UTF-8?q?hanks=20to=20Oleg=20Roitburd).=20-=20When=20determining=20the?= =?UTF-8?q?=20amount=20of=20free=20disk=20space,=20any=20deleted=20(but=20?= =?UTF-8?q?not=20yet=20removed)=20=20=20recordings=20on=20different=20file?= =?UTF-8?q?=20systems=20(that=20are=20mounted=20under=20the=20video=20dire?= =?UTF-8?q?ctory)=20=20=20are=20no=20longer=20taken=20into=20account.=20-?= =?UTF-8?q?=20When=20running=20out=20of=20disk=20space=20during=20a=20reco?= =?UTF-8?q?rding,=20only=20such=20deleted=20or=20old=20=20=20recordings=20?= =?UTF-8?q?are=20removed,=20that=20actually=20are=20on=20the=20video=20dir?= =?UTF-8?q?ectory=20file=20system(s).=20=20=20This=20prevents=20VDR=20from?= =?UTF-8?q?=20accidentally=20deleting=20recordings=20on=20other=20file=20s?= =?UTF-8?q?ystems,=20=20=20which=20would=20not=20add=20any=20free=20space?= =?UTF-8?q?=20to=20the=20video=20directory.=20-=20Implemented=20the=20cSta?= =?UTF-8?q?tus,=20cDevice=20and=20cPlayer=20functions=20for=20setting=20su?= =?UTF-8?q?btitle=20tracks=20=20=20in=20plugins=20(thanks=20to=20Petri=20H?= =?UTF-8?q?intukainen).=20-=20Added=20cStatus::TimerChange()=20to=20inform?= =?UTF-8?q?=20plugins=20about=20changes=20to=20the=20list=20of=20timers=20?= =?UTF-8?q?=20=20(based=20on=20a=20patch=20from=20Benedikt=20Elser).=20-?= =?UTF-8?q?=20Added=20new=20cStatus=20functions=20to=20the=20'status'=20pl?= =?UTF-8?q?ugin.=20-=20Added=20missing=20#include=20=20to=20epg.?= =?UTF-8?q?c=20and=20menuitems.h=20(thanks=20to=20Ville=20Skytt=C3=A4).=20?= =?UTF-8?q?-=20The=20new=20function=20cSkin::SetScrollbar()=20can=20be=20i?= =?UTF-8?q?mplemented=20by=20skins=20to=20display=20=20=20a=20scrollbar=20?= =?UTF-8?q?in=20every=20list=20menu.=20The=20'classic'=20and=20'sttng'=20s?= =?UTF-8?q?kins=20have=20been=20=20=20changed=20accordingly,=20as=20well?= =?UTF-8?q?=20as=20the=20'skincurses'=20plugin.=20-=20Introduced=20'operat?= =?UTF-8?q?or=20const=20void=20*=20()'=20in=20cString=20to=20catch=20cases?= =?UTF-8?q?=20where=20operator*()=20=20=20should=20be=20used.=20-=20Fixed?= =?UTF-8?q?=20calculating=20the=20scrollbar=20sizes=20in=20the=20skins.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- recording.c | 100 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 47 insertions(+), 53 deletions(-) (limited to 'recording.c') diff --git a/recording.c b/recording.c index 7999f72..4ecf4a9 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.157 2007/11/04 11:17:43 kls Exp $ + * $Id: recording.c 1.161 2008/02/16 13:31:39 kls Exp $ */ #include "recording.h" @@ -81,6 +81,7 @@ cRemoveDeletedRecordingsThread::cRemoveDeletedRecordingsThread(void) void cRemoveDeletedRecordingsThread::Action(void) { + SetPriority(19); // Make sure only one instance of VDR does this: cLockFile LockFile(VideoDirectory); if (LockFile.Lock()) { @@ -143,10 +144,12 @@ void AssertFreeDiskSpace(int Priority, bool Force) cThreadLock DeletedRecordingsLock(&DeletedRecordings); if (DeletedRecordings.Count()) { cRecording *r = DeletedRecordings.First(); - cRecording *r0 = r; + cRecording *r0 = NULL; while (r) { - if (r->start < r0->start) - r0 = r; + if (IsOnVideoDirectoryFileSystem(r->FileName())) { // only remove recordings that will actually increase the free video disk space + if (!r0 || r->start < r0->start) + r0 = r; + } r = DeletedRecordings.Next(r); } if (r0 && r0->Remove()) { @@ -155,11 +158,13 @@ void AssertFreeDiskSpace(int Priority, bool Force) return; } } - // DeletedRecordings was empty, so to be absolutely sure there are no - // deleted recordings we need to double check: - DeletedRecordings.Update(true); - if (DeletedRecordings.Count()) - return; // the next call will actually remove it + else { + // DeletedRecordings was empty, so to be absolutely sure there are no + // deleted recordings we need to double check: + DeletedRecordings.Update(true); + if (DeletedRecordings.Count()) + return; // the next call will actually remove it + } // No "deleted" files to remove, so let's see if we can delete a recording: isyslog("...no deleted recording found, trying to delete an old recording..."); cThreadLock RecordingsLock(&Recordings); @@ -167,15 +172,17 @@ void AssertFreeDiskSpace(int Priority, bool Force) cRecording *r = Recordings.First(); cRecording *r0 = NULL; while (r) { - if (!r->IsEdited() && r->lifetime < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever - if ((r->lifetime == 0 && Priority > r->priority) || // the recording has no guaranteed lifetime and the new recording has higher priority - (r->lifetime > 0 && (time(NULL) - r->start) / SECSINDAY >= r->lifetime)) { // the recording's guaranteed lifetime has expired - if (r0) { - if (r->priority < r0->priority || (r->priority == r0->priority && r->start < r0->start)) - r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities) + if (IsOnVideoDirectoryFileSystem(r->FileName())) { // only delete recordings that will actually increase the free video disk space + if (!r->IsEdited() && r->lifetime < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever + if ((r->lifetime == 0 && Priority > r->priority) || // the recording has no guaranteed lifetime and the new recording has higher priority + (r->lifetime > 0 && (time(NULL) - r->start) / SECSINDAY >= r->lifetime)) { // the recording's guaranteed lifetime has expired + if (r0) { + if (r->priority < r0->priority || (r->priority == r0->priority && r->start < r0->start)) + r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities) + } + else + r0 = r; } - else - r0 = r; } } r = Recordings.Next(r); @@ -350,7 +357,7 @@ bool cRecordingInfo::Read(FILE *f) char *p = strchr(t, ' '); if (p) { free(channelName); - asprintf(&channelName, "%s", compactspace(p)); + channelName = strdup(compactspace(p)); *p = 0; // strips optional channel name } if (*t) @@ -524,7 +531,7 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event) else if (Timer->IsSingleEvent() || !Setup.UseSubtitle) name = strdup(Timer->File()); else - asprintf(&name, "%s~%s", Timer->File(), Subtitle); + name = strdup(cString::sprintf("%s~%s", Timer->File(), Subtitle)); // substitute characters that would cause problems in file names: strreplace(name, '\n', ' '); start = Timer->StartTime(); @@ -565,22 +572,19 @@ cRecording::cRecording(const char *FileName) } GetResume(); // read an optional info file: - char *InfoFileName = NULL; - asprintf(&InfoFileName, "%s%s", fileName, INFOFILESUFFIX); + cString InfoFileName = cString::sprintf("%s%s", fileName, INFOFILESUFFIX); FILE *f = fopen(InfoFileName, "r"); if (f) { if (!info->Read(f)) - esyslog("ERROR: EPG data problem in file %s", InfoFileName); + esyslog("ERROR: EPG data problem in file %s", *InfoFileName); fclose(f); } else if (errno != ENOENT) - LOG_ERROR_STR(InfoFileName); - free(InfoFileName); + LOG_ERROR_STR(*InfoFileName); #ifdef SUMMARYFALLBACK // fall back to the old 'summary.vdr' if there was no 'info.vdr': if (isempty(info->Title())) { - char *SummaryFileName = NULL; - asprintf(&SummaryFileName, "%s%s", fileName, SUMMARYFILESUFFIX); + cString SummaryFileName = cString::sprintf("%s%s", fileName, SUMMARYFILESUFFIX); FILE *f = fopen(SummaryFileName, "r"); if (f) { int line = 0; @@ -626,8 +630,7 @@ cRecording::cRecording(const char *FileName) free(data[i]); } else if (errno != ENOENT) - LOG_ERROR_STR(SummaryFileName); - free(SummaryFileName); + LOG_ERROR_STR(*SummaryFileName); } #endif } @@ -696,7 +699,7 @@ const char *cRecording::FileName(void) const struct tm tm_r; struct tm *t = localtime_r(&start, &tm_r); name = ExchangeChars(name, true); - asprintf(&fileName, NAMEFORMAT, VideoDirectory, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, priority, lifetime); + fileName = strdup(cString::sprintf(NAMEFORMAT, VideoDirectory, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, priority, lifetime)); name = ExchangeChars(name, false); } return fileName; @@ -715,7 +718,7 @@ const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level) cons s++; else s = name; - asprintf(&titleBuffer, "%02d.%02d.%02d%c%02d:%02d%c%c%s", + titleBuffer = strdup(cString::sprintf("%02d.%02d.%02d%c%02d:%02d%c%c%s", t->tm_mday, t->tm_mon + 1, t->tm_year % 100, @@ -724,7 +727,7 @@ const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level) cons t->tm_min, New, Delimiter, - s); + s)); // let's not display a trailing '~': if (!NewIndicator) stripspace(titleBuffer); @@ -784,16 +787,14 @@ bool cRecording::IsEdited(void) const bool cRecording::WriteInfo(void) { - char *InfoFileName = NULL; - asprintf(&InfoFileName, "%s%s", fileName, INFOFILESUFFIX); + cString InfoFileName = cString::sprintf("%s%s", fileName, INFOFILESUFFIX); FILE *f = fopen(InfoFileName, "w"); if (f) { info->Write(f); fclose(f); } else - LOG_ERROR_STR(InfoFileName); - free(InfoFileName); + LOG_ERROR_STR(*InfoFileName); return true; } @@ -910,8 +911,7 @@ void cRecordings::ScanVideoDir(const char *DirName, bool Foreground, int LinkLev struct dirent *e; while ((Foreground || Running()) && (e = d.Next()) != NULL) { if (strcmp(e->d_name, ".") && strcmp(e->d_name, "..")) { - char *buffer; - asprintf(&buffer, "%s/%s", DirName, e->d_name); + char *buffer = strdup(AddDirectory(DirName, e->d_name)); struct stat st; if (stat(buffer, &st) == 0) { int Link = 0; @@ -993,10 +993,12 @@ bool cRecordings::Update(bool Wait) cRecording *cRecordings::GetByName(const char *FileName) { - for (cRecording *recording = First(); recording; recording = Next(recording)) { - if (strcmp(recording->FileName(), FileName) == 0) - return recording; - } + if (FileName) { + for (cRecording *recording = First(); recording; recording = Next(recording)) { + if (strcmp(recording->FileName(), FileName) == 0) + return recording; + } + } return NULL; } @@ -1039,7 +1041,7 @@ int cRecordings::TotalFileSizeMB(void) int size = 0; LOCK_THREAD; for (cRecording *recording = First(); recording; recording = Next(recording)) { - if (recording->fileSizeMB > 0) + if (recording->fileSizeMB > 0 && IsOnVideoDirectoryFileSystem(recording->FileName())) size += recording->fileSizeMB; } return size; @@ -1070,9 +1072,7 @@ cMark::~cMark() cString cMark::ToText(void) { - char *buffer; - asprintf(&buffer, "%s%s%s\n", *IndexToHMSF(position, true), comment ? " " : "", comment ? comment : ""); - return cString(buffer, true); + return cString::sprintf("%s%s%s\n", *IndexToHMSF(position, true), comment ? " " : "", comment ? comment : ""); } bool cMark::Parse(const char *s) @@ -1161,11 +1161,9 @@ const char *cRecordingUserCommand::command = NULL; void cRecordingUserCommand::InvokeCommand(const char *State, const char *RecordingFileName) { if (command) { - char *cmd; - asprintf(&cmd, "%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\"$")); - isyslog("executing '%s'", cmd); + cString cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\"$")); + isyslog("executing '%s'", *cmd); SystemExec(cmd); - free(cmd); } } @@ -1409,10 +1407,6 @@ bool cIndexFile::IsStillRecording() // --- cFileName ------------------------------------------------------------- -#include -#include -#include "videodir.h" - #define MAXFILESPERRECORDING 255 #define RECORDFILESUFFIX "/%03d.vdr" #define RECORDFILESUFFIXLEN 20 // some additional bytes for safety... -- cgit v1.2.3