1. Victor Stinner
  2. hachoir
  3. Issues
Issue #37 new

Patch: MpegTS adapation-field parsing

Ulrik Mikaelsson
created an issue

Attaching a patch that provides parsing of the MpegTS adaptation-field.

The PCR in the adaptation-field can be used to calculate the duration of streams, independent of stream-content (codecs, DVB-encryption...).

Comments (7)

  1. Ulrik Mikaelsson reporter

    I think, by specification, all MpegTS-files must have them. Every 40ms in stream-time, at least one packet must have an adaptation-field header, with a valid PCR clock.

    If you still need something, most of my real sample files are copyrighted, but I can see if I can chop out a second or two tomorrow.

  2. Robert Xiao

    OK, patch looks good. One question: is there any specific format for the stuffing bits? In your sample, I noticed that in the second adaptation field packet (packet[77]) the field is exclusively 1 bits, but in the first adaptation field (packet[2]), the field has the pattern "001010" which looks a bit suspicious. Then again, since they are stuffing bits, maybe I am ascribing too much meaning to them ;)

  3. Ulrik Mikaelsson reporter

    Regarding stuffing, AFAIK it has no particular meaning. I don't have the spec here, but IIRC, it's just there to pad out the bits to an even byte-count.

    I just looked at the patch again though, and I don't really see my motivation for the last change, moving the synchronisation-code out of the main-loop. Please ignore that part.

  4. Log in to comment