From 36ae8a6cab69f849b3e78ddf6840e5f95c86c659 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 7 Apr 2015 21:38:39 +0200 Subject: audio: automatically deatch filters if spdif prevents their use Fixes #1743 and partially #1780. --- audio/filter/af.c | 17 +++++++++++++++++ audio/filter/af_scaletempo.c | 5 ----- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'audio/filter') diff --git a/audio/filter/af.c b/audio/filter/af.c index 48f6d58868..8d29e332a8 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -561,6 +561,23 @@ static int af_reinit(struct af_stream *s) retry++; continue; } + // If the format conversion is (probably) caused by spdif, then + // (as a feature) drop the filter, instead of failing hard. + int fmt_in1 = af->prev->data->format; + int fmt_in2 = in.format; + if (af_fmt_is_valid(fmt_in1) && af_fmt_is_valid(fmt_in2)) { + bool spd1 = AF_FORMAT_IS_IEC61937(fmt_in1); + bool spd2 = AF_FORMAT_IS_IEC61937(fmt_in2); + if (spd1 != spd2) { + MP_WARN(af, "Filter %s apparently cannot be used due to " + "spdif passthrough - removing it.\n", + af->info->name); + struct af_instance *aft = af->prev; + af_remove(s, af); + af = aft->next; + break; + } + } goto negotiate_error; } case AF_DETACH: { // Filter is redundant and wants to be unloaded diff --git a/audio/filter/af_scaletempo.c b/audio/filter/af_scaletempo.c index 1f187a98bc..ad8e520601 100644 --- a/audio/filter/af_scaletempo.c +++ b/audio/filter/af_scaletempo.c @@ -303,11 +303,6 @@ 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_ERROR; - } - mp_audio_force_interleaved_format(data); mp_audio_copy_config(af->data, data); -- cgit v1.2.3