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 MP4 file.

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 MP4 sample.
  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. Use the frame immediately preceding the frame that starts the next access unit to complete the MP4 sample.
  5. Use the frame that starts the next access unit as the first frame of the next MP4 sample.

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 MP4 sample.
  3. As frames are placed in the MP4 sample, 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 completes six blocks (or a multiple of six blocks), the current sample is completed. Otherwise, keep searching until six blocks have been accumulated.