Klaus Schmidinger wrote:
- Find a way to mark a receiver as being 'extremely unimportant', and
don't count them as NeedsDetachReceiver or as Receiving() in that case, maybe by using -1 as priority.
Using a negative priority would be the right way:
cReceiver(tChannelID ChannelID, int Priority, int Pid, const int *Pids1 = NULL, const int *Pids2 = NULL, const int *Pids3 = NULL); ///< ... ///< Priority may be any value in the range -99..99. Negative values indicate ///< that this cReceiver may be detached at any time (without blocking the ///< cDevice it is attached to).
Why does the osdteletext plugin use a non-negative priority at all?
Good question. Though, this alone doesn't fix it.
This is VDR without osdteletext, switching to a different transponder: GetDevice: Device 0 Impact 020c4c6e Detach:0 GetDevice: Device 1 Impact 060c4c60 Detach:0
Device 0 is the FF card, device 1 is the budget card. The FF card gets a boost by the first rule: imp |= LiveView ? !device[i]->IsPrimaryDevice() || ndr : 0; The FF card is the primary device, and it has nothing to detach, so this is imp |= true ? !true || false : 0 returning false, giving the FF card a priority boost.
The same with osdteletext (priority patched to -1) running: GetDevice: Device 0 Impact 060c4c7e Detach:1 GetDevice: Device 1 Impact 060c4c60 Detach:0
What happened? The ndr clause canceled the FF boost. The actual path in cDvbDevice::ProvidesChannel is ProvidesTransponder(Channel) -> Priority
= 0 && Receiving(true) -> !dvbTuner->IsTunedTo(Channel), leading to
NeedsDetachReceivers=true. Priority>=0 is the new live channel priority, not the -1 of osdteletext. Receiving(true) does count -1 receivers, as opposed to Receiving(false).
The next counting rule is the 5'th last low priority rule to prefer channels without receivers.
Cheers,
Udo