Commit Graph

13087 Commits

Author SHA1 Message Date
Max Kellermann d9d511f33e player/Thread: update function name in comment 2020-09-16 20:12:05 +02:00
Max Kellermann c61a3b8d13 LogBackend: change the initial log_threshold to DEFAULT
The log levels have always been very confusing (and badly named), but
this was most confusing: if there's a log level called "default", why
is it not the default?

Closes https://github.com/MusicPlayerDaemon/MPD/issues/926
2020-09-16 17:17:34 +02:00
Max Kellermann e10b867fe6 decoder/ffmpeg: add "hls+http://" to the list of supported protocols 2020-09-16 16:36:07 +02:00
Max Kellermann 43e230f543 decoder/ffmpeg: remove "rtsp://" from the list of supported protocols
FFmpeg implements RTSP as a demuxer, not as a protocol handler.  Thus,
avio_open() cannot be used, and our input plugin cannot handle RTSP.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/930
2020-09-16 16:32:31 +02:00
Max Kellermann e8380cf2aa Merge branch 'v0.21.x' into master 2020-09-07 21:15:53 +02:00
Max Kellermann b2ae5298a7 archive/iso9660: implement seeking 2020-09-07 21:13:28 +02:00
Max Kellermann 17dd21ac7f archive/iso9660: fix unaligned reads
Oh the horror!  This plugin cannot possibly ever have worked.  It was
broken from the start, when it was added in commit 37796699cf nearly
twelve (!) years ago.

The plugin would always read at sector boundaries, so it could only
ever work at multiples of 2 kB.
2020-09-07 21:08:46 +02:00
Max Kellermann 291be84704 Merge branch 'v0.21.x' into master 2020-09-07 20:18:40 +02:00
Max Kellermann ae23682372 system/FileDescriptor: add method FullWrite() 2020-09-07 20:13:43 +02:00
Max Kellermann 540919f256 *: use nullptr instead of NULL 2020-09-07 20:08:27 +02:00
Max Kellermann 398281cd76 io/FileDescriptor: add method FullRead() 2020-09-07 20:07:47 +02:00
Max Kellermann 67c7116f05 Merge branch 'v0.21.x' into master 2020-09-04 18:35:21 +02:00
bitkeeper 9aa432c078 Support soxr custom recipes.
MPD uses soxr with prefined resample recipes. Soxr also support defining a recipe your self.
This commit will support a custom recipe by changing the existing quality setting to "custom".

The same structs as the predefined recipes uses can now set by hand.

This will make the following settings available:
- precision 16|20|24|28|32 bits, example "28"
- phase_response - 0-100, example "45"
- passband_end - used bandwidth of source 80-99.7%, example "99.7.0"
- stopband_begin - anti aliasing 100.0+%, example "100".
- attenuation - signal reduciton in dB's, 0-30. example "3.0".
- flags "0" - additional bitmask with extra settings

The data is set in the structs soxr_quality_spec and soxr_io_spec (found in soxr.h).
2020-09-04 18:32:03 +02:00
Max Kellermann db8b419b8c archive/iso9660: free iso9660_stat_t as early as possible 2020-09-04 18:17:24 +02:00
Max Kellermann 990f631cbc archive/bzip2: make variables more local 2020-09-04 18:02:22 +02:00
Max Kellermann db46d84458 archive/bzip2: move the eof check out of the ScopeUnlock 2020-09-04 18:01:29 +02:00
Max Kellermann 9e6c4f8d80 archive/bzip2: throw on unexpected input EOF
Don't silently return 0 when there is no more data, because this may
crash the caller.  And flush output even if input EOF has been reached.
2020-09-04 17:54:53 +02:00
Max Kellermann 41b47f95c5 archive/bzip2: simplify bz_stream initializer 2020-09-04 17:52:04 +02:00
Max Kellermann 15939fd87c archive/bzip2: fold Open() into constructor 2020-09-04 17:51:41 +02:00
Max Kellermann f63c343f68 archive/bzip2: reorder fields to improve packing 2020-09-04 17:51:22 +02:00
Max Kellermann 1a516e7744 archive/bzip2: add `override` 2020-09-04 17:51:21 +02:00
Max Kellermann 1f6a7d6462 archive/zzip: fix crash on corrupt ZIP file
Sometimes, zzip_file_read() returns 0 even though the end of the file
was not reached.  This causes assertion failures in
DecoderBridge::Read().

