Commit Graph

204 Commits

Author SHA1 Message Date
Max Kellermann
4c7154bd23 filter/Observer: add noexcept 2019-08-26 21:04:35 +02:00
Max Kellermann
4f5c3b349d filter/Filter: document that Flush() can throw 2019-08-26 21:03:25 +02:00
Max Kellermann
4fabfdabde filter/Filter: allow throwing any exception 2019-08-26 21:01:22 +02:00
Max Kellermann
2e9b5e4e78 filter/Registry: rename the source file 2019-08-26 20:54:52 +02:00
Max Kellermann
af99f9fc90 pcm/Volume: convert S16 to S24 to preserve quality and reduce noise
Applying software volume to S16 samples means several bits of
precision are lost; at 25% volume, two bits are lost.  Additionally,
dithering adds some noise.

The problem gets worse when you apply the software volume code twice:
for the software mixer volume, and again for the replay gain.  This
loses some more precision and adds even more dithering noise, which
can become audible (see
https://github.com/MusicPlayerDaemon/MPD/issues/542).

By converting everything to 24 bit, we need to shift only two bits to
the right instead of ten, losing nearly no precision, and dithering is
not needed.  Even if the output device is unable to play S24 directly,
we can convert back to S16 with only one stage of dithering.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/542
2019-07-30 20:03:37 +02:00
Max Kellermann
5fa7610264 pcm/Volume: Open() returns output sample format
Prepare for a new mode which may convert to a different sample format
when applying volume, to reduce dithering.
2019-07-05 19:03:00 +02:00
Max Kellermann
d663f81420 include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Max Kellermann
e87f0ca771 pcm/Pcm*: drop more "Pcm" prefixes from source file names 2019-06-17 11:17:48 +02:00
Max Kellermann
a139279575 Copyright year 2019 2019-06-17 11:17:30 +02:00
Max Kellermann
e78d825059 pcm/PcmConvert: eliminate Open() and Close()
Let the constructor and destructor do this.  This means that all users
have to be converted to allocate PcmConvert dynamically.
2019-04-04 21:01:08 +02:00
Max Kellermann
00b04468dc filter/Convert: make in_audio_format const 2019-04-04 21:00:23 +02:00
Max Kellermann
ca4e53859d Merge branch 'v0.21.x' 2019-03-25 08:11:07 +01:00
Max Kellermann
8b327f1d9b filter/AutoConvert: implement Flush() 2019-03-24 22:42:06 +01:00
Max Kellermann
aef0507abb filter/Filter: fix typo in API doc 2019-03-24 22:34:11 +01:00
Max Kellermann
61120d2059 filter/ffmpeg: use only one AVFrame
The two were never used at the same time, and merging them saves one allocation.
2019-03-24 22:29:57 +01:00
Max Kellermann
cc1822810f filter/ffmpeg: use av_buffersrc_add_frame() instead of av_buffersrc_write_frame()
This transfers ownership of the buffer instead of adding another reference.
2019-03-24 22:28:40 +01:00
Max Kellermann
a21c6884f2 filter/ffmpeg: call av_frame_unref() before av_buffersink_get_frame()
Fix another memory leak.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/514
2019-03-24 22:27:48 +01:00
Max Kellermann
2700eed08d filter/ffmpeg: remove unnecessary av_frame_make_writable() call
A newly allocated buffer doesn't need this call; it only adds overhead
for copying the data.
2019-03-24 22:26:09 +01:00
Max Kellermann
ec2badbedd filter/ffmpeg: call av_frame_unref() before av_frame_get_buffer()
av_frame_get_buffer() leaks memory if buffers were already allocated.

Fixes one of the memory leaks of https://github.com/MusicPlayerDaemon/MPD/issues/514
2019-03-24 22:24:54 +01:00
Max Kellermann
ec5be91ff6 filter/ffmpeg: new filter plugin 2019-03-18 18:56:06 +01:00
Max Kellermann
a7a9490a0c filter/hdcd: include cleanup 2019-03-18 18:55:25 +01:00
Max Kellermann
c0d6008781 filter/hdcd: move generic code to class FfmpegFilter 2019-03-18 18:35:23 +01:00
Max Kellermann
9f62824e98 filter/hdcd: fix typo 2019-03-18 18:32:20 +01:00
Max Kellermann
c673528cff filter/hdcd: new filter plugin based on FFmpeg's "af_hdcd" 2019-03-18 13:48:24 +01:00
Max Kellermann
321f01b95c filter/plugins/null: move code to src/filter/NullFilter.hxx 2019-03-18 13:48:24 +01:00
Max Kellermann
9acc6617d2 filter/registry: move extern lines to plugin headers 2019-03-12 12:26:12 +01:00
Max Kellermann
4f72f49216 filter/normalize: clean up forward declarations 2019-03-12 12:24:31 +01:00
Max Kellermann
ce49d99c2f check.h: remove obsolete header
Since we switched from autotools to Meson in commit
94592c1406, we don't need to include
`config.h` early to properly enable large file support.  Meson passes
the required macros on the compiler command line instead of defining
them in `config.h`.

This means we can include `config.h` at any time, whenever we want to
check its macros, and there are no ordering constraints.
2018-11-19 16:33:49 +01:00
Max Kellermann
f5c9071494 *: copyright year 2018 2018-10-31 17:54:59 +01:00
Max Kellermann
94592c1406 build with Meson instead of autotools
So long, autotools!  This is my last MPD related project to migrate
away from it.  It has its strengths, but also very obvious weaknesses
and weirdnesses.  Today, many of its quirks are not needed anymore,
and are cumbersome and slow.  Now welcome our new Meson overlords!
2018-10-14 23:41:38 +02:00
Max Kellermann
ec54754e22 Compiler.h: move to util/ 2018-08-20 16:19:17 +02:00
Max Kellermann
4531e4cc55 filter/LoadChain: move code to class FilterFactory
Eliminate a use of GetGlobalConfig().
2018-08-18 20:57:02 +02:00
Max Kellermann
7b02c0224c filter/LoadChain: use struct ConfigData 2018-07-17 22:05:24 +02:00
Max Kellermann
5b192beaa5 config/Global: remove ConfigBlock::SetUsed() call, let caller do that
This fixes an old bug which caused the "unused" warnings to be
unreliable; only the first block in the list was marked as being
"used", no matter if it was really used, and the rest was never marked
as "used", suppressing all warnings for them.
2018-07-17 21:08:41 +02:00
Max Kellermann
816603fd9a config/Config*: rename files, drop "Config" prefix 2018-07-16 19:50:07 +02:00
Max Kellermann
65bbb0e0aa release v0.20.17
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlqAMO0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEg8eD/49NlFvlNdkamgYvh7MI1Sn67yKAwQt+N51
 W0hVnmXwPoSg76gfWw8J9kVyQy/jEkaCxsPF/UuEbH5jzqAC0y8hwYVRkJaRc9wN
 ZfwHvLHeaUxQweoguEwRSREy4ZC4ImQOK+eAxI1R43mqxxyhko1Akc1NmRVWzYfv
 /FGmAjTi1U6FR/yDpdSFn1NdlPmIgZ4WDuRsDT2NrshX/Bb32FiyZBytvek2P8n/
 QNgXv18E4yWXSb+zBYhPy/eaKhGasyjI3cbht1F0hNW9Yo/BsFxDuwXrX1vNBaOS
 E3Dux4s/nfcJ4RMRjmrkFwXImCvxt7+AGfh8RYBXuwqMExXz2kZjIs4ZVvO7Nu9A
 pFDJQwRIojXMfk73LU/MEpmNNEXhvfQLYkrM7poSqYaOr8SWMszqSgNnnfq6+flB
 sJbstgAStI6lL0jy0HrtMTvPVEiAGh6wCvMy/r2G9XUAyw76ccOg7MaIldn0MHJv
 A51+GfRTi4ILH0ReL1BGAg9nG97uFmRAWGkfkhtyD540xGRk7x5R8/ml4zFogHN6
 SbrV0NPdwk+uFd0y2znQT2gWyjc0id4WEKEoHX+Gl6c5qtPIfrq+PQPyk9kR+u+i
 AxwqMoKQer6Ji5qnsvCiKSkaGGiVNivrZ11jDWNCZaKjmvlKlvj/P5GxbPpORorq
 v4ru/4vNXQ==
 =v4t8
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.17'

release v0.20.17
2018-02-11 13:22:43 +01:00
Max Kellermann
e46fbd0780 filter/convert: set the PcmConvert instance only if it was initialized
Fixes valgrind warning.
2018-02-09 19:05:45 +01:00
Max Kellermann
56b74ad990 filter/convert: add method IsActive() 2018-02-09 19:04:45 +01:00
Max Kellermann
9ce6828d72 filter/convert: call PcmConvert::Flush() only if initialized
Fixes another part of #208, the one which caused the bogus exception.
2018-01-29 22:35:28 +01:00
Max Kellermann
7ff5cf8372 filter/convert: add method IsActive() 2018-01-29 22:33:54 +01:00
Max Kellermann
6908555ed3 filter/Observer: drop bogus "noexcept"
Closes #208.
2018-01-29 22:14:27 +01:00
Max Kellermann
4a120f8090 Merge branch 'v0.20.x' 2018-01-05 10:10:17 +01:00
Max Kellermann
f6ec43b9ec pcm/Resampler: add virtual method Flush()
Wired to Filter::Flush().

Closes #153
2018-01-02 23:17:25 +01:00
Max Kellermann
6d0d8cf9cf filter/Filter: add virtual method Flush()
This will be used by filters which have internal buffers which need to
be flushed at the end, e.g. the "soxr" resampler.
2018-01-02 23:15:51 +01:00
Max Kellermann
5ede02aed8 filter/FilterConfig: rename to LoadChain.cxx 2018-01-02 23:09:36 +01:00
Max Kellermann
bbabb7a14c filter/Plugin: move filter_configured_new() to LoadOne.cxx 2018-01-02 23:06:53 +01:00
Max Kellermann
b13ebe3ddb filter/Plugin: eliminate filter_new() 2018-01-02 23:00:16 +01:00
Max Kellermann
17b0add058 filter/Observer: pass Reset() to underlying Filter
Wohooooo, the method Filter::Reset() has been broken because no
implementation of it has ever been called for a loooong time.
And nobody ever noticed it.  WTF.
2018-01-02 22:13:14 +01:00
Max Kellermann
e387d94ff1 filter/Filter: add "noexcept" 2018-01-01 19:23:01 +01:00
Max Kellermann
551ac56a33 Filter/Internal: split header 2018-01-01 18:48:34 +01:00