MP4DMX Appendix

Track Synchronization Errors

Synchronization of samples from different tracks occasionally cannot be guaranteed for certain stream structures and certain numbers of elements in an internal buffer. If this happens, MP4DMX_RET_EXECUTE_WARNING is returned when ordinary processing (getting samples, MP4DMXExecute) exits (when an ending time is specified or at the end of a fragment). MP4DMX_RET_EXECUTE_WARNING is not returned for any stream that is not fragmented and has audio and video of equal length.

After MP4DMX_RET_EXECUTE_WARNING has been returned, behavior depends on the processing defined by the application. The following diagrams show the flowchart for track synchronization errors, and the sequence diagram.


Figure 1: Track Synchronization Error Flowchart


Figure 2: Track Synchronization Error Sequence Diagram

Getting the Playback Time

After completing processing from initialization MP4DMXOpen to header parsing MP4DMXReadHeader, get system information (including the time scale, title, copyright, and playback time) as well as video and audio track information (including the time scale, bitrate, and sampling rate) using utility functions for header information (MP4DMXGetHeaderInf, MP4DMXGetTrackInf, MP4DMXGetVideoTrackInf, and MP4DMXGetAudioTrackInf). However, you must read to the end of the MP4 data file when it is fragmented and does not have a MovieExtendsBox.

To get the playback time the user application must read to the end of the MP4 data file-and parse all fragments-for any return value. As a result, the return value MP4DMX_RET_READ_HEADER will indicate a fragment that has already been played back regardless of the time that you seek to in the file when demultiplexing (getting current position, MP4DMXExecute). To read to the end of an MP4 data file without marking it as having been played back, specify MP4DMX_UNASSIGNED_END_TIME_STAMP—which indicates the end of the file—as the input timestamp when parsing headers (MP4DMXReadHeader). If you do not read to the end of the MP4 data file, you can only get the playback time of the fragments that have been read.

The following two figures show the procedure and sequence of events, respectively, for getting the playback time.


Figure 3: Procedure for Getting the Playback Time


Figure 4: Sequence of Events for Getting the Playback Time

Revision History

2014/08/04 Initial version.


CONFIDENTIAL