The MPEG chunk file contains 6, possibly 7, chunks:
The type of this chunk is:
The data in the chunk is:
The media field specifies a general type of media. For mjpeg files, this is:
The format field specifies a specific format. For mjpeg files, this is:
The device field specifies the original recording device. This field isn't really used for anything but is set to one of the following:
The version field specifies what version of the cmplayer is being used. This is currently set to:
The num_frames field contains how many frames of data are in the file.
The length_s field indicates how long the clip is in seconds.
The length_ns field indicates how many nanoseconds in addition to the previously indicated number of seconds the clip contains. Thus, the length of the clipfile can be found as (length_s + (length_ns * ONE_BILLION)).
The type of this chunk is:
The data in this chunk is:
Width and height are the width and height in pixels of the mjpeg data.
aspectRatioCode is the aspect ratio code used by the MPEG standard given in the video system header.
frameRateCode is the frame rate code used by the MPEG standard given in the video system header.
bitRate is the bit rate specified in the video system header.
vbvBufferSize is the vbv buffer size specified in the video system header.
constrainedParamFlag is 1 if the constrained parameter flag was set in the system header and 0 otherwise.
The type of this chunk is:
The data of this chunk consistes of (number_of_frames + 1) entries of the following form:
The start time of the nth frame is the nth entry of the above form. Again the actual time is found as:
The end time of the nth frame is the start time of the n+1 frame. Thus, the Frame Time Table contains one more time entry than number of frames in order to specify the end time of the last frame.
The type of this chunk is:
The data of this chunk consists of number_of_frames entries of the following form:
Offset refers to the byte offset from the beginning of the data segment where the frame's data begins.
Length refers to the length of the frame's data.
Each frame's offset and length are specified requiring number_of_frames entries of this form.
The type of this chunk is:
The data of this chunk consists of some number of entries of the following form:
intra_matrix_flag indicates whether or not intra_matrix_values follow. If set, the next 64*4 bytes are to be taken as a intra_quant_matrix in zigzag order.
The non_intra_matrix_flag and values work the same way.
Both flags can not be 0, at least one will be set. If both were zero, the default matrices would be used and there would be no need to put the entry in this table.
There can be many entries of this form in the header table chunk. Each one is refered to by its index number (i.e. position in the table starting at 0) by entries in the reference table chunk, see below.
This chunk does not have to exist. If it doesn't, all frames are assumed to use the default tables.
The type of this chunk is:
The data of this chunk consists of number_of_frames entries of the following form:
Type is the frame type (either 1, 2, 3, 4 for I, P, B, or D).
Ref1 is the index of the frame's chronologically past reference frame. For I frames, this is set to the index of the previous I frame. The value -1 indicates no valid past reference.
Ref2 is the index of the frame's chronologically future reference frame. For I and P frames, this is set to the index of the next I frame. The value -1 indicates no valid future reference.
HeaderRef indicates the index of the quant matrices to use. -1 means use the default matrices.
The type of this chunck is:
The data of this chunk is the mjpeg data itself.
The frame offset table is specified relative to the beginning of this chunk.