audio: automatically deatch filters if spdif prevents their use

Fixes #1743 and partially #1780.
This commit is contained in:
wm4 2015-04-07 21:38:39 +02:00
parent 579c4dac34
commit 36ae8a6cab
2 changed files with 17 additions and 5 deletions

View File

@ -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

View File

@ -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);