Add debug output for PES packets
In our goal to solve the timing problem in DVB we're going to need to have proper debugging info for PES packets.
PES means packetized elementary stream, and well, it's what the name suggests. Anyway, we have this function:
// Read ts packets until a complete video PES element can be returned. // The data is read into cinfo->capbuf and the function returns the number of // bytes read. long ts_readstream(struct ccx_demuxer *ctx, struct demuxer_data **data)
Which as you can see, reads packets until a complete PES is assembled, then return the PES and it's length.
The DVB specification says: A DVB subtitle stream is carried in PES packets and the timing of their presentation is defined by the PTS in the PES header. Upon reception and decoding of the subtitle data for a page (such as the page composition, the region composition, the objects to be used and any other associated data) the page contents are displayed at the time indicated by the associated PTS.
(google en_300743v010301p.pdf for the complete docs)
Anyway, it seems clear that we have to parse the PES header to figure out what's going on. The header itself is simple:
http://dvd.sourceforge.net/dvdinfo/pes-hdr.html
And the specific job here is add a parameter -pesheader that makes CCExtractor write the contents of the header each time a PES is complete.