mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
30f3f9fcda
commit
2a3d19a9df
|
@ -287,19 +287,17 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
||||||
int nch = data->nch;
|
int nch = data->nch;
|
||||||
int use_int = 0;
|
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",
|
MP_VERBOSE(af, "%.3f speed * %.3f scale_nominal = %.3f\n",
|
||||||
s->speed, s->scale_nominal, s->scale);
|
s->speed, s->scale_nominal, s->scale);
|
||||||
|
|
||||||
mp_audio_force_interleaved_format(data);
|
mp_audio_force_interleaved_format(data);
|
||||||
mp_audio_copy_config(af->data, 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) {
|
if (data->format == AF_FORMAT_S16) {
|
||||||
use_int = 1;
|
use_int = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue