The problem was that I played fast and loose with the diseqc spec. I set the
line volts much later than you're supposed to, for various reasons.
I've now sorted that, though because of the complexity if a rotor exists I
run a full re-program of the switch (only if a rotor is present). And I double
set the line volts, both in the switch (to ensure it happens early) and then
in the LNB tuning (in case no switch exists).
If a service was marked as bad (no input) it was not unlinking the
subscription from the service before re-applying, this resulted in
a double entry into the service subs list and ultimatey a livelock
or possibly worse.
This was due to failure to properly reported which adapters have
been enabled. There are other problems with the capmt setup code
that really need addressing, but I don't have the time right now!
It's possible a mux is not tunable, yet that doesn't imply the presence
of a free tuner means its invalid. It could just be that its an S2 mux
with only an S tuner available (just one example).
Rather than adding an explicit flag (to stop mux calls) on retune I
have moved the frontend close operation to be done in the background
monitor timer. This isn't foolproof but will cover most things
and I can probably add a delay to cause that to not execute immediately
should the timer be about to expire.
Now have the concept of both input and output bandwidth usage of a sub.
The reason for this is that while data may be flowing into the subscription,
i.e. a signal is being received. Things like timeshift, or even potentially
flow control, may mean the actual outgoing rate is quite different.
Input rate is added by the subscription code as data enters the sub, however
the output rate must be added by the subscription handler as close to the
client as possible.
This is particularly important for null susbcriptions that receive no
stream data and therefore handle the SMT_STOP inline (actually was
direct before). This causes list corruption, therefore these subs
are now stored to a secondary list that are cleaned up within the
standard rescheduler.
THe problem is that mux subs have been done such that unsubscribe
(which in turn calls subs_reschedule()) can itelf be called in line
from subs_reschedule().
Really this is a bit of a mess but this simple hack fixes things.
I've made the table extraid 64 bits, as some entries require 32+X bits
so a 32-bit field wasn't enough.
Added callback for registering destruction (for dealloc'ing memory
alloc'd for opaque).
Added method of registering desciptor tag handlers, saves duplicating
BAT processing used for OpenTV, which uses 1 custom descriptor.
Improved the table completion detection and reduced level of debug
that could swamp tvhlog queue.