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/af.c | |
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/af.c')
-rw-r--r-- | audio/filter/af.c | 17 |
1 files changed, 17 insertions, 0 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 |