[vdr] receive data with low prio, so user-action can detach the receiver

Patrick Fischer patrick_fischer at gmx.de
Tue Nov 22 15:56:14 CET 2005


Hello Klaus,

>
> Wouldn't it be enough to simply give your receiver a priority
> of -2 (anything less than -1 would do)? That way any recording
> and even a Transfer Mode (which uses priority -1) could detach your
> receiver.
>  
> Klaus

I didn't knew that I can use values less then -1
If I understand right, this should work:

PRIORECEIVER= -2
PRIOSWITCHCHANNEL= -3
receiver = new MyReceiver(PRIORECEIVER);
:FOR ALL DEVICES
device = cDevice::GetDevice(SomeDevice);
    if(device->ProvidesChannel(channel,PRIOSWITCHCHANNEL)){
            device->SwitchChannel(channel,false);
            if (!device->AttachReceiver(receiver)){
                esyslog("ERROR could not attach receiver to device.");
            }
    }

now I have replaced this with:

PRIORECEIVER= -2
PRIOSWITCHCHANNEL= -3
receiver = new MyReceiver(PRIORECEIVER);
device = cDevice::GetDevice(channel, PRIOCHANGECHANNEL);
if(device){
  device->SwitchChannel(channel,false);
  if (!device->AttachReceiver(receiver)){
      esyslog("ERROR could not attach receiver to device.");
  }
}else{
dsyslog("no device can handle the channel");
}


In this case device->ProvidesChannel(channel,PRIOSWITCHCHANNEL) is 
always true
If I use
PRIORECEIVER= 11
PRIOSWITCHCHANNEL= 10
It works, but useraction will not detach myreceiver.

If I'm looking in dvbdevice.c ProvidesChannel:

bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, 
bool *NeedsDetachReceivers) const
{
  bool result = false;
  bool hasPriority = Priority < 0 || Priority > this->Priority();
....

  if (ProvidesSource(Channel->Source()) && ProvidesCa(Channel)) {
     result = hasPriority;
     if (Priority >= 0 && Receiving(true)) {  
       .............
     }
    ........
  return result;
}

So if I call this Function with a value < 0 and the device can 
ProvideSource and ProvideCa it will always return true.
There is no check for other receiver(and the prio of them) are attached.

Should I try to reexplane my Problem?

Patrick



More information about the vdr mailing list