[mythtv] DVB support - Status update

Ben Bucksch linux.news at bucksch.org
Thu May 1 02:18:37 EDT 2003

Andy Davidoff wrote:

> I hope to write a panacea tuning patch in another couple weeks, so
> if you can do a good job of describing the semantics of DVB tuning,
> I'll try to give you some suggestions for generally applicable
> architecture. 

Great! :-)

DVB tuning itself is not *all* that complicated.

First, you have 4 DVB "carriers" (not sure what the official term is): S 
(sat), C (Cable), T (terrestrical=antenna) and (hardly used) IP 
(Internet). Each of those have different ways to "tune" to a given 
transport stream. DVB-S has frequency, polarization (horizontal or 
vertical) and symbol rate. DVB-T has frequency, modularizaion, bandwidth 
and a number of other parameters (5-10) needed to tune. Not sure about 
DVB-C, but I think it only needs the frequency.

DVB-S has a special parameter, which I guess is uncommon these days, 
namely diseqc, it controls the motors used to rotate the sat dish, 
allowing you to receive from any satelite. Of course, once you move the 
dish, you change it for *all* connected cards. It also takes some time 
to move the dish (a few secs, I think). Not sure, if we want to support 
that at all, it sure can drawf a whole design.

Secondly, there are several program streams in a transport stream. A TS 
consists out of any number of streams, each assigned a PID. A TV 
"channel" usually consists out of one stream for video, one for audio 
and maybe others for other data (teletext, metadata etc.). One TS 
typically (depending on the bitrate) contains 5-8 TV channels. So, you 
need to know which PIDs a channel has, in addition to the other tuning 
parameters above. When a DVB receiver tunes, it receives a full TS at 
once. The "full" DVB cards have "demultiplex" hardware, which you tell a 
number of PIDs and the hardware demuxes the TS, leaves out everything 
apart from the streams with those PIDs, remuxes that and feeds it to 
you, so you get a single TV channel only from the card. The "budget" 
cards, however, have the ability to give you (the application) a full 
TS. The application (or driver) is then responsible to to the demux and 
remux/conversion to get to a single channel. I wrote my code so that we 
can exploit that and receive the same stream several times, each time 
filtering out other program streams. Long story short, you can, with a 
single DVB card, receive several TV channels at once, if (and only if) 
they happen to be on the same TS. You know that they are, if all the 
DVB-type-specific tuning parameters I described above are identical and 
only the PIDs differ.

An implementation gotcha here is that the "recorder" (the part of Myth 
that reads the data from the device) needs to know the PIDs to be able 
to filter for them, not just the "channel" (the part of Myth that 
tunes). (I have solved that with the current code, the recorder asks the 
channel for the PIDs upon recording start and the channel notifies the 
recorder of PID changes upon channel change.)

Of course, you have on top of that all the problems caused by PayTV. 
DVB-cards can decrypt internally using a special hardware interface, but 
that only works on the card where the smartcard is connected to. So, you 
may have channels available on one card, but not the other, while both 
cards can receive all FreeTV channels.


More information about the mythtv-dev mailing list