This patch implements (quite naively) an auto-adjustment mechanism of the playback speed based on the proportion between the real delta_time elapsed from the beginning of the playback and the delta_reference_clock found in the multiplex. At the moment the only mux that carries this information is MPEG-TS and only if demuxed by demux_ts.c. The patch is just in an initial state, but I'd like to know if this code is (or resembles) what Uoti and Rich had in mind when they objected to my commit in ds_fill_buffer() a couple of months ago. The patch should always be used with -af scaletempo, or the audio stream will sound distorted. Possible parameters are: -autospeed to enable the auto-adjustment -autospeed-period (in seconds) indicates the smallest period between two consecutive adjustments -autospeed-threshold is the minimum difference between the two delta_times after which the adjustment will be considered necessary Unfortunately even with this patch applies the video stream sometimes still stutters ... Ideas and comments welcome