[mythtv] Channel handling

Daniel Kristjansson danielk at cuymedia.net
Sun Jan 15 15:36:26 UTC 2006


On Sat, 2006-01-14 at 19:55 -0800, jafa wrote:
> Thanks - that was what I was looking for.
> (resending to avoid size limit)

> Am I correct in thinking the "channelnames" and "currentcapchannel" 
> relate to the input selection? (choosing between a list of inputs such 
> as antenna, composite, and s-video?)
Yes.

> This box has only one input (it has two tuners but they both run at the 
> same time so show up as two different devices). At the moment I have the 
> following in my constructor:
>    channelnames[0] = "MPEG2TS";
>    currentcapchannel = 0;
> 
> I also don't quite get the sourceid side of things... channel.cpp uses 
> sourceid based on the current input.
>        "WHERE videosource.sourceid = channel.sourceid AND "
>        "      channum = '%1' AND channel.sourceid = '%2'")
>        .arg(chan).arg(sourceid[currentcapchannel]);
> 
> DBox2 does something different:
>          "WHERE "
>          "channel.sourceid = cardinput.sourceid AND "
>          "cardinput.cardid = :CARDID AND "
>                  "channel.channum = :CHANNUM");
>    query.bindValue(":CARDID", m_cardid);
>    query.bindValue(":CHANNUM", channelnumber);

I would recommend keeping the input stuff in there, this allows for
easier refactoring of channel classes later on. And if at some point
multiple inputs are added to a future rev of the hardware you won't
have to rewrite everything (Say you want to support OTA and Cable
with the same device without the user needing to change the wiring).

DVBChannel was originally written with only one input in mind and we
are still finding problems with the code now that multiple inputs are
supported.

BTW You may want to look at DVBChannel as well. Everything DVBChannel
does, Channel does as well, but DVBChannel might be map more closely
to your device.

Also, the DB schema for the channel and dtv_multiplex tables is in
dbcheck.cpp.

A couple cotchas: The frequency for BTTV cards (Channel) is the visual
carrier frequency, while the frequency for DVB cards is the center
frequency. There is a 1.75 Mhz or so offset between them. I would
recommend you use the DVB method, as there is no visual carrier with
ATSC so this concept just adds confusion there.

The ATSC major and minor channels are stored in atscsrcid, and the
ATSC source id is not stored in the table at all. It is encoded as
(majorChannel * 256 | minorChannel). This is used to find the
correct program number in the VCT table, which is used to find
the PMT using the PAT.

-- Daniel



More information about the mythtv-dev mailing list