[mythtv] Input switching question

Bruce Markey bjm at lvcm.com
Wed Feb 15 20:37:56 UTC 2006

Daniel Kristjansson wrote:
> On Tue, 2006-02-14 at 00:34 -0500, Jerry Rubinow wrote:
>> If I wanted to prevent myth from switching to an input that was
>> connected to the same external tuner that was in use by another input,
>> would the MainServer::Handle...() functions related to free recorders
>> be a workable place to put code for this?  Does all the tuner
>> switching code go through there?
>> For example, if I had a firewire input for HD channels, and an PVR
>> input for svideo from the same cable box for non-HD channels, I'd want
>> both inputs to look like they were busy if either one was being
>> recorded from, since both depend on the same cable box tuner.
>> I realize that I also need to put in checks, probably in schedule.cpp,
>> to prevent a show being scheduled on both connected inputs as well. 
>> But as a first step, I'm thinking the first change should prevent
>> channel changes in live tv from ruining in-progress recordings on the
>> other input.
>> Anything else I need to take into account?
> I think the scheduler might be the biggest difficulty, though David
> Engel or Bruce Markley may disagree. You need to introduce into it
> the concept that two inputs can conflict even if they are on separate
> cards.

In the core scheduler logic there is nothing new or difficult. The
opposite case of a DVB card able to record two streams from the
same card has often been discussed with the assumption that this
would be a radical change for scheduling but that isn't true either.

The scheduler already knows that it can record two different shows
from two different cards and can deal with the fact that it can only
record one show from a card with two (or three or more) inputs.

The question is, which inputs are independent and which are in conflict.
Without suggesting a specific implementation, the solution would be to
have some sort of 'input groups'. Right now the assumption is that all
inputs on a card are the same group (based on the card number) and
only one can be used. For illustration, I'll use letters for 'input

Card Type input inputid source  InputGroup

1    bttv coax      1   cable        A
2    ivtv coax      2   cable        B
2    ivtv s-video   3   STB-cable    B
3    DVB  DVB       4   DVB          C
3    DVB  DVB       5   DVB          D
4    HD   HD        6   STB-firewire B

Again, this isn't a specific implementation but an example. Currently
the grouping is by card. You can record two shows from "cable" on card
1 and 2 but you cannot record two cable and one STB-cable and you can
only record one show from DVB. It will allow recording from the settopbox
with cards 2 and 4 at the same time but this really won't work. If the
grouping was based on IG rather than cardid, you could record two DVB
(inputid 4 in group C and inputid 5 in group D) but could only record
one from group B (either STB-cable or STB-firewire but not both). Other
than using IG in place of cardid, nothing would need to change in how
the scheduler goes about filling in the schedule. It can already deal
with situations that come up when two inputs are not allowed to be
used at the same time.

Some flaws in this example, 2, 3 and 6 are all in the same group but
it may be possible to record from 2 and 6 at the same time, it may be
possible to record more than 2 DVB but at some point, I/O would have
to become a problem so it can't be open ended and a finite maximum
number of streams should be configured.

--  bjm

More information about the mythtv-dev mailing list