Skip to main content

rounding_quantum

Function rounding_quantum 

Source
pub fn rounding_quantum(timestamps: &[i64]) -> i64
Expand description

The unit a stream’s timestamps are rounded to, as their spacing shows, in the units of the stream’s time base; 0 when they show none.

timestamps are a stream’s first presentation timestamps, in any order: its first ROUNDING_SCAN_FRAMES packets’, fewer when those before hold ROUNDING_SCAN_BYTES. A frame interval that is not a whole number of a rounding unit comes out of the rounding as two lengths a unit apart: 29.97 fps in milliseconds is 33 and 34 ms, and so in a 1/16000 time base that kept the milliseconds of the file it was copied from (528 and 544). The unit is the greatest common divisor of the differences between the intervals. Intervals that are all one length show no rounding: the frames are exact in the time base. Intervals whose differences are as long as half the shortest are a variable frame rate, not a rounding (60 and 30 fps frames in an exact 1/90000 time base are 1500 and 3000 apart), and show none either. Fewer than three distinct timestamps show none.

Only the start of a stream is read: a file whose later frames are rounded otherwise than its first (two recordings joined) keeps the slack its start shows.