From 2a3d19a9dffc2613d491fc4dcd49e1e239e663c9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Feb 2015 22:14:26 +0100 Subject: af_scaletempo: drop detaching or skipping init on speed=1 This code skipped initialization if no speed/pitch change was to be applied. It also didn't force conversion of the audio to a supported format, which is probably the most important case in context of compatibility. With this change applied, af_scaletempo will always force format conversion. To make the change less disruptive, make the filter detach if unconvertable formats are used. Some users use spdif and also have "af=scaletempo" in their config, so better not completely break this. In the case the filter was added with the "speed=both" suboption, the filter also detached itself in this case; but it's an obscure case, so I don't care about that. --- audio/filter/af_scaletempo.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'audio') diff --git a/audio/filter/af_scaletempo.c b/audio/filter/af_scaletempo.c index f48f67fbc3..449ad02dc2 100644 --- a/audio/filter/af_scaletempo.c +++ b/audio/filter/af_scaletempo.c @@ -287,19 +287,17 @@ static int control(struct af_instance *af, int cmd, void *arg) int nch = data->nch; int use_int = 0; + if (AF_FORMAT_IS_SPECIAL(data->format)) { + MP_ERR(af, "Changing speed is not supported with spdif formats.\n"); + return AF_DETACH; + } + MP_VERBOSE(af, "%.3f speed * %.3f scale_nominal = %.3f\n", s->speed, s->scale_nominal, s->scale); mp_audio_force_interleaved_format(data); mp_audio_copy_config(af->data, data); - if (s->scale == 1.0) { - if (s->speed_tempo && s->speed_pitch) - return AF_DETACH; - af->delay = 0; - return af_test_output(af, data); - } - if (data->format == AF_FORMAT_S16) { use_int = 1; } else { -- cgit v1.2.3