summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-28 22:38:47 +0100
committerwm4 <wm4@nowhere>2013-04-13 04:21:28 +0200
commitf9a6b1c3f8b82f809429ea61396a89bd0aeb64b6 (patch)
treeafa636283f3186ba3a58ffe9ff33127d95dcbc43
parentbc268b313e3764ff192f9adb28c5735a6241224a (diff)
downloadmpv-f9a6b1c3f8b82f809429ea61396a89bd0aeb64b6.tar.bz2
mpv-f9a6b1c3f8b82f809429ea61396a89bd0aeb64b6.tar.xz
af: remove force option
Dangerous and misleading. If it turns out that this is actually needed to make certain setups work right, it should be added back in a better way (in a way it doesn't cause random crashes).
-rw-r--r--audio/filter/af.c113
1 files changed, 49 insertions, 64 deletions
diff --git a/audio/filter/af.c b/audio/filter/af.c
index d6d09158ef..46e7108273 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -421,37 +421,24 @@ int af_reinit(struct af_stream *s)
af = af->next;
break;
case AF_FALSE: { // Configuration filter is needed
- // Do auto insertion only if force is not specified
- if ((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE) {
- int progress = 0;
- if (af_fix_channels(s, &af, in) == AF_OK)
- progress = 1;
- if (af_fix_format_conversion(s, &af, in) == AF_OK)
- progress = 1;
- if (progress) {
- retry++;
- continue;
- }
- goto negotiate_error;
- } else {
- mp_msg(
- MSGT_AFILTER, MSGL_ERR,
- "[libaf] Automatic filter insertion disabled "
- "but formats do not match. Giving up.\n");
- return AF_ERROR;
+ int progress = 0;
+ if (af_fix_channels(s, &af, in) == AF_OK)
+ progress = 1;
+ if (af_fix_format_conversion(s, &af, in) == AF_OK)
+ progress = 1;
+ if (progress) {
+ retry++;
+ continue;
}
- break;
+ goto negotiate_error;
}
case AF_DETACH: { // Filter is redundant and wants to be unloaded
- // Do auto remove only if force is not specified
- if ((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE) {
- struct af_instance *aft = af->prev;
- af_remove(s, af);
- if (aft)
- af = aft->next;
- else
- af = s->first; // Restart configuration
- }
+ struct af_instance *aft = af->prev;
+ af_remove(s, af);
+ if (aft)
+ af = aft->next;
+ else
+ af = s->first; // Restart configuration
break;
}
default:
@@ -558,46 +545,44 @@ int af_init(struct af_stream *s)
return -1;
// Check output format
- if ((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE) {
- struct af_instance *af = NULL; // New filter
- // Check output frequency if not OK fix with resample
- if (s->output.rate && s->last->data->rate != s->output.rate) {
- // try to find a filter that can change samplrate
- af = af_control_any_rev(s, AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET,
- &(s->output.rate));
- if (!af) {
- char *resampler = "lavrresample";
- if ((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_SLOW) {
- if (af_is_conversion_filter(s->first))
- af = af_append(s, s->first, resampler);
- else
- af = af_prepend(s, s->first, resampler);
- } else {
- if (af_is_conversion_filter(s->last))
- af = af_prepend(s, s->last, resampler);
- else
- af = af_append(s, s->last, resampler);
- }
- // Init the new filter
- if (!af)
- return -1;
- af->auto_inserted = true;
- if (af->control(af, AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET,
- &(s->output.rate)) != AF_OK)
- return -1;
+ struct af_instance *af = NULL; // New filter
+ // Check output frequency if not OK fix with resample
+ if (s->output.rate && s->last->data->rate != s->output.rate) {
+ // try to find a filter that can change samplrate
+ af = af_control_any_rev(s, AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET,
+ &(s->output.rate));
+ if (!af) {
+ char *resampler = "lavrresample";
+ if ((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_SLOW) {
+ if (af_is_conversion_filter(s->first))
+ af = af_append(s, s->first, resampler);
+ else
+ af = af_prepend(s, s->first, resampler);
+ } else {
+ if (af_is_conversion_filter(s->last))
+ af = af_prepend(s, s->last, resampler);
+ else
+ af = af_append(s, s->last, resampler);
}
- if (AF_OK != af_reinit(s))
+ // Init the new filter
+ if (!af)
+ return -1;
+ af->auto_inserted = true;
+ if (af->control(af, AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET,
+ &(s->output.rate)) != AF_OK)
return -1;
}
- if (AF_OK != fixup_output_format(s)) {
- // Something is stuffed audio out will not work
- mp_msg(
- MSGT_AFILTER, MSGL_ERR,
- "[libaf] Unable to setup filter system can not"
- " meet sound-card demands, please send a bug report. \n");
- af_uninit(s);
+ if (AF_OK != af_reinit(s))
return -1;
- }
+ }
+ if (AF_OK != fixup_output_format(s)) {
+ // Something is stuffed audio out will not work
+ mp_msg(
+ MSGT_AFILTER, MSGL_ERR,
+ "[libaf] Unable to setup filter system can not"
+ " meet sound-card demands, please send a bug report. \n");
+ af_uninit(s);
+ return -1;
}
return 0;
}