Question on PAT/PMT tables

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
Post Reply
PhilipD
Posts: 6
Joined: Sun Sep 15, 2019 3:21 am

Question on PAT/PMT tables

Post by PhilipD » Thu Oct 10, 2019 12:34 am

Hi

So the Program Association Table (PAT) has a list of program numbers in a transport stream, providing a PID that identifies the Program Map Table, which essentially identifies all the PIDs (the parts) for a single program.

My question is, what is best practice about storing these?

For example, on "tuning" to the channels, is it usual to read the PAT and obtain all the PMT information and store that in non-volatile memory so when a program is wanted it is quicker to lookup the PIDs and get a filtered stream? Or is it the case that this information should be collected and re-read on every request for a program from the stream under the basis they change fairly often? Also could the PMT list of PIDs change midway through a program, for example if the broadcaster goes to an advert break where there is no audio description or subtitles, does the PMT list of PIDs change at that cut over point, before switching back when program restarts?

Regards

Phil

nickk
Silicondust
Posts: 15621
Joined: Tue Jan 13, 2004 9:39 am

Re: Question on PAT/PMT tables

Post by nickk » Thu Oct 10, 2019 8:43 am

Hi,

PIDs don't change mid stream - they generally only change if something has been manually reconfigured by the broadcaster. With that said, for US we recommend storing only the frequency + program number and finding the PAT+PMT each time to get the PID information. Typically these tables are outputted before the I frame and you have to wait for that anyway.

If using a HDHomeRun we recommend pulling the channel lineup /lineup.json and have the HDHomeRun tune the sub-program. The stream you get back will have the PAT and PMT first for rapid decoding.

Nick

PhilipD
Posts: 6
Joined: Sun Sep 15, 2019 3:21 am

Re: Question on PAT/PMT tables

Post by PhilipD » Thu Oct 10, 2019 10:49 am

Hi Nick

Many thanks for the reply.

I had noticed the HDHomeRun always outputted a modified PAT (only containing the relevant program number) as the first packet.

I would use the HDHomeRun to do the heavy lifting so to speak however I also need the EIT tables (PID 0x12) in the stream to extract 'present and following' events in real time, which doesn't seem to be included otherwise.

I will lookup the PAT/PMT each time then. Thanks the information.

Regards

Phil

Post Reply