I thought I'd share what I learned in the recent week's worth of work since most of the guides that I'd found had some of the information that I needed, but none of them really had it all.
Background
--------------
I've got Comcast, which means that when I try to get MythTV to scan for channels, it doesn't add anything. It can tune them in, but the cable provider is nice enough to strip off all of the metadata from the channels that would normally be available over-the-air.
MySQL Tables
----------------
There are three primary tables that need to have data inserted if you want to add digital channels. They are:
channel - These are the actual channel listings that tie the XMLTV data, the PIDs, and the Multiplex information all together. The ChanID field is the key field here.
dtv_multiplex - This table has all of your transports, or base frequencies that the digital channels are broadcast on. If you're using digital cable, most of these fields are left at the default (I'll explain which ones matter).
dvb_pids - This table contains information about which program ID goes with which channel. There are two types of programs used for digital cable: video and audio.
Step 1
-------
atscscan is included in the KnoppMyth distribution. The important thing to know is what frequencies you need it to scan through, because atscscan doesn't just sweep the entire spectrum. There are a bunch of frequencies listed in:
/usr/local/share/dvb/scan/atsc
Pick the appropriate one and you should end up with a file similar to:
WKRNDT:555000000:QAM_256:2048:2049:1
WSMVDT:555000000:QAM_256:2112:2113:2
WTVFDT:555000000:QAM_256:2176:2177:3
WZTVDT:555000000:QAM_256:2240:2241:4
WNPTDT:555000000:QAM_256:2304:2305:5
[0008]:555000000:QAM_256:2432:2433:8
WNABDT:555000000:QAM_256:2496:2497:9
WUXPDT:555000000:QAM_256:2688:2689:12
WGNSAT:555000000:QAM_256:2752:2753:6
Notice the [0008] channel in there. This is a symptom of the PSID being stripped out, otherwise atscscan would have put in the name of the station pulled from the digital channel itself. In my region (Nashville, TN, area) all of the channels had the data stripped out, so I'm showing you the file after I substituted the data myself.
Here's what the data means:
WKRNDT:555000000:QAM_256:2048:2049:1
WKRNDT - This is the channel name
555000000 - This is the frequency that the channel is broadcast on
QAM_256 - This is the encoding scheme used by the carrier (Comcast)
2048 - This is the Program ID for the video portion of the channel
2049 - This is the Program ID for the audio portion of the channel
1 - This is the service ID (used in conjunction with the frequency)
So, go figure out what each of your channels is before trying to proceed to the next step.
Step 2
-------
Create a Zap2It Labs profile with the channels you have available in your area.
Step 3
-------
Run mythtv-setup and add in your digital tuner card, define the source for your newly created profile, and connect the input->source. Don't bother with the channel editor - if it worked for you then you wouldn't have read this far into the document! Exit mythtv-setup and run mythfilldatabase to get the xmltvid's for your channels.
Step 4
-------
Hand edit the database. Yikes, you say!? Well, it's a lot easier if you install phpMyAdmin, which is a graphical database frontend.
We'll look at the channels you have, but only the 'meat' will be dealt with here. If I don't mention it, the value doesn't matter for our example (the tables are designed to house information for all kinds of channels - analog, digital satellite, digital OTA, digital cable).
mysql> select chanid,channum,callsign,name,icon,xmltvid,useonairguide,mplexid,serviceid from channel;
| 1000 | 21 | WKRN-DT | WKRN-DT | none | 20465 | 0 | 1 | 1 |
You should have one channel for each one that is in your Zap2It Labs profile and will need to modify each record accordingly.
FreqID is really only important for analog channels, as digital relies on entries in the dtv_multiplex table to define the frequencies.
My entry has already been modified to match the atscscan, so here's what each value means and where it came from:
1000 - This was an auto generated unique ID and there's no need to modify it
21 - This is the channel that you would type on your remote control to directly tune in. Since this system is ONLY running digital, I'm not worried about overlapping with analog stations.
WKRN-DT - In both fields, this is just what is displayed in the guide and on-screen display
none - If I were motivated, I would put in the path to the icon for ABC
20465 - This is the xmltvid for the channel and was auto-populated when I ran mythfilldatabase.
0 - This means not to use the on-air guide. A 1 here would tell MythTV to ignore xmltv and use the on-air guide instead. I don't have that choice since the metadata is being stripped by my cable provider.
1 - This is the multiplex ID. We'll have to create a record for that, next. Just know that for every frequency (transport) for digital channels, you need a multiplex record. Since all of my clear channels are on the same transport, I only needed one.
1 - This is the service ID. From above, you saw that my service ID for WKRN-DT was 1. (The last field in the atscscan output)
Now you need to insert your multiplex ID's into the database. Here's what you'll type for a scenario like mine (QAM_256 encoding, frequency 555000000):
mysql> insert into dtv_multiplex set mplexid='1', sourceid='1', frequency='555000000', modulation='qam_256';
sourceid = What card this applies to, found in the capturecard table.
Finally, you need to define the Program ID's. If you forget this step, your mythbackend log file will have lots of entries similar to:
DVB#0 ERROR - No PIDS set, please correct your channel setup.
You fix this by inserting the last bit of information into the database:
mysql> insert into dvb_pids set chanid='1000', pid='2048', type='v';
mysql> insert into dvb_pids set chanid='1000', pid='2049', type='a';
There should be two records for every channel - one video ('v') and one audio ('a'). These are taken right from the atscscan output.
Step 5
-------
Ok, now that you've got all of your channel information added in, you will have to restart your mythbackend. However, once you do that, you should be able to watch digital cable!
I reserve the right to correct my mistakes and deny that they ever existed.
Scott