diff options
author | wm4 <wm4@nowhere> | 2015-04-07 21:38:39 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-04-07 21:38:39 +0200 |
commit | 36ae8a6cab69f849b3e78ddf6840e5f95c86c659 (patch) | |
tree | 846c83729a728cb78acd45d610740bd6b09e8b8a /audio/filter | |
parent | 579c4dac34546357a5fd1dfd67712df6a5930bf6 (diff) | |
download | mpv-36ae8a6cab69f849b3e78ddf6840e5f95c86c659.tar.bz2 mpv-36ae8a6cab69f849b3e78ddf6840e5f95c86c659.tar.xz |
audio: automatically deatch filters if spdif prevents their use
Fixes #1743 and partially #1780.
Diffstat (limited to 'audio/filter')
-rw-r--r-- | audio/filter/af.c | 17 | ||||
-rw-r--r-- | audio/filter/af_scaletempo.c | 5 |
2 files changed, 17 insertions, 5 deletions
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); |