Closes https://github.com/MusicPlayerDaemon/MPD/issues/935
2020-09-04 14:34:54 +02:00
Max Kellermann e44b953d9a archive/zzip: use zzip_ssize_t to avoid integer overflows 2020-09-04 14:33:44 +02:00
Max Kellermann 6c85020630 archive/zzip: add `override` 2020-09-04 14:33:44 +02:00
Max Kellermann 9d910320f3 archive/zzip: pass std::shared_ptr as template parameter
This eliminates a tiny amount of overhead because the compiler can
choose how to pass the parameter.
2020-09-04 14:33:44 +02:00
Max Kellermann c53074efc9 archive/zzip: add `explicit` 2020-09-04 14:33:11 +02:00
Max Kellermann 0aa0ffb67b decoder/sndfile: allow partial reads at end of file
While libsndfile doesn't like partial reads in the middle of a file
(see commit 95ac6071b9), it allows partial reads at the end of a file.
It doesn't pay attention to the file size when issuing a read.

Commit ecb67a1ed1 (MPD 0.18.12) was a regression: previously,
partial reads at the end of a file were possible, but switching to
decoder_read_full() made this an error condition.  This way, a portion
at the end of each file was lost, leading to corruption with gapless
playback (https://github.com/MusicPlayerDaemon/MPD/issues/936).

This fix switches to the newly introduced function
decoder_read_much(), which does the same as the code before commit
ecb67a1ed1.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/936
2020-09-04 13:35:00 +02:00
Max Kellermann 33f70931dd decoder/API: add decoder_read_much() 2020-09-04 13:35:00 +02:00
Max Kellermann 8830ea319f decoder/API: add `noexcept` 2020-09-04 13:35:00 +02:00
Johann Uhrmann 38498d3ee2 Removed duplicate check for negative song time 2020-08-23 12:17:10 +02:00
Max Kellermann ddb524b6b2 input/uring: add `noexcept` 2020-08-14 16:45:00 +02:00
Max Kellermann cbcdc73f9a system/ByteOrder: add `noexcept` 2020-08-14 16:36:24 +02:00
Max Kellermann 4f6c54ecb3 output/osx: catch kAudioDevicePropertyHogMode errors
Our AudioObjectGetPropertyDataT() wrapper throws exception on error,
and calling it from OSXOutput::Disable() can cause MPD crash due to
std::terminate().

Closes https://github.com/MusicPlayerDaemon/MPD/issues/932
2020-08-14 16:33:43 +02:00
Max Kellermann dbdf782e59 net/{Resolver,HostParser}: include <cstring>
Fixup after e4dad42ca1
2020-07-23 17:40:29 +02:00
Max Kellermann f102cbb613 net/AllocatedSocketAddress: add missing forward declaration 2020-07-23 17:40:29 +02:00
Max Kellermann 5522967286 net/StaticSocketAddress: add IWYU pragma 2020-07-23 17:40:29 +02:00
Max Kellermann a2f42e6424 time/ISO8601: use <cstdlib> 2020-07-23 16:26:18 +02:00
Max Kellermann bdfe6c2c45 lib/dbus/Values: use `using` instead of `typedef` 2020-07-23 16:26:18 +02:00
Max Kellermann 5e1a2e2a93 lib/dbus/Values: add `uint32_t` and `uint64_t` support 2020-07-23 16:26:18 +02:00
Max Kellermann 7376f31c97 lib/dbus/Message: add `noexcept` 2020-07-23 16:26:18 +02:00
Max Kellermann 155fc8fa5a include cleanup 2020-07-23 16:26:18 +02:00
Max Kellermann 7daf80a0c0 util/RuntimeError: add IWYU pragma 2020-07-23 16:10:28 +02:00
Max Kellermann eb87c28225 util/CharUtil: fix doc typo 2020-07-23 16:08:52 +02:00
Rosen Penev c876d6a51c lib/icu: fix build without libc iconv support
Need to check for it in iconv.h. Otherwise meson prefixes a __builtin variant in the check.
2020-07-23 14:09:43 +02:00
Max Kellermann 47f54b5650 input/smbclient: close handle on stat error 2020-07-20 22:43:49 +02:00
Max Kellermann fbfa1723e7 lib/smbclient/Mutex: remove obsolete library 2020-07-20 22:40:27 +02:00
Max Kellermann a74140842c storage/smbclient: add Mutex attribute
This per-object Mutex replaces the global `smbclient_mutex`.
2020-07-20 22:39:59 +02:00
Max Kellermann f5a85a816c storage/smbclient: store SmbclientStorage reference 2020-07-20 22:37:11 +02:00
Max Kellermann 2a15fafbd7 input/smbclient: remove mutex locking
This is no longer necessary with the new API.
2020-07-20 22:34:56 +02:00
Max Kellermann 2fc4802886 neighbor/smbclient: remove mutex locking
This is no longer necessary with the new API.
2020-07-20 22:32:59 +02:00
Max Kellermann bb3f487ee5 lib/smbclient/Context: add global Mutex for smbc_{new,free}_context()
Preparing to replace `smbclient_mutex`, for finer-grained locking.
2020-07-20 22:32:00 +02:00
Max Kellermann 7d97d0ae87 lib/smbclient/Init: move code to SmbclientContext::New()
We no longer need to call smbc_init() because we don't need the compat
layer anymore.
2020-07-20 22:23:18 +02:00
Max Kellermann f6dc9bcad6 */smbclient: use the new API with SMBCCTX parameter
As a side effect, the input plugin closes the SMB/CIFS connection
after closing the file.

This solves one part of
https://github.com/MusicPlayerDaemon/MPD/issues/916
2020-07-20 22:05:05 +02:00
Max Kellermann 697531a948 lib/smbclient/Context: new wrapper for SMBCCTX 2020-07-20 22:01:10 +02:00
Max Kellermann 3c745b4bc6 neighbor/smbclient: remove obsolete commented code 2020-07-20 18:13:38 +02:00
Max Kellermann 448b397cb8 output/sles: support floating point samples
According to https://developer.android.com/ndk/guides/audio/opensl/android-extensions

This feature was mentioned in https://github.com/MusicPlayerDaemon/MPD/issues/922
2020-07-20 15:23:50 +02:00
Max Kellermann 64a1386eb6 output/sles: move SampleFormat selection to switch/case block 2020-07-20 14:47:36 +02:00
Max Kellermann cf674e9273 input/Init: downgrade PluginUnconfigured to LogLevel::DEBUG
`LogLevel::INFO` is logged by default, but this message shall only
appear with `--verbose`.

This finally solves https://github.com/MusicPlayerDaemon/MPD/issues/430
2020-07-16 13:19:14 +02:00
Max Kellermann b74a91427d release v0.21.25
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl8DfoEQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEgVqD/0X+QAV77Pw+RDP7qPtyYDfBH6jOvSpAmHm
 moXIFMBaPeIrAFd6jfYTL+JMcVf+jfS6H86JlrWVz5/jerV0St/LxwrTGRqkac8K
 OFDmMl2SE2KkniLOTHC2nKq3RFzAKDKK8uCaw3JFpXiAezuRXutX19nHitbau+HC
 jD+2Ybyy149fPAB+D6aON6vjZI9hQyyeGoEbducZ5uZz+tvzwY0w1KcnDlaicjJq
 Wdu16RFFZNXJnrXQ8hPWTxltgIdRfc9xMrIkydsyQkpW5jLZAJn9Yvl4xIQJhJlb
 HlF2/xAUAIqykDqjbxWGnQYywOtCh12XDdn2S2AzAGgNH0z++EBiMyQjLorHf3Eo
 wSa/qvi1E5rf8WBCaz3Qa/oa9trj4TQcQFQ+v9esO/yBn3O0K6oGr67P45f1KRqg
 SAwnwd+YwYp838lT+MlueD+c67QAY64qCYjI810o3rZ3cyEitWKF6kkvwfzqCfly
 HeZJS7OsG1UoxInSfnYwJW1svwtkfZU0WqWHxqKSL/MnwihXhlkhkom8jIS+yYcO
 pVPllLvF1H0d/Y2Eb2MH6OKZF+7c5cwSeXJzA808NwzE5dpL2tHAgjxhS/P66voF
 /UqLyXySqEaUijp9hW3jEeFJ5TSP2bCaNXnbsQUoM4uqjhkoUi9QLTJIqyG1PKmM
 3JKzuZXy2g==
 =eK6Y
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.25'

release v0.21.25
2020-07-06 21:47:30 +02:00
Max Kellermann 00789de7d4 db/upnp/Object: root nodes are allowed to omit parent_id and name
This fixes compatibility with Plex DLNA.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/851
2020-07-06 21:36:30 +02:00
Max Kellermann 9964a5ffe8 db/update/Service: avoid copying the mount point path 2020-07-06 21:09:58 +02:00
Max Kellermann 5ece9685c2 PluginUnavailable: backport class PluginUnconfigured from master
Stop bothering people about the Tidal/Qobuz plugins.
2020-07-06 21:08:22 +02:00
Max Kellermann e7c5a42821 Log: add Log() and LogFormat() overloads with std::exception_ptr
Make LogError()/FormatError() wrappers for those.  Now we can log
exceptions with a lower level.
2020-07-06 21:08:04 +02:00
Max Kellermann 36e6079c57 Log: make LogLevel the first parameter
Prepare for templated functions.
2020-07-06 21:07:26 +02:00
Max Kellermann e5f23678ca Log: use GetFullMessage() to print exceptions
Print all nested exceptions on a single line to avoid confusion.
2020-07-06 21:07:16 +02:00
Max Kellermann c3cfb5fe16 Merge branch 'v0.21.x' 2020-07-06 20:56:52 +02:00
Max Kellermann 749ad7cd83 PluginUnavailable: inherit the base class constructor 2020-07-06 20:40:25 +02:00
Max Kellermann fe48e5596f command/storage: automatically scan new mounts
Closes https://github.com/MusicPlayerDaemon/MPD/issues/841
2020-07-06 20:23:41 +02:00
Max Kellermann d7744d2b8e command/storage: check if storage is already mounted
Mounting one storage URI twice on different mount points can lead to
conflicts with the database cache file, and it doesn't make a lot of
sense.

But most importantly, our udisks storage plugin will unmount the disk
from the kernel VFS, and if two exist, they will compete with each
others.  We could (and should) fix this in the udisks storage plugin,
but for now, this workaround is good enough (and useful).
2020-07-06 18:02:47 +02:00
Max Kellermann 33ee35ab92 command/storage: check if mount point is busy
When mounting something over a directory that is already a mount
point, CompositeStorage::Mount() silently overwrites the previously
mounted storage, disposing it.  After that, SimpleDatabase::Mount()
will fail and handle_mount() will roll back the
CompositeStorage::Mount() command, effectively unmounting what was
there before (and also leaking memory).

Closes https://github.com/MusicPlayerDaemon/MPD/issues/918
2020-07-06 17:49:38 +02:00
Max Kellermann 5b291ff768 db/update/Walk: pass concatenated .mpdignore URI to storage.MapUTF8()
Fixes the "Unrecognized URI" error with the udisks storage plugin,
which is caused by the kludge in UdisksStorage::MapUTF8().
2020-07-06 17:19:38 +02:00
Max Kellermann 39d6816a6d neighbor/upnp: roll back changes if DoOpen() fails 2020-07-06 16:23:58 +02:00
Max Kellermann 6517b2d2ac neighbor/upnp: remove D-Bus filter and match in Close()
Fixes use-after-free crash bug during MPD shutdown.
2020-07-06 16:15:18 +02:00
Max Kellermann bfdf13dca3 decoder/Plugin: allow scan_{file,stream}() to throw
Bug #915 is about an I/O exception thrown where none was allowed,
leading to crash via std::terminate().  However, instead of catching
and logging the error inside the decoder plugin, it should be able to
propagate the I/O error to the MPD core, so MPD can avoid trying other
decoder plugins.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/915
2020-07-06 14:13:34 +02:00
Max Kellermann 86823af685 Merge branch 'v0.21.x' 2020-07-02 15:34:16 +02:00
Max Kellermann daefc61aa4 output/osx: postpone start until the end of Play()
Wait until there is data in the ring buffer.
2020-07-02 15:26:38 +02:00
Max Kellermann 6fed6e50e4 output/osx: merge some duplicate code 2020-07-02 15:25:51 +02:00
Max Kellermann bc9e074822 output/osx: postpone start until the first Play() call
Wait until there is some data; don't let our render callback be
invoked without any data.
2020-07-02 15:21:54 +02:00
Max Kellermann 8047102542 output/osx: don't restart AudioUnit at the end of Cancel()
We shouldn't restart the AudioUnit while the ring buffer is empty, or
else our render callback may emit noise.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/771
2020-07-02 15:20:43 +02:00
Max Kellermann fe5b81e180 output/osx: check `started` in Close() and Cancel() 2020-07-02 15:19:40 +02:00
Max Kellermann f032925c2d output/osx: add `started` flag
This will keep track of AudioOutputUnitStart() and
AudioOutputUnitStop().  This will provide some separation between "not
(yet) (re)started" and "paused".
2020-07-02 15:18:37 +02:00
Max Kellermann 8125a5dddb output/osx: don't uninitialize AudioUnit if restart fails
This shall be done by Close(), which will be called automatically
after an error.
2020-07-02 15:10:03 +02:00
Max Kellermann 154170e475 output/osx: clear `pause` flag only after successful AudioOutputUnitStart() 2020-07-02 15:08:59 +02:00
Max Kellermann fb83936feb apple/AudioUnit: add AudioUnitSetPropertyT() 2020-07-02 14:59:40 +02:00
Max Kellermann db8bf52f7d apple/AudioObject: add AudioObjectGetStringProperty() 2020-07-02 13:50:05 +02:00
Max Kellermann 756f0b8027 apple: build static library
Move build rules from src/output/plugins/meson.build
2020-07-02 13:49:54 +02:00
Max Kellermann b1fba8d3d7 apple/AudioObject: add missing `inline` 2020-07-02 13:49:52 +02:00
Max Kellermann 4d88bddfe2 Merge branch 'v0.21.x' 2020-07-01 23:07:57 +02:00
Max Kellermann e606044271 apple/AudioUnit: library wrapping AudioUnit*() functions 2020-07-01 23:02:22 +02:00
Max Kellermann bcbb3371ff apple/AudioUnit: rename to AudioObject.hxx 2020-07-01 22:49:03 +02:00
Max Kellermann de632882d1 output/osx: move code to FindAudioDeviceByName() 2020-07-01 22:48:12 +02:00
Max Kellermann 745e492d15 output/osx: use [[maybe_unused]] 2020-07-01 22:41:00 +02:00
Max Kellermann c5dc615efe output/osx: use IsDigitASCII() 2020-07-01 22:39:54 +02:00
Max Kellermann a08d4b3d66 Merge branch 'v0.21.x' 2020-07-01 22:09:33 +02:00
Max Kellermann beeb02025e output/osx: use range-based `for` 2020-07-01 22:06:36 +02:00
Max Kellermann cdf7062597 apple/AudioUnit: wrapper functions for AudioObject properties 2020-07-01 22:05:11 +02:00
Max Kellermann 346084da1e apple/Throw: new helper library replacing osx_os_status_to_cstring() 2020-07-01 22:05:11 +02:00
Max Kellermann bbceb5eb91 output/osx: silently ignore some errors in osx_output_set_device() 2020-07-01 22:05:11 +02:00
Max Kellermann 90d85319c2 apple/ErrorRef: new library wrapping CFErrorRef 2020-07-01 22:05:10 +02:00
Max Kellermann 3d03683e7d output: use StringIsEqual() 2020-07-01 22:04:26 +02:00