Skip to content

Background Info

Marc edited this page Nov 9, 2022 · 4 revisions
TS Header:

  Bytes
  |00     |01   02|03          |
  +-------+-------+------------+
  | Sync  |  PID  | Continuity |
  |  0x47 |   1)  | counter 2) |
  +-------+-------+------------+

  1) Bit
      7 - Transport error indicator
      6 - Payload unit start indicator
      5 - Transport priority
      4 - PID (msb)
      3 - PID
      2 - PID
      1 - PID
      0 - PID

      7 - PID
      :
      0 - PID (lsb)

  2) Bit
      7 - Transport scrambling control
      6 - Transport scrambling control
      5 - Adaptation field control
      4 - Adaptation field control
      3 - Continuity counter
      2 - Continuity counter
      1 - Continuity counter
      0 - Continuity counter

    Transport scrambling control:
      00 - Not scrambled
      01 - User-defined
      10 - User-defined
      10 - User-defined

    Transport scrambling control:
      00 - Reserved
      01 - No adaptation field |    Payload
      10 -    Adaptation field | No payload
      10 -    Adaptation field |    Payload

PAT/PMT:

  Table Id:
    0x00 - PAT
    0x02 - PMT

  PAT:
  Bytes
  |00       03|04 |05     |06    07|08       09|10   |11       |12      |13    | 4 bytes |
  +--+--+--+--+---+-------+--------+-----------+-----+---------+--------+------+---------+
  |  Header   | P | Table | Length | Transport | Ver | section | last   | N    |   CRC   |
  |           | 1)|  Id   | 2)     | stream ID |  3) |  number | sec nr | loop |         |
  +-----------+---+-------+--------+-----------+-----+---------+--------+------+---------+
                                                                       /     /
           /----------------------------------------------------------/     /
          /                                          /---------------------/
         /                                          /
         |13     14|15     16|17     18|19        20|
         +---------+---------+---------+------------+---...
         | prg nr: | Network | prg nr: | program map|
         |  0000   |   PID   |   i     |  PID of i  |
         +---------+---------+---------+------------+---...

  1) P = Pointer field
     According to the ITU H.222.0 (05/06) section 2.4.4.2:
       When at least one section begins in a given Transport Stream packet,
       then the payload_unit_start_indicator (refer to 2.4.3.2) shall be set to '1'
       and the first byte of the payload of that Transport Stream packet shall
       contain the pointer. When no section begins in a given Transport Stream packet,
       then the payload_unit_start_indicator shall be set to '0' and no pointer
       shall be sent in the payload of that packet.

  2) Bit
	  7 - Section syntax ind.
	  6 - '0'
	  5 - don't care
	  4 - don't care
	  3 - section length (msb)
	  2 - section length
	  1 - section length
	  0 - section length

	  7 - section length
	  :
	  0 - section length (lsb)

  3) Bit
	  7 - don't care
	  6 - don't care
	  5 - version number (msb)
	  4 - version number
	  3 - version number
	  2 - version number
	  1 - version number (lsb)
	  0 - Current Next Indicator


  PMT:
  Bytes
  |00       03|04 |05     |06     07|08     09|10   |11       |12      |13  14|15       16|17    |      | 4 bytes |
  +--+--+--+--+---+-------+---------+---------+-----+---------+--------+------+-----------+------+------+---------+
  |  Header   | P | Table | Section | Program | Ver | section | last   | PCR  | Prog Info | Info |      |   CRC   |
  |           | 1)|  Id   | Length  | Number  |     |  number | sec nr | PID  | Length    |      |      |         |
  +-----------+---+-------+---------+---------+-----+---------+--------+------+-----------+------+------+---------+
                                                                                                /      /
           /-----------------------------------------------------------------------------------/      /
          /                                            /---------------------------------------------/
         /                                            /
         |00      |01        02|03     04|05        20|
         +--------+------------+---------+------------+---...
         | Stream | Elementary | ES info |            |
         |  Type  |   PID      | Length  |            |
         +--------+------------+---------+------------+---...

     05 = Table ID
  06-07 = Section Syntax Indicator | '0' | res | res | Section Length 12Bits
  08-09 = program_number
     10 = res | res | Version Number 5Bits | Current Next Indicator
     11 = Section Number      (0x00)
     12 = Last Section Number (0x00)
  13-14 = res | res | res | PCR_PID 13Bits
  15-16 = res | res | res | res | Program Info Length 12Bits
  17-.. = Program Info

     00 = stream type
  01-02 = res | res | res | Elementary PID 13Bits
  03-04 = res | res | res | res | ES-Info Length 12Bits