[vdr] how to stop timer?

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Thu Jan 19 18:04:28 CET 2006


Markus Hahn wrote:
> Hi there 
> 
> A full or not available disk causes  a endless lopp of 
> TimerStart and EmergencyExit if a timer is active.
> 
> To avoid this, I added this code to cRecordControls::Start() : 
> 
> menu.c:3518
> bool cRecordControls::Start(cTimer *Timer, bool Pause)
> {
>   ChangeState();
>   if (!VideoFileSpaceAvailable(300))
>   {
>      Skins.Message(mtInfo, tr("No disk space!"));
>      if (Timer)
>        Timer->Delete();
> 
>        return false;
>   }
> 
> Now the message pops up endlessly, because the timer is still 
> aktive??? Any suggestions?

Maybe a better place for this would be in the main VDR loop:

            // Start new recordings:
            if (VideoFileSpaceAvailable(300)) {
               cTimer *Timer = Timers.GetMatch(Now);
               if (Timer) {
                  if (!cRecordControls::Start(Timer))
                     Timer->SetPending(true);
                  else
                     LastTimerChannel = Timer->Channel()->Number();
                  }
               }
            else if (/*TimeSinceLastNoDiskSpaceMessageGreaterLimit*/) {
               Skins.Message(mtWarning, tr("No disk space!"));
               // reset timeout limit
               }

BTW: brutally deleting that timer is probably not a good idea.
This could be a repeating timer, or disk space could become
available later. Also, the cRecordControls::Start() function is called
from a loop through all timers, so if you delete it, strange things
might happen ;-)

Klaus



More information about the vdr mailing list