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

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

 



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


[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