summaryrefslogtreecommitdiffstats
path: root/audio/filter/tools.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-10 19:48:46 +0200
committerwm4 <wm4@nowhere>2016-07-10 19:53:53 +0200
commit60048b7eb957bbe09b9c42d11ed61911939b0553 (patch)
treea19c1d446d9f2cb0c177cfe3f2fdc02dbf9ea4a6 /audio/filter/tools.c
parent7be98ef1b29a654d7a7c01f9223a174b4a3f241c (diff)
downloadmpv-60048b7eb957bbe09b9c42d11ed61911939b0553.tar.bz2
mpv-60048b7eb957bbe09b9c42d11ed61911939b0553.tar.xz
audio: add heuristic to move auto-downmixing before other filters
Normally, you want downmixing to happen first thing in the filter chain. This is reflected in codec downmixing, which feeds the filter chain downmixed audio in the first place. Doing this has the advantage of needing less data to process. But the main motivation is that if there is a drc filter in the chain, you want to process it the downmixed audio. Add an idiotic heuristic to achieve this. It tries to detect whether the audio was indeed automatically downmixed (or upmixed). To detect what the output format is going to be, it builds the filter chain normally, and then retries with the heuristic applied (and for extra paranoia, retries without the heuristic again if it fails to successfully rebuild the filter chain for unknown reasons). This is simple and will work in almost all cases. Doing it in a more complete way is rather hard, because filters are so generic. For example, we know absolutely nothing about the behavior of af_lavfi, which creates an opaque filter graph with libavfilter. We don't know why a filter would e.g. change the channel layout on its output. (Our heuristic bails out in this case.) We're also slave to the lowest common denominator of how our format negotiation works, and how libavfilter's works. In theory, we could make this mechanism explicit by introducing a special dummy filter. The filter chain would then try to convert between input and output formats at the dummy filter, which would give the user more control over how downmix happens. On the other hand, the user could just insert explicit conversion filters instead, so this would probably have questionable value.
Diffstat (limited to 'audio/filter/tools.c')
0 files changed, 0 insertions, 0 deletions