[mythtv] MythTV database structure for channels
Fri, 23 Aug 2002 10:10:23 +0100 (BST)
(Isaac: you've another copy in your moderator queue - just toss that)
---------- Forwarded message ----------
Date: Fri, 23 Aug 2002 09:59:02 +0100 (BST)
From: Stephen Davies <firstname.lastname@example.org>
Subject: MythTV database structure for channels
Hi Isaac and others,
I see that right now MythTV has a simple model of TV channels that is
limited to handling ordinary terrestrial or analogue cable setups - those
where you just tune the TV card tuner to pick between channels.
This design is OK for single tuner card setups where simple terrestrial or
analogue cable is being used.
Of course, as you realise, this is too simplistic for those with external
tuner boxes and suchlike.
I did read the post from you, Isaac, about the "Composite1:123" approach
to channels etc. (It doesn't look like anyone has taken up the challenge
to finish this off yet).
But this change isn't really enough to handle more complicated setups.
Especially when you think about supporting the use of more than one
capture card at the same time, which you are starting to play with.
Here's why - using my own environment - which must be about as
complicated as any around - as an example.
I also have a proposal that is more complete. I'll send that after I
get your comments on this mail - its long enough as it is.
I'm happy to write some code to implement if the design is agreeable.
Here are the issues. Bear in mind that I'm trying to design for a
multi-card setup. I've used the obvious extension to the Composite1:123
idea to video0:Composite1:123 for the multi-card scenario.
Issue 1) Keeping track of channels that can be received via multiple
Once you have more than one source of channels, you'll usually have lots
of overlap. For instance - I can receive BBC-1 4 different ways: via
analogue cable, via digital terrestrial (DVB-T), via digital cable and via
This is a "good thing" because it helps "parallel" recording. If the
digital cable box (connected to video1) is busy recording something else
when MythTV wants to record BBC-1 then MythTV can just record BBC-1 from
The current "flat" list of channels doesn't account for this. You either
have to load only one of the sources for a channel (which removes
information that could be used to help resolve overlapping recordings).
Or you need to have the channel listed repeatedly: you have to load the
same schedule into the database over and over, and it will be listed
This would probably also break the "record this every time its on" mode -
it would try to record the same Friends episode on at the same time on all
4 "versions" of BBC-1.
IMHO, the right structure is to separate the channel from the ways it can
be received. That way the schedule info can be loaded once only, and all
the channels in the channel table are unique.
You also want this separation so that the decision as to which card to use
and which receiver to use can be done flexibly by the recording scheduler
so as to minimise conflicts.
For example: in the existing proposal the user might choose to record a
program from [video0:]Composite1:504 (one of the sources of, say,
Discovery) and video0:Composite1:101 (one of the sources of say BBC-1) at
the same time. They've created a conflict because the capture card can
only capture one thing at a time.
If instead they selected "Discovery" and "BBC-1" then the system would
have the flexibility to record Discovery via the satellite receiver on
video0:Composite1:504 and BBC-1 via say analogue cable via the RF input on
video1 (viz video1:32).
2) Making sure that we don't try to tune an external tuner to two things
The [video0:]Composite1:123 channel number approach assumes that each
external tuner box is connected to one card input only.
But there is an advantage to having more connections - Having lots of
connections like this helps further in avoiding conflicts - if the first
card is busy recording from another input then we can still get at the
output of the external tuner via another card.
But - this can't be handled properly with the flat channel list. MythTV
has no way of telling that video0:Composite1 and video1:36 are actually
connected to the same tuner box. It might easily try to record from
video0:Composite1:101 and video1:36:504 at the same time - it's separate
capture cards after all - but the external tuner box can only tune one
thing at a time so things will not go well.
The right way to handle this is for the database to have information on
the various channel sources and how they are connected to the system.
As I said I have a proposal to offer. But first - does my "problem
statement" make sense to you?