Parsing the Program Association Section of a Transport Stream

1.3k views Asked by At

I am trying to find the Type of PID (AUDIO,VIDEO,etc..), i have parsed the Header section of the Transport Stream and extracted the PIDS . By going through the Transport Stream Standard i got to know that i need to parse the PAT to get the this. The Program Association Section mentioned in the standard is the below. In the below section what does 'N' in the for loop actually mean, can anyone please help me out.(Refer Table 2-25 in standard)

program_association_section() {
  table_id
  section_syntax_indicator
  '0'
  reserved
  section_length
  transport_stream_id
  reserved
  version_number
  current_next_indicator
  section_number
  last_section_number
  for (i = 0; i < N; i++) {
    program_number
    reserved
    if (program_number = = '0') {
      network_PID
    }
    else {
      program_map_PID
    }
  }
  CRC_32
}
1

There are 1 answers

2
aergistal On

The Program Association Table (PAT) can contain information about multiple programs. PAT packets always have the PID 0x00.

To find out the stream type you need more than the PAT.

Parsing the program section in the PAT will give the PIDs of the Program Map Tables (PMT) for each program.

The PMT packets are the ones you're after as they contain the information about the elementary streams of each program, including the stream type.

You can find an overview here.