Instant Timer with a given Channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patrick Fischer schrieb:

> Hello
> I want to create a new instant Recording from a Plugin at a specific 
> Channel.
>
> The normal way to create a instant Recording is to call
>
> cRecordControls::Start ();
>
> This will create a Recording of the current Channel.
>
> So if I want to create a recording on an different Channel, I can 
> create a new Timer
> and give this new Timer to cRecordControls::Start ().
>
> cTimer *timer = new cTimer(true,false);
> cRecordControls::Start (timer);
>
> But new cTimer(true, false) also use the current Channel.
>
> Is it possible that Klaus change the Constructor from
> cTimer::cTimer(bool Instant, bool Pause)
> to
> cTimer::cTimer(bool Instant, bool Pause, int channel = 0)
>
> And the line 30 in timers.c from
> channel = Channels.GetByNumber(cDevice::CurrentChannel());
> to
> channel = 
> Channels.GetByNumber(channel?channel:cDevice::CurrentChannel());
>
> In this case i can create a new recording by
> cTimer *timer = new cTimer(true,false,MYCHANNEL);
> cRecordControls::Start (timer);
>
> please!!! :-)
>
> Yours sincerely,
> Patrick


A improved Version would be this:

cTimer::cTimer(bool Instant, bool Pause,cChannel *Channel=NULL)
{
  startTime = stopTime = 0;
  recording = pending = inVpsMargin = false;
  flags = tfNone;
  if (Instant)
     SetFlags(tfActive | tfInstant);
  channel = Channel?Channel:Channels.GetByNumber(cDevice::CurrentChannel());
  time_t t = time(NULL);
  struct tm tm_r;
  struct tm *now = localtime_r(&t, &tm_r);
  day = SetTime(t, 0);
  weekdays = 0;
  start = now->tm_hour * 100 + now->tm_min;
  stop = now->tm_hour * 60 + now->tm_min + Setup.InstantRecordTime;
  stop = (stop / 60) * 100 + (stop % 60);
  if (stop >= 2400)
     stop -= 2400;
  priority = Pause ? Setup.PausePriority : Setup.DefaultPriority;
  lifetime = Pause ? Setup.PauseLifetime : Setup.DefaultLifetime;
  *file = 0;
  summary = NULL;
  event = NULL;
  if (Instant && channel)
     snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" 
: "", *Setup.NameInstantRecord ? Setup.NameInstantRecord : channel->Name());
}




[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux