mpv/audio/out
wm4 d725630b5f 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.
2017-11-29 21:30:51 +01:00
..
ao.c audio: add audio softvol processing to AO 2017-11-29 21:30:51 +01:00
ao.h audio: add audio softvol processing to AO 2017-11-29 21:30:51 +01:00
ao_alsa.c ao_alsa: change license to LGPL 2017-11-23 16:43:59 +01:00
ao_audiounit.m ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio.c ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio_chmap.c audio/out: add AudioUnit output driver for iOS 2016-11-01 16:25:40 +01:00
ao_coreaudio_chmap.h audio/out: add AudioUnit output driver for iOS 2016-11-01 16:25:40 +01:00
ao_coreaudio_exclusive.c ao_coreaudio: insane hack for passing through AC3 as float PCM 2017-06-30 09:06:01 +02:00
ao_coreaudio_properties.c ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio_properties.h ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio_utils.c ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_coreaudio_utils.h ao_coreaudio: change license to LGPL 2017-05-08 13:57:40 +02:00
ao_jack.c Add checks for HAVE_GPL to various GPL-only source files 2017-10-10 15:51:16 +02:00
ao_lavc.c audio/out: require AO drivers to report period size and correct buffer 2017-06-25 15:57:43 +02:00
ao_null.c audio/out: require AO drivers to report period size and correct buffer 2017-06-25 15:57:43 +02:00
ao_openal.c audio/out: require AO drivers to report period size and correct buffer 2017-06-25 15:57:43 +02:00
ao_opensles.c options: remove deprecated sub-option handling for --vo and --ao 2016-11-25 21:17:25 +01:00
ao_oss.c Add checks for HAVE_GPL to various GPL-only source files 2017-10-10 15:51:16 +02:00
ao_pcm.c ao_pcm: drop AF_FORMAT_S24 usage 2017-07-07 17:56:18 +02:00
ao_pulse.c ao_pulse: reorder format choice 2017-06-23 21:12:44 +02:00
ao_rsound.c ao_rsound: allow setting the host 2017-08-21 15:46:00 +02:00
ao_sdl.c options: remove deprecated sub-option handling for --vo and --ao 2016-11-25 21:17:25 +01:00
ao_sndio.c ao_sndio: drop AF_FORMAT_S24 usage 2017-07-07 17:56:18 +02:00
ao_wasapi.c ao_wasapi: return bool instead of HRESULT from thread_init 2017-08-07 14:33:03 -07:00
ao_wasapi.h ao_wasapi: reorganize wasapi.h 2017-08-07 14:33:03 -07:00
ao_wasapi_changenotify.c ao_wasapi_changenotify: use %ls instead of %S for wchar_t 2017-04-20 07:38:03 +02:00
ao_wasapi_utils.c ao_wasapi: remove old comment 2017-08-07 16:33:29 -07:00
internal.h audio: add audio softvol processing to AO 2017-11-29 21:30:51 +01:00
pull.c audio: add audio softvol processing to AO 2017-11-29 21:30:51 +01:00
push.c audio: add audio softvol processing to AO 2017-11-29 21:30:51 +01:00