diff options
author | wm4 <wm4@nowhere> | 2017-11-29 21:30:10 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-11-29 21:30:51 +0100 |
commit | d725630b5f5817287d44cb31c3c7b9d815c187db (patch) | |
tree | 6c54b58b8bb3a4bfc25e0eafb253266a3a10f766 /Copyright | |
parent | 9c909fbb4d4abeabe9ac6731cb0c3f966dacf0ff (diff) |
audio: add audio softvol processing to AO
This does what af_volume used to do. Since we couldn't relicense it,
just rewrite it. Since we don't have a new filter mechanism yet, and the
libavfilter is too inconvenient, do applying the volume gain in ao.c
directly. This is done before handling the audio data to the driver.
Since push.c runs a separate thread, and pull.c is called asynchronously
from the audio driver's thread, the volume value needs to be
synchronized. There's no existing central mutex, so do some shit with
atomics. Since there's no atomic_float type predefined (which is at
least needed when using the legacy wrapper), do some nonsense about
reinterpret casting the float value to an int for the purpose of atomic
access. Not sure if using memcpy() is undefined behavior, but for now I
don't care.
The advantage of not using a filter is lower complexity (no filter auto
insertion), and lower latency (gain processing is done after our
internal audio buffer of at least 200ms).
Disavdantages include inability to use native volume control _before_
other filters with custom filter chains, and the need to add new
processing for each new sample type.
Since this doesn't reuse any of the old GPL code, nor does indirectly
rely on it, volume and replaygain handling now works in LGPL mode.
How to process the gain is inspired by libavfilter's af_volume (LGPL).
In particular, we use exactly the same rounding, and we quantize
processing for integer sample types by 256 steps. Some of libavfilter's
copyright may or may not apply, but I think not, and it's the same
license anyway.
Diffstat (limited to 'Copyright')
-rw-r--r-- | Copyright | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -34,8 +34,8 @@ a LGPL mode to mpv, MPlayer code had to be relicensed from GPLv2+ to LGPLv2.1+ by asking the MPlayer authors for permission. Since permission could not be obtained from everyone, LGPL mode disables the following features, some of them quite central: -- no audio filtering, which breaks: --volume, --af, replaygain, pitch - correction, fine control about downmix/upmix/resampling behavior +- no audio filtering, which breaks: --af, pitch correction, fine control over + downmix/upmix/resampling behavior - Linux X11 video output - BSD audio output via OSS - NVIDIA/Linux hardware decoding (vdpau, although nvdec usually works) |