Parsing a Dolby Digital Plus bitstream

A product must use several bitstream information fields in the Dolby Digital Plus bitstream to identify access units and to properly signal the Dolby Digital Plus bitstream information in the PES packet payload.

To locate the start of an access unit, the product checks the numblkscod, strmtyp, and substreamid values. The multiplexing processing logic depends on the number of blocks per frame (indicated by the numblkscod value) in the Dolby Digital Plus bitstream.

If the numblkscod value is 3:

  1. Find the first frame with a strmtyp value of 0 and a substreamid value of 0. This indicates the start of an access unit.
  2. Use the frame as the first frame of the program elementary stream packet payload.
  3. Search for the next frame with a strmtyp value of 0 and substreamid value of 0. This indicates the start of the next access unit.
  4. If putting another access unit in the payload, continue placing frames in the PES packet payload and go back to step 3.

    Alternatively, use the frame immediately preceding the frame that starts the next access unit to complete the current PES packet payload.

  5. Use the frame that starts the next access unit as the first frame of the next PES packet payload.

If the numblkscod value is not 3:

  1. Find the first frame with a strmtyp value of 0, a substreamid value of 0, and a convsync flag set to 1.

    This indicates the start of an access unit.

  2. Use the frame as the first frame of the PES packet payload.
  3. As frames are placed in the PES packet payload, keep track of the number of accumulated audio blocks.
  4. Find the next frame with a strmtyp value of 0, a substreamid value of 0, and a convsync flag set to 1:
    • If the frame immediately preceding the next frame does not complete six blocks (or a multiple of six blocks), keep searching until completing six blocks or multiple of them.
    • If the frame immediately preceding the next frame completes six blocks (or a multiple of six blocks), the current access unit is completed.
  5. If putting another access unit in the payload, restart the count of accumulated audio blocks, put the next frame in the PES packet payload, and continue with step 4.

    Alternatively, use the frame immediately preceding the frame that starts the next access unit to complete the current PES packet payload.

  6. Use the frame that starts the next access unit as the first frame of the next PES packet payload.