[mythtv] SI/PSIP Parser

Taylor Jacob rtjacob at earthlink.net
Tue Sep 21 22:40:53 EDT 2004

I sent this to Daniel Thor Kristjansson, but I see no reason why I shouldn't get some input from
anyone else interested in this:


I finally got a idea for a class that will work for both DVB and ATSC :)

I am in the process of moving my code into the new class.. The data will be passed in via a signal
called ParseTable(uint8_t* buffer, int size);

This will process the tables (whatever ATSC tables you want to handle.. I wrote some partial table
parsers and tested them with PBS on AMC3 which uses ATSC over DVB).

You will need to add slots to recorder called AddPid, DelPid that will control what pids you
This way once the MGT determines what PIDs have the EIT on them the recorder can know to grab
these and send them off via the slot.

In the recorder loop you will need to check for any of the added pids, and if its one of them pass
the data into a TS2PES class I wrote for organizing the data into a section table, and when this
gets a complete table send the signal to the siparser which will process it..  I will probbably
make all the processing threaded so it wont slow down the dvbrecorder. This isnt such a big deal
for DVB but the heavy lifting should be done in a thread anyway..

The SIParser class will have some generic methods called ScanServices(), ScanTransports(),
FetchGuide() which will determine if its an ATSC or DVB source (this can be force of course) and
will call the right functions.. The ScanServices for ATSC could just parse the TVCT and shove some
entries into the channels table.. The ScanTransports for ATSC could attempt to tune to each
broadcast channel and check for a signal.. The FetchGuide should be apparent.. The only thing that
you will have to make sure of is you stick with some kind of scheme with teh zap2itid field in
channel.. For DVB I am using networkid.serviceid.. I guess for ATSC you could just use
ChannelMajor.ChannelMinor or some other linkage like the channelTSID.programNumber.  Most likely
the ScanXX functions would only be used from the setup application..

The SIParser class will be created in tv_rec.cpp and will be connected to what slots it needs to
communicate.. I guess the hdtvrecorder.cpp will either need to be left running all the time just
not writing to the ringbuffer, or make another class that just handles the pid control so you can
do guide scanning while not recording..

If this doesnt make sense give me a few days and I will send you what ive got and you can take a
look.. I also have some huffmann code that I will be adding into the guide parser stuff so you
should be able to use huffmann encoded guide data (dont know if anyone uses it or not).. I can
probbably test some of the ATSC parsing with PBS, but their guide only says "PBS SD Event" with a
length of 3 hours, so it won't be a real robust test.

Hopefully I haven't stepped on anything you have done too badly but the more I looked into the
ATSC tables it seemed stupid to not put them together, and since ATSC over DVB exists it really
should be combined..


More information about the mythtv-dev mailing list