Klaus Schmidinger wrote:
Christian Wieninger wrote:
...
//XXX what if Priority() is < -1? -> limit to -1..MAXPRIORITY???
how can one set a priority below -1 and what would this mean? As far as understood the cDevice class, this can only be done in a cDevice-derived class. So perhaps cDevice::Priority should limit its return value to -1 ... MAXPRIORITY?
The priority comes from the cReveicers attached to the device:
cReceiver(int Ca, int Priority, int Pid, const int *Pids1 = NULL, const int *Pids2 = NULL, const int *Pids3 = NULL); ... ///< Priority may be any value in the range 0..99. Negative values indicate ///< that this cReceiver may be detached at any time (without blocking the ///< cDevice it is attached to).
So officially the value can't be greater than 99, but it may well be any negative value. However, VDR itself only uses '-1', and I guess it's fair to assume that no plugin will be using too large negative values. To be on the safe side I guess I'll do
imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0),
0xFF);
which would allow values in the range -99..99, and in any case limit the result to 0..255.
I just noticed that I have inadvertently removed assigning 'ndr' to the resulting 'NeedsDetachReceivers'. So attached is an updated version of the fix.
Klaus