Compare commits

...

792 Commits

Author SHA1 Message Date
Max Kellermann
566787f041 release v0.21.26 2020-09-21 15:14:43 +02:00
Max Kellermann
79b2366387 archive/iso9660: fix odd seeking bug (assertion failure)
Skip the beginning of a sector if the last seek was odd, and clear the
buffer on seek.
2020-09-21 15:11:21 +02:00
Max Kellermann
5acea014b0 archive/iso9660: remove unused macro CEILING() 2020-09-21 15:11:17 +02:00
Max Kellermann
b72801abf3 util/ByteOrder: add FromLE16S() 2020-09-21 11:15:45 +02:00
Desuwa
23d5a2b862 Support opus header gain tags and match opus playback volume to other tracks when ReplayGain is enabled. 2020-09-21 10:51:06 +02:00
Rosen Penev
7715311117 fix double promotions
Found with -Wdouble-promotion

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-21 09:13:51 +02:00
Max Kellermann
4c1cfca95b db/update/InotifyUpdate: pass path by value to recursive_watch_subdirectories() 2020-09-17 14:18:29 +02:00
Max Kellermann
e113ce9621 db/update/InotifyUpdate: obey .mpdignore files
Closes https://github.com/MusicPlayerDaemon/MPD/issues/846
2020-09-17 14:17:17 +02:00
Max Kellermann
e8213220e2 db/update/InotifyUpdate: split the WatchDirectory constructor 2020-09-16 21:08:22 +02:00
Max Kellermann
83f9d2a963 db/update/InotifyUpdate: use class DirectoryReader 2020-09-16 21:02:07 +02:00
Max Kellermann
bf97ebf89f db/update/InotifyUpdate: convert pointer to reference 2020-09-16 20:59:41 +02:00
Max Kellermann
5b22d27cbb db/update/InotifyUpdate: remove commented log call 2020-09-16 20:59:40 +02:00
Max Kellermann
e907ff43ae command/file, storage/{nfs,smbclient}: use PathTraitsFS::IsSpecialFilename()
Eliminate some duplicate code.
2020-09-16 20:57:46 +02:00
Max Kellermann
b18fc3a8d0 db/update/InotifySource: use auto 2020-09-16 20:40:27 +02:00
Max Kellermann
a8e23c4140 db/update/InotifySource: add noexcept 2020-09-16 20:40:06 +02:00
Max Kellermann
fc3861b421 db/update/InotifyQueue: add noexcept 2020-09-16 20:40:03 +02:00
Max Kellermann
e81bb5d8f1 db/update/Inotify*: include cleanup 2020-09-16 20:39:44 +02:00
Max Kellermann
32f4f15831 player/Thread: call OnPlayerSync() in SeekDecoder()
This fixes a spurious "single" mode bug which occurs when using "play"
or "seek" to start playback on the song that is currently paused: in
that case, the main thread never queues the next song, and at the end
of the song, the player thread exits Run(), stopping playback, and
after that, the main thread starts the next song without considering
"single" mode.

By calling OnPlayerSync(), we ensure that the main thread gets a
chance to queue the next song before the player thread exits the Run()
loop.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/850
2020-09-16 20:36:19 +02:00
Max Kellermann
e29c06b718 player/Thread: add another code comment explaining OnPlayerSync() 2020-09-16 20:12:52 +02:00
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
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
1a5e0ef7c9 test/test_archive_iso9660.sh: use an odd chunk size to trigger bug
This makes the unit test fail.  D'oh!
2020-09-07 20:53:46 +02:00
Max Kellermann
979a7a1dcc test/run_input: add option --chunk-size 2020-09-07 20:52:37 +02:00
Max Kellermann
962cf32ba7 test/run_input: pass FileDescriptor to dump_input_stream() 2020-09-07 20:14:39 +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
88446ccde9 test/run_filter: use Filter::Flush() 2020-09-07 20:07:40 +02:00
Max Kellermann
6238cc0734 test/run_filter: pass ConstBuffer<void> to FullWrite() 2020-09-07 20:07:33 +02:00
Max Kellermann
fd4823c507 test/run_filter: fix error message 2020-09-07 20:07:29 +02:00
Max Kellermann
68bcfd8bf0 test/run_filter: check for partial writes 2020-09-07 20:07:24 +02:00
Max Kellermann
1d332746af test/run_filter: move code to WriteOrThrow() 2020-09-07 20:07:18 +02:00
Max Kellermann
f3e133c617 test/run_filter: use class FileDescriptor 2020-09-07 20:07:13 +02:00
Max Kellermann
1678a6eb59 test/run_filter: ensure that partial frames will not get passed to the filter 2020-09-07 20:07:08 +02:00
Max Kellermann
b4dc2c07d5 test/run_filter: move the buffer into the loop 2020-09-07 20:07:03 +02:00
Max Kellermann
d7838950d8 test/run_input: use WithBufferedOutputStream() 2020-09-07 20:04:13 +02:00
Max Kellermann
2e93a83dd5 test/run_input: convert pointer to reference 2020-09-07 20:02:12 +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
5c9d97775f python/build/libs.py: update Boost to 1.74.0 2020-09-04 14:49:11 +02:00
Max Kellermann
64aadcd13f python/build/libs.py: update CURL to 7.72.0 2020-09-04 14:48:40 +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
3b51c53eca win32/build.py: add -D_FORTIFY_SOURCE=0
This fixes the Windows build.  Linking failed because some packages
(e.g. libFLAC) default to enabling `_FORTIFY_SOURCE`, which is broken
in recent mingw versions
(https://github.com/msys2/MINGW-packages/issues/5803).
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
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
2bdf1b2284 test/meson.build: add explicit dependency from run_output on libevent.a
We could exclude that feature if neither ALSA nor httpd are enabled,
but that's too complicated for this small debug program.
2020-08-14 14:40:39 +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
3c745b4bc6 neighbor/smbclient: remove obsolete commented code 2020-07-20 18:13:38 +02:00
Max Kellermann
3a08a6ad72 doc/plugins.rst: document sample formats for OpenSLES 2020-07-20 15:27:41 +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
77c2efe171 python/build/libs.py: update CURL to 7.71.1 2020-07-20 12:37:54 +02:00
Max Kellermann
587c0f6232 python/build/libs.py: update FFmpeg to 4.3.1 2020-07-20 12:37:16 +02:00
Max Kellermann
64e8abf203 python/build/libs.py: update libvorbis to 1.3.7 2020-07-20 12:34:16 +02:00
Max Kellermann
6c40d2a656 python/build/libs.py: update libmpdclient to 2.19 2020-07-20 12:32:19 +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
9bda0379af increment version number to 0.21.26 2020-07-16 12:53:22 +02:00
Max Kellermann
c67372f8af release v0.21.25 2020-07-06 21:41:53 +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
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
749ad7cd83 PluginUnavailable: inherit the base class constructor 2020-07-06 20:40:25 +02:00
Max Kellermann
0b59f4eaee doc/plugins.rst: merge redundant nfs:// documentation 2020-07-06 20:37:58 +02:00
Max Kellermann
402663de74 doc/plugins.rst: more markup 2020-07-06 20:34:04 +02:00
Max Kellermann
eaa66c7ee3 doc/plugins.rst: add smb:// with password example
Closes https://github.com/MusicPlayerDaemon/MPD/issues/864
2020-07-06 20:32:41 +02:00
Max Kellermann
996714d6ff doc/plugins.rst: more markup 2020-07-06 20:32:11 +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  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
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
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
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
Max Kellermann
d8a74802d1 apple/StringRef: new library wrapping CFStringRef 2020-07-01 22:01:53 +02:00
Max Kellermann
191919d1b1 output/osx: remove trailing newline from exception messages 2020-07-01 22:01:51 +02:00
Max Kellermann
df38e7565b util/HugeAllocator: import std::swap() 2020-07-01 21:56:58 +02:00
Max Kellermann
cb49a03fd7 util/HugeAllocator: add noexcept 2020-07-01 21:56:54 +02:00
Max Kellermann
faee5bbb78 decoder/opus: implement End Trimming (RFC7845 4.4)
Closes https://github.com/MusicPlayerDaemon/MPD/issues/867
2020-07-01 21:26:34 +02:00
Max Kellermann
7befab7e83 decoder/opus: keep track of the granulepos
Will be needed for End Trimming (RFC7845 4.4,
https://github.com/MusicPlayerDaemon/MPD/issues/867).
2020-07-01 21:21:06 +02:00
Max Kellermann
4244e61214 decoder/opus: simplify indentation in HandleAudio() 2020-07-01 21:19:52 +02:00
Max Kellermann
46eab05045 decoder/opus: allocate buffer only in the first chained song
Fixes memory leak.  That's what we get for
2020-07-01 21:07:49 +02:00
Max Kellermann
5ca137c73c decoder/opus: add API docs 2020-07-01 20:55:18 +02:00
Max Kellermann
760238fe16 decoder/opus: apply pre-skip (RFC7845 4.2)
Fixes the first part of
https://github.com/MusicPlayerDaemon/MPD/issues/867
2020-07-01 20:44:53 +02:00
Max Kellermann
a99b4abae8 decoder/OpusHead: return pre-skip 2020-07-01 17:51:07 +02:00
Max Kellermann
472881cb95 util/ByteOrder: remove redundant inline keywords from constexpr functions 2020-07-01 17:50:34 +02:00
Max Kellermann
c4efc37ad8 system/ByteOrder: move to util/ 2020-07-01 17:49:57 +02:00
Max Kellermann
691b6a236e output/osx: improve sample rate selection
The formula in osx_output_score_sample_rate() to detect multiples of
the source sample rate was broken: when given a 44.1 kHz input file,
it preferred 16 kHz over 48 kHz, because its `frac_portion(16)=0.75`
is smaller than `frac_portion(48)=0.91`.

That formula, introduced by commit 40a1ebee29, looks completely
wrong.  It doesn't do what the code comment pretends it does.

Instead of using that `frac_portion` to calculate a score, this patch
adds to the score only if `frac_portion` is nearly `0` or `1`.  This
means that the factor is nearly integer.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/904
2020-07-01 17:38:08 +02:00
Max Kellermann
5c7243d3ad output/osx: make several fields const 2020-07-01 17:35:39 +02:00
Max Kellermann
44cfdff39a output/osx: make variables more local 2020-07-01 17:35:33 +02:00
Max Kellermann
5eedda691a output/osx: make more AudioObjectPropertyAddress instances static constexpr 2020-07-01 17:35:19 +02:00
Max Kellermann
a30d5e1b6a output/osx: make AudioObjectPropertyAddress variables static constexpr 2020-07-01 17:34:12 +02:00
Max Kellermann
8ef09a0a71 output/osx: don't use C99 designated initializers
Fixes `-Wpedantic`.
2020-07-01 17:34:06 +02:00
Max Kellermann
e8044663b3 output/{alsa,osx}: use ConstBuffer::empty() 2020-07-01 17:32:37 +02:00
Max Kellermann
8444c33514 output/osx: don't use variable-length arrays 2020-07-01 17:31:46 +02:00
Max Kellermann
2b7328b434 output/osx: fix coding style 2020-07-01 17:11:02 +02:00
Max Kellermann
ca705e1e37 python/build/meson.py: set BOOST_ROOT for Meson 0.54
Commit
08224dafcb
changed Meson to require BOOST_ROOT for cross builds.
2020-07-01 16:55:28 +02:00
Max Kellermann
d9f9b3df10 input/file: detect premature end of file
A bug report (https://github.com/MusicPlayerDaemon/MPD/issues/912)
suggests that on Linux, reading on `cifs` files may rarely return 0 (=
end of file) before the end of the file has really been reached.  But
that's just a theory which I need to validate, so this runtime check
shall catch this condition before the assertion in
DecoderBridge::Read() crashes MPD.  Let's see.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/912
2020-07-01 15:14:27 +02:00
Max Kellermann
a43ee97746 util/UriUtil: strip credentials from smb:// URIs
Closes https://github.com/MusicPlayerDaemon/MPD/issues/910
2020-06-22 22:48:56 +02:00
Max Kellermann
43c32372e7 util/UriUtil: make schemes array static 2020-06-22 22:48:07 +02:00
Max Kellermann
5716cde1fb queue/PlaylistEdit: fix crash in SetSongIdRange() while playing
An assertion failure in UpdateQueuedSong() could trigger because the
`prev` parameter is always `nullptr`, but `queued` may be set.  And in
fact, calling UpdateQueuedSong() is only necessary when the queued
song was edited, to re-queue it with the new range.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/901
2020-06-11 07:07:02 +02:00
Max Kellermann
b7a99b4a4b increment version number to 0.21.25 2020-06-11 06:29:08 +02:00
Max Kellermann
24741c5d06 release v0.21.24 2020-06-10 22:48:50 +02:00
Max Kellermann
6b3a282db4 lib/curl/Request: don't enable CURLOPT_NETRC on Windows
Our Windows build is built with `--disable-netrc`, and that makes
CURLOPT_NETRC fail, causing failures with all streams.  D'oh!

Closes https://github.com/MusicPlayerDaemon/MPD/issues/886
2020-06-10 22:46:42 +02:00
Max Kellermann
7583cfe9b7 {android,win32}/build.py: enable the GME decoder plugin
Closes https://github.com/MusicPlayerDaemon/MPD/issues/891
2020-06-10 21:33:29 +02:00
Max Kellermann
aafc9ce75b decoder/gme: use class NarrowPath() for Windows compatibility 2020-06-10 21:22:00 +02:00
Max Kellermann
fea326530b decoder/gme: simplify LoadGmeAndM3u() by moving code to ReplaceSuffix() 2020-06-10 21:20:49 +02:00
Max Kellermann
8925cc17d8 decoder/gme: use StringAfterPrefix() 2020-06-10 21:11:08 +02:00
Max Kellermann
14412c867f add a few IWYU pragmas 2020-06-10 21:10:33 +02:00
Max Kellermann
c5cc256bf2 decoder/gme: use Path::GetSuffix() 2020-06-10 21:02:07 +02:00
Max Kellermann
563c7318f9 fs/AllocatedPath: add method GetSuffix() 2020-06-10 21:00:41 +02:00
Max Kellermann
e92129f449 doc/protocol.rst: clarify the term "UNIX time"
Closes https://github.com/MusicPlayerDaemon/MPD/issues/893
2020-06-10 20:42:42 +02:00
Max Kellermann
374cc51f77 decoder/Bridge: add flag to make initial seek errors fatal
When the client wants to seek, but the decoder has already finished
decoding the current song, the player restarts the decoder with an
initial seek at the new position.  When this initial seek fails, MPD
pretends nothing has happened and plays this song from the start.

With this new flag, a restarted decoder marks the initial seek as
"essential" and fails the decoder if that seek fails.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/895
2020-06-10 17:49:10 +02:00
Rosen Penev
1008d5f67c use cwchar include
Needed for std::wmemchr under libcxx

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-30 13:22:04 +02:00
Shen-Ta Hsieh
8e07ea7ad8 src/db: fitting libmpdclient interface 2020-05-29 19:00:16 +02:00
Max Kellermann
d751df0a73 storage/State: disable -Wcomma to work around Boost compiler warning 2020-05-28 14:00:31 +02:00
Max Kellermann
2c084781b0 output/openal: disable -Wdeprecated-declarations on Apple 2020-05-28 13:59:52 +02:00
Max Kellermann
ae7d550a01 meson.build: remove -Wall -Wextra, to be set by Meson 2020-05-28 13:19:34 +02:00
Max Kellermann
30d97fe8a0 meson.build: fix the WildMidi check when the feature is disabled
Fixes regression from commit 69f09648a4
2020-05-27 16:06:49 +02:00
Max Kellermann
5cb0080052 meson.build: default to warning_level=2
This branch isn't yet ready for level 3 (`-Wpedantic`) due to several
C++ violations (e.g. variable length arrays).  These are already
cleaned up in the master branch (0.22).
2020-05-27 15:57:13 +02:00
Max Kellermann
8e4ca23727 lib/ffmpeg/Time: replace C99 compound literal with C++ initializer list 2020-05-27 15:54:34 +02:00
Max Kellermann
bdc861f058 util/TemplateString: remove extra semicolon 2020-05-27 15:46:55 +02:00
Rosen Penev
8925040262 remove some more extra semicolons
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-27 15:36:53 +02:00
Max Kellermann
c065950ced .travis.yml: disable zzip on OS X to fix Travis-CI build failure 2020-05-27 15:31:34 +02:00
Max Kellermann
257a77fa35 {android,win32}/build.py: build libmodplug and WildMidi
Closes https://github.com/MusicPlayerDaemon/MPD/issues/866
2020-05-27 15:03:49 +02:00
Max Kellermann
4e5d6e560b decoder/modplug: assume ModPlug is built as static library on Windows 2020-05-27 15:03:46 +02:00
Max Kellermann
d276d8eda2 decoder/wildmidi: assume WildMidi is built as static library on Windows 2020-05-27 15:03:35 +02:00
Max Kellermann
ebcb5e9368 decoder/wildmidi: use NarrowPath, fixing the Windows build 2020-05-27 15:03:33 +02:00
Max Kellermann
69f09648a4 meson.build: attempt to detect WildMidi using pkg-config
The WildMidi project added the pkg-config file in version 0.3.3, but
unfortunately, Debian still doesn't ship it 4 years later:

 https://bugs.debian.org/916631

However, for cross-compiling, the pkg-config file is very helpful.
2020-05-27 15:03:16 +02:00
Max Kellermann
9adda30c38 NEWS: move two lines below Windows/Android 2020-05-27 14:33:43 +02:00
Max Kellermann
d2d4a0251e .gitignore: add emacs lsp-mode files 2020-05-26 21:07:56 +02:00
Max Kellermann
f7b6431b6f meson.build: work around Meson bug detecting strndup() on Windows
Work around Meson bug https://github.com/mesonbuild/meson/issues/3672
2020-05-26 20:50:56 +02:00
Max Kellermann
03b9bd3a9e python/build/libs.py: update FFmpeg to 4.2.3 2020-05-26 18:54:56 +02:00
Max Kellermann
61aed60f6d python/build/libs.py: update CURL to 7.70.0 2020-05-07 14:18:55 +02:00
Max Kellermann
2cc323c9fe python/build/libs.py: update Boost to 1.73.0 2020-05-07 14:18:21 +02:00
Max Kellermann
f24ab120ee android/build.py: use -fpic instead of -fPIC on ARM/Aarch64
Sync with the Android NDK build scripts.
2020-05-07 13:58:36 +02:00
Max Kellermann
68349bc55c android/build.py: use -mfpu=vfpv3-d16 on ARMv7
This flag is used by the Android NDK build scripts as well, and this
fixes a build failure (assembler error) with FFmpeg and NDK r21.
2020-05-07 13:50:33 +02:00
Max Kellermann
209364adf2 db/simple: fix crash when mounting twice
The `db->close()` call was a `nullptr` dereference because the `db`
variable had already been moved.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/839
2020-05-05 18:57:29 +02:00
Max Kellermann
24afdee35c command/all: "tagtypes" requires no permissions
The command is used to configure the client's connection, and this
shouldn't require any permissions.  The client should be able to do
that before sending a password.
2020-04-30 13:08:09 +02:00
Max Kellermann
7aea285361 Revert "Fix unsafe float comparison."
This reverts commit a5273d6992.  It was
wrong and broke the MixRamp unit test.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/844
2020-04-30 06:57:36 +02:00
Rosen Penev
47a7707df1 Math.hxx: fix wrong macro name
_GLIBCXX_USE_C99_MATH_TR1 is the correct one.

_GLIBCXX_USE_C99_MATH is always defined.
2020-04-29 23:20:04 +02:00
Max Kellermann
6fdae1139f increment version number to 0.21.24 2020-04-29 23:20:04 +02:00
Max Kellermann
6c240f667c release v0.21.23 2020-04-23 17:46:20 +02:00
Max Kellermann
3040ddb5ec lib/nfs/FileReader: use struct stat64 on Windows 32-bit
libnfs is compiled with `-D_FILE_OFFSET_BITS=64`, but Meson decides
not to enable this mode.  We could force this mode, but then again,
these days, nobody should be using 32-bit Windows ... so this is a
kludge only for debugging with 32-bit WINE.
2020-04-23 17:32:34 +02:00
Max Kellermann
fdb28eb0c4 fs/NarrowPath: preserve nullptr in Path operator
Fixes Path::IsNull() checks on Windows.
2020-04-23 17:10:28 +02:00
Max Kellermann
7ded244a61 lib/nfs/Connection: pass POLLHUP and POLLERR to nfs_service() 2020-04-23 16:58:53 +02:00
Max Kellermann
8ed533acf3 event/SocketMonitor: handle epoll_ctl()=EBADF/ENOENT in Schedule()
This fixes a freeze bug in the NFS input/storage plugins: when libnfs
auto-reconnets after a failure, it installs the new socket on the same
file descriptor number.  MPD's attempt to unregister the old socket by
calling SocketMonitor::Steal() from NfsConnection::ScheduleSocket()
fails because the new/old socket number is not registered in epoll, so
epoll_ctl() returns ENOENT.  The problem is that it left
`scheduled_flags`, and so subsequent Schedule() calls will use
`EPOLL_CTL_MOD`, which will fail again and again.  Instead, we need to
use `EPOLL_CTL_ADD` to register the new socket.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/806

Closes https://github.com/MusicPlayerDaemon/MPD/issues/756
2020-04-23 16:58:26 +02:00
Max Kellermann
a27580d0cc lib/nfs/Connection: don't pass HANGUP to Schedule()
This flag is output-only.
2020-04-23 15:21:04 +02:00
Max Kellermann
905db05cf9 zeroconf/AvahiPoll: don't pass ERROR|HANGUP to Schedule()
These flags are output-only.
2020-04-23 15:19:24 +02:00
Max Kellermann
4242aee21e event/SocketMonitor: remove HANGUP|ERROR from ScheduleRead()
These flags are output-only.  Using them here is misleading.
2020-04-23 15:18:18 +02:00
Max Kellermann
e71bd2a08b event/PollGroupWinSelect: make EVENT_{READ,WRITE} static 2020-04-23 15:10:57 +02:00
Max Kellermann
e53a4d0a9e lib/nfs/FileReader: reset state in OnNfsCallback()
The object's state is `IDLE` when OnNfsCallback() gets invoked, so
let's use the start of the method to reset the `state` field.
2020-04-23 14:54:52 +02:00
Max Kellermann
159389164a lib/nfs/FileReader: set state=IDLE before invoking callback
Fixes assertion failure if the callback fails.
2020-04-23 14:51:43 +02:00
geneticdrift
0a92fbc18e tag/Fallback: add tag fallback for AlbumSort
Closes https://github.com/MusicPlayerDaemon/MPD/issues/832
2020-04-22 22:00:38 +02:00
Max Kellermann
138c29320b gme: adapt to API change in the upcoming version 0.7.0
Closes https://github.com/MusicPlayerDaemon/MPD/issues/833
2020-04-22 21:53:00 +02:00
Max Kellermann
8f00dbea45 lib/icu/Compare: add Windows implementation
Using CompareStringEx() and FindNLSStringEx().

Implements a missing piece for
https://github.com/MusicPlayerDaemon/MPD/issues/820
2020-04-22 21:42:12 +02:00
Max Kellermann
f3fd2eb618 lib/icu/Compare: use AllocatedString::Clone() 2020-04-22 21:39:13 +02:00
Max Kellermann
fc92db83cf lib/icu/Collate: use NORM_IGNORECASE instead of LINGUISTIC_IGNORECASE
LINGUISTIC_IGNORECASE is unimplemented on Wine, but since we don't
have any locale support (yet), and we're using LOCALE_NAME_INVARIANT,
NORM_IGNORECASE should essentially be the same, so why bother.
2020-04-22 21:39:13 +02:00
Max Kellermann
3b0f8d5516 lib/icu/CaseFold: remove Windows implementation
Reverts commit fb3564fbe7

LCMapStringEx() doesn't do what I imagined it would do 5 years ago.
D'oh!

Closes https://github.com/MusicPlayerDaemon/MPD/issues/820
2020-04-22 19:32:36 +02:00
Rosen Penev
a5273d6992 Fix unsafe float comparison.
Switching == to >= should be safe here since the next if is the opposite.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-22 18:21:40 +02:00
Thomas Guillem
b18074f899 storage/curl: fix path comparison when the server escapes differently
Unescape the base path and the path coming from the server (href) to fix the
comparison when the server uses different escaped characters.

The outputted name need to be unescaped. Doing that before or after the
HrefToEscapedName() call should not change the current behavior.
2020-04-15 13:50:12 +02:00
Thomas Guillem
3d8067a041 storage/curl: fix href when file has a '&' char
If the file name is "Hello & bye", 3 CharacterData events will be sent with the
State::HREF state:
 - "Hello%20"
 - "&"
 - "%20bye"

Reproduced with files hosted on an apache2 DAV server: 2.4.38-3+deb10u3.
2020-04-15 13:18:16 +02:00
Florian Heese
f6fe001fa9 Added missing channel order setups for ALSA 2020-04-15 13:13:09 +02:00
Max Kellermann
32a5bf043b player/Thread: drain outputs at end of song in "single" mode
Without this, the Pause() call would drop the ring buffers and would
skip a considerable portion of the end of the song.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/824
2020-04-14 16:07:03 +02:00
Max Kellermann
8d2079482f Merge branch 'lkj' of git://github.com/neheb/MPD into v0.21.x 2020-04-14 13:12:42 +02:00
Max Kellermann
c331c75fde increment version number to 0.21.23 2020-04-14 13:12:36 +02:00
Rosen Penev
6080c3b4ba Math.hxx: move cmath include out of define
The _GLIBCXX_USE_C99_MATH macro is defined in glibcxx by c++config.h, which
gets included by every header. Which means a header needs to be present.

(cherry picked from commit 79e9aff338)
2020-04-09 14:24:06 -07:00
Max Kellermann
5ccfcffcc1 release v0.21.22 2020-04-02 17:48:56 +02:00
Max Kellermann
afe2aaa5f6 fs/io/GzipOutputStream: increase buffer size to 16 kB
Reduce I/O overhead.
2020-04-02 17:17:58 +02:00
Max Kellermann
9b11caa0e6 fs/io/BufferedReader: larger default buffer (4 kB -> 16 kB)
Reduce I/O overhead.
2020-04-02 17:17:27 +02:00
Max Kellermann
a689b881d3 test/meson.build: work around linker failure due to statically linked CURL 2020-04-02 17:16:05 +02:00
Max Kellermann
e94c436264 src/event/meson.build: depend in libnet.a
The event library uses various libnet.a classes,
e.g. SocketDescriptor.
2020-04-02 17:16:05 +02:00
Max Kellermann
bad829509e test/ShutdownHandler: add inline to work around Windows linker problems 2020-04-02 17:16:05 +02:00
Max Kellermann
9c66b0414a test/*: fix Windows build using class FromNarrowPath 2020-04-02 17:16:05 +02:00
Max Kellermann
4d453a8313 fs/NarrowPath: add class FromNarrowPath
Move code from ParseCommandLine().
2020-04-02 17:15:34 +02:00
Max Kellermann
61d7b436a2 fs/NarrowPath: un-inline Windows constructor 2020-04-02 16:27:44 +02:00
Max Kellermann
cdddaf21b0 db/simple/Directory: optimize GetName() using the parent's path
This method gets called a lot during MPD startup, via FindChild() and
directory_load_subdir(), so this is worth optimizing at the expense of
code readability.

This speeds up MPD startup by 10%.
2020-04-02 16:12:08 +02:00
Max Kellermann
b267ba5f0a tag/Pool: enlarge hash table
This consumes more memory (plus 48 kB on 32 bit systems), but reduces
the number of hash collisions, speeding up MPD startup with large
databases.
2020-04-02 15:45:35 +02:00
Max Kellermann
8270043053 Revert "decoder/ffmpeg: copy the AVPacket in ffmpeg_send_packet()"
This reverts commit eb192137d6.

This is no longer necessary because we require FFmpeg 3.1 or newer
since MPD 0.21.2.

This fixes a deprecation warning because the implicit AVPacket copy
constructor copies the deprecated attribute `convergence_duration`.
2020-04-01 17:30:28 +02:00
Max Kellermann
c00ce42bca python/build/libs.py: update libmpdclient to 2.18 2020-04-01 17:17:30 +02:00
Max Kellermann
3852ddbbce .travis.yml: install more packages on OSX
Enable lots of plugins for better CI coverage.
2020-04-01 16:37:45 +02:00
Max Kellermann
672bc3ab67 time/Convert: fix GetTimeZoneOffset() on Windows
Was using the wrong parameter.
2020-04-01 16:21:29 +02:00
Max Kellermann
62229f14da test/time: add test for LocalTime(), GmTime() 2020-04-01 16:21:29 +02:00
Max Kellermann
a4c925c8d7 test/meson.build: move TestTime to time/ 2020-04-01 16:12:01 +02:00
Max Kellermann
60610e90b1 test/net/TestIPv[46]Address: fix Windows build errors 2020-04-01 16:09:24 +02:00
Max Kellermann
90184e0ce7 python/build/libs.py: update CURL to 7.69.1 2020-04-01 15:49:16 +02:00
Max Kellermann
9c3e1d450a fs/io/GunzipReader: increase buffer size to 64 kB
Reduces I/O overhead while reading a compressed database file.
2020-03-31 15:07:39 +02:00
Thomas Guillem
60f2116202 android/Settings: remove the EXPIRIMENTAL text
Using MPD from Android since quite some times now. I consider it very stable
now.
2020-03-26 17:31:31 +01:00
Thomas Guillem
4ff2532330 android: add TV support
TODO: Not sure the app could be accepted on the play store without a valid
banner.
2020-03-26 17:31:20 +01:00
Thomas Guillem
9c15760c4d android/Main: handle API26 NotificationChannel
This seems to be required on recent Android versions (tested with Android 10).
This is also required for android TV services (cf. next commit).

This is done using Java reflection so that the project doesn't depend on
android compat libs.
2020-03-26 17:30:55 +01:00
Max Kellermann
e1c43ec65f Merge branch 'ucl' of git://github.com/neheb/MPD into v0.21.x 2020-03-26 17:28:21 +01:00
Thomas Guillem
4dd10894ba lib/curl/Request: fix Exception "error" on Android
Apparently, it's not possible to change CURLOPT_NETRC on Android.
2020-03-26 17:26:14 +01:00
Rosen Penev
608d7ec1e7 [clang-tidy] change integer prefixes to uppercase
Found with readability-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-26 17:25:20 +01:00
Max Kellermann
8474599ed6 lib/curl/Easy: add method Unpause() 2020-03-26 17:22:10 +01:00
Max Kellermann
ab39f64fc0 lib/curl/Easy: add setter functions 2020-03-26 17:21:30 +01:00
Max Kellermann
185fbca282 lib/curl/Global: make ReadInfo() private 2020-03-26 17:20:10 +01:00
Max Kellermann
6e3b2fd844 lib/curl/Global: remove redundant API docs 2020-03-26 17:20:06 +01:00
Max Kellermann
dab39dc778 lib/curl: fix coding style 2020-03-26 17:19:48 +01:00
Max Kellermann
8cd5e79fbd event/*, ...: make GetEventLoop() const 2020-03-26 17:19:13 +01:00
Max Kellermann
1de3ac6c78 lib/curl/Init: add const overloads 2020-03-26 17:18:27 +01:00
Max Kellermann
abe06a5fa6 lib/curl/Init: add noexcept 2020-03-26 17:18:23 +01:00
Rosen Penev
85c27840a3 treewide: use boost::lround when std::round is unavailable
This is the case with uClibc-ng currently.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
(cherry picked from commit 769cd0ee9f0cf8ceb026aa751b5d4a390bb5dbdc)
(changed define to match master)
2020-03-25 18:54:15 -07:00
Thomas Guillem
81c16273c5 output/sles: use the AndroidMixerPlugin 2020-03-25 20:08:53 +01:00
Thomas Guillem
801ae86b5d mixer: add AndroidMixerPlugin 2020-03-25 20:07:26 +01:00
Thomas Guillem
5619fd0bba android: Context: add GetAudioManager 2020-03-25 20:07:25 +01:00
Thomas Guillem
200258c7c3 android: add AudioManager 2020-03-25 20:07:24 +01:00
Max Kellermann
5418bb49fb android/Context: add noexcept 2020-03-25 20:07:18 +01:00
Max Kellermann
3449c14ff5 java/Object: rename class Object to GlobalObject 2020-03-25 20:07:15 +01:00
kowalcj0
36a89e8fe7 Support RSS feeds with application/xml MIME-type 2020-03-22 10:49:38 +01:00
Max Kellermann
8e6a21a9c2 increment version number to 0.21.22 2020-03-22 10:48:53 +01:00
Max Kellermann
c560ec8ea6 release v0.21.21 2020-03-19 15:22:28 +01:00
Max Kellermann
56c234b410 raise default "max_connections" value to 100
Documentation says the limit is 5, but it was really 10 (at least
since 2004).  But since MPD wants to promote using many small clients
idling around, and these clients consume only very few resources, it
seems reasonable to raise this limit's default value.
2020-03-19 13:30:46 +01:00
Max Kellermann
82743dfd02 playlist/asx: concatenate multiple CharacterData fragments
Similar to c45f113856
2020-03-12 21:07:37 +01:00
Max Kellermann
33694642bd playlist/asx: add State::TAG 2020-03-12 20:42:16 +01:00
Max Kellermann
c71242d743 playlist/asx: use tag_table to convert element name to TagType 2020-03-12 20:40:18 +01:00
Max Kellermann
c45f113856 playlist/xspf: concatenate multiple CharacterData fragments
Closes https://github.com/MusicPlayerDaemon/MPD/issues/781
2020-03-12 08:02:58 +01:00
Max Kellermann
e0a8fd398c playlist/xspf: add State::TAG 2020-03-12 08:00:54 +01:00
Max Kellermann
3e97058151 playlist/xspf: move location.empty() check to _start_element() 2020-03-11 20:54:53 +01:00
Max Kellermann
51b1dd8672 playlist/xspf: use tag_table to convert element name to TagType 2020-03-11 20:51:47 +01:00
Max Kellermann
98a7d8da6c playlist/xspf: use C++11 initializer 2020-03-11 20:51:10 +01:00
Max Kellermann
acb29f792f tag/Mask: fix yet another typo, this time in Unset()
Similar to commits e8f2f98048 and
ff1ff1e54a

Closes https://github.com/MusicPlayerDaemon/MPD/issues/783
2020-03-11 20:34:02 +01:00
Max Kellermann
cd364023ae .travis.yml: rename "matrix" to "jobs"
Travis has changed the canonical name for this a while ago.

(Now really.  The last commit for this was empty.)
2020-03-07 09:31:46 +01:00
Max Kellermann
8d34a1cfc6 archive/iso9660: skip empty filenames
Aparently, libcdio sometimes returns empty filenames, causing MPD
crashes.  This shouldn't really happen, and I consider this a libcdio
bug - but if it happens, people blame MPD, so let's add a check.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/776
2020-03-07 09:30:56 +01:00
Max Kellermann
73a1f078a6 archive/iso9660: use IsSpecialFilename() 2020-03-07 09:30:56 +01:00
Max Kellermann
b7ce452308 fs/Traits: add IsSpecialFilename()
Merge some duplicate code in a central library.
2020-03-07 09:30:56 +01:00
Max Kellermann
5faf76051d .travis.yml: force updating homebrew on OSX
Workaround for Travis failures as described in
 https://travis-ci.community/t/macos-build-fails-because-of-homebrew-bundle-unknown-command/7296/18
2020-03-07 09:30:56 +01:00
Max Kellermann
5fe70a3417 .travis.yml: rename "matrix" to "jobs"
Travis has changed the canonical name for this a while ago.
2020-03-07 09:30:56 +01:00
Thomas Klausner
7a68b1e71f Adapt SolarisOutputPlugin.cxx to be usable on NetBSD. 2020-02-29 10:05:29 +01:00
Thomas Klausner
d5468dfe89 Add missing header.
Fixes
../src/time/ISO8601.cxx:67:24: error: use of undeclared identifier 'strtoul'
        unsigned long value = strtoul(s, &endptr, 10);
                              ^
../src/time/ISO8601.cxx:77:14: error: use of undeclared identifier 'strtoul'
                        minutes = strtoul(s, &endptr, 10);
                                  ^

on NetBSD with clang 9.0.0.
2020-02-29 10:04:54 +01:00
John Regan
976372ff63 gme: check for empty metadata strings instead of nullptr
Using libgme 0.6.2 on macOS, it appears that gme_info_t strings can be
empty, which creates weird track titles: (001/050)

This adds an additional check for an empty string.
2020-02-25 20:12:08 +01:00
Max Kellermann
9abb686eeb increment version number to 0.21.21 2020-02-16 20:48:46 +01:00
Max Kellermann
f24bcc7f42 release v0.21.20 2020-02-16 20:43:35 +01:00
Max Kellermann
89800324cb .travis.yml: use GTest 1.8.0 instead of HEAD
Fixes strange C++11 compatibility problems during GTest installation:

 /tmp/gtest-20200216-20679-mu1044/googletest/include/gtest/internal/gtest-internal.h:1249:1: error: unknown type name 'constexpr'
 constexpr bool TypedTestCaseIsDeprecated() { return true; }

 /tmp/gtest-20200216-20679-mu1044/googletest/include/gtest/internal/gtest-internal.h:1249:11: error: expected unqualified-id
 constexpr bool TypedTestCaseIsDeprecated() { return true; }

 /tmp/gtest-20200216-20679-mu1044/googletest/include/gtest/internal/gtest-internal.h:1254:1: error: unknown type name 'constexpr'
 constexpr bool RegisterTypedTestCase_P_IsDeprecated() { return true; }
2020-02-16 20:33:15 +01:00
Rosen Penev
050e30418c Fix travis
pip is bugged on arm64 and s390x. Add --no-cache-dir to fix. For
consistency, it doesn't hurt to add everywhere.
2020-02-16 19:29:30 +01:00
Max Kellermann
5397d18ed9 protocol/ArgParser: cast seek offset to SignedSongTime
"The issue is that ParseCommandArgSignedSongTime parses with
SongTime::FromS, not SignedSongTime::FromS, before casting back to a
SignedSongTime for the return. With x86 overflow rules this doesn't
matter, but on ARM the first cast turns negative values to zero."

Closes https://github.com/MusicPlayerDaemon/MPD/issues/757
2020-02-10 09:18:37 +01:00
Max Kellermann
42eb69f46f test/meson.build: restore -Wno-missing-declarations for GTest
This is still needed for GTest 1.8.0 (Travis / Ubuntu Bionic).
2020-02-04 22:06:51 +01:00
Max Kellermann
f1ad21d2bf test/meson.build: add -Wno-unused-command-line-argument for clang 9+ 2020-02-04 16:35:44 +01:00
Max Kellermann
535a099a27 test/meson.build: drop obsolete gtest warning suppressions 2020-02-04 16:32:13 +01:00
Max Kellermann
50003f6ad2 decoder/ffmpeg: add two more missing commas 2020-02-04 16:30:05 +01:00
Rosen Penev
0914644d2b add missing comma
Found with bugprone-suspicious-missing-comma

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-02-04 16:29:23 +01:00
Max Kellermann
5ad6e7fec5 decoder/{audio,snd}file: handle MIME type "audio/wav" 2020-02-01 11:26:57 +01:00
Rosen Penev
0bb943ba3e FfmpegDecoderPlugin: add WAV support 2020-02-01 11:24:51 +01:00
Rosen Penev
80a0cf694f MadDecoderPlugin: fix bad printf format
max_frames is size_t, not unsigned long. Fixes GCC warning.
2020-01-31 21:21:39 +01:00
Max Kellermann
0c9e25b3c4 NEWS: add missing line 2020-01-25 20:09:16 +01:00
Max Kellermann
943a67c805 decoder/ogg: need to sync small files while looking for EOS
When calling OggSeekFindEOS() from inside a OggVisitor callback, then
the #InputStream may be in the middle of an Ogg packet, and the newly
initialized #ogg_sync_state will not be able to load it without the
help of ogg_sync_pageseek().  By passing "synced=false" to
OggSeekFindEOS(), we force the use of ogg_sync_pageseek() even when
not actually seeking.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/719
2020-01-25 20:07:11 +01:00
Max Kellermann
881d91f86b lib/xiph/OggFind: add parameter "synced" 2020-01-25 20:07:10 +01:00
Max Kellermann
54d57fdcc2 test/DumpDecoderClient: dump the seekable flag 2020-01-25 20:07:09 +01:00
Max Kellermann
f6f30d6d64 increment version number to 0.21.20 2020-01-25 20:06:58 +01:00
Max Kellermann
4013fa15b9 release v0.21.19 2020-01-17 15:49:02 +01:00
Max Kellermann
ac1b844c15 android/AndroidManifest.xml: increase targetSdkVersion to 28
Google Play refuses uploads with a lower targetSdkVersion.
2020-01-17 15:48:43 +01:00
Max Kellermann
b8614048d4 python/build/libs.py: update Boost to 1.72.0 2020-01-17 15:33:13 +01:00
Max Kellermann
aed0d13591 python/build/libs.py: update expat to 2.2.9 2020-01-17 15:33:13 +01:00
Max Kellermann
9d02103ebe python/build/libs.py: disable various CURL features we don't use 2020-01-17 15:33:13 +01:00
Max Kellermann
61784c2144 python/build/libs.py: update CURL to 7.68.0 2020-01-17 15:19:46 +01:00
Max Kellermann
7059215795 python/build/libs.py: update FFmpeg to 4.2.2 2020-01-17 15:19:00 +01:00
Max Kellermann
2190cc7927 python/build/libs.py: update FLAC to 1.3.3 2020-01-17 15:17:21 +01:00
Max Kellermann
75dc9506c2 python/build/libs.py: update libmpdclient to 2.17 2020-01-17 15:16:20 +01:00
Max Kellermann
4f11fa0d41 config/File: allow overriding top-level settings in includes
Remove the error message and instead erase the old setting if the
"repeatable" flag is not set.

https://github.com/MusicPlayerDaemon/MPD/issues/684
2020-01-17 14:58:40 +01:00
Max Kellermann
ce7ec2b3f5 meson.build: add -f{function,data}-sections to C++ as well
By accident, this was only enabled for C.
2020-01-14 17:48:48 +01:00
Max Kellermann
fada4aa529 NEWS: mention the Android build fix 2020-01-12 13:08:37 +01:00
Max Kellermann
aa0e121ade android/build.py: support x86_64 builds 2020-01-12 13:03:18 +01:00
Max Kellermann
b4700039fd android/build.py: drop -lmstackrealign
This flag doesn't appear to work, and since we never had a problem
without the flag, implementing Google's recommendation is useless.
2020-01-12 13:03:18 +01:00
Max Kellermann
ab41c16eb5 android/build.py: add -Wl,--exclude-libs=ALL
Don't export the symbols of all those static libraries.  Most
importantly, don't export the whole libc++ ABI.
2020-01-12 12:47:40 +01:00
Max Kellermann
04101f37b8 android/build.py: add -fno-faddrsig and -lmstackrealign 2020-01-12 12:41:37 +01:00
Max Kellermann
8c31370534 android/build.py: drop --sysroot, -isystem, -L, ...
These appear to be no longer necessary (tested with NDK r20b).

Closes https://github.com/android/ndk/issues/951
2020-01-12 12:11:09 +01:00
Max Kellermann
2306b0d78c android/build.py: append API level to LLVM triple
This implicitly defines __ANDROID_API__, which means we can drop the
"-D__ANDROID_API__=" parameter.

This is recommended on
https://android.googlesource.com/platform/ndk/+/ndk-release-r20/docs/BuildSystemMaintainers.md
2020-01-12 12:02:12 +01:00
Max Kellermann
cb1a9045e6 android/build.py: drop "-none" from llvm_triple
It's not mentioned on
https://developer.android.com/ndk/guides/other_build_systems
2020-01-12 11:51:20 +01:00
Max Kellermann
e92af06664 android/build.py: remove obsolete dict key android_api_level 2020-01-12 11:49:10 +01:00
Max Kellermann
af20a1c994 pulse: obey Pulse's maximum sample rate (fixes DSD128 playback)
Closes https://github.com/MusicPlayerDaemon/MPD/issues/708
2020-01-12 07:58:17 +01:00
Max Kellermann
756560eac3 .travis.yml: add ARM64 build (for NEON optimizations) 2020-01-01 18:36:59 +01:00
Jacob Vosmaer
dca0519336 Clang: only use [[fallthrough]] in C++ files
It appears that [[fallthrough]] is valid in C++ but not in C. And
in some Clang versions (e.g. Clang 11 on macOS), Clang is pedantic
about this and considers it an error to use [[fallthrough]] in a
.c file such as src/util/format.c.

This changes makes gcc_fallthrough a no-op under Clang in C files.
2019-12-31 13:54:09 +01:00
Max Kellermann
b9a7f30443 .travis.yml: add s390x build (big-endian) 2019-12-24 16:47:07 +01:00
Max Kellermann
32a17a997a increment version number to 0.21.19 2019-12-24 16:41:13 +01:00
Max Kellermann
bf41d1ad2b release v0.21.18 2019-12-24 16:13:16 +01:00
Max Kellermann
d27e534a85 time/ISO8601: fix Windows build failure
Caused by 2bc127bb43
2019-12-24 16:12:52 +01:00
Max Kellermann
6d54928d7c Revert "lib/curl/Global: remove lower bound on timeouts"
This reverts commit 4475b8ca04.  Further
testing revealed that the threaded resolver still uses a timeout of
0ms.  This revert however lowers the bound to a minimum of 1ms instead
of 10ms.
2019-12-24 16:09:26 +01:00
Max Kellermann
0dffe05bf7 input/curl: remove unnecessary InvalidateSockets() call
Like fe598e7d30
2019-12-24 11:41:52 +01:00
Max Kellermann
9ef1f10319 .travis.yml: install brew packages using addons/homebrew 2019-12-24 11:20:54 +01:00
Max Kellermann
23fcfdbd2a .travis.yml: remove "brew update"
The packages from the Travis image are good enough, and this speeds up
the Travis build.
2019-12-24 11:20:29 +01:00
Max Kellermann
3401d26d4c .travis.yml: switch to xcode9.4, the current default 2019-12-24 10:20:04 +01:00
Max Kellermann
256753ea46 .travis.yml: disable Homebrew analytics
Don't bother sending analytics data for a CI runner.  This adds
traffic but doesn't bring anybody any benefit.
2019-12-24 10:19:25 +01:00
Max Kellermann
76cd5f8595 .travis.yml: cache Homebrew on osx 2019-12-24 10:17:37 +01:00
Max Kellermann
5684025847 .travis.yml: change "cache" yaml syntax 2019-12-24 10:17:35 +01:00
Max Kellermann
744bd1eadc time/ISO8601: refactor ParseTimeOfDay() to parse one by one
This prepares the migration away from strptime() for Windows
portability.

But the real reason I'm doing this is that strptime() on Apple is
buggy: strptime("14", "%H%M%S") (without separating colons) succeeds
even though only the hour has been parsed.  This fixes recent Travis
failures in the ParseISO8601() unit test.
2019-12-24 10:15:03 +01:00
Max Kellermann
2bc127bb43 time/ISO8601: move code to ParseTimeOfDay() 2019-12-24 10:15:01 +01:00
Max Kellermann
7770298a65 util/Compiler.h: use [[fallthrough]] on clang
Older clang versions don't support the GCC __attribute__ syntax.  For
those, don't use anything at all, and new clang versions shall use the
standard syntax.
2019-12-24 08:04:48 +01:00
Max Kellermann
fa50cdb39e .travis.yml: escape dollar signs in MATRIX_EVAL
Expand $PATH at evaluation and not at assignment, which fixes the
problem that /usr/lib/ccache was added to $PATH between the
MATRIX_EVAL assignment and its evaluation.
2019-12-24 07:51:55 +01:00
Max Kellermann
816ef12088 .travis.yml: add Ubuntu Bionic build 2019-12-23 18:12:04 +01:00
Max Kellermann
5ff786e59c .travis.yml: enable ccache on Linux 2019-12-23 18:10:58 +01:00
Max Kellermann
80fe88e8f6 .travis.yml: enable ccache on osx 2019-12-23 18:10:52 +01:00
Max Kellermann
a1afe9afc6 util/Compiler.h: add gcc_fallthrough
Works around build failures with ccache which may feed processed code
to GCC, which doesn't have the "fall through" code comments.
2019-12-23 17:53:57 +01:00
Max Kellermann
fe598e7d30 lib/curl/Global: remove InvalidateSockets() call from Remove()
curl_multi_remove_handle() calls our socket function, and there's no
need to call curl_multi_socket_action().
2019-12-23 14:52:46 +01:00
Max Kellermann
4475b8ca04 lib/curl/Global: remove lower bound on timeouts
This was a problem 9 years ago, and apparently, it has been fixed long
ago.
2019-12-23 14:50:51 +01:00
Max Kellermann
a714bdb0ce lib/curl: drop support for CURL versions older than 7.32.0
For simplicity, this commit removes a workaround for an old CURL bug.
2019-12-23 14:41:06 +01:00
Max Kellermann
087874620f test/RunCurl: new debug program 2019-12-23 14:26:56 +01:00
Max Kellermann
f1116c9258 event/Loop: remove bogus assertion
Can fail if somebody calls Break().
2019-12-23 14:20:09 +01:00
Max Kellermann
d01fb6730a storage/curl: move start call out of the constructor
This can cause request completion in the I/O thread before this
constructor returns, leaving the object in an abstract state, causing
a crash due to pure virtual method call.  We should not start the
request until this object is fully constructed.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/665
2019-12-23 13:37:58 +01:00
Max Kellermann
7bfe6a3304 test/run_storage: add command "stat" 2019-12-22 19:54:31 +01:00
Max Kellermann
9a577f8060 event/MultiSocketMonitor: add workaround for /dev/null
The ALSA "null" driver opens /dev/null and returns the file handle
from snd_pcm_poll_descriptors(), but /dev/null cannot be used with
epoll, the epoll_ctl() system call returns -EPERM.  This means that
the ALSA output hangs, eventually freezing the whole MPD process.

This commit adds a workaround to the MultiSocketMonitor class which is
used by the ALSA output plugin.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/695
2019-12-22 12:08:44 +01:00
Max Kellermann
d75a0d714e event/MultiSocketMonitor: remove unnecessary friend declaration 2019-12-22 12:08:44 +01:00
Max Kellermann
9be3a1554e event/MultiSocketMonitor: remove duplicate IdleMonitor::Schedule() call
SetReady() does this already.
2019-12-22 12:08:10 +01:00
Max Kellermann
7764719513 event/MultiSocketMonitor: un-inline AddSocket() 2019-12-22 12:00:12 +01:00
Max Kellermann
dcbb9fe07c event/Loop: round timeout up to avoid unnecessary wakeups 2019-12-22 11:58:31 +01:00
Max Kellermann
e3b347820a event/MultiSocketMonitor: use std::exchange() 2019-12-20 13:42:35 +01:00
Max Kellermann
a84bf5a92e event/MultiSocketMonitor: AddSocket() returns bool 2019-12-18 17:50:21 +01:00
Max Kellermann
732bdc800d event/SocketMonitor: Schedule() returns bool 2019-12-18 17:46:33 +01:00
Max Kellermann
a8661b5931 increment version number to 0.21.18 2019-12-18 16:49:04 +01:00
Max Kellermann
5680a3a4b7 release v0.21.17 2019-12-16 23:32:44 +01:00
Max Kellermann
15ce8eb487 time/ISO8601: support omitting field separators
Closes https://github.com/MusicPlayerDaemon/MPD/issues/685
2019-12-16 23:31:29 +01:00
Max Kellermann
b7744be208 song/Filter: try ParseISO8601() first
Prepare for allowing ISO8601 time stamps without delimiters, such as
20191216, and prevent them from being interpreted as numeric UNIX time
stamps.
2019-12-16 23:31:29 +01:00
Max Kellermann
63c5d66016 time/ISO8601: support omitting minutes 2019-12-16 23:24:43 +01:00
Max Kellermann
d09bd9178f time/ISO8601: support omitting seconds 2019-12-16 23:24:43 +01:00
Max Kellermann
7d8b1860c3 time/ISO8601: support time zone offset 2019-12-16 23:24:43 +01:00
Max Kellermann
b06825829b time/ISO8601: allow omitting the "Z" suffix
And allow "Z" suffix after date.
2019-12-16 23:24:43 +01:00
Max Kellermann
ba4cd47fd8 time/ISO8601: allow omitting the time of day 2019-12-16 23:24:43 +01:00
Max Kellermann
bbe403f141 test/TestISO8601: unit test for time/ISO8601 2019-12-16 23:24:43 +01:00
Max Kellermann
5df2707d98 time/ISO8601: ParseISO8601() returns precision 2019-12-16 23:24:43 +01:00
Max Kellermann
4859ea468f time/ISO8601: implement with strptime(), without ParseTimePoint()
Prepare for adding more flexible parsing.
2019-12-16 23:24:43 +01:00
Max Kellermann
2a8830db70 time/Convert: fallback TimeGm() implementation
Move code from Parser.cxx.
2019-12-16 23:24:38 +01:00
Max Kellermann
fed9b6fd74 time/Parser: use TimeGm() 2019-12-16 23:03:31 +01:00
Max Kellermann
b02890eb8a time/Parser: explicitly initialize struct tm before strptime()
This is recommended by the strptime() manpage, because strptime() does
not initialize/set attributes which were not specified in the format
string.
2019-12-16 23:03:25 +01:00
Max Kellermann
da882a6eb6 time/Convert: include sys/time.h for struct timeval
Closes https://github.com/MusicPlayerDaemon/MPD/issues/562
2019-12-16 23:03:21 +01:00
Max Kellermann
aeb89aa9d6 time/ISO8601: forward-declare StringBuffer 2019-12-16 23:02:59 +01:00
Max Kellermann
f885807ecc time/Convert: update copyright 2019-12-16 23:02:58 +01:00
Max Kellermann
b826fd71f0 time/Convert: mention exceptions 2019-12-16 23:02:57 +01:00
Max Kellermann
ae35df1126 zeroconf/AvahiPoll: move TimevalToChrono() to time/Convert.cxx 2019-12-16 23:02:45 +01:00
Max Kellermann
80e55f6bfc time/Convert: add noexcept 2019-12-16 23:02:40 +01:00
Max Kellermann
e7411c0c4b time/Convert: add pure attributes 2019-12-16 23:02:38 +01:00
Max Kellermann
e9af692973 util/Time*: move to time/ 2019-12-16 23:02:14 +01:00
Max Kellermann
0cf90ee8b6 decoder/mad: work around bogus -Wuninitialized in GCC 10 2019-12-16 23:01:31 +01:00
Max Kellermann
dc3c0c8866 pcm/Convert, ...: add missing include for std::runtime_error 2019-12-16 22:52:50 +01:00
Max Kellermann
1c46bb1ba6 lib/gcrypt/MD5: add missing include for uint8_t 2019-12-16 22:52:22 +01:00
Max Kellermann
2e8f42c6ad util/StringBuffer: use std::size_t instead of size_t 2019-12-16 22:51:23 +01:00
Jacob Vosmaer
2b301ffd2c lib/xiph: add missing meson dependency 2019-12-16 17:11:14 +01:00
Jacob Vosmaer
ef0765ca10 input: add missing boost meson dependency 2019-12-16 17:11:14 +01:00
Naglis Jonaitis
9766ac6db3 Fix typo in documentation 2019-12-16 17:09:45 +01:00
Max Kellermann
32799ff682 archive/zzip: improve error reporting
Most importantly, this commit translates ZZIP_ENOENT to
std::system_error(ENOENT) so IsFileNotFound() returns true and
find_stream_art() can suppress the log line.
2019-12-04 12:33:42 +01:00
Max Kellermann
ce093be12c system/Error: add FormatFileNotFound() 2019-12-04 12:33:38 +01:00
Max Kellermann
2c276770f0 util/PrintException, ...: update copyright 2019-12-04 12:33:36 +01:00
Max Kellermann
75a592f629 system/Error: move code to IsErrno() 2019-12-04 12:33:33 +01:00
Max Kellermann
13ce07d181 output/shout: declare metadata as UTF-8
Apparently, Icecast defaults to ISO-8859-1 for MP3:

 http://icecast.org/docs/icecast-2.4.0/config-file.html#mountsettings

This change forces Icecast to UTF-8 without having to configure it in
Icecast's configuration file.
2019-11-06 16:05:22 +01:00
Max Kellermann
d659c7df19 python/build/libs: update CURL to 7.66.0 2019-11-04 14:27:00 +01:00
Max Kellermann
f8403a1d29 python/build/libs: update FFmpeg to 4.2.1 2019-11-04 14:26:05 +01:00
Max Kellermann
ebb952c4ad neighbor/meson.build: disable if -Ddatabase=false
Fixes yet another build failure (which however only affects the 0.22
branch).

Closes https://github.com/MusicPlayerDaemon/MPD/issues/666
2019-11-04 14:18:48 +01:00
Max Kellermann
bea3b954a5 meson.build, SongUpdate: disable db-specific archive code if -Ddatabase=false
Fixes another build failure.
2019-11-04 14:15:48 +01:00
Max Kellermann
129d8e89b9 lib/sqlite: disable if -Ddatabase=false
Fixes build failure in StickerCommands.cxx.
2019-11-04 14:10:03 +01:00
Niklas Haas
65778a3774 output/Jack: mark ports as terminal
This is the correct thing to do for ports from which a signal ultimately
"originates", such as is the case with mpd.
2019-10-29 10:07:44 +01:00
kaliko
d9841668ff doc/user.rst: update build dependencies on Debian Buster 2019-10-28 15:20:05 +01:00
Max Kellermann
85d27cbcb9 increment version number to 0.21.17 2019-10-16 14:20:28 +02:00
Max Kellermann
9b95e65bd9 release v0.21.16 2019-10-16 11:58:36 +02:00
Max Kellermann
12a86c4975 queue/PlaylistEdit: fix relative destination offset when moving a range
Commit 13208bf5a7 added range support to
the `move` command, but applied the wrong offset to the `to` variable.
When the source range is before the current song, and the song thus
gets decremented by the range size, then the final destination offset
must also be decremented by the range size.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/663
2019-10-15 17:00:16 +02:00
Max Kellermann
0b9435858b storage/curl: unescape file names from PROPFIND
This is the last missing piece for https://github.com/MusicPlayerDaemon/MPD/issues/662
2019-10-15 16:49:17 +02:00
Max Kellermann
f0386459ee storage/curl: follow redirects for collections without trailing slash 2019-10-15 16:42:39 +02:00
Max Kellermann
e98d4670b8 storage/curl: work around different case in hex digits 2019-10-15 16:26:53 +02:00
Max Kellermann
56cc42b752 storage/curl: use MapUTF8() to reuse existing escaping code
Commit 29f78b18b1 continued.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/662
2019-10-15 16:26:53 +02:00
Max Kellermann
ead208987d storage/curl: unescape URI in MapToRelativeUTF8() 2019-10-15 16:26:49 +02:00
Max Kellermann
364acc8949 lib/curl/Escape: add CurlUnescape() 2019-10-15 13:39:02 +02:00
Max Kellermann
a8f4d2b6fc storage/curl: move code to EscapeUriPath() 2019-10-15 13:24:06 +02:00
Max Kellermann
0eb113e7c6 lib/curl/String: OO wrapper for allocated strings returned from CURL 2019-10-15 13:13:39 +02:00
Andre Heider
96a9670c69 lib/icu: fix build with iconv() 2019-10-07 13:34:04 +02:00
Max Kellermann
dcc5ce6792 storage/curl: request the "resourcetype" property to fix update
Without requesting the property, "good" WebDAV servers would not send
it, and so MPD could never recognize a directory, failing the database
update.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/660
2019-10-07 12:44:48 +02:00
Max Kellermann
23d08820a2 db/update/Walk: fix crash when music_directory is not a directory
Add a runtime sanity check to avoid the assertion failure.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/660
2019-10-07 12:24:25 +02:00
Max Kellermann
b9b906ab20 increment version number to 0.21.16 2019-10-07 12:24:25 +02:00
Max Kellermann
964804a4c2 release v0.21.15 2019-09-25 21:24:15 +02:00
Max Kellermann
92495d2b0b decoder/mpcdec: fix bogus ReplayGain values
Apparently, libmpcdec sets gain/peak variables to zero if they are not
present.  This clashes with our formula and results in bogus values
which cause noise during playback.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/640
2019-09-13 19:52:11 +02:00
Max Kellermann
9270829b5b ReplayGainInfo: move more code to a function 2019-09-13 19:50:49 +02:00
Max Kellermann
b6243a9945 decoder/mpcdec: merge duplicate code 2019-09-13 19:50:43 +02:00
Max Kellermann
496f88653d ReplayGainInfo: add static method Undefined() 2019-09-13 19:46:39 +02:00
Max Kellermann
5ef645df97 NEWS: add missing line for 818b7e0641 2019-09-08 12:54:16 +02:00
Max Kellermann
bf49c9e4e2 decoder/{dsf,dsdiff}: precalculate bit rate 2019-09-08 12:52:02 +02:00
Max Kellermann
0da9c91af2 decoder/{dsf,dsdiff}: fix displayed bit rate
The formula did not consider the channel count.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/639
2019-09-08 12:45:05 +02:00
Max Kellermann
193e637dd9 python/build/libs: update Boost to 1.71.0 2019-09-01 13:03:50 +02:00
Max Kellermann
928bee933d python/build/libs: update expat to 2.2.7 2019-09-01 13:02:56 +02:00
Max Kellermann
4d1720c886 python/build/libs: update CURL to 7.65.3 2019-09-01 13:02:04 +02:00
Max Kellermann
8f8ed87327 python/build/libs: update FFmpeg to 4.2 2019-09-01 13:00:26 +02:00
Max Kellermann
28a441c977 python/build/libs: update Opus to 1.3.1 2019-09-01 12:59:17 +02:00
Max Kellermann
8cf50b08f2 python/build/libs: update libogg to 1.3.4 2019-09-01 12:58:26 +02:00
Max Kellermann
818b7e0641 output/solaris: include sys/stropts.h only on Solaris
This header had been available for a long time on Linux, but was
removed in glibc 2.30.  This commit moves the `#include` line inside
the `#ifdef __sun` block and adds a fake declaration of `I_FLUSH` for
the Linux build.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/630
2019-08-22 11:41:12 +02:00
Max Kellermann
e70f40fac1 increment version number to 0.21.15 2019-08-22 11:40:17 +02:00
Max Kellermann
bc89ca92b4 release v0.21.14 2019-08-21 10:47:53 +02:00
Max Kellermann
b968e1b6de output/Thread: add missing return in exception handler 2019-08-21 10:20:17 +02:00
Max Kellermann
6c9f9c136b command/all: don't create new Response instance in exception handler
The new Response instance in the `catch` block didn't have the
`command` attribute set, so the error response didn't indicate which
command had failed, which however is required in the MPD protocol.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/628
2019-08-20 20:31:36 +02:00
Max Kellermann
9bff5f9e36 client/Process, command/all: add noexcept
Clarify that those can't throw, preparing for the next commit.
2019-08-20 20:28:15 +02:00
Max Kellermann
2bf26a2ff8 command/all: remove obsolete prototype 2019-08-20 20:28:10 +02:00
Max Kellermann
e33b50d9c5 command/all: simplify return from command_process() 2019-08-20 20:26:07 +02:00
Max Kellermann
21fa44c0d5 command/all: catch all exceptions 2019-08-20 20:23:54 +02:00
Max Kellermann
44444e1b89 decoder/Thread: on late SEEK, start decoder at seek position
Previously, a bogus value (whatever happened to be still in
`start_time`) was used.
2019-08-20 20:15:08 +02:00
Max Kellermann
ca450663d0 decoder/Control: work around crash after SEEK was too late
See code comment.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/629
2019-08-20 20:01:53 +02:00
Max Kellermann
f3d16f6d1b output/Thread: fix typo in comment 2019-08-13 13:08:40 +02:00
Max Kellermann
4464cdcc67 doc/protocol.rst: add missing newline to "albumart" example
This was missing in commit 0f488dcecf
2019-08-12 20:20:17 +02:00
Fredrik Noring
2d61e526de decoder/sidplay: Fix date field to have year but not company or author
Field 2 is called <released>, formerly used as <copyright>[1][2]. It is
formatted <year><space><company or author or group>, where <year> may be
<YYYY>, <YYY?>, <YY??> or <YYYY-YY>, for example "1987", "199?", "19??"
or "1985-87". The <company or author or group> may be for example Rob
Hubbard. A full field may be for example "1987 Rob Hubbard".

This change splits the <released> field at the first <space>, to retain
the <year> part.

The 51823 SID files in High Voltage SID Collection (HVSC) version 71
have the following distribution of dates:

    333 19??         11 1990-92       6 1995-99       2 2006-08
    827 198?         88 1990-93    2140 1996        530 2007
     32 1982         69 1990-94       9 1996-97      15 2007-08
      1 1982-83      49 1990-95       2 1996-98       2 2007-09
    255 1983       3467 1991          5 1996-99       1 2007-10
    677 1984         75 1991-92    1840 1997        430 2008
    775 1985         65 1991-93       4 1997-98      23 2008-09
      3 1985-86      10 1991-94    1276 1998          1 2008-12
     10 1985-87      35 1991-97       4 1998-99     631 2009
    943 1986       3320 1992        865 1999          1 2009-10
     12 1986-87      26 1992-93      24 200?        645 2010
      5 1986-89      59 1992-94     590 2000          1 2010-12
   2083 1987          1 1992-96       4 2000-01     538 2011
     31 1987-88    2996 1993        727 2001          1 2011-12
     44 1987-89      42 1993-94     875 2002        651 2012
   2510 1988         12 1993-95       2 2002-04     811 2013
    129 1988-89       2 1993-97     844 2003        790 2014
     91 1988-90    2737 1994          3 2003-05     740 2015
     58 1988-91      16 1994-95     842 2004        792 2016
   3466 1989         20 1994-96       2 2004-05     775 2017
     95 1989-90      17 1994-97     707 2005        638 2018
    150 1989-91    2271 1995          1 2005-06     284 2019
   1077 199?          2 1995-96       2 2005-07
   2834 1990          4 1995-97     785 2006
    119 1990-91       2 1995-98       6 2006-07

References:

[1] https://www.hvsc.c64.org/download/C64Music/DOCUMENTS/SID_file_format.txt
[2] https://hvsc.c64.org/info
2019-08-10 10:50:51 +02:00
Fredrik Noring
7723c481db decoder/sidplay: Fix windows-1252 to utf-8 string conversion
High Voltage SID Collection (HVSC) metadata fields are encoded in
windows-1252, as described in DOCUMENTS/SID_file_format.txt:

https://www.hvsc.c64.org/download/C64Music/DOCUMENTS/SID_file_format.txt

If utf-8 transcoding fails, or the ICU library is unavailable, fall
back to plain ASCII and replace other characters with '?'.
2019-08-10 10:45:02 +02:00
Fredrik Noring
0ed10542cc decoder/sidplay: Fix song length initialisation during container scan
The song length was previously undetermined.
2019-08-09 15:39:36 +02:00
Max Kellermann
ab830f9afd increment version number to 0.21.14 2019-08-09 15:38:01 +02:00
Max Kellermann
d4d2bc072e release v0.21.13 2019-08-06 11:35:42 +02:00
Max Kellermann
bcccc8f66c output/jack: use jack_free() for Windows compatibility 2019-08-06 11:34:56 +02:00
Max Kellermann
848c63e2d5 output/jack: use std::atomic_bool for "shutdown" and "pause"
Without this, the compiler may optimize accesses away.
2019-08-06 11:34:00 +02:00
Max Kellermann
f6d0310f9c output/jack: use SIZE_MAX instead of (size_t)-1 2019-08-06 11:33:52 +02:00
Max Kellermann
3ef043392c input/cdio_paranoia: drop support for libcdio-paranoia older than 10.2+0.93+1
Version 10.2+0.93+1 was released five years ago in 2014 and is the
first version to feature cdio_cddap_free_messages().  There is no way
to check the libcdio-paranoia version at compile time, so let's just
remove support for older versions instead of attempting to fix the
cdio_cddap_free_messages() check at build time.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/613
2019-08-06 11:09:36 +02:00
Max Kellermann
864d6f312d Revert "decoder/mad: use MAD_F_MIN and MAD_F_MAX"
This reverts commit f7ed7446ae.  It was
a bad idea, because MAD_F_MIN and MAD_F_MAX do not represent the
clamping limits, but the theoretical minimum and maximum values of the
mad_fixed_t data type.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/617
2019-08-05 13:07:41 +02:00
Max Kellermann
f44c67de09 increment version number to 0.21.13 2019-08-05 13:05:54 +02:00
Max Kellermann
ae19bda1f2 release v0.21.12 2019-08-03 12:48:20 +02:00
Max Kellermann
f2d8fd769d player/Thread: don't restart unseekable song after failed seek attempt
The check IsSeekableCurrentSong() was added by commit
44b200240f in version 0.20.19, but it
caused a regression: by doing the branch only if the current song is
seekable, the player would restart the current song if it was not
seekable, and later the initial seek would fail; but we already know
it's not seekable, and so we should fail early.
2019-08-03 12:30:10 +02:00
Max Kellermann
9661062ae2 decoder/mad: pass const reference to RecoverFrameError() 2019-08-03 11:59:41 +02:00
Max Kellermann
2a07354cad decoder/mad: change integers to size_t 2019-08-03 11:44:02 +02:00
Max Kellermann
fc18fd571c decoder/mad: return from SynthAndSubmit() early 2019-08-03 11:42:05 +02:00
Max Kellermann
51abed9732 decoder/mad: pass mad_pcm to mad_fixed_to_24_buffer() 2019-08-03 11:40:06 +02:00
Max Kellermann
d00afc912c decoder/mad: eliminate the loop in SubmitPCM()
libmad has a hard-coded maximum PCM buffer size; if we make our
output_buffer just as large, we can avoid the loop, because any
possible size will fit.
2019-08-03 11:36:05 +02:00
Max Kellermann
9d0fe725eb decoder/mad: rename a few misnamed methods 2019-08-03 11:32:42 +02:00
Max Kellermann
8a432c9b7f decoder/mad: move code to LoadNextFrame() 2019-08-03 11:32:06 +02:00
Max Kellermann
187204f03c decoder/mad: move code to HandleCurrentFrame() 2019-08-03 11:32:06 +02:00
Max Kellermann
5e5fadb5f2 decoder/mad: remove unnecessary initializers
These will not be used until they are initialized in SyncAndSend().
2019-08-03 08:49:26 +02:00
Max Kellermann
952c793235 decoder/mad: subtract libmad decoder delay from LAME encoder padding
Apparently, libmad not only inserts 529 samples of silence at the
beginning of the file, but also removes them at the end.

This solves the last piece of
https://github.com/MusicPlayerDaemon/MPD/issues/601

Closes https://github.com/MusicPlayerDaemon/MPD/issues/601
2019-08-03 08:35:00 +02:00
Max Kellermann
3e3d8c7f9d decoder/mad: pad the input buffer with zero bytes and end of file
libmad requires padding the input buffer with "MAD_BUFFER_GUARD" zero
bytes at the end of the file, or else it is unable to decode the last
frame.

This fixes yet another bug which prevented this plugin from decoding
the last frame, see
https://github.com/MusicPlayerDaemon/MPD/issues/601
2019-08-03 08:32:27 +02:00
Max Kellermann
9b99a9897a decoder/mad: don't count the Xing/LAME metadata frame
The Xing/LAME frame indicates how many frames there are, but that
excludes the initial Xing/LAME frame.  Therefore, it should not be
counted.

This fixes an off-by-one bug which caused the last frame to be
skipped, fixing one part of
https://github.com/MusicPlayerDaemon/MPD/issues/601
2019-08-03 08:25:48 +02:00
Max Kellermann
4f56fdc397 decoder/mad: make "current_frame" zero-based
Increment "current_frame" after processing the frame.
2019-08-03 08:24:25 +02:00
Max Kellermann
c87d6825ec decoder/mad: add API documentation 2019-08-03 08:07:30 +02:00
Max Kellermann
00830a20e3 decoder/mad: convert to class, make almost everything private 2019-08-03 07:52:51 +02:00
Max Kellermann
d39d2874b4 decoder/mad: move code to methods RunDecoder(), RunScan() 2019-08-03 07:49:41 +02:00
Max Kellermann
a0a74951b8 decoder/mad: eliminate attribute "bit_rate"
This also fixes a bug which caused the bit rate to not update after
seeking.
2019-08-03 00:38:45 +02:00
Max Kellermann
779a6855ff decoder/mad: add noexcept 2019-08-03 00:28:59 +02:00
Max Kellermann
f7ed7446ae decoder/mad: use MAD_F_MIN and MAD_F_MAX 2019-08-03 00:27:59 +02:00
Max Kellermann
9d44a6d2ae decoder/mad: use Clamp() 2019-08-03 00:26:57 +02:00
Max Kellermann
10da9ee7ba decoder/mad: refactor local variables in FillBuffer() 2019-08-02 23:19:11 +02:00
Max Kellermann
f9eff31205 decoder/mad: use sizeof(input_buffer) 2019-08-02 23:19:11 +02:00
Max Kellermann
1d74a029a2 decoder/mad: simplify variable initialization in FillBuffer() 2019-08-02 23:19:11 +02:00
Max Kellermann
6b8ca514bb decoder/mad: fix broken log message
Broken since commit f8bfea8bae
2019-08-02 22:58:16 +02:00
Max Kellermann
f51e555154 decoder/mad: change "mp3_" suffix to "mad_" 2019-08-02 22:49:55 +02:00
Max Kellermann
61a3c69a06 decoder/mad: make enums strictly-typed 2019-08-02 22:49:55 +02:00
Max Kellermann
089615a01e decoder/mad: include cleanup 2019-08-02 22:49:55 +02:00
Max Kellermann
52bee8f81f util/StaticFifoBuffer: add GetAvailable() 2019-08-02 22:49:55 +02:00
Max Kellermann
adc25e648f util/StaticFifoBuffer: add constexpr 2019-08-02 22:49:33 +02:00
Max Kellermann
31da8eac9b util/StaticFifoBuffer: add noexcept 2019-08-02 22:49:05 +02:00
Max Kellermann
e00464435b util/Compiler.h: move compiler version checks to meson.build 2019-08-02 15:53:16 +02:00
Diomendius
b81138bda1 Fix JACK plugin outputting only to left channel
The JACK output plugin would not correctly upmix mono input files when exactly 2 output ports were configured. This fixes that.
2019-08-02 15:52:20 +02:00
Max Kellermann
6de088140b lib/xiph/OggVisitor: invoke OnOggPacket() with the "E_O_S" packet
The "end of stream" packet is not special; it contains normal data,
and thus we should pass it to OnOggPacket().

This fixes one part of https://github.com/MusicPlayerDaemon/MPD/issues/601
2019-08-02 14:04:08 +02:00
Max Kellermann
86d0534638 lib/xiph/OggVisitor: more API documentation 2019-08-02 13:56:00 +02:00
Max Kellermann
1033dbca2b playlist/Song: add missing includes 2019-07-29 11:31:30 +02:00
Max Kellermann
b955334882 decoder/opus: ignore case in replay gain tag names
Closes https://github.com/MusicPlayerDaemon/MPD/issues/604
2019-07-29 10:40:37 +02:00
Max Kellermann
90ea3bf985 playlist/Song: support backslash in relative URIs
Closes https://github.com/MusicPlayerDaemon/MPD/issues/607
2019-07-29 09:58:53 +02:00
Max Kellermann
83b0871248 test/test_translate_song: remove unused variable "s1" 2019-07-29 09:52:57 +02:00
Max Kellermann
d8aec4b2dc test/run_decoder: catch StopDecoder
This exception is usually thrown by class DecoderBridge, but the Opus
plugin (ab)uses it as well, so we need to catch it.
2019-07-12 17:49:12 +02:00
Max Kellermann
39b302dcad increment version number to 0.21.12 2019-07-12 17:22:20 +02:00
Max Kellermann
f6125f0c35 release v0.21.11 2019-07-03 15:16:27 +02:00
Max Kellermann
f780ac418a output/alsa: log when generating silence due to slow decoder
MPD used to do that when this code lived in the player thread, but it
was removed by commit 98a7c62d7a4f716d90af6d78e18d1a3b10bc54b3; and
the replacement code in the ALSA output plugin didn't have it.
2019-06-28 18:15:30 +02:00
Max Kellermann
61a72a5d13 output/alsa: schedule a timer to generate silence
Without this timer, DispatchSockets() may disable the
MultiSocketMonitor and if Play() doesn't get called soon, it never
gets a chance to generate silence.  However if Play() gets called,
generating silence isn't necessary anymore...

Resulting from this misdesign (added by commit ccafe3f3cf in 0.21.3),
the silence generator didn't work reliably.
2019-06-28 18:04:49 +02:00
Max Kellermann
0c0a354753 output/alsa: add a new flag "waiting" for xrun management
In DispatchSockets(), when there was not enough data, but enough for
current playback, the method would disable the "active" flag so the
next Play() call would re-enable the MultiSocketMonitor.

This was an abuse of the flag which could result in a crash
in Cancel(), because that method asserts that the period_buffer is
empty, which it may be not.

The solution is to add anther flag called "waiting" which shares some
behavior with the old flag.
2019-06-28 18:04:49 +02:00
Max Kellermann
3c5f860fb8 output/alsa: Cancel() also affects "active" (documentation) 2019-06-28 18:04:49 +02:00
Max Kellermann
3da1fa88d0 output/alsa: fix comment typo 2019-06-28 18:04:49 +02:00
Max Kellermann
fac15aaffb output/alsa: fix comment typo 2019-06-28 14:39:54 +02:00
Max Kellermann
c926021599 output/alsa: always redo DrainInternal() after writing
Draining isn't finished just because the period_buffer has run empty.
It is only finished after snd_pcm_drain() has succeeded.
2019-06-28 09:10:16 +02:00
Max Kellermann
543776d9c9 output/alsa: check PCM state before calling snd_pcm_drain()
Apparently, if snd_pcm_drain() returns EAGAIN, it does not actually
want to be called again; the next call will snd_pcm_drain() will also
return EAGAIN, forever, even though the PCM state has meanwhile
switched to SND_PCM_STATE_SETUP.  This causes a busy loop; to fix
this, we should always check snd_pcm_state() to see if draining is
really required.
2019-06-28 08:55:25 +02:00
Max Kellermann
8bf3f9b874 input/tidal: deprecated because Tidal has changed the protocol
See https://github.com/MusicPlayerDaemon/MPD/issues/545
2019-06-26 23:14:07 +02:00
Max Kellermann
f07f8f7d88 decoder/wildmidi: add fallbacks for libwildmidi<0.4
Fix build breakage from commit ea639269d8
2019-06-26 23:13:23 +02:00
Max Kellermann
39b40ac1fd decoder/wildmidi: remove unused variable wildmidi_domain 2019-06-26 23:10:20 +02:00
Max Kellermann
ea639269d8 decoder/wildmidi: throw PluginUnavailable on WildMidi_Init() error
Closes https://github.com/MusicPlayerDaemon/MPD/issues/589
2019-06-26 22:40:27 +02:00
Max Kellermann
0abaa3ecc5 decoder/wildmidi: throw PluginUnavailable if config file does not exist
This makes the configuration error more visible, possibly addressing
one part of https://github.com/MusicPlayerDaemon/MPD/issues/589
2019-06-26 22:38:40 +02:00
Max Kellermann
c4d3efe71d decoder/List: handle exception PluginUnavailable 2019-06-26 22:02:54 +02:00
Max Kellermann
85e82e3d4d decoder/List: annotate exceptions thrown by DecoderPlugin::Init() 2019-06-26 22:01:45 +02:00
Max Kellermann
f44011519c meson.build: increase protocol version to 0.21.11
Commit 1eae9339f2 added support for
multiple "groups" in the "list" command, and this change allows
clients to detect that this behavior, which had been documented for
several years, is now implemented properly.
2019-06-18 15:35:38 +02:00
Max Kellermann
2c3eeb7194 MusicChunk: pad MusicChunkInfo to a multiple of 8 bytes
Workaround for a regression caused by commit
a06bf388d9, revealing a problem with
discarding odd numer of frames in the DSD_U32 and DoP converters,
causing distortions with DSD_U32 and DoP on 32 bit CPUs.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/469
2019-06-17 21:24:32 +02:00
Max Kellermann
79839db3a3 output/oss: return early if PcmExport::Export() returns empty array
This can happen if the DoP converter doesn't get enough source samples
for one destination quad.  This isn't a critical bug, because the OSS
plugin doesn't support DoP yet, but it's good to be prepared.
2019-06-17 21:07:30 +02:00
Max Kellermann
d478bdda8e pcm/Export: document that Export() may return an empty buffer 2019-06-17 21:07:29 +02:00
Max Kellermann
1eae9339f2 db/Interface: CollectUniqueTags() allows multiple "groups"
Instead of passing tag and group, pass an array of tags.  To support a
nested return value, return a nested std::map of std::maps.  Each key
specifies the tag value, and each value may be another nesting level.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/408
2019-06-16 10:39:29 +02:00
Max Kellermann
923c1b6220 doc/include: remove obsolete DocBook fragment 2019-06-11 09:29:20 +02:00
Max Kellermann
09884e608b increment version number to 0.21.11 2019-06-11 09:29:05 +02:00
Max Kellermann
e239009295 release v0.21.10 2019-06-05 22:32:32 +02:00
Max Kellermann
3fae2150f5 decoder/OpusReader: return StringView
Since we now don't duplicate all items, we can easily remove the 64kB
limit from OpusReader::ReadString() and instead silently ignore and
skip all strings which are longer than 4 kB.

This fixes a tag duplication bug with Opus file containing a very long
`METADATA_BLOCK_PICTURE` tag, which occurred because the Opus plugin
returned false after parsing all tags, and then the MPD core fell back
to FFmpeg which scanned the tags again.
2019-06-05 22:19:35 +02:00
cathugger
f9ca2f52c1 output/httpd: reject some well-known request paths
Return `404 not found` for some common well-known paths, as clients requesting them usually do that automatically and don't expect endless audio stram.

Closes 
2019-06-05 21:53:46 +02:00
cathugger
4b81cf0c2c output/httpd: use strncmp instead of memcmp
memcmp use may result in out of bounds access
2019-06-05 21:53:46 +02:00
Max Kellermann
e7acbf112c output/httpd: fix indent 2019-06-05 21:53:43 +02:00
Max Kellermann
304d45b551 Revert "player/Thread: remove unnecessary "pipe" check"
This reverts commit ff3e2c0514.  The
check was necessary, after all, because this is what checked whether
the decoder had finished the current or the next song.

> The "queued" flag can only possibly be set if the decoder is still
> decoding the current song or if the decoder is stopped.

That was wrong because ProcessCommand() sets `queued=true` and also
starts the decoder (if it was idle).

> This is also what the following assert() checks.

That was also wrong, because the assert() has two conditions.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/566
2019-05-31 17:23:12 +02:00
Max Kellermann
0f488dcecf doc/protocol.rst: binary responses do have a newline after all
Closes https://github.com/MusicPlayerDaemon/MPD/issues/568
2019-05-31 16:47:41 +02:00
Max Kellermann
17039aec70 doc/user.rst: more heading corrections
According to http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#sections
2019-05-31 16:30:06 +02:00
Max Kellermann
fb6cb07912 doc/developer.rst: remove outdated section about the clang static analyzer 2019-05-31 16:27:43 +02:00
Max Kellermann
e9e0e02db3 doc/user.rst: use ".. note:" 2019-05-31 16:26:52 +02:00
Max Kellermann
03507037e8 increment version number to 0.21.10 2019-05-31 16:16:56 +02:00
Max Kellermann
66a8fac25e release v0.21.9 2019-05-20 17:10:58 +02:00
Max Kellermann
1b902e00b4 doc/protocol.rst: several clarifications
Closes https://github.com/MusicPlayerDaemon/MPD/issues/340
2019-05-20 17:06:20 +02:00
Max Kellermann
923e66738c player/Thread: fix "single" mode race condition
If the decoder finishes decoding the current song between the two
IsIdle() checks, MPD stops playback instead of starting the decoder
for the next song.

This is usually not visible problem, because the main thread restarts
it via playlist::ResumePlayback(), but that way it, ignores "single"
mode.

As a workaround, this commit adds another "queued" check which
re-enters the player loop and checks again whether to start the
decoder.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/556
2019-05-20 16:22:01 +02:00
Max Kellermann
ff3e2c0514 player/Thread: remove unnecessary "pipe" check
The "queued" flag can only possibly be set if the decoder is still
decoding the current song or if the decoder is stopped.  This is also
what the following assert() checks.  This check was not necessary.
2019-05-20 16:20:59 +02:00
Max Kellermann
6922a2f55e input/buffered: check error in IsAvailable() 2019-05-17 12:43:45 +02:00
Max Kellermann
ca5a400dbe input/buffered: rethrow read_error in Check() 2019-05-16 22:08:33 +02:00
Max Kellermann
63fe4d1d17 input/buffered: wake up client thread on seek error 2019-05-16 22:05:25 +02:00
Max Kellermann
ca06d9d3bf input/buffered: fix deadlock bug 2019-05-16 21:11:03 +02:00
Max Kellermann
ed2db04f43 doc/mpd.conf.5: remove ALSA specific documentation
ALSA is just one out of many output plugins, and detailed plugin
documentation should only live in the user manual, without having
duplicates in the (brief) manpage.

Also move "mixer_type" to the "optional audio output parameters"
section; it is a generic option, not specific to ALSA.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/552
2019-05-13 22:51:48 +02:00
Max Kellermann
de0afa0e08 doc/mpd.conf.5: fix section indent 2019-05-13 22:51:45 +02:00
Max Kellermann
f0d3227d7b doc/protocol.rst: add references to audio_output_format 2019-05-13 22:46:23 +02:00
Max Kellermann
fb07a7cecc doc/user.rst: move audio format spec to section "Global Audio Format" 2019-05-13 22:39:49 +02:00
Max Kellermann
c6b08a4d48 doc/user.rst: add reference to audio_output_format 2019-05-13 22:39:44 +02:00
Max Kellermann
040e87ad8d doc/user.rst: more markup 2019-05-13 22:36:19 +02:00
Max Kellermann
d5521ead56 doc/user.rst: add missing space 2019-05-13 22:36:19 +02:00
Max Kellermann
f8468451c9 android/AndroidManifest.xml: increment versionCode after hotfix upload 2019-05-04 13:25:05 +02:00
Max Kellermann
65df6ca14e android/Settings: request READ_EXTERNAL_STORAGE permission
Using this API function requires SDK level 23.
2019-05-04 07:29:41 +02:00
Max Kellermann
36dec47bf7 android/build.py: link ARMv7 binary with libunwind
Fixes nullptr dereference when an exception gets thrown because there
is no ".eh_frame" section for unwinding.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/543
2019-05-03 20:15:50 +02:00
Max Kellermann
478cedcadf increment version number to 0.21.9 2019-05-03 20:15:33 +02:00
Max Kellermann
cabcbb059d release v0.21.8 2019-04-23 14:35:14 +02:00
Max Kellermann
5e21b2db3c doc/protocol.rst: "list file" is deprecated
Closes https://github.com/MusicPlayerDaemon/MPD/issues/526
2019-04-23 14:29:42 +02:00
Max Kellermann
3a0d6d96c1 input/smbclient: wrap in MaybeBufferedInputStream
This enables the input buffer for remote files and caches file
contents in MPD.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/376
2019-04-23 14:08:27 +02:00
Max Kellermann
f39d2d33c0 python/build/libs.py: upgrade Boost to 1.70.0 2019-04-23 14:08:27 +02:00
Max Kellermann
ead3dc6a92 LocateUri: pass URI plugin kind, optionally disables plugin verify
Commit b3a458338a added a LocateUri()
call to several playlist commands, which applied InputPlugin URI
scheme verification to playlist URIs.  This broke the SoundCloud
playlist plugin which uses "soundcloud://" URIs for which no input
plugin exists.

This commit allows the caller to specify the kind of plugin which
shall be used to verify the URI.  Right now, only "input" is
implemented; "storage" uses the "input" verification for now; and
"playlist" has no verification at all (for now).

Closes https://github.com/MusicPlayerDaemon/MPD/issues/528
2019-04-18 10:03:15 +02:00
Max Kellermann
7d814cc899 neighbor/smbclient: fix double smbc_closedir() call
There is already one call in ReadServers(), which is the correct place
to do it.
2019-04-18 09:40:56 +02:00
Max Kellermann
f5b4606c09 .travis.yml: switch to another PPA for a newer ninja version
Fixes Travis failure with Meson 0.50:

 ERROR: Could not detect Ninja v1.5 or newer
2019-04-18 09:40:30 +02:00
Max Kellermann
d6dbf64efb CommandLine: fix another build failure with -Ddatabase=false
Split several printf() calls to make it easier to deal with all those
#ifdefs.
2019-04-18 09:20:12 +02:00
Eugene Gorodinsky
8d18b4c24b Fix meson.build to work properly with '-Ddatabase=false' 2019-04-18 08:55:13 +02:00
Max Kellermann
fe8621906d systemd: add user socket unit
Copy the system socket unit to the "user" directory.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/530
2019-04-10 16:37:13 +02:00
Max Kellermann
b4fcbdb235 systemd/socket: use %t instead of hard-coding /run
This allows using the file as a user unit, where "%t" maps to
"$XDG_RUNTIME_DIR".

Proposed in https://github.com/MusicPlayerDaemon/MPD/issues/530
2019-04-10 16:34:40 +02:00
Max Kellermann
f4b5a28596 doc/protocol: mention that stickers are only implemented for songs
Closes https://github.com/MusicPlayerDaemon/MPD/issues/524
2019-04-10 16:33:17 +02:00
Max Kellermann
6cbd77fc57 doc/protocol.rst: mention "in seconds" where it was missing
Closes https://github.com/MusicPlayerDaemon/MPD/issues/523
2019-04-10 16:30:26 +02:00
cotko
1bc78e9f2c Fid move doc args 2019-04-10 13:16:58 +02:00
Max Kellermann
cb6282e0a7 doc/developer.rst: remove mailing list, refer to GitHub instead 2019-04-10 11:36:03 +02:00
Max Kellermann
f6941f9a44 event/SocketMonitor: don't cancel if OnSocketReady() returns false
Expect OnSocketReady() to cancel events.  If it returns false, the
SocketMonitor may be destructed already.  This fixes a use-after-free
bug in the "httpd" output plugin.
2019-04-04 10:24:58 +02:00
Max Kellermann
d2eb4df8fc event/{Fully,}BufferedSocket: add more API documentation 2019-04-04 10:24:58 +02:00
Max Kellermann
df33a898d7 zeroconf/Bonjour: fix OnSocketReady() return value
Keep the SocketMonitor registered.  This wrong return value was added
6 years ago in commit 72cf8dd8a0, andd
apparently, nobody ever noticed.
2019-04-04 10:24:29 +02:00
Max Kellermann
325c7b8e8b output/httpd: close client connection on error
This missing piece probably never really hurt, because
HttpdClient::OnSocketClosed() would be called right after a socket
error, but it's better to be explicit about closing on error.
2019-04-04 09:39:22 +02:00
Max Kellermann
380656d8c9 output/httpd: add missing mutex lock 2019-04-03 22:53:03 +02:00
Max Kellermann
9111bc2c21 output/httpd: add more API documentation about locking 2019-04-03 22:49:25 +02:00
Max Kellermann
37b54179d8 net/IPv[46]Address: add cast to void* to fix GCC9 build failure
Fixes:

 src/net/IPv4Address.hxx: In member function 'constexpr IPv4Address::operator SocketAddress() const':
 src/net/IPv4Address.hxx:171:24: error: a reinterpret_cast is not a constant expression
   171 |   return SocketAddress((const struct sockaddr *)&address,
       |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 src/net/IPv6Address.hxx: In member function 'constexpr IPv6Address::operator SocketAddress() const':
 src/net/IPv6Address.hxx:138:24: error: a reinterpret_cast is not a constant expression
   138 |   return SocketAddress((const struct sockaddr *)&address,
       |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Closes https://github.com/MusicPlayerDaemon/MPD/issues/522
2019-04-03 16:59:53 +02:00
Max Kellermann
511826763a increment version number to 0.21.8 2019-04-03 12:27:18 +02:00
Max Kellermann
ef10354d06 release v0.21.7 2019-04-03 12:18:29 +02:00
Max Kellermann
158458db5f python/build/libs.py: upgrade libnfs to 4.0.0 2019-04-03 11:37:33 +02:00
Max Kellermann
e183ab5cf8 python/build/libs.py: upgrade CURL to 7.64.1 2019-04-03 11:35:13 +02:00
Max Kellermann
fef839e2a9 python/build/libs.py: upgrade FFmpeg to 4.1.3 2019-04-03 11:34:32 +02:00
Max Kellermann
9776e43bbe android/AndroidManifest.xml: update version number 2019-04-03 11:28:59 +02:00
Max Kellermann
5201147ab1 input/curl: use std::throw_with_nested() instead of logging the exception
Let the caller decide what to do with the original exception.
2019-03-29 17:34:51 +01:00
Max Kellermann
fb7daa0d05 input/smbclient: use std::throw_with_nested() to construct PluginUnavailable
Preserve the original exception.
2019-03-29 17:32:23 +01:00
Max Kellermann
2e9f3d8b9f decoder/HybridDSD: downgrade log message to "debug"
This plugin is interesting only for a tiny fraction of MPD users, so
let's not spam everybody else's log with it.
2019-03-29 17:15:48 +01:00
Max Kellermann
976731ab6c command/playlist: invoke the RemoteTagScanner on all newly added songs
Closes https://github.com/MusicPlayerDaemon/MPD/issues/234
2019-03-29 17:01:31 +01:00
François Revol
0d8942e64a Haiku: remove redundant calls to delete_sem()
Fixes .

Semaphores are kernel-managed objects, calling delete_sem() twice is not more
dangerous than calling close() twice on an fd though, it would just return
an error.
2019-03-29 14:33:49 +01:00
François Revol
37a0f04712 Haiku: add version info to the resources like win32 does 2019-03-29 14:33:27 +01:00
François Revol
cde9348009 Haiku: fix adding resources
The custom_command was run in src/haiku/ and created a file with only resources inside.

Since xres edits the file in-place and meson doesn't like it, we have to run a shell script for now.
Maybe later I'll add proper support in meson.
2019-03-29 14:32:59 +01:00
François Revol
095e6e6ad4 Haiku: meson.build: fix linking (missing libs) 2019-03-29 14:32:19 +01:00
François Revol
9d0bf5e95c Haiku: fix build 2019-03-29 14:32:06 +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
6bab3bcfea test/RunChromaprint: add missing override 2019-03-20 13:30:13 +01:00
Max Kellermann
a854595886 event/ServerSocket: runtime error if abstract sockets are unavailable 2019-03-20 13:09:16 +01:00
Max Kellermann
8fc3c5c612 event/ServerSocket: add HAVE_UN check to AddAbstract()
Closes https://github.com/MusicPlayerDaemon/MPD/issues/510
2019-03-20 13:06:09 +01:00
Max Kellermann
4f408bd952 event/ServerSocket, doc, ...: refer to AF_LOCAL as "local socket"
.. and not "UNIX domain socket.  Be consistent about the naming.
2019-03-20 12:57:26 +01:00
Max Kellermann
7de8fd04a4 doc/plugins.rst: add the Haiku plugin and mark it as unmaintained 2019-03-18 18:24:51 +01:00
Max Kellermann
8158bd218c doc/plugins.rst: add filter plugin reference 2019-03-18 18:05:18 +01:00
Max Kellermann
aa1d867b72 doc/user.rst: document the "filters" setting 2019-03-18 17:05:23 +01:00
Max Kellermann
34c8242133 doc/user.rst: add more links 2019-03-18 17:01:55 +01:00
Max Kellermann
e22bdee808 win32/res/meson.build: drop tilde suffix from version number before splitting
MPD sometimes uses version numbers like "0.22~git" to mark unreleased
versions.  That makes the win32 resource compiler unhappy, because it
expects numbers only.
2019-03-18 09:58:40 +01:00
Jörg Krause
7f87de783f src/lib/gcrypt/meson.build: use dependency() for quering linker flags
Since version 0.49.0 the Meson build system has native support for
finding and using the gcrypt library using the `dependency()` function.

`dependency()` has the advantage over `find_library()` as it queries the
required linker flags for proper linking with external libraries, e.g.
libgpg-error.

As the latest released version 1.8.4 of libgcrypt does not
provide a .pc file, using `libgcrypt-config` is the only way to query
the required linker flags.

Unfortunately, there is an issue when cross compiling mpd and the user does not
define `libgcrypt-config` in the cross file. If the user sets the qobuz feature
to `auto` and the target does not have libgcrypt installed, the Meson
build system will falsly assume libgcrypt is available for the target as
it uses the native `libgcrypt-config` on the host and pretend is has
found the library.

Therefore, we still rely on `find_library()` to workaround this buggy
behavior. This way, if qobuz feature detection is set to `auto`, the
feature is disabled in case there is no target libgcrypt available.

Fixes building mpd statically with the qobuz feature enabled. Otherwise
the build fails with undefined references because of the missing libgpg-error
dependency:

```
/sysroot/usr/lib/libgcrypt.a(libgcrypt_la-visibility.o): In function `gcry_strerror':
visibility.c:(.text+0x14): undefined reference to `gpg_strerror'
```
2019-03-18 09:12:19 +01:00
Jörg Krause
c66389a453 meson.build: require Meson 0.49.0
Meson 0.49.0 adds native support for `libgcrypt-config` which is
necessary for detecting libgcrypt dependencies, as the latest
version 1.8.4 of libgcrypt does not provide a .pc file.
2019-03-18 09:11:46 +01:00
Max Kellermann
b63c1a2144 increment version number to 0.21.7 2019-03-18 09:11:16 +01:00
Max Kellermann
808dd7cc54 release v0.21.6 2019-03-17 23:52:13 +01:00
Max Kellermann
62a129c18f PlaylistFile: ignore empty playlist names
Closes https://github.com/MusicPlayerDaemon/MPD/issues/465 and
https://github.com/MusicPlayerDaemon/MPD/pull/466
2019-03-17 23:46:36 +01:00
Max Kellermann
c18cd941aa lib/xiph: disable Tremor detection if libvorbis was found
And disable libvorbis detection if Tremor was explicitly enabled.

This fixes a crash bug caused by libvorbis/Tremor ABI conflict caused
by commit 4f7d52dbf2
2019-03-17 23:36:52 +01:00
Max Kellermann
6d12c22653 decoder/ogg: ignore the BOS packet after seek to the beginning of song
Previously, MPD would skip the current song after attempting to seek
to its beginnig, because that was a seek to offset 0.  At offset 0,
MPD will see the BOS packet again, which results in throwing
StopDecoder in MPDOpusDecoder::OnOggEnd().

Closes https://github.com/MusicPlayerDaemon/MPD/issues/470
2019-03-17 23:14:59 +01:00
Max Kellermann
b76d78e6ae output/sles: enable power saving mode 2019-03-17 18:04:40 +01:00
Jacob Vosmaer
0a6e484b1a output/plugins/OSXOutputPlugin: add boost meson dependency 2019-03-17 16:59:24 +01:00
Max Kellermann
0bb71f1f20 output/pulse: use pa_channel_map_init_extend() instead of _auto()
Unlike pa_channel_map_init_auto(), pa_channel_map_init_extend() does
not fail if there is no valid mapping for the given channel count, but
instead maps additional "AUX" channels.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/493
2019-03-16 14:03:10 +01:00
Max Kellermann
1aa7cdd602 decoder/opus: fix replay gain when there are no other tags
The `tag_builder.empty()` check was wrong for the SubmitReplayGain()
call.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/497
2019-03-16 13:55:19 +01:00
Max Kellermann
a4b8a0d801 doc/protocol.rst: clarify filter expressions with multiple tag values
Clarification for https://github.com/MusicPlayerDaemon/MPD/issues/505
2019-03-16 13:23:44 +01:00
Max Kellermann
3bf521d5ca song/TagSongFilter: apply negation properly to multiple tag values
The old implementation didn't make a lot of sense; the "!=" operator
was not actually the opposite of "==".

Closes https://github.com/MusicPlayerDaemon/MPD/issues/505
2019-03-16 13:23:02 +01:00
Max Kellermann
0acb55cde5 song/StringFilter: remove obsolete #if 2019-03-16 13:23:02 +01:00
Max Kellermann
6b89fd6100 song/StringFilter: make MatchWithoutNegation() public 2019-03-16 13:23:02 +01:00
Max Kellermann
52ce39dc3e test/TestSongFilter: unit test for song filters
A few of those tests fail due to bugs.
2019-03-16 13:23:02 +01:00
Max Kellermann
7a3e15d8e5 test/meson.build: add section for filter tests 2019-03-16 13:23:02 +01:00
Max Kellermann
cf66a60c60 test/MakeTag: add noexcept 2019-03-16 13:23:02 +01:00
Max Kellermann
9b26d451e4 test/MakeTag: remove static 2019-03-16 13:23:02 +01:00
Max Kellermann
137ffba1b4 test/test_translate_song: move MakeTag() to header 2019-03-16 13:23:02 +01:00
Max Kellermann
5c5dc1b7c0 meson.build: increase protocol version to 0.21.6
There is a minor new feature (commit 713c1f2ba9) and clients might be
interested in detecting it by the protocol version.
2019-03-16 13:23:02 +01:00
Max Kellermann
9e9418294a song/TagSongFilter: eliminate Match(TagItem) 2019-03-15 20:28:27 +01:00
Max Kellermann
b850eb74b7 song/TagSongFilter: add code comments 2019-03-15 19:54:29 +01:00
Max Kellermann
67d73a2aee song/TagSongFilter: improve lambda indent 2019-03-15 19:54:16 +01:00
Max Kellermann
fde9a470dd song/TagSongFilter: eliminate the std::fill_n() call 2019-03-15 19:35:58 +01:00
Max Kellermann
8d1f30e55b tag/Fallback: add API documentation 2019-03-15 19:23:10 +01:00
Max Kellermann
ddd2b60489 doc/protocol.rst: add missing operators to example expressions 2019-03-15 19:14:06 +01:00
Max Kellermann
8777737861 doc/protocol.rst: use double backticks for tag names 2019-03-15 19:11:30 +01:00
Max Kellermann
cb71f6dd04 doc/protocol.rst: clarify the meaning of the any tag type 2019-03-15 19:09:55 +01:00
Max Kellermann
1881b0e975 song/TagSongFilter: rename MatchNN() to Match()
The "NN" suffix used to mean "no negation", but that's not how it's
implemented today.
2019-03-15 19:06:56 +01:00
Max Kellermann
98b29f6d1c meson.build: remove the libwinpthread-1.dll dependency on Windows
Closes https://github.com/MusicPlayerDaemon/MPD/issues/507
2019-03-14 20:07:06 +01:00
Max Kellermann
59fdfd25cb command/database: fix "list" with filter expression
Disable the 0.11 compatibility mode if the only argument is a filter
expression.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/506
2019-03-14 19:50:09 +01:00
Max Kellermann
0d98677212 playlist/flac: copy the URI to fix use-after-free bug
Closes https://github.com/MusicPlayerDaemon/MPD/issues/508
2019-03-14 19:30:33 +01:00
Max Kellermann
38f0c16904 system/UniqueFileDescriptor: add CreatePipeNonBlock() 2019-02-27 23:30:56 +01:00
Max Kellermann
4fbf6b6c95 net/StaticSocketAddress: remove GetAddress() 2019-02-27 23:26:59 +01:00
Max Kellermann
1f8ff48168 net/StaticSocketAddress: add GetLocalRaw() 2019-02-27 23:26:00 +01:00
Max Kellermann
20b6e0d684 net/SocketDescriptor: add SetTcpUserTimeout() 2019-02-27 23:22:12 +01:00
Max Kellermann
713c1f2ba9 Merge branch 'feature/playlist' of git://github.com/miccoli/MPD 2019-02-27 13:49:22 +01:00
Stefano Miccoli
a149bc4c5d update protocol documentation for new semantics of playlist abs. name 2019-02-26 00:12:09 +01:00
Stefano Miccoli
b3a458338a allow loading playlists specified as absolute filesystem paths
implement for the "load" command the same logic used for the "add"
command: local clients can load playlist specified as absolute paths.

For relative paths the old logic is preserved: first look for a stored
playlist, then look in the music directory.
2019-02-26 00:12:09 +01:00
Max Kellermann
44422b2b2f event/ServerSocket, config/Net: abstract socket support 2019-02-25 13:08:33 +01:00
Max Kellermann
f10afd38b5 NEWS: mention the cdio_paranoia build failure fix 2019-02-25 13:08:33 +01:00
Thomas Zander
4c50a5e0b3 Ensure SEEK_SET is set on systems where stdio.h is not pulled in by accident. 2019-02-23 18:04:00 +01:00
Max Kellermann
f255a485b7 increment version number to 0.21.6 2019-02-22 15:28:03 +01:00
Max Kellermann
1930d5774d release v0.21.5 2019-02-22 15:23:33 +01:00
Max Kellermann
7220a76be0 doc/plugins.rst: document udisks2/policykit rule 2019-02-22 15:22:20 +01:00
Max Kellermann
83f7610dd1 storage/udisks2: move empty string check out of the fallback block in MapUTF8()
Even if the LocalStorage is available, return the "udisks://" URI when
the MapUTF8() parameter is an empty string.  This fixes the mount URI
in the state file.
2019-02-22 15:07:40 +01:00
Max Kellermann
30e0644722 db/simple: call ReturnSong() on mounted database
Fixes a memory leak, or an assertion failure in the debug build.
2019-02-22 14:52:13 +01:00
Max Kellermann
3ada464020 db/simple: use C++11 initializer 2019-02-22 14:52:01 +01:00
Max Kellermann
d5983dd362 storage/udisks2: use the relative path
Closes 
2019-02-22 14:41:56 +01:00
Max Kellermann
98258acc37 storage/udisks2: pass Path to SetMountPoint() 2019-02-22 14:41:56 +01:00
Max Kellermann
8002bc752f NEWS: mention the udisks2 AlreadyMounted fix 2019-02-22 14:41:56 +01:00
Max Kellermann
834ad7a58f TagPrint: omit tags which were disabled by the client
Closes 
2019-02-22 13:05:38 +01:00
Max Kellermann
e8f2f98048 tag/Mask: fix another typo, this time in operator^=
Similar to commit ff1ff1e54a
2019-02-22 12:44:36 +01:00
Max Kellermann
c672b60d07 build/pkg-config.sh: add comment 2019-02-22 12:39:59 +01:00
Max Kellermann
ea269c9c92 python/build/libs.py: upgrade CURL to 7.64.0 2019-02-22 12:10:06 +01:00
Max Kellermann
1fe3a77640 python/build/libs.py: upgrade FFmpeg to 4.1.1 2019-02-22 12:09:35 +01:00
Max Kellermann
bbaeea1ab7 storage/udisks2: use existing mount point if already mounted
Fixes the "org.freedesktop.UDisks2.Error.AlreadyMounted" error.

Closes 
2019-02-21 13:32:03 +01:00
Max Kellermann
0a3aee9d82 storage/udisks2: move code to SetMountPoint() 2019-02-21 13:31:59 +01:00
Max Kellermann
2434020971 storage/udisks2: adjust lambda indent 2019-02-21 13:31:57 +01:00
Max Kellermann
41e0eb7378 lib/dbus/udisks2: parse the MountPoints property 2019-02-21 13:28:26 +01:00
Max Kellermann
6adf964c81 lib/dbus/ReadIter: add dbus_message_iter_get_fixed_array() wrapper 2019-02-21 12:56:05 +01:00
Max Kellermann
b59f37bc0a db/simple/Directory: close the Database in destructor
Fixes assertion failure.
2019-02-20 22:50:15 +01:00
Max Kellermann
cf2d171ccc db/simple: reorder checks in assert() to fix assertion failure
`light_song.Get()` could cause an assertion failure because the
`Manual<>` object must not be used if uninitialized.

Regression by commit ebc006ab52
2019-02-20 21:24:01 +01:00
Max Kellermann
cc28a7b67f Main: create Database on stack, move to Instance after Open() succeeded
This fixes use-after-free bug in SimpleDatabase::Close(), accessing
the `root` object which was already freed by the `catch` block in
Open().

By having the Database on the stack first, we can avoid calling
Close() on the failed-to-open Database from Instance's destructor.

Closes 
2019-02-20 20:50:28 +01:00
Max Kellermann
8b5c33cecd Instance: use std::unique_ptr<> to manage the Database pointer 2019-02-20 20:48:20 +01:00
Max Kellermann
6c28adbcd2 db/Plugin: use std::unique_ptr<> to manage Database pointers 2019-02-20 20:43:31 +01:00
Max Kellermann
2125e3ed57 db/simple/Directory: add noexcept 2019-02-20 20:39:49 +01:00
Max Kellermann
3da7ecfadf mixer/pulse: add missing ParseFloat() check 2019-02-20 19:27:13 +01:00
Max Kellermann
5bb02bbd39 mixer/pulse: move volume_scale_factor up to improve struct packing 2019-02-20 19:25:55 +01:00
Max Kellermann
f11aa09f7c mixer/pulse: add const to volume_scale_factor 2019-02-20 19:25:53 +01:00
Max Kellermann
02eb4752d3 mixer/pulse: use C++11 initializer 2019-02-20 19:25:45 +01:00
Max Kellermann
d9c3215584 mixer/pulse: rename scale to scale_volume
Make it less generic, to avoid clashes.
2019-02-20 19:23:11 +01:00
Clément Pit-Claudel
110e6d026b mixer/pulse: Add a new 'scale' parameter to allow volumes above 100
Closes GH-479.
2019-02-17 16:14:52 -05:00
Max Kellermann
c0f57b8a8b net/IPv[46]Address: update copyright 2019-02-19 13:00:45 +01:00
Max Kellermann
57633fbcb3 net/AllocatedSocketAddress: add methods IsV6Any(), IsV4Mapped() 2019-02-19 12:51:24 +01:00
Max Kellermann
864c87e6c0 net/SocketAddress: add method GetLocalPath() 2019-02-19 12:50:40 +01:00
Max Kellermann
1a516cf3c0 net/AllocatedSocketAddress: add method GetLocalRaw() 2019-02-19 12:43:16 +01:00
Max Kellermann
5c25499c5e lib/cdio/Paranoia: add method GetDiscSectorRange() 2019-02-19 12:40:36 +01:00
Max Kellermann
da4bb4c298 fs/io/OutputStream: update include guard 2019-02-19 12:39:29 +01:00
Max Kellermann
5b8ff61799 fs/io/BufferedOutputStream: add WithBufferedOutputStream() 2019-02-19 12:37:53 +01:00
Max Kellermann
56bded07b1 system/UniqueFileDescriptor: import std::swap 2019-02-19 12:36:54 +01:00
Max Kellermann
db144a43ad system/Open: add OpenWriteOnly(), OpenDirectory() 2019-02-19 12:16:41 +01:00
Max Kellermann
5965f62b56 system/EpollFD: include cleanup 2019-02-19 11:51:52 +01:00
Max Kellermann
05aa9f72a9 util/StringView: add SkipPrefix(), RemoveSuffix() 2019-02-19 11:51:32 +01:00
Max Kellermann
281461f0f0 nfs: work around assertion failure on exception during program init
Closes 
2019-02-15 18:33:58 +01:00
Max Kellermann
f70eb63879 Instance: eliminate FinishShutdownUpdate(), move code to destructor 2019-02-15 18:20:11 +01:00
Max Kellermann
99c23cf139 Instance: eliminate ShutdownDatabase(), move code to destructor
Destruct automatically, even if leaving the scope due to exception
being thrown.
2019-02-15 18:04:23 +01:00
Max Kellermann
9aa75e738c Merge branch 'protocol-doc-typo' of git://github.com/mxjeff/MPD 2019-02-15 18:03:49 +01:00
Max Kellermann
e9c45a9140 playlist/Registry: add RAII class 2019-02-05 23:03:29 +01:00
Max Kellermann
a065c6e6b9 Main: use AtScopeExit() to call DeinitFS() 2019-02-05 23:02:50 +01:00
Max Kellermann
feb5ff9bd2 Mapper: remove empty function mapper_finish() 2019-02-05 23:01:09 +01:00
Max Kellermann
92ec3f0881 valgrind.suppressions: add GObject/libgcrypt/libsmbclient suppressions 2019-02-05 22:53:02 +01:00
Max Kellermann
98c47d9d36 Instance: remove FinishShutdownPartitions()
The list of partitions is cleared automatically.
2019-02-05 22:53:02 +01:00
Max Kellermann
6c67408944 event/Loop: add flag alive
This replaces the old `dead` flag which was unreliable; it was `false`
if the EventThread was not yet started, which could cause deadlocks in
BlockingCall().
2019-02-05 22:38:45 +01:00
Max Kellermann
261a816b21 command/AllCommands: remove empty function command_finish() 2019-02-05 22:15:41 +01:00
Max Kellermann
7a23c123c8 decoder/List: add RAII class 2019-02-05 22:12:22 +01:00
Max Kellermann
e85b24bee0 decoder/List: add noexcept 2019-02-05 22:11:51 +01:00
Max Kellermann
9e73ea77b4 input/Init: add RAII class 2019-02-05 22:07:49 +01:00
Max Kellermann
b0739eca87 test/ConfigGlue: merge duplicate code from various debug programs 2019-02-05 21:56:20 +01:00
Max Kellermann
848f6aa5ab Main: stop io_thread and rtio_thread automatically
They will be stopped by ~EventThread() when the `Instance` is deleted.
2019-02-05 21:49:59 +01:00
Max Kellermann
c9ba4f3f9c archive/List: add RAII class 2019-02-05 21:40:07 +01:00
Max Kellermann
c0e9246a66 archive/List: add noexcept 2019-02-05 21:38:46 +01:00
Max Kellermann
096c23f27d unix/SignalHandlers: add RAII class 2019-02-05 21:36:51 +01:00
Max Kellermann
40bde1eac9 unix/SignalHandlers: add noexcept 2019-02-05 21:36:35 +01:00
Max Kellermann
4b55ed17a9 LogInit: add noexcept 2019-02-05 21:36:35 +01:00
kaliko
4f757a5add Fixed protocol documentation
* "lsinfo" argument is optional
 * "tagtypes disable" arguments are mandatory (typo)
2019-02-03 10:38:34 +01:00
Max Kellermann
674c137e5f NEWS: mention the TagMask typo fix 2019-02-02 15:17:25 +01:00
kaliko
ff1ff1e54a Fixed typo in TagMask 2019-02-02 15:14:31 +01:00
Yue Wang
42b22187c8 [OSXOutput] Throw an error when device not found
Currently it falls back to system default device (either internal speaker or headphone) when device not found. 
I believe it is a better to fail in this case, to make it better aligned with platforms (such as alsa).
2019-01-25 19:50:27 -08:00
Max Kellermann
cfe22502ab fs/io/StdioOutputStream: add noexcept 2019-01-22 09:03:49 +01:00
Max Kellermann
d77b0c7dcd net/SocketAddress: add constexpr 2019-01-22 08:42:35 +01:00
Max Kellermann
5cf889b676 util/WStringView: add missing include 2019-01-22 08:38:03 +01:00
Max Kellermann
ffc36d5255 input/buffered: implement seeking to end of file
Previously, a seek to the end of the file would cause an assertion
failure in SparseMap::Check() because the given offset was invalid.

Closes 
2019-01-22 07:42:00 +01:00
Max Kellermann
0126276e2f FileCommands: log irregular errors while looking for cover art 2019-01-21 22:21:11 +01:00
Max Kellermann
58d6ddab9e FileCommands: catch all exceptions 2019-01-21 22:19:32 +01:00
Max Kellermann
05db6934eb FileCommands: fix deadlock in "albumart" command
Must lock the mutex before calling any of the unprotected InputStream methods.

Closes 
2019-01-21 22:16:46 +01:00
Max Kellermann
02c68c5cdb net/HostParser: add noexcept 2019-01-21 21:20:43 +01:00
Max Kellermann
b02fee7309 util/PrintException: support "const char *" 2019-01-21 21:19:35 +01:00
Max Kellermann
424f75c9e1 util/OffsetPointer: remove redundant inline keywords from constexpr functions 2019-01-21 21:19:09 +01:00
Max Kellermann
f6e1176f97 util/CharUtil: remove redundant inline keywords from constexpr functions 2019-01-21 21:18:23 +01:00
Max Kellermann
e4700c0a27 util/Cast: remove redundant inline keywords from constexpr functions 2019-01-21 21:17:58 +01:00
Max Kellermann
cf23fd8774 fs/io/FileOutputStream: add constructor with directory fd 2019-01-21 21:10:02 +01:00
Max Kellermann
dee8872395 fs/io/FileOutputStream: move code to Open() 2019-01-21 21:09:34 +01:00
Max Kellermann
4ba9357a9c input/CdioParanoia: C++ wrappers for libcdio types 2019-01-21 20:20:20 +01:00
Max Kellermann
48ec09ab1e test/net/TestIPv4Address: make literal unsigned to work around -Wsign-compare 2019-01-21 14:39:24 +01:00
Max Kellermann
754f4048a8 output/shout: evaluate tls option only if TLS is enabled in libshout
Fixes build failure after commit
0cea67ee70
2019-01-21 14:36:43 +01:00
Max Kellermann
037bb07d08 db/VHelper: include DetachedSong.hxx to fix GCC 9 build failure
GCC 9's libstdc++ is unable to use forward-declared types as
std::vector item because the compiler wants to resolve `noexcept()` on
the item destructor.
2019-01-21 14:34:12 +01:00
Max Kellermann
87635c5268 input/CdioParanoia: use the new function names 2019-01-21 14:18:55 +01:00
Max Kellermann
528b4338f4 input/CdioParanoia: use cdio_cddap_free_messages() on recent library versions 2019-01-21 14:16:51 +01:00
Max Kellermann
c780b8bba9 input/CdioParanoia: remove useless cdda_messages() call 2019-01-21 12:36:59 +01:00
Max Kellermann
ca34f3250b input/CdioParanoia: detect libcdio version at compile time
libcdio_paranoia was split from libcdio in version 90, and at the same
time, the header was moved from cdio/paranoia.h to
cdio/paranoia/paranoia.h.  We can easily detect this version at
compile time which is faster than configure time.
2019-01-21 12:14:13 +01:00
Max Kellermann
6a68e1c3f3 test/net/TestIPv6Address: work around failure on macOS 2019-01-21 12:13:52 +01:00
Max Kellermann
85f77ec81d test/net/TestLocalSocketAddress: can't use strcmp() if the string isn't null-terminated. 2019-01-21 12:12:36 +01:00
Max Kellermann
37debed0b8 python/build/libs.py: upgrade Boost to 1.69.0 2019-01-21 10:19:46 +01:00
Max Kellermann
008383f24a python/build/libs.py: upgrade CURL to 7.63.0 2019-01-21 10:11:50 +01:00
Jörg Krause
4f7d52dbf2 meson: add fixed-point Vorbis (Tremor) decoder support
Re-add build support for the fixed-point Vorbis (Tremor) decoder, which
was dropped when switching from Autotools to Meson.

Note, that it is not possible to build both, the Vorbis and the Tremor
decoder.

Closes: 
2019-01-21 08:35:17 +01:00
Max Kellermann
c7848da8f2 input/CdioParanoia: add const to pointer 2019-01-20 22:03:49 +01:00
Max Kellermann
10a6c5c57d input/CdioParanoia: make variables more local 2019-01-20 21:59:57 +01:00
Max Kellermann
2cc2bab309 test/net: new unit tests 2019-01-20 21:05:21 +01:00
Max Kellermann
701fd1d939 net/IPv4Address: fix comment typo 2019-01-20 21:05:12 +01:00
Max Kellermann
d1bdea8edb Merge branch 'shout_tls' of git://github.com/JakobOvrum/MPD 2019-01-20 21:03:42 +01:00
Jakob Ovrum
0cea67ee70 shout output plugin: add support for TLS 2019-01-19 17:36:14 +01:00
Thomas Klausner
3a0480a482 Add missing include of stdlib.h.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/456
2019-01-15 16:52:40 +01:00
Max Kellermann
1fa99da3c2 net/IPv[46]Address: make the initializers even more portable
Similar to 5a5229b499: use more C++14
constexpr.
2019-01-14 19:21:07 +01:00
James D. Smith
22d669da18 Add APE mapping for album artist.
"De-facto" field mappings are available at http://wiki.hydrogenaud.io/index.php?title=Tag_Mapping.
2019-01-14 19:15:42 +01:00
Thomas Zander
772681f23d Fix link_args for mDNSResponder on non-darwin platforms 2019-01-13 14:09:14 +01:00
Max Kellermann
1862a98a44 increment version number to 0.21.5 2019-01-04 19:31:07 +01:00
Max Kellermann
4634b94c83 release v0.21.4 2019-01-04 19:22:21 +01:00
Max Kellermann
6e04a327b4 android/AndroidManifest.xml: increment version number to 0.21.4 2019-01-04 19:22:14 +01:00
Max Kellermann
7ec887eea2 Merge branch 'add-meson-dependencies' of git://github.com/jacobvosmaer/MPD 2019-01-04 19:06:49 +01:00
Max Kellermann
1477b64d4f Merge branch 'patch-2' of git://github.com/HyShai/MPD
Closes 
2019-01-04 19:04:52 +01:00
Max Kellermann
a2c108f5ef NEWS: mention the Haiku build fix 2019-01-04 19:03:53 +01:00
Zoltán Mizsei
f546e76490 Build fix. This struct is the same on Haiku and on Linux, still gcc
fails on it. This fixes.
2019-01-04 19:01:27 +01:00
Zoltán Mizsei
2568bc3957 Haiku is "haiku". 2019-01-04 18:59:49 +01:00
Max Kellermann
7104ac963b util/AllocatedArray: import std::swap 2018-12-28 17:18:41 +01:00
Max Kellermann
2cb36590b2 util/AllocatedArray: add noexcept 2018-12-28 17:17:28 +01:00
Max Kellermann
af7b928d7c output/httpd/Page: remove obsolete API documentation 2018-12-28 17:16:12 +01:00
Max Kellermann
c0d8a9b07a output/httpd/Page: add noexcept 2018-12-28 17:15:28 +01:00
Max Kellermann
5b0d23d553 output/httpd/IcyMetaDataServer: add noexcept 2018-12-28 17:14:27 +01:00
Max Kellermann
ab30695bd1 output/httpd: add noexcept 2018-12-28 17:06:01 +01:00
Max Kellermann
53a4de35c4 util/DynamicFifoBuffer: add noexcept 2018-12-28 17:06:01 +01:00
Max Kellermann
22e6d95c4b remove libwrap support
libwrap is an obscure artefact from a past long ago, when source IP
address meant something.

And its API is "interesting"; it requires the application to expose
two global variables `allow_severity` and `deny_severity`.  This led
to bug .  I don't want to declare those variables; instead, I'd
like to remove libwrap support.

Closes 
2018-12-28 14:16:02 +01:00
Max Kellermann
1c7bd7d5c4 db/update/InotifyQueue: check for ACK_ERROR_UPDATE_ALREADY
Since commit cc64c715a2, UpdateService::Enqueue() throws
ProtocolError(ACK_ERROR_UPDATE_ALREADY) instead of returning 0.
2018-12-28 14:02:41 +01:00
Max Kellermann
3c4ed9cbe3 db/update/InotifyQueue: catch UpdateService::Enqueue() exceptions 2018-12-28 14:00:58 +01:00
Max Kellermann
2677b90244 db/update/InotifyQueue: add noexcept 2018-12-28 14:00:55 +01:00
Max Kellermann
1b20fa441d db/update/InotifyQueue: update code comment 2018-12-28 14:00:10 +01:00
HyShai
18c042d4cf remove non-block call
This is similar to b177bffa6a, in that it fixes the Windows issue of connecting to the open socket. Also, the listen_socket is set to AcceptNonBlock after the connection anyways.
2018-12-18 15:23:40 -05:00
Max Kellermann
98f92d828a NEWS: mention the "ICY" -> "HTTP/1.1" change 2018-12-14 09:26:59 +01:00
HyShai
76268773b5 change HTTP Version to a valid version 2018-12-14 01:51:54 -05:00
Jacob Vosmaer
87542e3080 Add missing pcre_dep in src/song/meson.build 2018-12-09 17:21:38 +01:00
Jacob Vosmaer
66f5b0fed7 Add boost_dep in subdir meson.build files 2018-12-09 17:20:47 +01:00
Max Kellermann
5cb603983e alsa/NonBlock: throw on snd_pcm_poll_descriptors_revents() error
This function is sparsely documented and a look at the bluez-alsa
source code shows that implementations make undocumented assumptions
on the `struct pollfd` array parameter which can lead to strange
effects.
2018-12-04 18:00:52 +01:00
Max Kellermann
9c5790ab1d doc/user.rst: more markup 2018-11-20 22:06:42 +01:00
Max Kellermann
4b7078297d db/upnp: use the generic ::CollectUniqueTags() function
This function implements the "group" feature on top of the
Database::Visit() method.
2018-11-19 20:08:10 +01:00
Max Kellermann
841694ccf2 db/Interface: document CollectUniqueTags() 2018-11-19 19:40:00 +01:00
Max Kellermann
12f4a8255a Main: use DatabasePlugin::RequireStorage() 2018-11-19 19:39:37 +01:00
Max Kellermann
bda77ffc5b db/Interface: remove IsPlugin(), use dynamic_cast instead 2018-11-19 19:38:20 +01:00
Max Kellermann
ed9ece5ea3 db/Interface: make the constructor protected 2018-11-19 19:38:20 +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
2e450bbf95 src/thread/meson.build: detect pthread_setname_np()
This compile-time check got lost during the Meson transition.
2018-11-19 16:33:14 +01:00
Max Kellermann
303b3071e4 db/UniqueTags: remove pure attribute because function may throw 2018-11-19 11:32:53 +01:00
Max Kellermann
eb6d5f34fc db/UniqueTags: include cleanup 2018-11-19 11:11:45 +01:00
Max Kellermann
f80126959d meson.build: increment PROTOCOL_VERSION to 0.21.4
This version should have been incremented in 0.21.2 because this
version added new search operators.  In 0.21.4, we'll have more
protocol bug fixes which may be important for clients to know.
2018-11-19 11:11:45 +01:00
Max Kellermann
4fb4f6d1b7 increment version number to 0.21.4 2018-11-19 09:58:05 +01:00
Max Kellermann
43df4a7500 release v0.21.3 2018-11-16 13:27:58 +01:00
Max Kellermann
4cdcaa8630 output/alsa: don't call snd_pcm_drain() if nothing was written
Works around a problem where MPD goes into a busy loop because
snd_pcm_drain() always returns `-EAGAIN` without making any progress
(fixes ).

This problem was triggered by snd_pcm_drain() after snd_pcm_cancel()
and snd_pcm_prepare(), but without submitting any data with
snd_pcm_writei().

I believe this is a kernel bug: in non-blocking mode, the kernel's
snd_pcm_drain() function returns early.  In this mode, it only checks
whether snd_pcm_drain_done() has been called already, but
snd_pcm_drain_done() is never called if no data was submitted.

In blocking mode, the following `for` loop detects this condition, so
snd_pcm_drain_done() is not necessary, but without this extra check,
we get `-EAGAIN` forever.
2018-11-16 12:49:37 +01:00
Volodymyr Medvid
04f632296f test/meson.build: run_storage depends on event lib
test/run_storage.cxx depends on EventThread/EventLoop from libevent.a.
Depend on it explicitly. This addresses build failure with
-Dtest=true -Dcurl=disabled -Ddbus=disabled
2018-11-15 19:01:43 +02:00
Max Kellermann
7c8dbcfaac doc/protocol.rst: song position is 0-based 2018-11-15 12:34:23 +01:00
Max Kellermann
436ba3c96c output/alsa: drain the whole ring_buffer, not just one period
This fixes a problem which caused a failure with snd_pcm_writei()
because snd_pcm_drain() had already been called in the previous
iteration.  This commit makes sure that snd_pcm_drain() is only called
after the final snd_pcm_writei() call.

This fixes discarded samples at the end of playback.
2018-11-14 13:35:17 +01:00
Max Kellermann
5d12f52873 output/alsa: clear error after reopening device
When a playback error has occurred, MPD would never recover until one
restarts MPD.
2018-11-14 13:20:54 +01:00
Max Kellermann
a8bf8ede01 event/Thread: reduce the RTIO timer slack to 10us
MPD's default is 100ms, which is too long for the real-time I/O
thread.  The OutputThread has 100us, but the real-time I/O thread
might have tighter deadlines.

This change has currently no effect (I believe), because nobody uses
timers on the RTIO thread.
2018-11-14 12:11:57 +01:00
Max Kellermann
8682183bc3 LogInit: default to journal if MPD was started as systemd service 2018-11-14 12:07:22 +01:00
Max Kellermann
94c31d0da9 doc/mpdconf.example: no, logging is not disabled without log_file 2018-11-14 12:07:22 +01:00
Max Kellermann
464a4cbeec python/build/libs.py: upgrade FFmpeg to 4.1 2018-11-14 11:50:51 +01:00
Max Kellermann
9f0cbf418a python/build/libs.py: upgrade CURL to 7.62.0 2018-11-14 11:50:51 +01:00
Max Kellermann
b477f86c92 output/alsa: don't lock the mutex in CancelInternal()
CancelInternal() doesn't need to be protected because it is called
synchronously from Cancel().
2018-11-14 11:50:51 +01:00
Max Kellermann
020371f145 output/alsa: wake up the client thread after generating silence
Fixes a theoretical race condition which could occur in Drain() (but
was extremely unlikely).
2018-11-14 11:48:55 +01:00
Max Kellermann
ccafe3f3cf output/alsa: don't generate silence if ALSA-PCM buffer has enough data
If our `ring_buffer` is smaller than the ALSA-PCM buffer (if the
latter has more than the 4 periods we allocate), it can happen that
the start threshold is crossed and ALSA switches to
`SND_PCM_STATE_RUNNING`, but the `ring_buffer` is empty.  In this
case, MPDD will generate silence, even though the ALSA-PCM buffer has
enough data.  This causes stuttering ().

This commit amends an older workaround for a similar problem (commit
e08598e7e2) by adding a snd_pcm_avail()
check, and only generate silence if there is less than one period of
data in the ALSA-PCM buffer.

Fixes 
2018-11-14 11:17:59 +01:00
Max Kellermann
3830748de5 output/alsa: clear the period_buffer in LockCaughtError()
The method Cancel() assumes that the `period_buffer` must be empty
when `active==false`, but that is not the case when Play() fails.

Of course the assertion in Cancel() is not 100% correct, but I decided
to rather fix this in LockCaughtError() because the `period_buffer`
should only be accessed from within the RTIO thread, and this is the
only code path where `active` can be set to `false` with a non-empty
`period_buffer`.

Fixes 
2018-11-14 10:24:08 +01:00
Max Kellermann
1a43f5145d output/alsa: throw on snd_pcm_writei() error while draining
This implements real error handling, and avoids calling
CancelInternal() from this code path.
2018-11-14 10:08:29 +01:00
Max Kellermann
7f143a83c1 output/alsa: fix wrong use of errno
alsa-lib doesn't set errno, it returns errors as negative integers.
2018-11-14 10:07:23 +01:00
Max Kellermann
6ccc254179 output/alsa: throw after snd_pcm_drain() error 2018-11-14 10:04:10 +01:00
Max Kellermann
7db2450447 output/alsa: refactor the drain EAGAIN workaround 2018-11-14 10:00:50 +01:00
Max Kellermann
6c2a6a65e0 output/alsa: remove snd_pcm_state() check from DrainInternal()
This check was added 9 years ago in commit
4dc25d3908 to work around a dmix bug
which I assume has been fixed long ago.

Removing this fixes another corner case: if draining is requested
before the start threshold is reached, the PCM is still in
SND_PCM_STATE_PREPARED but not yet SND_PCM_STATE_RUNNING, which means
the submitted data will never be played.  This corner case is
realistic when playing songs shorter than the ALSA buffer (if the
buffer is very large).
2018-11-14 09:48:24 +01:00
Max Kellermann
4247a757b3 output/alsa: call snd_pcm_prepare() if draining is requested early
This fixes a corner case which has probably never occurred and
probably never will: if Cancel() is called, and then Play() followed
by Drain(), the plugin should really play that data.  However
currently, this never happens, because snd_pcm_prepare() is never
called.
2018-11-14 09:43:14 +01:00
Max Kellermann
57e34823d8 increment version number to 0.21.3 2018-11-12 13:59:17 +01:00
974 changed files with 8674 additions and 4485 deletions
.gitignore.travis.ymlNEWS
android
build
doc
meson.buildmeson_options.txt
python/build
scripts
src
AudioFormat.hxxAudioParser.cxxCheckAudioFormat.cxxCommandLine.cxxIcyMetaDataParser.cxxIdle.cxxIdleFlags.cxxInstance.cxxInstance.hxxLocateUri.cxxLocateUri.hxxLog.cxxLog.hxxLogBackend.cxxLogBackend.hxxLogInit.cxxLogInit.hxxLogV.hxxMain.cxxMapper.cxxMapper.hxxMixRampInfo.hxxMusicBuffer.cxxMusicChunk.cxxMusicChunk.hxxMusicChunkPtr.cxxMusicChunkPtr.hxxMusicPipe.cxxPartition.hxxPermission.cxxPermission.hxxPlaylistDatabase.cxxPlaylistDatabase.hxxPlaylistError.cxxPlaylistFile.cxxPlaylistPrint.cxxPluginUnavailable.hxxRemoteTagCache.cxxRemoteTagCache.hxxReplayGainConfig.hxxReplayGainGlobal.cxxReplayGainGlobal.hxxReplayGainInfo.cxxReplayGainInfo.hxxSongLoader.cxxSongLoader.hxxSongPrint.cxxSongSave.cxxSongUpdate.cxxStateFile.cxxStateFile.hxxStateFileConfig.cxxStateFileConfig.hxxStats.cxxTagArchive.cxxTagArchive.hxxTagFile.cxxTagFile.hxxTagPrint.cxxTagSave.cxxTagStream.cxxTagStream.hxxTimePrint.cxx
android
apple
archive
client
command
config
db
decoder
encoder
event
filter
fs
haiku
input
java
lib
mixer
neighbor
net
output
pcm
player
playlist
protocol
queue
song
sticker
storage
system
tag
thread
time
unix
util
win32
zeroconf
systemd
test
valgrind.suppressions
win32

3
.gitignore vendored

@@ -6,3 +6,6 @@
/output/
__pycache__/
/.clangd/
/compile_commands.json

@@ -1,7 +1,73 @@
language: cpp
matrix:
jobs:
include:
# Ubuntu Bionic (18.04) with GCC 7
- os: linux
dist: bionic
addons:
apt:
sources:
- sourceline: 'ppa:deadsnakes/ppa' # for Python 3.7 (required by Meson)
packages:
- libgtest-dev
- libboost-dev
- python3.6
- python3-urllib3
- ninja-build
before_install:
- wget https://bootstrap.pypa.io/get-pip.py
- /usr/bin/python3.6 get-pip.py --user --no-cache-dir
install:
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson --no-cache-dir
env:
- MATRIX_EVAL="export PATH=\$HOME/.local/bin:\$PATH"
# Ubuntu Bionic (18.04) with GCC 7 on big-endian
- os: linux
arch: s390x
dist: bionic
addons:
apt:
sources:
- sourceline: 'ppa:deadsnakes/ppa' # for Python 3.7 (required by Meson)
packages:
- libgtest-dev
- libboost-dev
- python3.6
- python3-urllib3
- ninja-build
before_install:
- wget https://bootstrap.pypa.io/get-pip.py
- /usr/bin/python3.6 get-pip.py --user --no-cache-dir
install:
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson --no-cache-dir
env:
- MATRIX_EVAL="export PATH=\$HOME/.local/bin:\$PATH"
# Ubuntu Bionic (18.04) with GCC 7 on ARM64
- os: linux
arch: arm64
dist: bionic
addons:
apt:
sources:
- sourceline: 'ppa:deadsnakes/ppa' # for Python 3.7 (required by Meson)
packages:
- libgtest-dev
- libboost-dev
- python3.6
- python3-urllib3
- ninja-build
before_install:
- wget https://bootstrap.pypa.io/get-pip.py
- /usr/bin/python3.6 get-pip.py --user --no-cache-dir
install:
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson --no-cache-dir
env:
- MATRIX_EVAL="export PATH=\$HOME/.local/bin:\$PATH"
# Ubuntu Trusty (16.04) with GCC 6
- os: linux
dist: trusty
addons:
@@ -9,7 +75,7 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:mhier/libboost-latest'
- sourceline: 'ppa:saiarcot895/chromium-dev' # for ninja-build
- sourceline: 'ppa:mstipicevic/ninja-build-1-7-2'
- sourceline: 'ppa:deadsnakes/ppa' # for Python 3.7 (required by Meson)
packages:
- g++-6
@@ -20,13 +86,14 @@ matrix:
- ninja-build
before_install:
- wget https://bootstrap.pypa.io/get-pip.py
- /usr/bin/python3.6 get-pip.py --user
- /usr/bin/python3.6 get-pip.py --user --no-cache-dir
install:
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson --no-cache-dir
env:
# use gold as workaround for https://sourceware.org/bugzilla/show_bug.cgi?id=17068
- MATRIX_EVAL="export CC=gcc-6 CXX=g++-6 LDFLAGS=-fuse-ld=gold PATH=$HOME/.local/bin:$PATH"
- MATRIX_EVAL="export CC='ccache gcc-6' CXX='ccache g++-6' LDFLAGS=-fuse-ld=gold PATH=\$HOME/.local/bin:\$PATH"
# Ubuntu Trusty (16.04) with GCC 8
- os: linux
dist: trusty
addons:
@@ -34,7 +101,7 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:mhier/libboost-latest'
- sourceline: 'ppa:saiarcot895/chromium-dev' # for ninja-build
- sourceline: 'ppa:mstipicevic/ninja-build-1-7-2'
- sourceline: 'ppa:deadsnakes/ppa' # for Python 3.7 (required by Meson)
packages:
- g++-8
@@ -45,31 +112,61 @@ matrix:
- ninja-build
before_install:
- wget https://bootstrap.pypa.io/get-pip.py
- /usr/bin/python3.6 get-pip.py --user
- /usr/bin/python3.6 get-pip.py --user --no-cache-dir
install:
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson
- /usr/bin/python3.6 $HOME/.local/bin/pip install --user meson --no-cache-dir
env:
# use gold as workaround for https://sourceware.org/bugzilla/show_bug.cgi?id=17068
- MATRIX_EVAL="export CC=gcc-8 CXX=g++-8 LDFLAGS=-fuse-ld=gold PATH=$HOME/.local/bin:$PATH"
- MATRIX_EVAL="export CC='ccache gcc-8' CXX='ccache g++-8' LDFLAGS=-fuse-ld=gold PATH=\$HOME/.local/bin:\$PATH"
- os: osx
osx_image: xcode9.3beta
osx_image: xcode9.4
addons:
homebrew:
packages:
- ccache
- meson
- icu4c
- ffmpeg
- libnfs
- yajl
- libupnp
- libid3tag
- chromaprint
- libsamplerate
- libsoxr
# libzzip appears to be broken on Homebrew: "ld: library not found for -lzzip"
#- libzzip
- flac
- opus
- libvorbis
- faad2
- wavpack
- libmpdclient
update: true
env:
- MATRIX_EVAL=""
- MATRIX_EVAL="export PATH=/usr/local/opt/ccache/libexec:$PATH HOMEBREW_NO_ANALYTICS=1"
cache:
- apt
- ccache
apt: true
ccache: true
directories:
- $HOME/Library/Caches/Homebrew
before_cache:
- test "$TRAVIS_OS_NAME" != "osx" || brew cleanup
before_install:
- eval "${MATRIX_EVAL}"
# C++14
- test "$TRAVIS_OS_NAME" != "osx" || brew update
install:
# C++14
- test "$TRAVIS_OS_NAME" != "osx" || brew install ccache meson
- test "$TRAVIS_OS_NAME" != "osx" || brew install --HEAD https://gist.githubusercontent.com/Kronuz/96ac10fbd8472eb1e7566d740c4034f8/raw/gtest.rb
# Work around "Target /usr/local/lib/libgtest.a is a symlink
# belonging to nss. You can unlink it" during gtest install
- test "$TRAVIS_OS_NAME" != "osx" || brew unlink nss
- test "$TRAVIS_OS_NAME" != "osx" || brew install https://gist.githubusercontent.com/Kronuz/96ac10fbd8472eb1e7566d740c4034f8/raw/gtest.rb
before_script:
- ccache -s

311
NEWS

@@ -1,3 +1,314 @@
ver 0.21.26 (2020/09/21)
* database
- inotify: obey ".mpdignore" files
* output
- osx: fix crash bug
- sles: support floating point samples
* archive
- bzip2: fix crash on corrupt bzip2 file
- bzip2: flush output at end of input file
- iso9660: fix unaligned reads
- iso9660: support seeking
- zzip: fix crash on corrupt ZIP file
* decoder
- ffmpeg: remove "rtsp://" from the list of supported protocols
- ffmpeg: add "hls+http://" to the list of supported protocols
- opus: support the gain value from the Opus header
- sndfile: fix lost samples at end of file
* fix "single" mode bug after resuming playback
* the default log_level is "default", not "info"
ver 0.21.25 (2020/07/06)
* protocol:
- fix crash when using "rangeid" while playing
* database
- simple: automatically scan new mounts
- upnp: fix compatibility with Plex DLNA
* storage
- fix disappearing mounts after mounting twice
- udisks: fix reading ".mpdignore"
* input
- file: detect premature end of file
- smbclient: don't send credentials to MPD clients
* decoder
- opus: apply pre-skip and end trimming
- opus: fix memory leak
- opus: fix crash bug
- vorbis: fix crash bug
* output
- osx: improve sample rate selection
- osx: fix noise while stopping
* neighbor
- upnp: fix crash during shutdown
* Windows/Android:
- fix Boost detection after breaking change in Meson 0.54
ver 0.21.24 (2020/06/10)
* protocol
- "tagtypes" requires no permissions
* database
- simple: fix crash when mounting twice
* decoder
- modplug: fix Windows build failure
- wildmidi: attempt to detect WildMidi using pkg-config
- wildmidi: fix Windows build failure
* player
- don't restart current song if seeking beyond end
* Android
- enable the decoder plugins GME, ModPlug and WildMidi
- fix build failure with Android NDK r21
* Windows
- fix stream playback
- enable the decoder plugins GME, ModPlug and WildMidi
- work around Meson bug breaking the Windows build with GCC 10
* fix unit test failure
ver 0.21.23 (2020/04/23)
* protocol
- add tag fallback for AlbumSort
* storage
- curl: fix corrupt "href" values in the presence of XML entities
- curl: unescape "href" values
* input
- nfs: fix crash bug
- nfs: fix freeze bug on reconnect
* decoder
- gme: adapt to API change in the upcoming version 0.7.0
* output
- alsa: implement channel mapping for 5.0 and 7.0
* player
- drain outputs at end of song in "single" mode
* Windows
- fix case insensitive search
ver 0.21.22 (2020/04/02)
* database
- simple: optimize startup
* input
- curl: fix streaming errors on Android
* playlist
- rss: support MIME type application/xml
* mixer
- android: new mixer plugin for "sles" output
* Android
- TV support
* Windows
- fix time zone offset check
* fix build failures with uClibc-ng
ver 0.21.21 (2020/03/19)
* configuration
- fix bug in "metadata_to_use" setting
* playlist
- asx, xspf: fix corrupt tags in the presence of XML entities
* archive
- iso9660: skip empty file names to work around libcdio bug
* decoder
- gme: ignore empty tags
* output
- solaris: port to NetBSD
* raise default "max_connections" value to 100
ver 0.21.20 (2020/02/16)
* decoder
- audiofile, ffmpeg, sndfile: handle MIME type "audio/wav"
- ffmpeg: fix playback of AIFF and TTA
- vorbis, opus: fix seeking in small files
* fix backwards seeking on ARM (and other non-x86 CPUs)
ver 0.21.19 (2020/01/17)
* configuration
- allow overriding top-level settings in includes
* output
- pulse: obey Pulse's maximum sample rate (fixes DSD128 playback)
* fix build failure with clang 10
* fix build failure with Android NDK r20
ver 0.21.18 (2019/12/24)
* protocol
- work around Mac OS X bug in the ISO 8601 parser
* output
- alsa: fix hang bug with ALSA "null" outputs
* storage
- curl: fix crash bug
* drop support for CURL versions older than 7.32.0
* reduce unnecessary CPU wakeups
ver 0.21.17 (2019/12/16)
* protocol
- relax the ISO 8601 parser: allow omitting field separators, the
time of day and the "Z" suffix
* archive
- zzip: improve error reporting
* outputs
- jack: mark ports as terminal
- shout: declare metadata as UTF-8
* fix build failure with -Ddatabase=false
ver 0.21.16 (2019/10/16)
* queue
- fix relative destination offset when moving a range
* storage
- curl: request the "resourcetype" property to fix database update
- curl: URL-encode more paths
- curl: follow redirects for collections without trailing slash
* update
- fix crash when music_directory is not a directory
* fix build with iconv() instead of ICU
ver 0.21.15 (2019/09/25)
* decoder
- dsdiff, dsf: fix displayed bit rate
- mpcdec: fix bogus ReplayGain values
* output
- solaris: fix build with glibc 2.30
ver 0.21.14 (2019/08/21)
* decoder
- sidplay: show track durations in database
- sidplay: convert tag values from Windows-1252 charset
- sidplay: strip text from "Date" tag
* player
- fix crash after song change
- fix seek position after restarting the decoder
* protocol
- include command name in error responses
ver 0.21.13 (2019/08/06)
* input
- cdio_paranoia: require libcdio-paranoia 10.2+0.93+1
* decoder
- mad: fix crackling sound (0.21.12 regression)
* output
- jack: improved Windows compatibility
ver 0.21.12 (2019/08/03)
* decoder
- mad: update bit rate after seeking
- mad: fix several bugs preventing the plugin from decoding the last frame
- opus: ignore case in replay gain tag names
- opus, vorbis: decode the "end of stream" packet
* output
- jack: fix mono-to-stereo conversion
* player
- don't restart unseekable song after failed seek attempt
* Windows
- support backslash in relative URIs loaded from playlists
ver 0.21.11 (2019/07/03)
* input
- tidal: deprecated because Tidal has changed the protocol
* decoder
- wildmidi: log error if library initialization fails
* output
- alsa: fix busy loop while draining
- alsa: fix missing drain call
- alsa: improve xrun-avoiding silence generator
- alsa: log when generating silence due to slow decoder
- alsa, osx: fix distortions with DSD_U32 and DoP on 32 bit CPUs
* protocol
- fix "list" with multiple "group" levels
ver 0.21.10 (2019/06/05)
* decoder
- opus: fix duplicate tags
* output
- httpd: reject some well-known URIs
* fix crash bug (0.21.9 regression)
ver 0.21.9 (2019/05/20)
* input
- buffer: fix deadlock bug
* Android
- fix crash on ARMv7
- request storage permission on Android 6+
* fix spurious "single" mode bug
ver 0.21.8 (2019/04/23)
* input
- smbclient: download to buffer instead of throttling transfer
* output
- httpd: add missing mutex lock
- httpd: fix use-after-free bug
* playlist
- soundcloud: fix "Unsupported URI scheme" (0.21.6 regression)
* fix Bonjour bug
* fix build failure with GCC 9
* fix build failure with -Ddatabase=false
* systemd: add user socket unit
* doc: "list file" is deprecated
ver 0.21.7 (2019/04/03)
* input
- qobuz/tidal: scan tags when loading a playlist
* require Meson 0.49.0 for native libgcrypt-config support
* fix build failure with -Dlocal_socket=false
* Haiku
- fix build
- add version info
ver 0.21.6 (2019/03/17)
* protocol
- allow loading playlists specified as absolute filesystem paths
- fix negated filter expressions with multiple tag values
- fix "list" with filter expression
- omit empty playlist names in "listplaylists"
* input
- cdio_paranoia: fix build failure due to missing #include
* decoder
- opus: fix replay gain when there are no other tags
- opus: fix seeking to beginning of song
- vorbis: fix Tremor conflict resulting in crash
* output
- pulse: work around error with unusual channel count
- osx: fix build failure
* playlist
- flac: fix use-after-free bug
* support abstract sockets on Linux
* Windows
- remove the unused libwinpthread-1.dll dependency
* Android
- enable SLES power saving mode
ver 0.21.5 (2019/02/22)
* protocol
- fix deadlock in "albumart" command
- fix "tagtypes disable" command
* database
- simple: fix assertion failure
- fix assertion failures with mount points
* storage
- udisks: fix "AlreadyMounted" error
- udisks: use relative path from mount URI
- fix memory leak
* input
- buffer: fix crash bug when playing remote WAV file
* tags
- ape: map "Album Artist"
* output
- shout: add support for TLS
* mixer
- pulse: add "scale_volume" setting
ver 0.21.4 (2019/01/04)
* database
- inotify: fix crash bug "terminate called after throwing ..."
- upnp: implement "list ... group"
* output
- httpd: declare protocol "HTTP/1.1" instead of "ICY"
* remove libwrap support
* Windows
- fix "Failed to accept connection: unknown error"
* fix Haiku build
ver 0.21.3 (2018/11/16)
* output
- alsa: fix crash bug
- alsa: fix stuttering at start of playback
- alsa: fix discarded samples at end of song
- alsa: clear error after reopening device
* log: default to journal if MPD was started as systemd service
ver 0.21.2 (2018/11/12)
* protocol
- operator "=~" matches a regular expression

@@ -2,18 +2,25 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.musicpd"
android:installLocation="auto"
android:versionCode="24"
android:versionName="0.21.2">
android:versionCode="49"
android:versionName="0.21.26">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="26"/>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
<uses-feature android:name="android.software.leanback"
android:required="false" />
<uses-feature android:name="android.hardware.touchscreen"
android:required="false" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application android:allowBackup="true"
android:icon="@drawable/icon"
android:banner="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".Settings"
android:label="@string/app_name">
@@ -22,6 +29,14 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Settings"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".Receiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />

@@ -25,25 +25,32 @@ android_abis = {
'arch': 'arm-linux-androideabi',
'ndk_arch': 'arm',
'toolchain_arch': 'arm-linux-androideabi',
'llvm_triple': 'armv7-none-linux-androideabi',
'cflags': '-march=armv7-a -mfpu=vfp -mfloat-abi=softfp',
'llvm_triple': 'armv7-linux-androideabi',
'cflags': '-fpic -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp',
},
'arm64-v8a': {
'android_api_level': '21',
'arch': 'aarch64-linux-android',
'ndk_arch': 'arm64',
'toolchain_arch': 'aarch64-linux-android',
'llvm_triple': 'aarch64-none-linux-android',
'cflags': '',
'llvm_triple': 'aarch64-linux-android',
'cflags': '-fpic',
},
'x86': {
'arch': 'i686-linux-android',
'ndk_arch': 'x86',
'toolchain_arch': 'x86',
'llvm_triple': 'i686-none-linux-android',
'cflags': '-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32',
'llvm_triple': 'i686-linux-android',
'cflags': '-fPIC -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32',
},
'x86_64': {
'arch': 'x86_64-linux-android',
'ndk_arch': 'x86_64',
'toolchain_arch': 'x86_64',
'llvm_triple': 'x86_64-linux-android',
'cflags': '-fPIC -m64',
},
}
@@ -76,27 +83,20 @@ class AndroidNdkToolchain:
ndk_arch = abi_info['ndk_arch']
android_api_level = '21'
ndk_platform = 'android-' + android_api_level
# select the NDK compiler
gcc_version = '4.9'
ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform)
sysroot = os.path.join(ndk_path, 'sysroot')
target_root = os.path.join(ndk_platform_path, 'arch-' + ndk_arch)
install_prefix = os.path.join(arch_path, 'root')
self.arch = arch
self.install_prefix = install_prefix
self.sysroot = sysroot
toolchain_path = os.path.join(ndk_path, 'toolchains', abi_info['toolchain_arch'] + '-' + gcc_version, 'prebuilt', build_arch)
llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch)
llvm_triple = abi_info['llvm_triple']
llvm_triple = abi_info['llvm_triple'] + android_api_level
common_flags = '-Os -g'
common_flags += ' -fPIC'
common_flags += ' ' + abi_info['cflags']
toolchain_bin = os.path.join(toolchain_path, 'bin')
@@ -107,6 +107,9 @@ class AndroidNdkToolchain:
common_flags += ' -fvisibility=hidden -fdata-sections -ffunction-sections'
# required flags from https://android.googlesource.com/platform/ndk/+/ndk-release-r20/docs/BuildSystemMaintainers.md#additional-required-arguments
common_flags += ' -fno-addrsig'
self.ar = os.path.join(toolchain_bin, arch + '-ar')
self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib')
self.nm = os.path.join(toolchain_bin, arch + '-nm')
@@ -114,15 +117,11 @@ class AndroidNdkToolchain:
self.cflags = common_flags
self.cxxflags = common_flags
self.cppflags = '--sysroot=' + sysroot + \
' -isystem ' + os.path.join(install_prefix, 'include') + \
' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch) + \
' -D__ANDROID_API__=' + android_api_level
self.ldflags = '--sysroot=' + sysroot + \
' -L' + os.path.join(install_prefix, 'lib') + \
' -L' + os.path.join(target_root, 'usr', 'lib') + \
' -B' + os.path.join(target_root, 'usr', 'lib') + \
self.cppflags = ' -isystem ' + os.path.join(install_prefix, 'include')
self.ldflags = ' -L' + os.path.join(install_prefix, 'lib') + \
' -Wl,--exclude-libs=ALL' + \
' ' + common_flags
self.ldflags = common_flags
self.libs = ''
self.is_arm = ndk_arch == 'arm'
@@ -130,13 +129,16 @@ class AndroidNdkToolchain:
self.is_aarch64 = ndk_arch == 'arm64'
self.is_windows = False
libcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/llvm-libc++')
libcxx_libs_path = os.path.join(libcxx_path, 'libs', android_abi)
libstdcxx_flags = ''
libstdcxx_cxxflags = libstdcxx_flags + ' -isystem ' + os.path.join(libcxx_path, 'include') + ' -isystem ' + os.path.join(ndk_path, 'sources/android/support/include')
libstdcxx_ldflags = libstdcxx_flags + ' -L' + libcxx_libs_path
libstdcxx_libs = '-lc++_static -lc++abi'
libstdcxx_cxxflags = ''
libstdcxx_ldflags = ''
libstdcxx_libs = '-static-libstdc++'
if self.is_armv7:
# On 32 bit ARM, clang generates no ".eh_frame" section;
# instead, the LLVM unwinder library is used for unwinding
# the stack after a C++ exception was thrown
libstdcxx_libs += ' -lunwind'
if use_cxx:
self.cxxflags += ' ' + libstdcxx_cxxflags
@@ -166,6 +168,9 @@ thirdparty_libs = [
opus,
flac,
libid3tag,
libmodplug,
wildmidi,
gme,
ffmpeg,
curl,
libexpat,

@@ -6,7 +6,7 @@ android_sdk = get_option('android_sdk')
android_abi = get_option('android_abi')
android_sdk_build_tools_version = '27.0.0'
android_sdk_platform = 'android-21'
android_sdk_platform = 'android-23'
android_build_tools_dir = join_paths(android_sdk, 'build-tools', android_sdk_build_tools_version)
android_sdk_platform_dir = join_paths(android_sdk, 'platforms', android_sdk_platform)

@@ -21,6 +21,7 @@ package org.musicpd;
import android.annotation.TargetApi;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ComponentName;
@@ -35,6 +36,9 @@ import android.os.RemoteException;
import android.util.Log;
import android.widget.RemoteViews;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class Main extends Service implements Runnable {
private static final String TAG = "Main";
private static final String REMOTE_ERROR = "MPD process was killed";
@@ -156,11 +160,36 @@ public class Main extends Service implements Runnable {
sendMessage(MSG_SEND_STATUS, mStatus, 0, mError);
}
private Notification.Builder createNotificationBuilderWithChannel() {
final NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager == null)
return null;
final String id = "org.musicpd";
final String name = "MPD service";
final int importance = 3; /* NotificationManager.IMPORTANCE_DEFAULT */
try {
Class<?> ncClass = Class.forName("android.app.NotificationChannel");
Constructor<?> ncCtor = ncClass.getConstructor(String.class, CharSequence.class, int.class);
Object nc = ncCtor.newInstance(id, name, importance);
Method nmCreateNotificationChannelMethod =
NotificationManager.class.getMethod("createNotificationChannel", ncClass);
nmCreateNotificationChannelMethod.invoke(notificationManager, nc);
Constructor nbCtor = Notification.Builder.class.getConstructor(Context.class, String.class);
return (Notification.Builder) nbCtor.newInstance(this, id);
} catch (Exception e)
{
Log.e(TAG, "error creating the NotificationChannel", e);
return null;
}
}
private void start() {
if (mThread != null)
return;
mThread = new Thread(this);
mThread.start();
final Intent mainIntent = new Intent(this, Settings.class);
mainIntent.setAction("android.intent.action.MAIN");
@@ -168,13 +197,25 @@ public class Main extends Service implements Runnable {
final PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
mainIntent, PendingIntent.FLAG_CANCEL_CURRENT);
Notification notification = new Notification.Builder(this)
.setContentTitle(getText(R.string.notification_title_mpd_running))
Notification.Builder nBuilder;
if (Build.VERSION.SDK_INT >= 26 /* Build.VERSION_CODES.O */)
{
nBuilder = createNotificationBuilderWithChannel();
if (nBuilder == null)
return;
}
else
nBuilder = new Notification.Builder(this);
Notification notification = nBuilder.setContentTitle(getText(R.string.notification_title_mpd_running))
.setContentText(getText(R.string.notification_text_mpd_running))
.setSmallIcon(R.drawable.notification_icon)
.setContentIntent(contentIntent)
.build();
mThread = new Thread(this);
mThread.start();
startForeground(R.string.notification_title_mpd_running, notification);
startService(new Intent(this, Main.class));
}

@@ -21,10 +21,12 @@ package org.musicpd;
import java.util.LinkedList;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -103,12 +105,13 @@ public class Settings extends Activity {
else
mRunButton.setChecked(false);
mFirstRun = true;
mTextStatus.setText("");
break;
case MSG_STARTED:
Log.d(TAG, "onStarted");
mRunButton.setChecked(true);
mFirstRun = true;
mTextStatus.setText("CAUTION: this version is EXPERIMENTAL!"); // XXX
mTextStatus.setText("MPD service started");
break;
case MSG_LOG:
if (mLogListArray.size() > MAX_LOGS)
@@ -178,6 +181,14 @@ public class Settings extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
/* TODO: this sure is the wrong place to request
permissions - it will cause MPD to quit
immediately; we should request permissions when we
need them, but implementing that is complicated, so
for now, we do it here to give users a quick
solution for the problem */
requestAllPermissions();
setContentView(R.layout.settings);
mRunButton = (ToggleButton) findViewById(R.id.run);
mRunButton.setOnCheckedChangeListener(mOnRunChangeListener);
@@ -203,6 +214,31 @@ public class Settings extends Activity {
super.onCreate(savedInstanceState);
}
private void checkRequestPermission(String permission) {
if (checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED)
return;
try {
this.requestPermissions(new String[]{permission}, 0);
} catch (Exception e) {
Log.e(TAG, "requestPermissions(" + permission + ") failed",
e);
}
}
private void requestAllPermissions() {
if (android.os.Build.VERSION.SDK_INT < 23)
/* we don't need to request permissions on
this old Android version */
return;
/* starting with Android 6.0, we need to explicitly
request all permissions before using them;
mentioning them in the manifest is not enough */
checkRequestPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
}
private void connectClient() {
mClient = new Main.Client(this, new Main.Client.Callback() {

@@ -1,5 +1,9 @@
#!/bin/sh -e
# This is a wrapper for pkg-config which helps with cross-compiling;
# it sets up environment variables to pkg-config searches for
# libraries in the sysroot where a copy of this script is located.
BIN=`dirname $0`
ROOT=`dirname "$BIN"`

@@ -38,7 +38,7 @@ author = 'Max Kellermann'
# built documents.
#
# The short X.Y version.
version = '0.21.2'
version = '0.21.26'
# The full version, including alpha/beta/rc tags.
release = version

@@ -2,12 +2,12 @@ Developer's Manual
##################
Introduction
============
************
This is a guide for those who wish to hack on the MPD source code. MPD is an open project, and we are always happy about contributions. So far, more than 150 people have contributed patches. This document is work in progress. Most of it may be incomplete yet. Please help!
Code Style
==========
**********
* indent with tabs (width 8)
* don't write CPP when you can write C++: use inline functions and constexpr instead of macros
@@ -18,7 +18,6 @@ Code Style
* classes and functions names use CamelCase; variables are lower-case with words separated by underscore
Some example code:
~~~~~~~~~~~~~~~~~~
.. code-block:: c
@@ -33,7 +32,7 @@ Some example code:
}
Hacking The Source
==================
******************
MPD sources are managed in a git repository on
`Github <https://github.com/MusicPlayerDaemon/>`_.
@@ -59,7 +58,7 @@ possible, to be sure that you don't break any disabled code.
Don't mix several changes in one single patch. Create a separate patch for every change. Tools like :program:`stgit` help you with that. This way, we can review your patches more easily, and we can pick the patches we like most first.
Basic stgit usage
-----------------
=================
stgit allows you to create a set of patches and refine all of them: you can go back to any patch at any time, and re-edit it (both the code and the commit message). You can reorder patches and insert new patches at any position. It encourages creating separate patches for tiny changes.
@@ -94,35 +93,7 @@ When the whole patch series is finished, convert stgit patches to git commits:
stg commit
Submitting Patches
==================
******************
Send your patches to the mailing list:
Email: `mpd-devel <mpd-devel@musicpd.org>`_
:program:`git pull` requests are preferred.
Development Tools
=================
Clang Static Analyzer
---------------------
The `static analyzer <http://clang-analyzer.llvm.org/>`_ is a tool that helps find bugs. To run it on the MPD code base, install LLVM and clang. configure MPD to use clang:
.. code-block:: sh
./configure --enable-debug CXX=clang++ CC=clang ...
It is recommended to use :code:`--enable-debug`, because the analyzer
takes advantage of :dfn:`assert()` calls, which are only enabled in
the debug build.
Now run the analyzer:
.. code-block:: sh
scan-build --use-c++=clang++ --use-cc=clang make
The options :code:`--use-c++` and :code:`--use-cc` are necessary
because it invokes :command:`cc` for actually compiling the sources by
default. That breaks, because MPD requires a C99 compiler.
Submit pull requests on GitHub:
https://github.com/MusicPlayerDaemon/MPD/pulls

@@ -1,165 +0,0 @@
<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE itemizedlist PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<itemizedlist>
<listitem>
<para>
<varname>artist</varname>: the artist name. Its meaning is not
well-defined; see <varname>composer</varname> and
<varname>performer</varname> for more specific tags.
</para>
</listitem>
<listitem>
<para>
<varname>artistsort</varname>: same as
<varname>artist</varname>, but for sorting. This usually omits
prefixes such as "The".
</para>
</listitem>
<listitem>
<para>
<varname>album</varname>: the album name.
</para>
</listitem>
<listitem>
<para>
<varname>albumsort</varname>: same as <varname>album</varname>,
but for sorting.
</para>
</listitem>
<listitem>
<para>
<varname>albumartist</varname>: on multi-artist albums, this is
the artist name which shall be used for the whole album. The
exact meaning of this tag is not well-defined.
</para>
</listitem>
<listitem>
<para>
<varname>albumartistsort</varname>: same as
<varname>albumartist</varname>, but for sorting.
</para>
</listitem>
<listitem>
<para>
<varname>title</varname>: the song title.
</para>
</listitem>
<listitem>
<para>
<varname>track</varname>: the decimal track number within the
album.
</para>
</listitem>
<listitem>
<para>
<varname>name</varname>: a name for this song. This is not the
song title. The exact meaning of this tag is not well-defined.
It is often used by badly configured internet radio stations
with broken tags to squeeze both the artist name and the song
title in one tag.
</para>
</listitem>
<listitem>
<para>
<varname>genre</varname>: the music genre.
</para>
</listitem>
<listitem>
<para>
<varname>date</varname>: the song's release date. This is
usually a 4-digit year.
</para>
</listitem>
<listitem>
<para>
<varname>composer</varname>: the artist who composed the song.
</para>
</listitem>
<listitem>
<para>
<varname>performer</varname>: the artist who performed the song.
</para>
</listitem>
<listitem>
<para>
<varname>comment</varname>: a human-readable comment about this
song. The exact meaning of this tag is not well-defined.
</para>
</listitem>
<listitem>
<para>
<varname>disc</varname>: the decimal disc number in a multi-disc
album.
</para>
</listitem>
<listitem>
<para>
<varname>musicbrainz_artistid</varname>: the artist id in the
<ulink
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
database.
</para>
</listitem>
<listitem>
<para>
<varname>musicbrainz_albumid</varname>: the album id in the
<ulink
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
database.
</para>
</listitem>
<listitem>
<para>
<varname>musicbrainz_albumartistid</varname>: the album artist
id in the <ulink
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
database.
</para>
</listitem>
<listitem>
<para>
<varname>musicbrainz_trackid</varname>: the track id in the
<ulink
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
database.
</para>
</listitem>
<listitem>
<para>
<varname>musicbrainz_releasetrackid</varname>: the release track
id in the <ulink
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
database.
</para>
</listitem>
<listitem>
<para>
<varname>musicbrainz_workid</varname>: the work id in the
<ulink
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
database.
</para>
</listitem>
</itemizedlist>

@@ -140,7 +140,6 @@ of database.
.B auto_update_depth <N>
Limit the depth of the directories being watched, 0 means only watch
the music directory itself. There is no limit by default.
.TP
.SH REQUIRED AUDIO OUTPUT PARAMETERS
.TP
.B type <type>
@@ -164,57 +163,12 @@ Specifies how replay gain is applied. The default is "software",
which uses an internal software volume control. "mixer" uses the
configured (hardware) mixer control. "none" disables replay gain on
this audio output.
.SH OPTIONAL ALSA OUTPUT PARAMETERS
.TP
.B device <dev>
This specifies the device to use for audio output. The default is "default".
.TP
.B mixer_type <hardware, software or none>
Specifies which mixer should be used for this audio output: the
hardware mixer (available for ALSA, OSS and PulseAudio), the software
mixer or no mixer ("none"). By default, the hardware mixer is used
for devices which support it, and none for the others.
.TP
.B mixer_device <mixer dev>
This specifies which mixer to use. The default is "default". To use
the second sound card in a system, use "hw:1".
.TP
.B mixer_control <mixer ctrl>
This specifies which mixer control to use (sometimes referred to as
the "device"). The default is "PCM". Use "amixer scontrols" to see
the list of possible controls.
.TP
.B mixer_index <mixer index>
A number identifying the index of the named mixer control. This is
probably only useful if your alsa device has more than one
identically\-named mixer control. The default is "0". Use "amixer
scontrols" to see the list of controls with their indexes.
.TP
.B auto_resample <yes or no>
Setting this to "no" disables ALSA's software resampling, if the
hardware does not support a specific sample rate. This lets MPD do
the resampling. "yes" is the default and allows ALSA to resample.
.TP
.B auto_channels <yes or no>
Setting this to "no" disables ALSA's channel conversion, if the
hardware does not support a specific number of channels. Default: "yes".
.TP
.B auto_format <yes or no>
Setting this to "no" disables ALSA's sample format conversion, if the
hardware does not support a specific sample format. Default: "yes".
.TP
.B buffer_time <time in microseconds>
This sets the length of the hardware sample buffer in microseconds. Increasing
it may help to reduce or eliminate skipping on certain setups. Most users do
not need to change this. The default is 500000 microseconds (0.5 seconds).
.TP
.B period_time <time in microseconds>
This sets the time between hardware sample transfers in microseconds.
Increasing this can reduce CPU usage while lowering it can reduce underrun
errors on bandwidth-limited devices. Some users have reported good results
with this set to 50000, but not all devices support values this high. Most
users do not need to change this. The default is 256000000 / sample_rate(kHz),
or 5804 microseconds for CD-quality audio.
.SH FILES
.TP
.BI ~/.mpdconf

@@ -32,7 +32,7 @@
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
# setting defaults to logging to syslog.
#
#log_file "~/.mpd/log"
#

@@ -4,10 +4,10 @@ Plugin reference
.. _database_plugins:
Database plugins
----------------
================
simple
~~~~~~
------
The default plugin. Stores a copy of the database in memory. A file is used for permanent storage.
@@ -25,7 +25,7 @@ The default plugin. Stores a copy of the database in memory. A file is used for
- Compress the database file using gzip? Enabled by default (if built with zlib).
proxy
~~~~~
-----
Provides access to the database of another :program:`MPD` instance using libmpdclient. This is useful when you run mount the music directory via NFS/SMB, and the file server already runs a :program:`MPD` instance. Only the file server needs to update the database.
@@ -42,77 +42,94 @@ Provides access to the database of another :program:`MPD` instance using libmpdc
* - **password**
- The password used to log in to the "master" :program:`MPD` instance.
* - **keepalive yes|no**
- Send TCP keepalive packets to the "master" :program:`MPD` instance? This option can help avoid certain firewalls dropping inactive connections, at the expensive of a very small amount of additional network traffic. Disabled by default.
- Send TCP keepalive packets to the "master" :program:`MPD` instance? This option can help avoid certain firewalls dropping inactive connections, at the expense of a very small amount of additional network traffic. Disabled by default.
upnp
~~~~
----
Provides access to UPnP media servers.
Storage plugins
---------------
===============
local
~~~~~
-----
The default plugin which gives :program:`MPD` access to local files. It is used when music_directory refers to a local directory.
curl
~~~~
----
A WebDAV client using libcurl. It is used when :code:`music_directory` contains a http:// or https:// URI, for example :samp:`https://the.server/dav/`.
A WebDAV client using libcurl. It is used when :code:`music_directory`
contains a ``http://`` or ``https://`` URI, for example
:samp:`https://the.server/dav/`.
smbclient
~~~~~~~~~
---------
Load music files from a SMB/CIFS server. It is used when :code:`music_directory` contains a smb:// URI, for example :samp:`smb://myfileserver/Music`.
Load music files from a SMB/CIFS server. It is used when
:code:`music_directory` contains a ``smb://`` URI, for example
:samp:`smb://myfileserver/Music`.
nfs
~~~
---
Load music files from a NFS server. It is used when :code:`music_directory` contains a nfs:// URI according to RFC2224, for example :samp:`nfs://servername/path`.
Load music files from a NFS server. It is used when
:code:`music_directory` contains a ``nfs://`` URI according to
RFC2224, for example :samp:`nfs://servername/path`.
This plugin uses libnfs, which supports only NFS version 3. Since :program:`MPD` is not allowed to bind to "privileged ports", the NFS server needs to enable the "insecure" setting; example :file:`/etc/exports`:
.. code-block:: none
/srv/mp3 192.168.1.55(ro,insecure)
Don't fear: "insecure" does not mean that your NFS server is insecure. A few decades ago, people thought the concept of "privileged ports" would make network services "secure", which was a fallacy. The absence of this obsolete "security" measure means little.
See :ref:`input_nfs` for more information.
udisks
~~~~~~
------
Mount file systems (e.g. USB sticks or other removable media) using
the udisks2 daemon via D-Bus. To obtain a valid udisks2 URI, consult
:ref:`the according neighbor plugin <neighbor_plugin>`.
It might be necessary to grant :program:`MPD` privileges to control
:program:`udisks2` through :program:`policykit`. To do this, create a
file called :file:`/usr/share/polkit-1/rules.d/mpd-udisks.rules` with
the following text::
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.udisks2.filesystem-mount" ||
action.id == "org.freedesktop.udisks2.filesystem-mount-other-seat") &&
subject.user == "mpd") {
return polkit.Result.YES;
}
});
If you run MPD as a different user, change ``mpd`` to the name of your
MPD user.
.. _neighbor_plugin:
Neighbor plugins
----------------
================
smbclient
~~~~~~~~~
---------
Provides a list of SMB/CIFS servers on the local network.
udisks
~~~~~~
------
Queries the udisks2 daemon via D-Bus and obtain a list of file systems (e.g. USB sticks or other removable media).
upnp
~~~~
----
Provides a list of UPnP servers on the local network.
.. _input_plugins:
Input plugins
-------------
=============
alsa
~~~~
----
Allows :program:`MPD` on Linux to play audio directly from a soundcard using the scheme alsa://. Audio is formatted as 44.1 kHz 16-bit stereo (CD format). Examples:
@@ -125,7 +142,7 @@ Allows :program:`MPD` on Linux to play audio directly from a soundcard using the
mpc add alsa://hw:1,0 plays audio from device hw:1,0 cdio_paranoia
cdio_paranoia
~~~~~~~~~~~~~
-------------
Plays audio CDs using libcdio. The URI has the form: "cdda://[DEVICE][/TRACK]". The simplest form cdda:// plays the whole disc in the default drive.
@@ -141,11 +158,14 @@ Plays audio CDs using libcdio. The URI has the form: "cdda://[DEVICE][/TRACK]".
- Request CDParanoia cap the extraction speed to Nx normal CD audio rotation speed, keeping the drive quiet.
curl
~~~~
----
Opens remote files or streams over HTTP using libcurl.
Note that unless overridden by the below settings (e.g. by setting them to a blank value), general curl configuration from environment variables such as http_proxy or specified in :file:`~/.curlrc` will be in effect.
Note that unless overridden by the below settings (e.g. by setting
them to a blank value), general curl configuration from environment
variables such as ``http_proxy`` or specified in :file:`~/.curlrc`
will be in effect.
.. list-table::
:widths: 20 80
@@ -163,44 +183,67 @@ Note that unless overridden by the below settings (e.g. by setting them to a bla
- Verify the certificate's name against host? `More information <http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html>`_.
ffmpeg
~~~~~~
------
Access to various network protocols implemented by the FFmpeg library: gopher://, rtp://, rtsp://, rtmp://, rtmpt://, rtmps://
Access to various network protocols implemented by the FFmpeg library:
``gopher://``, ``rtp://``, ``rtsp://``, ``rtmp://``, ``rtmpt://``,
``rtmps://``
file
~~~~
----
Opens local files
mms
~~~
---
Plays streams with the MMS protocol using `libmms <https://launchpad.net/libmms>`_.
nfs
~~~
.. _input_nfs:
Allows :program:`MPD` to access files on NFSv3 servers without actually mounting them (i.e. in userspace, without help from the kernel's VFS layer). All URIs with the nfs:// scheme are used according to RFC2224. Example:
nfs
---
Allows :program:`MPD` to access files on NFS servers without actually
mounting them (i.e. with :program:`libnfs` in userspace, without help
from the kernel's VFS layer). All URIs with the ``nfs://`` scheme are
used according to RFC2224. Example:
.. code-block:: none
mpc add nfs://servername/path/filename.ogg
Note that this usually requires enabling the "insecure" flag in the server's /etc/exports file, because :program:`MPD` cannot bind to so-called "privileged" ports. Don't fear: this will not make your file server insecure; the flag was named in a time long ago when privileged ports were thought to be meaningful for security. By today's standards, NFSv3 is not secure at all, and if you believe it is, you're already doomed.
This plugin uses :program:`libnfs`, which supports only NFS version 3.
Since :program:`MPD` is not allowed to bind to so-called "privileged
ports", the NFS server needs to enable the ``insecure`` setting;
example :file:`/etc/exports`:
.. code-block:: none
/srv/mp3 192.168.1.55(ro,insecure)
Don't fear: this will not make your file server insecure; the flag was
named a time long ago when privileged ports were thought to be
meaningful for security. By today's standards, NFSv3 is not secure at
all, and if you believe it is, you're already doomed.
smbclient
~~~~~~~~~
---------
Allows :program:`MPD` to access files on SMB/CIFS servers (e.g. Samba or Microsoft Windows). All URIs with the smb:// scheme are used. Example:
Allows :program:`MPD` to access files on SMB/CIFS servers (e.g. Samba
or Microsoft Windows). All URIs with the ``smb://`` scheme are
used. Example:
.. code-block:: none
mpc add smb://servername/sharename/filename.ogg
mpc add smb://username:password@servername/sharename/filename.ogg
qobuz
~~~~~
-----
Play songs from the commercial streaming service Qobuz. It plays URLs in the form qobuz://track/ID, e.g.:
Play songs from the commercial streaming service Qobuz. It plays URLs
in the form ``qobuz://track/ID``, e.g.:
.. code-block:: none
@@ -224,9 +267,16 @@ Play songs from the commercial streaming service Qobuz. It plays URLs in the for
- The `Qobuz format identifier <https://github.com/Qobuz/api-documentation/blob/master/endpoints/track/getFileUrl.md#parameters>`_, i.e. a number which chooses the format and quality to be requested from Qobuz. The default is "5" (320 kbit/s MP3).
tidal
~~~~~
-----
Play songs from the commercial streaming service `Tidal <http://tidal.com/>`_. It plays URLs in the form tidal://track/ID, e.g.:
Play songs from the commercial streaming service `Tidal
<http://tidal.com/>`_. It plays URLs in the form ``tidal://track/ID``,
e.g.:
.. warning::
This plugin is currently defunct because Tidal has changed the
protocol and decided not to share documentation.
.. code-block:: none
@@ -250,10 +300,10 @@ Play songs from the commercial streaming service `Tidal <http://tidal.com/>`_. I
.. _decoder_plugins:
Decoder plugins
---------------
===============
adplug
~~~~~~
------
Decodes AdLib files using libadplug.
@@ -267,17 +317,17 @@ Decodes AdLib files using libadplug.
- The sample rate that shall be synthesized by the plugin. Defaults to 48000.
audiofile
~~~~~~~~~
---------
Decodes WAV and AIFF files using libaudiofile.
faad
~~~~
----
Decodes AAC files using libfaad.
ffmpeg
~~~~~~
------
Decodes various codecs using FFmpeg.
@@ -293,12 +343,12 @@ Decodes various codecs using FFmpeg.
- Sets the FFmpeg muxer option probesize, which specifies probing size in bytes, i.e. the size of the data to analyze to get stream information. The `FFmpeg formats documentation <https://ffmpeg.org/ffmpeg-formats.html>`_ has more information.
flac
~~~~
----
Decodes FLAC files using libFLAC.
dsdiff
~~~~~~
------
Decodes DFF files containing DSDIFF data (e.g. SACD rips).
@@ -312,12 +362,12 @@ Decodes DFF files containing DSDIFF data (e.g. SACD rips).
- Decode the least significant bit first. Default is no.
dsf
~~~
---
Decodes DSF files containing DSDIFF data (e.g. SACD rips).
fluidsynth
~~~~~~~~~~
----------
MIDI decoder based on `FluidSynth <http://www.fluidsynth.org/>`_.
@@ -333,7 +383,7 @@ MIDI decoder based on `FluidSynth <http://www.fluidsynth.org/>`_.
- The absolute path of the soundfont file. Defaults to :file:`/usr/share/sounds/sf2/FluidR3_GM.sf2`.
gme
~~~
---
Video game music file emulator based on `game-music-emu <https://bitbucket.org/mpyne/game-music-emu/wiki/Home>`_.
@@ -347,7 +397,7 @@ Video game music file emulator based on `game-music-emu <https://bitbucket.org/m
- Enable more accurate sound emulation.
hybrid_dsd
~~~~~~~~~~
----------
`Hybrid-DSD
<http://dsdmaster.blogspot.de/p/bitperfect-introduces-hybrid-dsd-file.html>`_
@@ -370,12 +420,12 @@ of the file is better.
- This specifies whether to support gapless playback of MP3s which have the necessary headers. Useful if your MP3s have headers with incorrect information. If you have such MP3s, it is highly recommended that you fix them using `vbrfix <http://www.willwap.co.uk/Programs/vbrfix.php>`_ instead of disabling gapless MP3 playback. The default is to support gapless MP3 playback.
mad
~~~
---
Decodes MP3 files using `libmad <http://www.underbit.com/products/mad/>`_.
mikmod
~~~~~~
------
Module player based on `MikMod <http://mikmod.sourceforge.net/>`_.
@@ -391,7 +441,7 @@ Module player based on `MikMod <http://mikmod.sourceforge.net/>`_.
- Sets the sample rate generated by libmikmod. Default is 44100.
modplug
~~~~~~~
-------
Module player based on MODPlug.
@@ -405,27 +455,27 @@ Module player based on MODPlug.
- Number of times to loop the module if it uses backward loops. Default is 0 which prevents looping. -1 loops forever.
mpcdec
~~~~~~
------
Decodes Musepack files using `libmpcdec <http://www.musepack.net/>`_.
mpg123
~~~~~~
------
Decodes MP3 files using `libmpg123 <http://www.mpg123.de/>`_.
opus
~~~~
----
Decodes Opus files using `libopus <http://www.opus-codec.org/>`_.
pcm
~~~
---
Read raw PCM samples. It understands the "audio/L16" MIME type with parameters "rate" and "channels" according to RFC 2586. It also understands the MPD-specific MIME type "audio/x-mpd-float".
sidplay
~~~~~~~
-------
C64 SID decoder based on `libsidplayfp <https://sourceforge.net/projects/sidplay-residfp/>`_ or `libsidplay2 <https://sourceforge.net/projects/sidplay2/>`_.
@@ -447,23 +497,23 @@ C64 SID decoder based on `libsidplayfp <https://sourceforge.net/projects/sidplay
- Only libsidplayfp. Absolute path to basic rom image file.
sndfile
~~~~~~~
-------
Decodes WAV and AIFF files using `libsndfile <http://www.mega-nerd.com/libsndfile/>`_.
vorbis
~~~~~~
------
Decodes Ogg-Vorbis files using `libvorbis <http://www.xiph.org/ogg/vorbis/>`_.
wavpack
~~~~~~~
-------
Decodes WavPack files using `libwavpack <http://www.wavpack.com/>`_.
wildmidi
~~~~~~~~
--------
MIDI decoder based on `libwildmidi <http://www.mindwerks.net/projects/wildmidi/>`_.
@@ -479,10 +529,11 @@ MIDI decoder based on `libwildmidi <http://www.mindwerks.net/projects/wildmidi/>
.. _encoder_plugins:
Encoder plugins
---------------
===============
flac
~~~~
----
Encodes into `FLAC <https://xiph.org/flac/>`_ (lossless).
.. list-table::
@@ -495,7 +546,7 @@ Encodes into `FLAC <https://xiph.org/flac/>`_ (lossless).
- Sets the libFLAC compression level. The levels range from 0 (fastest, least compression) to 8 (slowest, most compression).
lame
~~~~
----
Encodes into MP3 using the `LAME <http://lame.sourceforge.net/>`_ library.
@@ -511,12 +562,12 @@ Encodes into MP3 using the `LAME <http://lame.sourceforge.net/>`_ library.
- Sets the bit rate in kilobit per second. Cannot be used with quality.
null
~~~~
----
Does not encode anything, passes the input PCM data as-is.
shine
~~~~~
-----
Encodes into MP3 using the `Shine <https://github.com/savonet/shine>`_ library.
@@ -530,7 +581,7 @@ Encodes into MP3 using the `Shine <https://github.com/savonet/shine>`_ library.
- Sets the bit rate in kilobit per second.
twolame
~~~~~~~
-------
Encodes into MP2 using the `TwoLAME <http://www.twolame.org/>`_ library.
@@ -546,7 +597,7 @@ Encodes into MP2 using the `TwoLAME <http://www.twolame.org/>`_ library.
- Sets the bit rate in kilobit per second. Cannot be used with quality.
opus
~~~~
----
Encodes into `Ogg Opus <http://www.opus-codec.org/>`_.
@@ -568,7 +619,7 @@ Encodes into `Ogg Opus <http://www.opus-codec.org/>`_.
.. _vorbis_plugin:
vorbis
~~~~~~
------
Encodes into `Ogg Vorbis <http://www.vorbis.com/>`_.
@@ -584,13 +635,13 @@ Encodes into `Ogg Vorbis <http://www.vorbis.com/>`_.
- Sets the bit rate in kilobit per second. Cannot be used with quality.
wave
~~~~
----
Encodes into WAV (lossless).
.. _resampler_plugins:
Resampler plugins
-----------------
=================
The resampler can be configured in a block named resampler, for example:
@@ -613,12 +664,12 @@ The following table lists the resampler options valid for all plugins:
- The name of the plugin.
internal
~~~~~~~~
--------
A resampler built into :program:`MPD`. Its quality is very poor, but its CPU usage is low. This is the fallback if :program:`MPD` was compiled without an external resampler.
libsamplerate
~~~~~~~~~~~~~
-------------
A resampler using `libsamplerate <http://www.mega-nerd.com/SRC/>`_ a.k.a. Secret Rabbit Code (SRC).
@@ -651,7 +702,7 @@ The following converter types are provided by libsamplerate:
- Linear interpolator, very fast, poor quality.
soxr
~~~~
----
A resampler using `libsoxr <http://sourceforge.net/projects/soxr/>`_, the SoX Resampler library
@@ -674,13 +725,15 @@ Valid quality values for libsoxr:
* "low"
* "quick"
.. _output_plugins:
Output plugins
--------------
==============
.. _alsa_plugin:
alsa
~~~~
----
The `Advanced Linux Sound Architecture (ALSA) <http://www.alsa-project.org/>`_ plugin uses libasound. It is recommended if you are using Linux.
@@ -739,7 +792,7 @@ The following attributes can be configured at runtime using the outputset comman
ao
~~
--
The ao plugin uses the portable `libao <https://www.xiph.org/ao/>`_ library. Use only if there is no native plugin for your operating system.
.. list-table::
@@ -756,7 +809,8 @@ The ao plugin uses the portable `libao <https://www.xiph.org/ao/>`_ library. Use
- This specifies how many bytes to write to the audio device at once. This parameter is to work around a bug in older versions of libao on sound cards with very small buffers. The default is 1024.
sndio
~~~~~
-----
The sndio plugin uses the `sndio <http://www.sndio.org/>`_ library. It should normally be used on OpenBSD.
.. list-table::
@@ -771,7 +825,7 @@ The sndio plugin uses the `sndio <http://www.sndio.org/>`_ library. It should no
- Set the application buffer time in milliseconds.
fifo
~~~~
----
The fifo plugin writes raw PCM data to a FIFO (First In, First Out) file. The data can be read by another program.
@@ -784,8 +838,18 @@ The fifo plugin writes raw PCM data to a FIFO (First In, First Out) file. The da
* - **path P**
- This specifies the path of the FIFO to write to. Must be an absolute path. If the path does not exist, it will be created when MPD is started, and removed when MPD is stopped. The FIFO will be created with the same user and group as MPD is running as. Default permissions can be modified by using the builtin shell command umask. If a FIFO already exists at the specified path it will be reused, and will not be removed when MPD is stopped. You can use the "mkfifo" command to create this, and then you may modify the permissions to your liking.
haiku
-----
Use the SoundPlayer API on the Haiku operating system.
This plugin is unmaintained and contains known bugs. It will be
removed soon, unless there is a new maintainer.
jack
~~~~
----
The jack plugin connects to a `JACK server <http://jackaudio.org/>`_.
.. list-table::
@@ -808,7 +872,8 @@ The jack plugin connects to a `JACK server <http://jackaudio.org/>`_.
- Sets the size of the ring buffer for each channel. Do not configure this value unless you know what you're doing.
httpd
~~~~~
-----
The httpd plugin creates a HTTP server, similar to `ShoutCast <http://www.shoutcast.com/>`_ / `IceCast <http://icecast.org/>`_. HTTP streaming clients like mplayer, VLC, and mpv can connect to it.
It is highly recommended to configure a fixed format, because a stream cannot switch its audio format on-the-fly when the song changes.
@@ -822,14 +887,15 @@ It is highly recommended to configure a fixed format, because a stream cannot sw
* - **port P**
- Binds the HTTP server to the specified port.
* - **bind_to_address ADDR**
- Binds the HTTP server to the specified address (IPv4, IPv6 or UNIX socket). Multiple addresses in parallel are not supported.
- Binds the HTTP server to the specified address (IPv4, IPv6 or local socket). Multiple addresses in parallel are not supported.
* - **encoder NAME**
- Chooses an encoder plugin. A list of encoder plugins can be found in the encoder plugin reference :ref:`encoder_plugins`.
* - **max_clients MC**
- Sets a limit, number of concurrent clients. When set to 0 no limit will apply.
null
~~~~
----
The null plugin does nothing. It discards everything sent to it.
.. list-table::
@@ -844,7 +910,8 @@ The null plugin does nothing. It discards everything sent to it.
.. _oss_plugin:
oss
~~~
---
The "Open Sound System" plugin is supported on most Unix platforms.
On Linux, OSS has been superseded by ALSA. Use the ALSA output plugin :ref:`alsa_plugin` instead of this one on Linux.
@@ -872,7 +939,7 @@ The according hardware mixer plugin understands the following settings:
- Choose a mixer control, defaulting to PCM.
openal
~~~~~~
------
The "OpenAL" plugin uses `libopenal <http://kcat.strangesoft.net/openal.html>`_. It is supported on many platforms. Use only if there is no native plugin for your operating system.
.. list-table::
@@ -885,7 +952,7 @@ The "OpenAL" plugin uses `libopenal <http://kcat.strangesoft.net/openal.html>`_.
- Sets the device which should be used. This can be any valid OpenAL device name. If not specified, then libopenal will choose a default device.
osx
~~~
---
The "Mac OS X" plugin uses Apple's CoreAudio API.
.. list-table::
@@ -906,7 +973,7 @@ The "Mac OS X" plugin uses Apple's CoreAudio API.
The channel map may not refer to outputs that do not exist according to the format. If the format is "*:*:1" (mono) and you have a four-channel sound card then "-1,-1,0,0" (dual mono output on the second pair of sound card outputs) is a valid channel map but "-1,-1,0,1" is not because the second channel ('1') does not exist when the output is mono.
pipe
~~~~
----
The pipe plugin starts a program and writes raw PCM data into its standard input.
@@ -922,7 +989,7 @@ The pipe plugin starts a program and writes raw PCM data into its standard input
.. _pulse_plugin:
pulse
~~~~~
-----
The pulse plugin connects to a `PulseAudio <http://www.freedesktop.org/wiki/Software/PulseAudio/>`_ server. Requires libpulse.
.. list-table::
@@ -935,9 +1002,11 @@ The pulse plugin connects to a `PulseAudio <http://www.freedesktop.org/wiki/Soft
- Sets the host name of the PulseAudio server. By default, :program:`MPD` connects to the local PulseAudio server.
* - **sink NAME**
- Specifies the name of the PulseAudio sink :program:`MPD` should play on.
* - **scale_volume FACTOR**
- Specifies a linear scaling coefficient (ranging from 0.5 to 5.0) to apply when adjusting volume through :program:`MPD`. For example, chosing a factor equal to ``"0.7"`` means that setting the volume to 100 in :program:`MPD` will set the PulseAudio volume to 70%, and a factor equal to ``"3.5"`` means that volume 100 in :program:`MPD` corresponds to a 350% PulseAudio volume.
recorder
~~~~~~~~
--------
The recorder plugin writes the audio played by :program:`MPD` to a file. This may be useful for recording radio streams.
.. list-table::
@@ -949,13 +1018,13 @@ The recorder plugin writes the audio played by :program:`MPD` to a file. This ma
* - **path P**
- Write to this file.
* - **format_path P**
- An alternative to path which provides a format string referring to tag values. The special tag iso8601 emits the current date and time in `ISO8601 <https://en.wikipedia.org/wiki/ISO_8601>`_ format (UTC). Every time a new song starts or a new tag gets received from a radio station, a new file is opened. If the format does not render a file name, nothing is recorded. A tag name enclosed in percent signs ('%') is replaced with the tag value. Example: :file:`~/.mpd/recorder/%artist% - %title%.ogg`. Square brackets can be used to group a substring. If none of the tags referred in the group can be found, the whole group is omitted. Example: [~/.mpd/recorder/[%artist% - ]%title%.ogg] (this omits the dash when no artist tag exists; if title also doesn't exist, no file is written). The operators "|" (logical "or") and "&" (logical "and") can be used to select portions of the format string depending on the existing tag values. Example: ~/.mpd/recorder/[%title%|%name%].ogg (use the "name" tag if no title exists)
- An alternative to path which provides a format string referring to tag values. The special tag iso8601 emits the current date and time in `ISO8601 <https://en.wikipedia.org/wiki/ISO_8601>`_ format (UTC). Every time a new song starts or a new tag gets received from a radio station, a new file is opened. If the format does not render a file name, nothing is recorded. A tag name enclosed in percent signs ('%') is replaced with the tag value. Example: :file:`-/.mpd/recorder/%artist% - %title%.ogg`. Square brackets can be used to group a substring. If none of the tags referred in the group can be found, the whole group is omitted. Example: [-/.mpd/recorder/[%artist% - ]%title%.ogg] (this omits the dash when no artist tag exists; if title also doesn't exist, no file is written). The operators "|" (logical "or") and "&" (logical "and") can be used to select portions of the format string depending on the existing tag values. Example: -/.mpd/recorder/[%title%|%name%].ogg (use the "name" tag if no title exists)
* - **encoder NAME**
- Chooses an encoder plugin. A list of encoder plugins can be found in the encoder plugin reference :ref:`encoder_plugins`.
shout
~~~~~
-----
The shout plugin connects to a ShoutCast or IceCast server using libshout. It forwards tags to this server.
You must set a format.
@@ -974,6 +1043,8 @@ You must set a format.
- Set the timeout for the shout connection in seconds. Defaults to 2 seconds.
* - **protocol icecast2|icecast1|shoutcast**
- Specifies the protocol that wil be used to connect to the server. The default is "icecast2".
* - **tls disabled|auto|auto_no_plain|rfc2818|rfc2817**
- Specifies what kind of TLS to use. The default is "disabled" (no TLS).
* - **mount URI**
- Mounts the :program:`MPD` stream in the specified URI.
* - **user USERNAME**
@@ -997,15 +1068,16 @@ You must set a format.
.. _sles_output:
sles
~~~~
----
Plugin using the `OpenSL ES <https://www.khronos.org/opensles/>`__
audio API. Its primary use is local playback on Android, where
:ref:`ALSA <alsa_plugin>` is not available.
:ref:`ALSA <alsa_plugin>` is not available. It supports 16 bit and
floating point samples.
solaris
~~~~~~~
-------
The "Solaris" plugin runs only on SUN Solaris, and plays via /dev/audio.
.. list-table::
@@ -1017,46 +1089,80 @@ The "Solaris" plugin runs only on SUN Solaris, and plays via /dev/audio.
* - **device PATH**
- Sets the path of the audio device, defaults to /dev/audio.
.. _filter_plugins:
Filter plugins
==============
normalize
---------
Normalize the volume during playback (at the expense of quality).
null
----
A no-op filter. Audio data is returned as-is.
route
-----
Reroute channels.
.. list-table::
:widths: 20 80
:header-rows: 1
* - Setting
- Description
* - **routes "0>0, 1>1, ..."**
- Specifies the channel mapping.
.. _playlist_plugins:
Playlist plugins
----------------
================
asx
~~~
---
Reads .asx playlist files.
cue
~~~
---
Reads .cue files.
embcue
~~~~~~
------
Reads CUE sheets from the "CUESHEET" tag of song files.
m3u
~~~
---
Reads .m3u playlist files.
extm3u
~~~~~~
------
Reads extended .m3u playlist files.
flac
~~~~
----
Reads the cuesheet metablock from a FLAC file.
pls
~~~
---
Reads .pls playlist files.
rss
~~~
---
Reads music links from .rss files.
soundcloud
~~~~~~~~~~
----------
Download playlist from SoundCloud. It accepts URIs starting with soundcloud://.
.. list-table::
@@ -1069,5 +1175,5 @@ Download playlist from SoundCloud. It accepts URIs starting with soundcloud://.
- An API key to access the SoundCloud servers.
xspf
~~~~
----
Reads XSPF playlist files.

@@ -14,6 +14,9 @@ Once the client is connected to the server, they conduct a
conversation until the client closes the connection. The
conversation flow is always initiated by the client.
All data between the client and the server is encoded in
UTF-8.
The client transmits a command sequence, terminated by the
newline character ``\n``. The server will
respond with one or more lines, the last of which will be a
@@ -42,9 +45,6 @@ quotation marks.
Argument strings are separated from the command and any other
arguments by linear white-space (' ' or '\\t').
All data between the client and the server is encoded in
UTF-8.
Responses
=========
@@ -52,6 +52,28 @@ A command returns ``OK`` on completion or
``ACK some error`` on failure. These
denote the end of command execution.
Some commands return more data before the response ends with ``OK``.
Each line is usually in the form ``NAME: VALUE``. Example::
foo: bar
OK
.. _binary:
Binary Responses
----------------
Some commands can return binary data. This is initiated by a line
containing ``binary: 1234`` (followed as usual by a newline). After
that, the specified number of bytes of binary data follows, then a
newline, and finally the ``OK`` line. Example::
foo: bar
binary: 42
<42 bytes>
OK
Failure responses
-----------------
@@ -112,9 +134,9 @@ list begins with `command_list_begin` or
`command_list_ok_begin` and ends with
`command_list_end`.
It does not execute any commands until the list has ended.
The return value is whatever the return for a list of commands
is. On success for all commands,
It does not execute any commands until the list has ended. The
response is a concatentation of all individual responses.
On success for all commands,
``OK`` is returned. If a command
fails, no more commands are executed and the appropriate
``ACK`` error is returned. If
@@ -144,15 +166,20 @@ syntax::
``EXPRESSION`` is a string enclosed in parantheses which can be one
of:
- ``(TAG == 'VALUE')``: match a tag value.
``(TAG != 'VALUE')``: mismatch a tag value.
The special tag "*any*" checks all
tag values.
*albumartist* looks for
- ``(TAG == 'VALUE')``: match a tag value; if there are multiple
values of the given type, at least one must match.
``(TAG != 'VALUE')``: mismatch a tag value; if there are multiple
values of the given type, none of them must match.
The special tag ``any`` checks all
tag types.
``AlbumArtist`` looks for
``VALUE`` in ``AlbumArtist``
and falls back to ``Artist`` tags if
``AlbumArtist`` does not exist.
``VALUE`` is what to find.
An empty value string means: match only if the given tag type does
not exist at all; this implies that negation with an empty value
checks for the existence of the given tag type.
- ``(TAG contains 'VALUE')`` checks if the given value is a substring
of the tag value.
@@ -173,12 +200,13 @@ of:
file's time stamp with the given value (ISO 8601 or UNIX
time stamp).
- ``(AudioFormat == 'SAMPLERATE:BITS:CHANNELS')``:
compares the audio format with the given value.
- ``(AudioFormat == 'SAMPLERATE:BITS:CHANNELS')``: compares the audio
format with the given value. See :ref:`audio_output_format` for a
detailed explanation.
- ``(AudioFormat =~ 'SAMPLERATE:BITS:CHANNELS')``:
matches the audio format with the given mask (i.e. one
or more attributes may be "*").
or more attributes may be ``*``).
- ``(!EXPRESSION)``: negate an expression. Note that each expression
must be enclosed in parantheses, e.g. :code:`(!(artist == 'VALUE'))`
@@ -207,11 +235,11 @@ backslash.
Example expression which matches an artist named ``foo'bar"``::
(artist "foo\'bar\"")
(Artist == "foo\'bar\"")
At the protocol level, the command must look like this::
find "(artist \"foo\\'bar\\\"\")"
find "(Artist == \"foo\\'bar\\\"\")"
The double quotes enclosing the artist name must be escaped because
they are inside a double-quoted ``find`` parameter. The single quote
@@ -409,15 +437,18 @@ Querying :program:`MPD`'s status
- ``songid``: playlist songid of the current song stopped on or playing
- ``nextsong`` [#since_0_15]_: playlist song number of the next song to be played
- ``nextsongid`` [#since_0_15]_: playlist songid of the next song to be played
- ``time``: total time elapsed (of current playing/paused song)
- ``time``: total time elapsed (of current playing/paused song) in seconds
(deprecated, use ``elapsed`` instead)
- ``elapsed`` [#since_0_16]_: Total time elapsed within the current song, but with higher resolution.
- ``elapsed`` [#since_0_16]_: Total time elapsed within the
current song in seconds, but with higher resolution.
- ``duration`` [#since_0_20]_: Duration of the current song in seconds.
- ``bitrate``: instantaneous bitrate in kbps
- ``xfade``: ``crossfade`` in seconds
- ``mixrampdb``: ``mixramp`` threshold in dB
- ``mixrampdelay``: ``mixrampdelay`` in seconds
- ``audio``: The format emitted by the decoder plugin during playback, format: ``*samplerate:bits:channels*``. Check the user manual for a detailed explanation.
- ``audio``: The format emitted by the decoder plugin during
playback, format: ``samplerate:bits:channels``. See
:ref:`audio_output_format` for a detailed explanation.
- ``updating_db``: ``job id``
- ``error``: if there is an error, returns message here
@@ -432,8 +463,9 @@ Querying :program:`MPD`'s status
- ``albums``: number of albums
- ``songs``: number of songs
- ``uptime``: daemon uptime in seconds
- ``db_playtime``: sum of all song times in the db
- ``db_update``: last db update in UNIX time
- ``db_playtime``: sum of all song times in the database in seconds
- ``db_update``: last db update in UNIX time (seconds since
1970-01-01 UTC)
- ``playtime``: time length of music played
Playback options
@@ -556,7 +588,7 @@ The Queue
There are two ways to address songs within the queue: by their
position and by their id.
The position is a 1-based index. It is unstable by design: if you
The position is a 0-based index. It is unstable by design: if you
move, delete or insert songs, all following indices will change, and a
client can never be sure what song is behind a given index/position.
@@ -594,7 +626,7 @@ Whenever possible, ids should be used.
Deletes the song ``SONGID`` from the
playlist
:command:`move {FROM} [{START:END} | {TO}]`
:command:`move [{FROM} | {START:END}] {TO}`
Moves the song at ``FROM`` or range of songs
at ``START:END`` [#since_0_15]_ to ``TO``
in the playlist.
@@ -714,7 +746,9 @@ and without the `.m3u` suffix).
Some of the commands described in this section can be used to
run playlist plugins instead of the hard-coded simple
`m3u` parser. They can access playlists in
the music directory (relative path including the suffix) or
the music directory (relative path including the suffix),
playlists in arbitrary location (absolute path including the suffix;
allowed only for clients that are connected via local socket), or
remote playlists (absolute URI with a supported scheme).
:command:`listplaylist {NAME}`
@@ -783,7 +817,7 @@ The music database
Returns the file size and actual number
of bytes read at the requested offset, followed
by the chunk requested as raw bytes, then a
by the chunk requested as raw bytes (see :ref:`binary`), then a
newline and the completion code.
Example::
@@ -853,8 +887,7 @@ The music database
:command:`list {TYPE} {FILTER} [group {GROUPTYPE}]`
Lists unique tags values of the specified type.
``TYPE`` can be any tag supported by
:program:`MPD` or
*file*.
:program:`MPD`.
Additional arguments may specify a :ref:`filter <filter_syntax>`.
The *group* keyword may be used
@@ -865,6 +898,10 @@ The music database
list album group albumartist
``list file`` was implemented in an early :program:`MPD` version,
but does not appear to make a lot of sense. It still works (to
avoid breaking compatibility), but is deprecated.
.. _command_listall:
:command:`listall [URI]`
@@ -909,7 +946,7 @@ The music database
.. _command_lsinfo:
:command:`lsinfo {URI}`
:command:`lsinfo [URI]`
Lists the contents of the directory
``URI``. The response contains records
starting with ``file``,
@@ -924,7 +961,7 @@ The music database
This command may be used to list metadata of remote
files (e.g. URI beginning with "http://" or "smb://").
Clients that are connected via UNIX domain socket may
Clients that are connected via local socket may
use this command to read the tags of an arbitrary local
file (URI is an absolute path).
@@ -1046,7 +1083,8 @@ Stickers
"Stickers" [#since_0_15]_ are pieces of
information attached to existing
:program:`MPD` objects (e.g. song files,
directories, albums). Clients can create arbitrary name/value
directories, albums; but currently, they are only implemented for
song). Clients can create arbitrary name/value
pairs. :program:`MPD` itself does not assume
any special meaning in them.
@@ -1131,7 +1169,7 @@ Connection settings
``tagtypes`` sub commands configure this
list.
:command:`tagtypes disable {NAME...]`
:command:`tagtypes disable {NAME...}`
Remove one or more tags from the list of tag types the
client is interested in. These will be omitted from
responses to this client.
@@ -1215,7 +1253,7 @@ Reflection
:command:`config`
Dumps configuration values that may be interesting for
the client. This command is only permitted to "local"
clients (connected via UNIX domain socket).
clients (connected via local socket).
The following response attributes are available:

@@ -54,7 +54,7 @@ Download the source tarball from the `MPD home page <https://musicpd.org>`_ and
In any case, you need:
* a C++14 compiler (e.g. gcc 6.0 or clang 3.9)
* `Meson 0.47.2 <http://mesonbuild.com/>`__ and `Ninja
* `Meson 0.49.0 <http://mesonbuild.com/>`__ and `Ninja
<https://ninja-build.org/>`__
* Boost 1.58
* pkg-config
@@ -62,16 +62,16 @@ In any case, you need:
Each plugin usually needs a codec library, which you also need to
install. Check the :doc:`plugins` for details about required libraries
For example, the following installs a fairly complete list of build dependencies on Debian Jessie:
For example, the following installs a fairly complete list of build dependencies on Debian Buster:
.. code-block:: none
apt install g++ \
apt install meson g++ \
libpcre3-dev \
libmad0-dev libmpg123-dev libid3tag0-dev \
libflac-dev libvorbis-dev libopus-dev \
libflac-dev libvorbis-dev libopus-dev libogg-dev \
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
libfluidsynth-dev libgme-dev libmikmod2-dev libmodplug-dev \
libfluidsynth-dev libgme-dev libmikmod-dev libmodplug-dev \
libmpcdec-dev libwavpack-dev libwildmidi-dev \
libsidplay2-dev libsidutils-dev libresid-builder-dev \
libavcodec-dev libavformat-dev \
@@ -88,10 +88,12 @@ For example, the following installs a fairly complete list of build dependencies
libupnp-dev \
libavahi-client-dev \
libsqlite3-dev \
libsystemd-dev libwrap0-dev \
libsystemd-dev \
libgtest-dev \
libboost-dev \
libicu-dev
libicu-dev \
libchromaprint-dev \
libgcrypt20-dev
Now configure the source tree:
@@ -276,7 +278,9 @@ You can also use multiple storage plugins to assemble a virtual music directory
Configuring database plugins
----------------------------
If a music directory is configured, one database plugin is used. To configure this plugin, add a database block to :file:`mpd.conf`:
If a music directory is configured, one database plugin is used. To
configure this plugin, add a :code:`database` block to
:file:`mpd.conf`:
.. code-block:: none
@@ -291,7 +295,9 @@ reference.
Configuring neighbor plugins
----------------------------
All neighbor plugins are disabled by default to avoid unwanted overhead. To enable (and configure) a plugin, add a neighbor block to :file:`mpd.conf`:
All neighbor plugins are disabled by default to avoid unwanted
overhead. To enable (and configure) a plugin, add a :code:`neighbor`
block to :file:`mpd.conf`:
.. code-block:: none
@@ -304,7 +310,8 @@ More information can be found in the :ref:`neighbor_plugin` reference.
Configuring input plugins
-------------------------
To configure an input plugin, add a input block to :file:`mpd.conf`:
To configure an input plugin, add an :code:`input` block to
:file:`mpd.conf`:
.. code-block:: none
@@ -332,7 +339,8 @@ More information can be found in the :ref:`input_plugins` reference.
Configuring decoder plugins
---------------------------
Most decoder plugins do not need any special configuration. To configure a decoder, add a decoder block to :file:`mpd.conf`:
Most decoder plugins do not need any special configuration. To
configure a decoder, add a :code:`decoder` block to :file:`mpd.conf`:
.. code-block:: none
@@ -359,16 +367,21 @@ More information can be found in the :ref:`decoder_plugins` reference.
Configuring encoder plugins
---------------------------
Encoders are used by some of the output plugins (such as shout). The encoder settings are included in the audio_output section.
Encoders are used by some of the output plugins (such as shout). The
encoder settings are included in the ``audio_output`` section, see :ref:`config_audio_output`.
More information can be found in the :ref:`encoder_plugins` reference.
.. _config_audio_output:
Configuring audio outputs
-------------------------
Audio outputs are devices which actually play the audio chunks produced by :program:`MPD`. You can configure any number of audio output devices, but there must be at least one. If none is configured, :program:`MPD` attempts to auto-detect. Usually, this works quite well with ALSA, OSS and on Mac OS X.
To configure an audio output manually, add one or more audio_output blocks to :file:`mpd.conf`:
To configure an audio output manually, add one or more
:code:`audio_output` blocks to :file:`mpd.conf`:
.. code-block:: none
@@ -391,14 +404,9 @@ The following table lists the audio_output options valid for all plugins:
- The name of the plugin
* - **name**
- The name of the audio output. It is visible to the client. Some plugins also use it internally, e.g. as a name registered in the PULSE server.
* - **format**
- Always open the audio output with the specified audio format samplerate:bits:channels), regardless of the format of the input file. This is optional for most plugins.
Any of the three attributes may be an asterisk to specify that this attribute should not be enforced, example: 48000:16:*. *:*:* is equal to not having a format specification.
The following values are valid for bits: 8 (signed 8 bit integer samples), 16, 24 (signed 24 bit integer samples padded to 32 bit), 32 (signed 32 bit integer samples), f (32 bit floating point, -1.0 to 1.0), "dsd" means DSD (Direct Stream Digital). For DSD, there are special cases such as "dsd64", which allows you to omit the sample rate (e.g. dsd512:2 for stereo DSD512, i.e. 22.5792 MHz).
The sample rate is special for DSD: :program:`MPD` counts the number of bytes, not bits. Thus, a DSD "bit" rate of 22.5792 MHz (DSD512) is 2822400 from :program:`MPD`'s point of view (44100*512/8).
* - **format samplerate:bits:channels**
- Always open the audio output with the specified audio format, regardless of the format of the input file. This is optional for most plugins.
See :ref:`audio_output_format` for a detailed description of the value.
* - **enabed yes|no**
- Specifies whether this audio output is enabled when :program:`MPD` is started. By default, all audio outputs are enabled. This is just the default setting when there is no state file; with a state file, the previous state is restored.
* - **tags yes|no**
@@ -406,14 +414,30 @@ The following table lists the audio_output options valid for all plugins:
* - **always_on yes|no**
- If set to yes, then :program:`MPD` attempts to keep this audio output always open. This may be useful for streaming servers, when you don't want to disconnect all listeners even when playback is accidentally stopped.
* - **mixer_type hardware|software|null|none**
- Specifies which mixer should be used for this audio output: the hardware mixer (available for ALSA :ref:`alsa_plugin`, OSS :ref:`oss_plugin` and PulseAudio :ref:`pulse_plugin`), the software mixer, the "null" mixer (null; allows setting the volume, but with no effect; this can be used as a trick to implement an external mixer :ref:`external_mixer`) or no mixer (none). By default, the hardware mixer is used for devices which support it, and none for the others.
- Specifies which mixer should be used for this audio output: the
hardware mixer (available for ALSA :ref:`alsa_plugin`, OSS
:ref:`oss_plugin` and PulseAudio :ref:`pulse_plugin`), the
software mixer, the ":samp:`null`" mixer (allows setting the
volume, but with no effect; this can be used as a trick to
implement an external mixer :ref:`external_mixer`) or no mixer
(:samp:`none`). By default, the hardware mixer is used for
devices which support it, and none for the others.
* - **filters "name,...**"
- The specified configured filters are instantiated in the given
order. Each filter name refers to a ``filter`` block, see
:ref:`config_filter`.
More information can be found in the :ref:`output_plugins` reference.
.. _config_filter:
Configuring filters
-------------------
Filters are plugins which modify an audio stream.
To configure a filter, add a filter block to :file:`mpd.conf`:
To configure a filter, add a :code:`filter` block to :file:`mpd.conf`:
.. code-block:: none
@@ -422,6 +446,9 @@ To configure a filter, add a filter block to :file:`mpd.conf`:
name "software volume"
}
Configured filters may then be added to the ``filters`` setting of an
``audio_output`` section, see :ref:`config_audio_output`.
The following table lists the filter options valid for all plugins:
.. list-table::
@@ -435,12 +462,18 @@ The following table lists the filter options valid for all plugins:
* - **name**
- The name of the filter
More information can be found in the :ref:`filter_plugins` reference.
Configuring playlist plugins
----------------------------
Playlist plugins are used to load remote playlists (protocol commands load, listplaylist and listplaylistinfo). This is not related to :program:`MPD`'s playlist directory.
Playlist plugins are used to load remote playlists (protocol commands
load, listplaylist and listplaylistinfo). This is not related to
:program:`MPD`'s :ref:`playlist directory <stored_playlists>`.
To configure a playlist plugin, add a playlist_plugin block to :file:`mpd.conf`:
To configure a playlist plugin, add a :code:`playlist_plugin` block to
:file:`mpd.conf`:
.. code-block:: none
@@ -468,13 +501,34 @@ reference.
Audio Format Settings
---------------------
Global Audio Format
~~~~~~~~~~~~~~~~~~~
.. _audio_output_format:
The setting audio_output_format forces :program:`MPD` to use one audio format for all outputs. Doing that is usually not a good idea. The values are the same as in format in the audio_output section.
Global Audio Format
^^^^^^^^^^^^^^^^^^^
The setting ``audio_output_format`` forces :program:`MPD` to use one
audio format for all outputs. Doing that is usually not a good idea.
The value is specified as ``samplerate:bits:channels``.
Any of the three attributes may be an asterisk to specify that this
attribute should not be enforced, example: ``48000:16:*``.
``*:*:*`` is equal to not having a format specification.
The following values are valid for bits: ``8`` (signed 8 bit integer
samples), ``16``, ``24`` (signed 24 bit integer samples padded to 32
bit), ``32`` (signed 32 bit integer samples), ``f`` (32 bit floating
point, -1.0 to 1.0), ``dsd`` means DSD (Direct Stream Digital). For
DSD, there are special cases such as ``dsd64``, which allows you to
omit the sample rate (e.g. ``dsd512:2`` for stereo DSD512,
i.e. 22.5792 MHz).
The sample rate is special for DSD: :program:`MPD` counts the number
of bytes, not bits. Thus, a DSD "bit" rate of 22.5792 MHz (DSD512) is
2822400 from :program:`MPD`'s point of view (44100*512/8).
Resampler
~~~~~~~~~
^^^^^^^^^
Sometimes, music needs to be resampled before it can be played; for example, CDs use a sample rate of 44,100 Hz while many cheap audio chips can only handle 48,000 Hz. Resampling reduces the quality and consumes a lot of CPU. There are different options, some of them optimized for high quality and others for low CPU usage, but you can't have both at the same time. Often, the resampler is the component that is responsible for most of :program:`MPD`'s CPU usage. Since :program:`MPD` comes with high quality defaults, it may appear that :program:`MPD` consumes more CPU than other software.
@@ -487,7 +541,7 @@ Client Connections
.. _listeners:
Listeners
~~~~~~~~~
^^^^^^^^^
The setting :code:`bind_to_address` specifies which addresses
:program:`MPD` listens on for connections from clients. It can be
@@ -514,6 +568,12 @@ choice::
bind_to_address "/var/run/mpd/socket"
On Linux, local sockets can be bound to a name without a socket inode
on the filesystem; MPD implements this by prepending ``@`` to the
address::
bind_to_address "@mpd"
If no port is specified, the default port is 6600. This default can
be changed with the port setting::
@@ -524,7 +584,7 @@ used.
Permissions and Passwords
~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^
By default, all clients are unauthenticated and have a full set of permissions. This can be restricted with the settings :code:`default_permissions` and :code:`password`.
@@ -587,7 +647,7 @@ Other Settings
Section :ref:`tags` contains a list of supported tags.
The State File
~~~~~~~~~~~~~~
^^^^^^^^^^^^^^
The state file is a file where :program:`MPD` saves and restores its state (play queue, playback position etc.) to keep it persistent across restarts and reboots. It is an optional setting.
@@ -605,7 +665,7 @@ The State File
- Auto-save the state file this number of seconds after each state change. Defaults to 120 (2 minutes).
The Sticker Database
~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^
"Stickers" are pieces of information attached to songs. Some clients
use them to store ratings and other volatile data. This feature
@@ -622,7 +682,7 @@ requires :program:`SQLite`, compile-time configure option
- The location of the sticker database.
Resource Limitations
~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^
These settings are various limitations to prevent :program:`MPD` from using too many resources (denial of service).
@@ -635,7 +695,7 @@ These settings are various limitations to prevent :program:`MPD` from using too
* - **connection_timeout SECONDS**
- If a client does not send any new data in this time period, the connection is closed. Clients waiting in "idle" mode are excluded from this. Default is 60.
* - **max_connections NUMBER**
- This specifies the maximum number of clients that can be connected to :program:`MPD` at the same time. Default is 5.
- This specifies the maximum number of clients that can be connected to :program:`MPD` at the same time. Default is 100.
* - **max_playlist_length NUMBER**
- The maximum number of songs that can be in the playlist. Default is 16384.
* - **max_command_list_size KBYTES**
@@ -644,7 +704,7 @@ These settings are various limitations to prevent :program:`MPD` from using too
- The maximum size of the output buffer to a client (maximum response size). Default is 8192 (8 MiB).
Buffer Settings
~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^
Do not change these unless you know what you are doing.
@@ -658,7 +718,7 @@ Do not change these unless you know what you are doing.
- Adjust the size of the internal audio buffer. Default is 4096 (4 MiB).
Zeroconf
~~~~~~~~
^^^^^^^^
If Zeroconf support (`Avahi <http://avahi.org/>`_ or Apple's Bonjour)
was enabled at compile time with :code:`-Dzeroconf=...`,
@@ -744,10 +804,12 @@ You can verify whether the real-time scheduler is active with the ps command:
The CLS column shows the CPU scheduler; TS is the normal scheduler; FF and RR are real-time schedulers. In this example, two threads use the real-time scheduler: the output thread and the rtio (real-time I/O) thread; these two are the important ones. The database update thread uses the idle scheduler ("IDL in ps), which only gets CPU when no other process needs it.
Note
~~~~
.. note::
There is a rumor that real-time scheduling improves audio quality. That is not true. All it does is reduce the probability of skipping (audio buffer xruns) when the computer is under heavy load.
There is a rumor that real-time scheduling improves audio
quality. That is not true. All it does is reduce the probability of
skipping (audio buffer xruns) when the computer is under heavy
load.
Using MPD
*********
@@ -775,7 +837,7 @@ Depending on the size of your music collection and the speed of the storage, thi
To exclude a file from the update, create a file called :file:`.mpdignore` in its parent directory. Each line of that file may contain a list of shell wildcards. Matching files in the current directory and all subdirectories are excluded.
Mounting other storages into the music directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:program:`MPD` has various storage plugins of which multiple instances can be "mounted" into the music directory. This way, you can use local music, file servers and USB sticks at the same time. Example:
@@ -817,10 +879,16 @@ The queue
The queue (sometimes called "current playlist") is a list of songs to be played by :program:`MPD`. To play a song, add it to the queue and start playback. Most clients offer an interface to edit the queue.
.. _stored_playlists:
Stored Playlists
----------------
Stored playlists are some kind of secondary playlists which can be created, saved, edited and deleted by the client. They are addressed by their names. Its contents can be loaded into the queue, to be played back. The playlist_directory setting specifies where those playlists are stored.
Stored playlists are some kind of secondary playlists which can be
created, saved, edited and deleted by the client. They are addressed
by their names. Its contents can be loaded into the queue, to be
played back. The :code:`playlist_directory` setting specifies where
those playlists are stored.
Advanced usage
**************
@@ -837,7 +905,7 @@ To verify if :program:`MPD` converts the audio format, enable verbose logging, a
.. code-block:: none
decoder: audio_format=44100:24:2, seekable=true
output: opened plugin=alsa name="An ALSA output"audio_format=44100:16:2
output: opened plugin=alsa name="An ALSA output" audio_format=44100:16:2
output: converting from 44100:24:2
This example shows that a 24 bit file is being played, but the sound chip cannot play 24 bit. It falls back to 16 bit, discarding 8 bit.
@@ -860,9 +928,11 @@ Obey the "format" row, which indicates that the current playback format is 16 bi
Check list for bit-perfect playback:
* Use the ALSA output plugin.
* Disable sound processing inside ALSA by configuring a "hardware" device (hw:0,0 or similar).
* Don't use software volume (setting mixer_type).
* Don't force :program:`MPD` to use a specific audio format (settings format, audio_output_format).
* Disable sound processing inside ALSA by configuring a "hardware"
device (:samp:`hw:0,0` or similar).
* Don't use software volume (setting :code:`mixer_type`).
* Don't force :program:`MPD` to use a specific audio format (settings
:code:`format`, :ref:`audio_output_format <audio_output_format>`).
* Verify that you are really doing bit-perfect playback using :program:`MPD`'s verbose log and :file:`/proc/asound/card*/pcm*p/sub*/hw_params`. Some DACs can also indicate the audio format.
Direct Stream Digital (DSD)
@@ -877,7 +947,11 @@ DSD (`Direct Stream Digital <https://en.wikipedia.org/wiki/Direct_Stream_Digital
* DoP (DSD over PCM) playback. This wraps DSD inside fake 24 bit PCM according to the DoP standard. Requires a DAC that supports DSD. No support from ALSA and the sound chip required (except for bit-perfect 24 bit PCM support).
* Convert DSD to PCM on-the-fly.
Native DSD playback is used automatically if available. DoP is only used if enabled explicitly using the dop option, because there is no way for :program:`MPD` to find out whether the DAC supports it. DSD to PCM conversion is the fallback if DSD cannot be used directly.
Native DSD playback is used automatically if available. DoP is only
used if enabled explicitly using the :code:`dop` option, because there
is no way for :program:`MPD` to find out whether the DAC supports
it. DSD to PCM conversion is the fallback if DSD cannot be used
directly.
Client Hacks
************
@@ -909,18 +983,18 @@ Support
-------
Getting Help
~~~~~~~~~~~~
^^^^^^^^^^^^
The :program:`MPD` project runs a `forum <https://forum.musicpd.org/>`_ and an IRC channel (#mpd on Freenode) for requesting help. Visit the MPD help page for details on how to get help.
Common Problems
~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^
1. Database
^^^^^^^^^^^
"""""""""""
Question: I can't see my music in the MPD database!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Check your :code:`music_directory` setting.
* Does the MPD user have read permission on all music files, and read+execute permission on all music directories (and all of their parent directories)?
@@ -928,22 +1002,22 @@ Question: I can't see my music in the MPD database!
* Did you enable all relevant decoder plugins at compile time? :command:`mpd --version` will tell you.
Question: MPD doesn't read ID3 tags!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* You probably compiled :program:`MPD` without libid3tag. :command:`mpd --version` will tell you.
2. Playback
^^^^^^^^^^^
"""""""""""
Question: I can't hear music on my client!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* That problem usually follows a misunderstanding of the nature of :program:`MPD`. :program:`MPD` is a remote-controlled music player, not a music distribution system. Usually, the speakers are connected to the box where :program:`MPD` runs, and the :program:`MPD` client only sends control commands, but the client does not actually play your music.
:program:`MPD` has output plugins which allow hearing music on a remote host (such as httpd), but that is not :program:`MPD`'s primary design goal.
Question: "Device or resource busy"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* This ALSA error means that another program uses your sound hardware exclusively. You can stop that program to allow :program:`MPD` to use it.
@@ -962,7 +1036,7 @@ Your bug report should contain:
* be clear about what you expect MPD to do, and what is actually happening
MPD crashes
~~~~~~~~~~~
^^^^^^^^^^^
All :program:`MPD` crashes are bugs which must be fixed by a developer, and you should write a bug report. (Many crash bugs are caused by codec libraries used by :program:`MPD`, and then that library must be fixed; but in any case, the :program:`MPD` `bug tracker <https://github.com/MusicPlayerDaemon/MPD/issues>`_ is a good place to report it first if you don't know.)

@@ -1,11 +1,12 @@
project(
'mpd',
['c', 'cpp'],
version: '0.21.2',
meson_version: '>= 0.47.2',
version: '0.21.26',
meson_version: '>= 0.49.0',
default_options: [
'c_std=c99',
'cpp_std=c++14'
'cpp_std=c++14',
'warning_level=2',
],
license: 'GPLv2+',
)
@@ -15,12 +16,18 @@ version_cxx = vcs_tag(input: 'src/GitVersion.cxx', output: 'GitVersion.cxx')
compiler = meson.get_compiler('cpp')
c_compiler = meson.get_compiler('c')
if compiler.get_id() == 'gcc' and compiler.version().version_compare('<6')
warning('Your GCC version is too old. You need at least version 6.')
elif compiler.get_id() == 'clang' and compiler.version().version_compare('<3')
warning('Your clang version is too old. You need at least version 3.')
endif
conf = configuration_data()
conf.set_quoted('PACKAGE', meson.project_name())
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('PROTOCOL_VERSION', '0.21.0')
conf.set_quoted('PROTOCOL_VERSION', '0.21.11')
conf.set_quoted('SYSTEM_CONFIG_FILE_LOCATION', join_paths(get_option('prefix'), get_option('sysconfdir'), 'mpd.conf'))
common_cppflags = [
@@ -34,9 +41,6 @@ common_cxxflags = [
]
test_common_flags = [
'-Wall',
'-Wextra',
'-fvisibility=hidden',
'-ffast-math',
@@ -82,6 +86,10 @@ test_ldflags = [
]
if get_option('buildtype') != 'debug'
test_cxxflags += [
'-ffunction-sections',
'-fdata-sections',
]
test_cflags += [
'-ffunction-sections',
'-fdata-sections',
@@ -99,7 +107,7 @@ is_linux = host_machine.system() == 'linux'
is_android = get_option('android_ndk') != ''
is_darwin = host_machine.system() == 'darwin'
is_windows = host_machine.system() == 'windows'
is_haiku = host_machine.system() == 'haiku' # TODO is this correct?
is_haiku = host_machine.system() == 'haiku'
if is_android
common_cppflags += '-DANDROID'
@@ -132,7 +140,13 @@ conf.set('HAVE_GETPWNAM_R', compiler.has_function('getpwnam_r'))
conf.set('HAVE_GETPWUID_R', compiler.has_function('getpwuid_r'))
conf.set('HAVE_INITGROUPS', compiler.has_function('initgroups'))
conf.set('HAVE_FNMATCH', compiler.has_function('fnmatch'))
conf.set('HAVE_STRNDUP', compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
# Explicitly exclude Windows in this check because
# https://github.com/mesonbuild/meson/issues/3672 (reported in 2018,
# still not fixed in 2020) causes Meson to believe it exists, because
# __builtin_strndup() exists (but strndup() still cannot be used).
conf.set('HAVE_STRNDUP', not is_windows and compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
conf.set('HAVE_STRCASESTR', compiler.has_function('strcasestr'))
conf.set('HAVE_PRCTL', is_linux)
@@ -280,6 +294,7 @@ if not is_android
else
sources += [
'src/android/Context.cxx',
'src/android/AudioManager.cxx',
'src/android/Environment.cxx',
'src/android/LogListener.cxx',
]
@@ -298,10 +313,14 @@ if enable_database
endif
subdir('src/util')
subdir('src/time')
subdir('src/system')
subdir('src/thread')
subdir('src/net')
subdir('src/event')
subdir('src/apple')
subdir('src/lib/dbus')
subdir('src/lib/icu')
subdir('src/lib/smbclient')
@@ -312,7 +331,6 @@ subdir('src/lib/curl')
subdir('src/lib/expat')
subdir('src/lib/ffmpeg')
subdir('src/lib/gcrypt')
subdir('src/lib/wrap')
subdir('src/lib/nfs')
subdir('src/lib/oss')
subdir('src/lib/pcre')
@@ -325,7 +343,6 @@ subdir('src/lib/yajl')
subdir('src/fs')
subdir('src/config')
subdir('src/net')
subdir('src/tag')
subdir('src/pcm')
subdir('src/neighbor')
@@ -368,8 +385,10 @@ basic_dep = declare_dependency(
if enable_database
subdir('src/storage')
subdir('src/db')
else
storage_glue_dep = dependency('', required: false)
endif
subdir('src/db')
if neighbor_glue_dep.found()
sources += 'src/command/NeighborCommands.cxx'
@@ -378,8 +397,11 @@ endif
if archive_glue_dep.found()
sources += [
'src/TagArchive.cxx',
'src/db/update/Archive.cxx',
]
if enable_database
sources += ['src/db/update/Archive.cxx']
endif
endif
if is_windows
@@ -391,6 +413,7 @@ more_deps = []
if is_android
subdir('src/java')
target_type = 'shared_library'
target_name = 'mpd'
link_args += [
'-Wl,--no-undefined,-shared,-Bsymbolic',
'-llog',
@@ -400,12 +423,20 @@ if is_android
declare_dependency(sources: [classes_jar]),
java_dep,
]
elif is_haiku
target_type = 'executable'
target_name = 'mpd.nores'
link_args += [
'-lnetwork',
'-lbe',
]
else
target_type = 'executable'
target_name = 'mpd'
endif
mpd = build_target(
'mpd',
target_name,
sources,
target_type: target_type,
include_directories: inc,
@@ -432,7 +463,6 @@ mpd = build_target(
systemd_dep,
sqlite_dep,
zeroconf_dep,
libwrap_dep,
more_deps,
],
link_args: link_args,
@@ -445,6 +475,14 @@ endif
if is_haiku
subdir('src/haiku')
custom_target(
'mpd',
output: 'mpd',
input: [mpd, rsrc],
command: [addres, '@OUTPUT@', '@INPUT0@', '@INPUT1@'],
install: true,
install_dir: get_option('bindir'),
)
endif
configure_file(output: 'config.h', configuration: conf)

@@ -128,6 +128,7 @@ option('mpg123', type: 'feature', description: 'MP3 decoder using libmpg123')
option('opus', type: 'feature', description: 'Opus decoder plugin')
option('sidplay', type: 'feature', description: 'C64 SID support via libsidplayfp or libsidplay2')
option('sndfile', type: 'feature', description: 'libsndfile decoder plugin')
option('tremor', type: 'feature', description: 'Fixed-point vorbis decoder plugin')
option('vorbis', type: 'feature', description: 'Vorbis decoder plugin')
option('wavpack', type: 'feature', description: 'WavPack decoder plugin')
option('wildmidi', type: 'feature', description: 'WildMidi decoder plugin')
@@ -175,7 +176,6 @@ option('dbus', type: 'feature', description: 'D-Bus support')
option('expat', type: 'feature', description: 'Expat XML support')
option('icu', type: 'feature', description: 'Use libicu for Unicode')
option('iconv', type: 'feature', description: 'Use iconv() for character set conversion')
option('libwrap', type: 'feature', description: 'libwrap support')
option('pcre', type: 'feature', description: 'Enable regular expression support (using libpcre)')
option('sqlite', type: 'feature', description: 'SQLite database support (for stickers)')
option('yajl', type: 'feature', description: 'libyajl for YAML support')

45
python/build/cmake.py Normal file

@@ -0,0 +1,45 @@
import subprocess
from build.project import Project
def configure(toolchain, src, build, args=()):
cross_args = []
if toolchain.is_windows:
cross_args.append('-DCMAKE_SYSTEM_NAME=Windows')
cross_args.append('-DCMAKE_RC_COMPILER=' + toolchain.windres)
configure = [
'cmake',
src,
'-DCMAKE_INSTALL_PREFIX=' + toolchain.install_prefix,
'-DCMAKE_BUILD_TYPE=release',
'-DCMAKE_C_COMPILER=' + toolchain.cc,
'-DCMAKE_CXX_COMPILER=' + toolchain.cxx,
'-DCMAKE_C_FLAGS=' + toolchain.cflags + ' ' + toolchain.cppflags,
'-DCMAKE_CXX_FLAGS=' + toolchain.cxxflags + ' ' + toolchain.cppflags,
'-GNinja',
] + cross_args + args
subprocess.check_call(configure, env=toolchain.env, cwd=build)
class CmakeProject(Project):
def __init__(self, url, md5, installed, configure_args=[],
**kwargs):
Project.__init__(self, url, md5, installed, **kwargs)
self.configure_args = configure_args
def configure(self, toolchain):
src = self.unpack(toolchain)
build = self.make_build_path(toolchain)
configure(toolchain, src, build, self.configure_args)
return build
def build(self, toolchain):
build = self.configure(toolchain)
subprocess.check_call(['ninja', 'install'],
cwd=build, env=toolchain.env)

@@ -4,19 +4,20 @@ from os.path import abspath
from build.project import Project
from build.zlib import ZlibProject
from build.meson import MesonProject
from build.cmake import CmakeProject
from build.autotools import AutotoolsProject
from build.ffmpeg import FfmpegProject
from build.boost import BoostProject
libmpdclient = MesonProject(
'https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.16.tar.xz',
'fa6bdab67c0e0490302b38f00c27b4959735c3ec8aef7a88327adb1407654464',
'https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.19.tar.xz',
'158aad4c2278ab08e76a3f2b0166c99b39fae00ee17231bd225c5a36e977a189',
'lib/libmpdclient.a',
)
libogg = AutotoolsProject(
'http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.xz',
'4f3fc6178a533d392064f14776b23c397ed4b9f48f5de297aba73b643f955c08',
'http://downloads.xiph.org/releases/ogg/libogg-1.3.4.tar.xz',
'c163bc12bc300c401b6aa35907ac682671ea376f13ae0969a220f7ddf71893fe',
'lib/libogg.a',
[
'--disable-shared', '--enable-static',
@@ -24,8 +25,8 @@ libogg = AutotoolsProject(
)
libvorbis = AutotoolsProject(
'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.tar.xz',
'af00bb5a784e7c9e69f56823de4637c350643deedaf333d0fa86ecdba6fcb415',
'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz',
'b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b',
'lib/libvorbis.a',
[
'--disable-shared', '--enable-static',
@@ -38,8 +39,8 @@ libvorbis = AutotoolsProject(
)
opus = AutotoolsProject(
'https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz',
'4f3d69aefdf2dbaf9825408e452a8a414ffc60494c70633560700398820dc550',
'https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz',
'65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d',
'lib/libopus.a',
[
'--disable-shared', '--enable-static',
@@ -52,8 +53,8 @@ opus = AutotoolsProject(
)
flac = AutotoolsProject(
'http://downloads.xiph.org/releases/flac/flac-1.3.2.tar.xz',
'91cfc3ed61dc40f47f050a109b08610667d73477af6ef36dcad31c31a4a8d53f',
'http://downloads.xiph.org/releases/flac/flac-1.3.3.tar.xz',
'213e82bd716c9de6db2f98bcadbc4c24c7e2efe8c75939a1a84e28539c4e1748',
'lib/libFLAC.a',
[
'--disable-shared', '--enable-static',
@@ -111,9 +112,44 @@ liblame = AutotoolsProject(
],
)
libmodplug = AutotoolsProject(
'https://downloads.sourceforge.net/modplug-xmms/libmodplug/0.8.9.0/libmodplug-0.8.9.0.tar.gz',
'457ca5a6c179656d66c01505c0d95fafaead4329b9dbaa0f997d00a3508ad9de',
'lib/libmodplug.a',
[
'--disable-shared', '--enable-static',
],
)
wildmidi = CmakeProject(
'https://codeload.github.com/Mindwerks/wildmidi/tar.gz/wildmidi-0.4.3',
'498e5a96455bb4b91b37188ad6dcb070824e92c44f5ed452b90adbaec8eef3c5',
'lib/libWildMidi.a',
[
'-DBUILD_SHARED_LIBS=OFF',
'-DWANT_PLAYER=OFF',
'-DWANT_STATIC=ON',
],
base='wildmidi-wildmidi-0.4.3',
name='wildmidi',
version='0.4.3',
)
gme = CmakeProject(
'https://bitbucket.org/mpyne/game-music-emu/downloads/game-music-emu-0.6.3.tar.xz',
'aba34e53ef0ec6a34b58b84e28bf8cfbccee6585cebca25333604c35db3e051d',
'lib/libgme.a',
[
'-DBUILD_SHARED_LIBS=OFF',
'-DENABLE_UBSAN=OFF',
'-DZLIB_INCLUDE_DIR=OFF',
'-DSDL2_DIR=OFF',
],
)
ffmpeg = FfmpegProject(
'http://ffmpeg.org/releases/ffmpeg-4.0.2.tar.xz',
'a95c0cc9eb990e94031d2183f2e6e444cc61c99f6f182d1575c433d62afb2f97',
'http://ffmpeg.org/releases/ffmpeg-4.3.1.tar.xz',
'ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb',
'lib/libavcodec.a',
[
'--disable-shared', '--enable-static',
@@ -341,8 +377,8 @@ ffmpeg = FfmpegProject(
)
curl = AutotoolsProject(
'http://curl.haxx.se/download/curl-7.61.1.tar.xz',
'3d5913d6a39bd22e68e34dff697fd6e4c3c81563f580c76fca2009315cd81891',
'http://curl.haxx.se/download/curl-7.72.0.tar.xz',
'0ded0808c4d85f2ee0db86980ae610cc9d165e9ca9da466196cc73c346513713',
'lib/libcurl.a',
[
'--disable-shared', '--enable-static',
@@ -358,6 +394,11 @@ curl = AutotoolsProject(
'--disable-manual',
'--disable-threaded-resolver', '--disable-verbose', '--disable-sspi',
'--disable-crypto-auth', '--disable-ntlm-wb', '--disable-tls-srp', '--disable-cookies',
'--disable-doh',
'--disable-mime',
'--disable-netrc',
'--disable-progress-meter',
'--disable-alt-svc',
'--without-ssl', '--without-gnutls', '--without-nss', '--without-libssh2',
],
@@ -365,8 +406,8 @@ curl = AutotoolsProject(
)
libexpat = AutotoolsProject(
'https://github.com/libexpat/libexpat/releases/download/R_2_2_6/expat-2.2.6.tar.bz2',
'17b43c2716d521369f82fc2dc70f359860e90fa440bea65b3b85f0b246ea81f2',
'https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.bz2',
'f1063084dc4302a427dabcca499c8312b3a32a29b7d2506653ecc8f950a9a237',
'lib/libexpat.a',
[
'--disable-shared', '--enable-static',
@@ -375,8 +416,8 @@ libexpat = AutotoolsProject(
)
libnfs = AutotoolsProject(
'https://github.com/sahlberg/libnfs/archive/libnfs-3.0.0.tar.gz',
'445d92c5fc55e4a5b115e358e60486cf8f87ee50e0103d46a02e7fb4618566a5',
'https://github.com/sahlberg/libnfs/archive/libnfs-4.0.0.tar.gz',
'6ee77e9fe220e2d3e3b1f53cfea04fb319828cc7dbb97dd9df09e46e901d797d',
'lib/libnfs.a',
[
'--disable-shared', '--enable-static',
@@ -387,12 +428,12 @@ libnfs = AutotoolsProject(
'--disable-utils', '--disable-examples',
],
base='libnfs-libnfs-3.0.0',
base='libnfs-libnfs-4.0.0',
autoreconf=True,
)
boost = BoostProject(
'http://downloads.sourceforge.net/project/boost/boost/1.68.0/boost_1_68_0.tar.bz2',
'7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7',
'https://dl.bintray.com/boostorg/release/1.74.0/source/boost_1_74_0.tar.bz2',
'83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1',
'include/boost/version.hpp',
)

@@ -91,7 +91,12 @@ def configure(toolchain, src, build, args=()):
'--cross-file', cross_file,
] + args
subprocess.check_call(configure, env=toolchain.env)
env = toolchain.env.copy()
# Meson 0.54 requires the BOOST_ROOT environment variable
env['BOOST_ROOT'] = toolchain.install_prefix
subprocess.check_call(configure, env=env)
class MesonProject(Project):
def __init__(self, url, md5, installed, configure_args=[],

@@ -1,47 +0,0 @@
#!/usr/bin/env ruby
#
# This script verifies that every source includes config.h first.
# This is very important for consistent Large File Support.
#
def check_file(file)
first = true
file.each_line do |line|
if line =~ /^\#include\s+(\S+)/ then
if $1 == '"config.h"'
unless first
puts "#{file.path}: config.h included too late"
end
else
if first
puts "#{file.path}: config.h missing"
end
end
first = false
end
end
end
def check_path(path)
File.open(path) do |file|
check_file(file)
end
end
if ARGV.empty?
Dir["src/*.c"].each do |path|
check_path(path)
end
Dir["src/*/*.c"].each do |path|
check_path(path)
end
Dir["test/*.c"].each do |path|
check_path(path)
end
else
ARGV.each do |path|
check_path(path)
end
end

@@ -20,7 +20,7 @@
#ifndef MPD_AUDIO_FORMAT_HXX
#define MPD_AUDIO_FORMAT_HXX
#include "pcm/SampleFormat.hxx"
#include "pcm/SampleFormat.hxx" // IWYU pragma: export
#include "util/Compiler.h"
#include <chrono>

@@ -22,7 +22,6 @@
*
*/
#include "config.h"
#include "AudioParser.hxx"
#include "AudioFormat.hxx"
#include "util/RuntimeError.hxx"

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "CheckAudioFormat.hxx"
#include "AudioFormat.hxx"
#include "util/RuntimeError.hxx"

@@ -33,11 +33,11 @@
#include "playlist/PlaylistRegistry.hxx"
#include "playlist/PlaylistPlugin.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/NarrowPath.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
#include "fs/StandardDirectory.hxx"
#include "system/Error.hxx"
#include "util/Macros.hxx"
#include "util/RuntimeError.hxx"
#include "util/Domain.hxx"
#include "util/OptionDef.hxx"
@@ -108,17 +108,17 @@ static constexpr Domain cmdline_domain("cmdline");
gcc_noreturn
static void version(void)
{
printf("Music Player Daemon " VERSION " (%s)\n"
printf("Music Player Daemon " VERSION " (%s)"
"\n"
"Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>\n"
"Copyright 2008-2018 Max Kellermann <max.kellermann@gmail.com>\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
"warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
GIT_VERSION);
#ifdef ENABLE_DATABASE
"\n"
"Database plugins:\n",
GIT_VERSION);
printf("\n"
"Database plugins:\n");
for (auto i = database_plugins; *i != nullptr; ++i)
printf(" %s", (*i)->name);
@@ -129,18 +129,18 @@ static void version(void)
for (auto i = storage_plugins; *i != nullptr; ++i)
printf(" %s", (*i)->name);
printf("\n"
printf("\n");
#endif
#ifdef ENABLE_NEIGHBOR_PLUGINS
"\n"
printf("\n"
"Neighbor plugins:\n");
for (auto i = neighbor_plugins; *i != nullptr; ++i)
printf(" %s", (*i)->name);
printf("\n"
#endif
printf("\n"
"\n"
"Decoders plugins:\n");
@@ -380,17 +380,7 @@ ParseCommandLine(int argc, char **argv, struct options &options,
if (config_file != nullptr) {
/* use specified configuration file */
#ifdef _UNICODE
wchar_t buffer[MAX_PATH];
auto result = MultiByteToWideChar(CP_ACP, 0, config_file, -1,
buffer, ARRAY_SIZE(buffer));
if (result <= 0)
throw MakeLastError("MultiByteToWideChar() failed");
ReadConfigFile(config, Path::FromFS(buffer));
#else
ReadConfigFile(config, Path::FromFS(config_file));
#endif
ReadConfigFile(config, FromNarrowPath(config_file));
return;
}

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "IcyMetaDataParser.hxx"
#include "tag/Tag.hxx"
#include "tag/Builder.hxx"

@@ -22,7 +22,6 @@
*
*/
#include "config.h"
#include "Idle.hxx"
#include "Main.hxx"
#include "Instance.hxx"

@@ -22,7 +22,6 @@
*
*/
#include "config.h"
#include "IdleFlags.hxx"
#include "util/ASCII.hxx"

@@ -30,6 +30,9 @@
#ifdef ENABLE_DATABASE
#include "db/DatabaseError.hxx"
#include "db/Interface.hxx"
#include "db/update/Service.hxx"
#include "storage/StorageInterface.hxx"
#ifdef ENABLE_SQLITE
#include "sticker/StickerDatabase.hxx"
@@ -48,7 +51,19 @@ Instance::Instance()
{
}
Instance::~Instance() noexcept = default;
Instance::~Instance() noexcept
{
#ifdef ENABLE_DATABASE
delete update;
if (database != nullptr) {
database->Close();
database.reset();
}
delete storage;
#endif
}
Partition *
Instance::FindPartition(const char *name) noexcept

@@ -20,7 +20,7 @@
#ifndef MPD_INSTANCE_HXX
#define MPD_INSTANCE_HXX
#include "check.h"
#include "config.h"
#include "event/Loop.hxx"
#include "event/Thread.hxx"
#include "event/MaskMonitor.hxx"
@@ -41,7 +41,7 @@ class NeighborGlue;
#ifdef ENABLE_DATABASE
#include "db/DatabaseListener.hxx"
class Database;
#include "db/Ptr.hxx"
class Storage;
class UpdateService;
#endif
@@ -104,7 +104,7 @@ struct Instance final
#endif
#ifdef ENABLE_DATABASE
Database *database;
DatabasePtr database;
/**
* This is really a #CompositeStorage. To avoid heavy include
@@ -147,7 +147,6 @@ struct Instance final
Partition *FindPartition(const char *name) noexcept;
void BeginShutdownPartitions() noexcept;
void FinishShutdownPartitions() noexcept;
#ifdef ENABLE_DATABASE
/**
@@ -156,7 +155,7 @@ struct Instance final
* music_directory was configured).
*/
Database *GetDatabase() {
return database;
return database.get();
}
/**
@@ -168,8 +167,6 @@ struct Instance final
#endif
void BeginShutdownUpdate() noexcept;
void FinishShutdownUpdate() noexcept;
void ShutdownDatabase() noexcept;
#ifdef ENABLE_CURL
void LookupRemoteTag(const char *uri) noexcept;

@@ -29,6 +29,8 @@
#include "storage/StorageInterface.hxx"
#endif
#include <stdexcept>
static LocatedUri
LocateFileUri(const char *uri, const Client *client
#ifdef ENABLE_DATABASE
@@ -55,14 +57,26 @@ LocateFileUri(const char *uri, const Client *client
}
static LocatedUri
LocateAbsoluteUri(const char *uri
LocateAbsoluteUri(UriPluginKind kind, const char *uri
#ifdef ENABLE_DATABASE
, const Storage *storage
#endif
)
{
if (!uri_supported_scheme(uri))
throw std::runtime_error("Unsupported URI scheme");
switch (kind) {
case UriPluginKind::INPUT:
case UriPluginKind::STORAGE: // TODO: separate check for storage plugins
if (!uri_supported_scheme(uri))
throw std::runtime_error("Unsupported URI scheme");
break;
case UriPluginKind::PLAYLIST:
/* for now, no validation for playlist URIs; this is
more complicated because there are three ways to
identify which plugin to use: URI scheme, filename
suffix and MIME type */
break;
}
#ifdef ENABLE_DATABASE
if (storage != nullptr) {
@@ -76,7 +90,8 @@ LocateAbsoluteUri(const char *uri
}
LocatedUri
LocateUri(const char *uri, const Client *client
LocateUri(UriPluginKind kind,
const char *uri, const Client *client
#ifdef ENABLE_DATABASE
, const Storage *storage
#endif
@@ -100,7 +115,7 @@ LocateUri(const char *uri, const Client *client
#endif
);
else if (uri_has_scheme(uri))
return LocateAbsoluteUri(uri
return LocateAbsoluteUri(kind, uri
#ifdef ENABLE_DATABASE
, storage
#endif

@@ -20,7 +20,7 @@
#ifndef MPD_LOCATE_URI_HXX
#define MPD_LOCATE_URI_HXX
#include "check.h"
#include "config.h"
#include "util/Compiler.h"
#include "fs/AllocatedPath.hxx"
@@ -41,6 +41,12 @@ class Client;
class Storage;
#endif
enum class UriPluginKind {
INPUT,
STORAGE,
PLAYLIST,
};
struct LocatedUri {
enum class Type {
/**
@@ -84,7 +90,8 @@ struct LocatedUri {
* that feature is disabled if this parameter is nullptr
*/
LocatedUri
LocateUri(const char *uri, const Client *client
LocateUri(UriPluginKind kind,
const char *uri, const Client *client
#ifdef ENABLE_DATABASE
, const Storage *storage
#endif

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,11 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "LogV.hxx"
#include "util/Domain.hxx"
#include <exception>
#include "util/Exception.hxx"
#include <stdio.h>
#include <string.h>
@@ -30,20 +28,20 @@
static constexpr Domain exception_domain("exception");
void
LogFormatV(const Domain &domain, LogLevel level,
LogFormatV(LogLevel level, const Domain &domain,
const char *fmt, va_list ap) noexcept
{
char msg[1024];
vsnprintf(msg, sizeof(msg), fmt, ap);
Log(domain, level, msg);
Log(level, domain, msg);
}
void
LogFormat(const Domain &domain, LogLevel level, const char *fmt, ...) noexcept
LogFormat(LogLevel level, const Domain &domain, const char *fmt, ...) noexcept
{
va_list ap;
va_start(ap, fmt);
LogFormatV(domain, level, fmt, ap);
LogFormatV(level, domain, fmt, ap);
va_end(ap);
}
@@ -52,7 +50,7 @@ FormatDebug(const Domain &domain, const char *fmt, ...) noexcept
{
va_list ap;
va_start(ap, fmt);
LogFormatV(domain, LogLevel::DEBUG, fmt, ap);
LogFormatV(LogLevel::DEBUG, domain, fmt, ap);
va_end(ap);
}
@@ -61,7 +59,7 @@ FormatInfo(const Domain &domain, const char *fmt, ...) noexcept
{
va_list ap;
va_start(ap, fmt);
LogFormatV(domain, LogLevel::INFO, fmt, ap);
LogFormatV(LogLevel::INFO, domain, fmt, ap);
va_end(ap);
}
@@ -70,7 +68,7 @@ FormatDefault(const Domain &domain, const char *fmt, ...) noexcept
{
va_list ap;
va_start(ap, fmt);
LogFormatV(domain, LogLevel::DEFAULT, fmt, ap);
LogFormatV(LogLevel::DEFAULT, domain, fmt, ap);
va_end(ap);
}
@@ -79,7 +77,7 @@ FormatWarning(const Domain &domain, const char *fmt, ...) noexcept
{
va_list ap;
va_start(ap, fmt);
LogFormatV(domain, LogLevel::WARNING, fmt, ap);
LogFormatV(LogLevel::WARNING, domain, fmt, ap);
va_end(ap);
}
@@ -88,42 +86,24 @@ FormatError(const Domain &domain, const char *fmt, ...) noexcept
{
va_list ap;
va_start(ap, fmt);
LogFormatV(domain, LogLevel::ERROR, fmt, ap);
LogFormatV(LogLevel::ERROR, domain, fmt, ap);
va_end(ap);
}
void
LogError(const std::exception &e) noexcept
Log(LogLevel level, const std::exception &e) noexcept
{
Log(exception_domain, LogLevel::ERROR, e.what());
try {
std::rethrow_if_nested(e);
} catch (const std::exception &nested) {
LogError(nested, "nested");
} catch (...) {
Log(exception_domain, LogLevel::ERROR,
"Unrecognized nested exception");
}
Log(level, exception_domain, GetFullMessage(e).c_str());
}
void
LogError(const std::exception &e, const char *msg) noexcept
Log(LogLevel level, const std::exception &e, const char *msg) noexcept
{
FormatError(exception_domain, "%s: %s", msg, e.what());
try {
std::rethrow_if_nested(e);
} catch (const std::exception &nested) {
LogError(nested);
} catch (...) {
Log(exception_domain, LogLevel::ERROR,
"Unrecognized nested exception");
}
LogFormat(level, exception_domain, "%s: %s", msg, GetFullMessage(e).c_str());
}
void
FormatError(const std::exception &e, const char *fmt, ...) noexcept
LogFormat(LogLevel level, const std::exception &e, const char *fmt, ...) noexcept
{
char msg[1024];
va_list ap;
@@ -131,37 +111,24 @@ FormatError(const std::exception &e, const char *fmt, ...) noexcept
vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
LogError(e, msg);
Log(level, e, msg);
}
void
LogError(const std::exception_ptr &ep) noexcept
Log(LogLevel level, const std::exception_ptr &ep) noexcept
{
try {
std::rethrow_exception(ep);
} catch (const std::exception &e) {
LogError(e);
} catch (...) {
Log(exception_domain, LogLevel::ERROR,
"Unrecognized exception");
}
Log(level, exception_domain, GetFullMessage(ep).c_str());
}
void
LogError(const std::exception_ptr &ep, const char *msg) noexcept
Log(LogLevel level, const std::exception_ptr &ep, const char *msg) noexcept
{
try {
std::rethrow_exception(ep);
} catch (const std::exception &e) {
LogError(e, msg);
} catch (...) {
FormatError(exception_domain,
"%s: Unrecognized exception", msg);
}
LogFormat(level, exception_domain, "%s: %s", msg,
GetFullMessage(ep).c_str());
}
void
FormatError(const std::exception_ptr &ep, const char *fmt, ...) noexcept
LogFormat(LogLevel level, const std::exception_ptr &ep, const char *fmt, ...) noexcept
{
char msg[1024];
va_list ap;
@@ -169,13 +136,13 @@ FormatError(const std::exception_ptr &ep, const char *fmt, ...) noexcept
vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
LogError(ep, msg);
Log(level, ep, msg);
}
void
LogErrno(const Domain &domain, int e, const char *msg) noexcept
{
LogFormat(domain, LogLevel::ERROR, "%s: %s", msg, strerror(e));
LogFormat(LogLevel::ERROR, domain, "%s: %s", msg, strerror(e));
}
void

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -28,16 +28,38 @@
class Domain;
void
Log(const Domain &domain, LogLevel level, const char *msg) noexcept;
Log(LogLevel level, const Domain &domain, const char *msg) noexcept;
gcc_printf(3,4)
void
LogFormat(const Domain &domain, LogLevel level, const char *fmt, ...) noexcept;
LogFormat(LogLevel level, const Domain &domain, const char *fmt, ...) noexcept;
void
Log(LogLevel level, const std::exception &e) noexcept;
void
Log(LogLevel level, const std::exception &e, const char *msg) noexcept;
gcc_printf(3,4)
void
LogFormat(LogLevel level, const std::exception &e,
const char *fmt, ...) noexcept;
void
Log(LogLevel level, const std::exception_ptr &ep) noexcept;
void
Log(LogLevel level, const std::exception_ptr &ep, const char *msg) noexcept;
gcc_printf(3,4)
void
LogFormat(LogLevel level, const std::exception_ptr &ep,
const char *fmt, ...) noexcept;
static inline void
LogDebug(const Domain &domain, const char *msg) noexcept
{
Log(domain, LogLevel::DEBUG, msg);
Log(LogLevel::DEBUG, domain, msg);
}
gcc_printf(2,3)
@@ -47,7 +69,7 @@ FormatDebug(const Domain &domain, const char *fmt, ...) noexcept;
static inline void
LogInfo(const Domain &domain, const char *msg) noexcept
{
Log(domain, LogLevel::INFO, msg);
Log(LogLevel::INFO, domain, msg);
}
gcc_printf(2,3)
@@ -57,7 +79,7 @@ FormatInfo(const Domain &domain, const char *fmt, ...) noexcept;
static inline void
LogDefault(const Domain &domain, const char *msg) noexcept
{
Log(domain, LogLevel::DEFAULT, msg);
Log(LogLevel::DEFAULT, domain, msg);
}
gcc_printf(2,3)
@@ -67,7 +89,7 @@ FormatDefault(const Domain &domain, const char *fmt, ...) noexcept;
static inline void
LogWarning(const Domain &domain, const char *msg) noexcept
{
Log(domain, LogLevel::WARNING, msg);
Log(LogLevel::WARNING, domain, msg);
}
gcc_printf(2,3)
@@ -77,28 +99,47 @@ FormatWarning(const Domain &domain, const char *fmt, ...) noexcept;
static inline void
LogError(const Domain &domain, const char *msg) noexcept
{
Log(domain, LogLevel::ERROR, msg);
Log(LogLevel::ERROR, domain, msg);
}
void
LogError(const std::exception &e) noexcept;
inline void
LogError(const std::exception &e) noexcept
{
Log(LogLevel::ERROR, e);
}
void
LogError(const std::exception &e, const char *msg) noexcept;
inline void
LogError(const std::exception &e, const char *msg) noexcept
{
Log(LogLevel::ERROR, e, msg);
}
gcc_printf(2,3)
void
FormatError(const std::exception &e, const char *fmt, ...) noexcept;
template<typename... Args>
inline void
FormatError(const std::exception &e, const char *fmt, Args&&... args) noexcept
{
LogFormat(LogLevel::ERROR, e, fmt, std::forward<Args>(args)...);
}
void
LogError(const std::exception_ptr &ep) noexcept;
inline void
LogError(const std::exception_ptr &ep) noexcept
{
Log(LogLevel::ERROR, ep);
}
void
LogError(const std::exception_ptr &ep, const char *msg) noexcept;
inline void
LogError(const std::exception_ptr &ep, const char *msg) noexcept
{
Log(LogLevel::ERROR, ep, msg);
}
gcc_printf(2,3)
void
FormatError(const std::exception_ptr &ep, const char *fmt, ...) noexcept;
template<typename... Args>
inline void
FormatError(const std::exception_ptr &ep,
const char *fmt, Args&&... args) noexcept
{
LogFormat(LogLevel::ERROR, ep, fmt, std::forward<Args>(args)...);
}
gcc_printf(2,3)
void

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,11 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "LogBackend.hxx"
#include "Log.hxx"
#include "util/Domain.hxx"
#include "util/StringStrip.hxx"
#include "config.h"
#include <assert.h>
#include <stdio.h>
@@ -61,7 +61,7 @@ ToAndroidLogLevel(LogLevel log_level) noexcept
#else
static LogLevel log_threshold = LogLevel::INFO;
static LogLevel log_threshold = LogLevel::DEFAULT;
static bool enable_timestamp;
@@ -176,7 +176,7 @@ FileLog(const Domain &domain, const char *message) noexcept
#endif /* !ANDROID */
void
Log(const Domain &domain, LogLevel level, const char *msg) noexcept
Log(LogLevel level, const Domain &domain, const char *msg) noexcept
{
#ifdef ANDROID
__android_log_print(ToAndroidLogLevel(level), "MPD",

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,7 +20,6 @@
#ifndef MPD_LOG_BACKEND_HXX
#define MPD_LOG_BACKEND_HXX
#include "check.h"
#include "LogLevel.hxx"
void

@@ -30,6 +30,10 @@
#include "util/RuntimeError.hxx"
#include "system/Error.hxx"
#ifdef ENABLE_SYSTEMD_DAEMON
#include <systemd/sd-daemon.h>
#endif
#include <assert.h>
#include <string.h>
#include <fcntl.h>
@@ -105,7 +109,7 @@ parse_log_level(const char *value, int line)
#endif
void
log_early_init(bool verbose)
log_early_init(bool verbose) noexcept
{
#ifdef ANDROID
(void)verbose;
@@ -139,6 +143,16 @@ log_init(const ConfigData &config, bool verbose, bool use_stdout)
if (param == nullptr) {
/* no configuration: default to syslog (if
available) */
#ifdef ENABLE_SYSTEMD_DAEMON
if (sd_booted() &&
getenv("NOTIFY_SOCKET") != nullptr) {
/* if MPD was started as a systemd
service, default to journal (which
is connected to fd=2) */
out_fd = STDOUT_FILENO;
return;
}
#endif
#ifndef HAVE_SYSLOG
throw std::runtime_error("config parameter 'log_file' not found");
#endif
@@ -157,7 +171,7 @@ log_init(const ConfigData &config, bool verbose, bool use_stdout)
#ifndef ANDROID
static void
close_log_files(void)
close_log_files() noexcept
{
#ifdef HAVE_SYSLOG
LogFinishSysLog();
@@ -167,7 +181,7 @@ close_log_files(void)
#endif
void
log_deinit(void)
log_deinit() noexcept
{
#ifndef ANDROID
close_log_files();
@@ -199,7 +213,8 @@ void setup_log_output()
#endif
}
int cycle_log_files(void)
int
cycle_log_files() noexcept
{
#ifdef ANDROID
return 0;

@@ -31,7 +31,7 @@ struct ConfigData;
* @param verbose true when the program is started with --verbose
*/
void
log_early_init(bool verbose);
log_early_init(bool verbose) noexcept;
/**
* Throws #std::runtime_error on error.
@@ -40,12 +40,12 @@ void
log_init(const ConfigData &config, bool verbose, bool use_stdout);
void
log_deinit();
log_deinit() noexcept;
void
setup_log_output();
int
cycle_log_files();
cycle_log_files() noexcept;
#endif /* LOG_H */

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,7 @@
#include <stdarg.h>
void
LogFormatV(const Domain &domain, LogLevel level,
LogFormatV(LogLevel level, const Domain &domain,
const char *fmt, va_list ap) noexcept;
#endif /* LOG_H */

@@ -185,19 +185,16 @@ InitStorage(const ConfigData &config, EventLoop &event_loop)
static bool
glue_db_init_and_load(const ConfigData &config)
{
instance->database =
CreateConfiguredDatabase(config, instance->event_loop,
instance->io_thread.GetEventLoop(),
*instance);
if (instance->database == nullptr)
auto db = CreateConfiguredDatabase(config, instance->event_loop,
instance->io_thread.GetEventLoop(),
*instance);
if (!db)
return true;
if (instance->database->GetPlugin().flags & DatabasePlugin::FLAG_REQUIRE_STORAGE) {
if (db->GetPlugin().RequireStorage()) {
InitStorage(config, instance->io_thread.GetEventLoop());
if (instance->storage == nullptr) {
delete instance->database;
instance->database = nullptr;
LogDefault(config_domain,
"Found database setting without "
"music_directory - disabling database");
@@ -211,22 +208,24 @@ glue_db_init_and_load(const ConfigData &config)
}
try {
instance->database->Open();
db->Open();
} catch (...) {
std::throw_with_nested(std::runtime_error("Failed to open database plugin"));
}
if (!instance->database->IsPlugin(simple_db_plugin))
instance->database = std::move(db);
auto *sdb = dynamic_cast<SimpleDatabase *>(instance->database.get());
if (sdb == nullptr)
return true;
SimpleDatabase &db = *(SimpleDatabase *)instance->database;
instance->update = new UpdateService(config,
instance->event_loop, db,
instance->event_loop, *sdb,
static_cast<CompositeStorage &>(*instance->storage),
*instance);
/* run database update after daemonization? */
return db.FileExists();
return sdb->FileExists();
}
static bool
@@ -351,27 +350,6 @@ Instance::BeginShutdownUpdate() noexcept
#endif
}
inline void
Instance::FinishShutdownUpdate() noexcept
{
#ifdef ENABLE_DATABASE
delete update;
#endif
}
inline void
Instance::ShutdownDatabase() noexcept
{
#ifdef ENABLE_DATABASE
if (instance->database != nullptr) {
instance->database->Close();
delete instance->database;
}
delete instance->storage;
#endif
}
inline void
Instance::BeginShutdownPartitions() noexcept
{
@@ -381,12 +359,6 @@ Instance::BeginShutdownPartitions() noexcept
}
}
inline void
Instance::FinishShutdownPartitions() noexcept
{
partitions.clear();
}
void
Instance::OnIdle(unsigned flags)
{
@@ -488,7 +460,7 @@ MainOrThrow(int argc, char *argv[])
#endif
const unsigned max_clients =
raw_config.GetPositive(ConfigOption::MAX_CONN, 10);
raw_config.GetPositive(ConfigOption::MAX_CONN, 100);
instance->client_list = new ClientList(max_clients);
initialize_decoder_and_player(raw_config, config.replay_gain);
@@ -523,18 +495,19 @@ static int
mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
{
ConfigureFS(raw_config);
AtScopeExit() { DeinitFS(); };
glue_mapper_init(raw_config);
initPermissions(raw_config);
spl_global_init(raw_config);
#ifdef ENABLE_ARCHIVE
archive_plugin_init_all();
const ScopeArchivePluginsInit archive_plugins_init;
#endif
pcm_convert_global_init(raw_config);
decoder_plugin_init_all(raw_config);
const ScopeDecoderPluginsInit decoder_plugins_init(raw_config);
#ifdef ENABLE_DATABASE
const bool create_db = InitDatabaseAndStorage(raw_config);
@@ -553,9 +526,9 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
}
client_manager_init(raw_config);
input_stream_global_init(raw_config,
instance->io_thread.GetEventLoop());
playlist_list_global_init(raw_config);
const ScopeInputPluginsInit input_plugins_init(raw_config,
instance->io_thread.GetEventLoop());
const ScopePlaylistPluginsInit playlist_plugins_init(raw_config);
#ifdef ENABLE_DAEMON
daemonize_commit();
@@ -564,7 +537,7 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
#ifndef ANDROID
setup_log_output();
SignalHandlersInit(instance->event_loop);
const ScopeSignalHandlersInit signal_handlers_init(instance->event_loop);
#endif
instance->io_thread.Start();
@@ -652,34 +625,10 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
}
#endif
instance->FinishShutdownUpdate();
instance->ShutdownDatabase();
#ifdef ENABLE_SQLITE
sticker_global_finish();
#endif
playlist_list_global_finish();
input_stream_global_finish();
#ifdef ENABLE_DATABASE
mapper_finish();
#endif
DeinitFS();
instance->FinishShutdownPartitions();
command_finish();
decoder_plugin_deinit_all();
#ifdef ENABLE_ARCHIVE
archive_plugin_deinit_all();
#endif
instance->rtio_thread.Stop();
instance->io_thread.Stop();
#ifndef ANDROID
SignalHandlersFinish();
#endif
return EXIT_SUCCESS;
}

@@ -58,11 +58,6 @@ mapper_init(AllocatedPath &&_playlist_dir)
mapper_set_playlist_dir(std::move(_playlist_dir));
}
void
mapper_finish() noexcept
{
}
#ifdef ENABLE_DATABASE
AllocatedPath

@@ -24,9 +24,10 @@
#ifndef MPD_MAPPER_HXX
#define MPD_MAPPER_HXX
#include <string>
#include "util/Compiler.h"
#include "config.h"
#include <string>
#define PLAYLIST_FILE_SUFFIX ".m3u"
@@ -36,9 +37,6 @@ class AllocatedPath;
void
mapper_init(AllocatedPath &&playlist_dir);
void
mapper_finish() noexcept;
#ifdef ENABLE_DATABASE
/**

@@ -20,7 +20,6 @@
#ifndef MPD_MIX_RAMP_INFO_HXX
#define MPD_MIX_RAMP_INFO_HXX
#include "check.h"
#include "util/Compiler.h"
#include <string>

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "MusicBuffer.hxx"
#include "MusicChunk.hxx"

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "MusicChunk.hxx"
#include "AudioFormat.hxx"
#include "tag/Tag.hxx"

@@ -43,7 +43,15 @@ struct MusicChunk;
/**
* Meta information for #MusicChunk.
*/
struct MusicChunkInfo {
struct alignas(8) MusicChunkInfo {
/* align to multiple of 8 bytes, which adds padding at the
end, so the size of MusicChunk::data is also a multiple of
8 bytes; this is a workaround for a bug in the DSD_U32 and
DoP converters which require processing 8 bytes at a time,
discarding the remainder */
/* TODO: once all converters have been fixed, we should remove
this workaround */
/** the next chunk in a linked list */
MusicChunkPtr next;
@@ -119,6 +127,10 @@ struct MusicChunk : MusicChunkInfo {
/** the data (probably PCM) */
uint8_t data[CHUNK_SIZE - sizeof(MusicChunkInfo)];
/* TODO: remove this check once all converters have been fixed
(see comment in struct MusicChunkInfo for details) */
static_assert(sizeof(data) % 8 == 0, "Wrong alignment");
/**
* Prepares appending to the music chunk. Returns a buffer
* where you may write into. After you are finished, call

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "MusicChunkPtr.hxx"
#include "MusicBuffer.hxx"

@@ -20,8 +20,6 @@
#ifndef MPD_MUSIC_CHUNK_PTR_HXX
#define MPD_MUSIC_CHUNK_PTR_HXX
#include "check.h"
#include <memory>
struct MusicChunk;

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "MusicPipe.hxx"
#include "MusicChunk.hxx"

@@ -31,6 +31,7 @@
#include "SingleMode.hxx"
#include "Chrono.hxx"
#include "util/Compiler.h"
#include "config.h"
#include <string>
#include <memory>

@@ -101,7 +101,7 @@ initPermissions(const ConfigData &config)
const char *separator = strchr(param.value.c_str(),
PERMISSION_PASSWORD_CHAR);
if (separator == NULL)
if (separator == nullptr)
throw FormatRuntimeError("\"%c\" not found in password string "
"\"%s\", line %i",
PERMISSION_PASSWORD_CHAR,

@@ -20,7 +20,7 @@
#ifndef MPD_PERMISSION_HXX
#define MPD_PERMISSION_HXX
#include "check.h"
#include "config.h"
struct ConfigData;

@@ -17,13 +17,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "PlaylistDatabase.hxx"
#include "db/PlaylistVector.hxx"
#include "fs/io/TextFile.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "time/ChronoUtil.hxx"
#include "util/StringStrip.hxx"
#include "util/ChronoUtil.hxx"
#include "util/RuntimeError.hxx"
#include <string.h>

@@ -20,8 +20,6 @@
#ifndef MPD_PLAYLIST_DATABASE_HXX
#define MPD_PLAYLIST_DATABASE_HXX
#include "check.h"
#define PLAYLIST_META_BEGIN "playlist_begin: "
class PlaylistVector;

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "PlaylistError.hxx"
#include "util/Domain.hxx"

@@ -134,7 +134,9 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
const auto *const name_fs_end =
FindStringSuffix(name_fs_str,
PATH_LITERAL(PLAYLIST_FILE_SUFFIX));
if (name_fs_end == nullptr)
if (name_fs_end == nullptr ||
/* no empty playlist names (raw file name = ".m3u") */
name_fs_end == name_fs_str)
return false;
FileInfo fi;

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "PlaylistPrint.hxx"
#include "PlaylistFile.hxx"
#include "PlaylistError.hxx"

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2020 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -27,10 +27,20 @@
* that this plugin is unavailable. It will be disabled, and MPD can
* continue initialization.
*/
class PluginUnavailable final : public std::runtime_error {
class PluginUnavailable : public std::runtime_error {
public:
explicit PluginUnavailable(const char *msg)
:std::runtime_error(msg) {}
using std::runtime_error::runtime_error;
};
/**
* Like #PluginUnavailable, but denotes that the plugin is not
* available because it was not explicitly enabled in the
* configuration. The message may describe the necessary steps to
* enable it.
*/
class PluginUnconfigured : public PluginUnavailable {
public:
using PluginUnavailable::PluginUnavailable;
};
#endif

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "RemoteTagCache.hxx"
#include "RemoteTagCacheHandler.hxx"
#include "input/ScanTags.hxx"

@@ -20,7 +20,6 @@
#ifndef MPD_REMOTE_TAG_CACHE_HXX
#define MPD_REMOTE_TAG_CACHE_HXX
#include "check.h"
#include "input/RemoteTagScanner.hxx"
#include "tag/Tag.hxx"
#include "event/DeferEvent.hxx"

@@ -20,8 +20,6 @@
#ifndef MPD_REPLAY_GAIN_CONFIG_HXX
#define MPD_REPLAY_GAIN_CONFIG_HXX
#include "check.h"
struct ReplayGainConfig {
static constexpr bool DEFAULT_LIMIT = true;

@@ -17,16 +17,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "ReplayGainGlobal.hxx"
#include "ReplayGainConfig.hxx"
#include "config/Param.hxx"
#include "config/Data.hxx"
#include "util/RuntimeError.hxx"
#include <assert.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <cstdlib>
#include <cmath>
static float
ParsePreamp(const char *s)
@@ -34,14 +33,14 @@ ParsePreamp(const char *s)
assert(s != nullptr);
char *endptr;
float f = strtod(s, &endptr);
float f = std::strtof(s, &endptr);
if (endptr == s || *endptr != '\0')
throw std::invalid_argument("Not a numeric value");
if (f < -15 || f > 15)
if (f < -15.0f || f > 15.0f)
throw std::invalid_argument("Number must be between -15 and 15");
return pow(10, f / 20.0);
return std::pow(10.0f, f / 20.0f);
}
static float

@@ -20,8 +20,6 @@
#ifndef MPD_REPLAY_GAIN_GLOBAL_HXX
#define MPD_REPLAY_GAIN_GLOBAL_HXX
#include "check.h"
struct ConfigData;
struct ReplayGainConfig;

@@ -17,11 +17,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "ReplayGainInfo.hxx"
#include "ReplayGainConfig.hxx"
#include <math.h>
#include <cmath>
float
ReplayGainTuple::CalculateScale(const ReplayGainConfig &config) const noexcept
@@ -29,13 +28,13 @@ ReplayGainTuple::CalculateScale(const ReplayGainConfig &config) const noexcept
float scale;
if (IsDefined()) {
scale = pow(10.0, gain / 20.0);
scale = std::pow(10.0f, gain / 20.0f);
scale *= config.preamp;
if (scale > 15.0)
scale = 15.0;
if (scale > 15.0f)
scale = 15.0f;
if (config.limit && scale * peak > 1.0)
scale = 1.0 / peak;
if (config.limit && scale * peak > 1.0f)
scale = 1.0f / peak;
} else
scale = config.missing_preamp;

@@ -20,7 +20,6 @@
#ifndef MPD_REPLAY_GAIN_INFO_HXX
#define MPD_REPLAY_GAIN_INFO_HXX
#include "check.h"
#include "util/Compiler.h"
#include "ReplayGainMode.hxx"
@@ -39,6 +38,10 @@ struct ReplayGainTuple {
return gain > -100;
}
static constexpr ReplayGainTuple Undefined() noexcept {
return {-200.0f, 0.0f};
}
gcc_pure
float CalculateScale(const ReplayGainConfig &config) const noexcept;
};
@@ -50,6 +53,13 @@ struct ReplayGainInfo {
return track.IsDefined() || album.IsDefined();
}
static constexpr ReplayGainInfo Undefined() noexcept {
return {
ReplayGainTuple::Undefined(),
ReplayGainTuple::Undefined(),
};
}
const ReplayGainTuple &Get(ReplayGainMode mode) const noexcept {
return mode == ReplayGainMode::ALBUM
? (album.IsDefined() ? album : track)

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "SongLoader.hxx"
#include "LocateUri.hxx"
#include "client/Client.hxx"
@@ -25,6 +24,7 @@
#include "storage/StorageInterface.hxx"
#include "song/DetachedSong.hxx"
#include "PlaylistError.hxx"
#include "config.h"
#include <assert.h>
@@ -94,7 +94,8 @@ SongLoader::LoadSong(const char *uri_utf8) const
assert(uri_utf8 != nullptr);
#endif
const auto located_uri = LocateUri(uri_utf8, client
const auto located_uri = LocateUri(UriPluginKind::INPUT,
uri_utf8, client
#ifdef ENABLE_DATABASE
, storage
#endif

@@ -20,8 +20,8 @@
#ifndef MPD_SONG_LOADER_HXX
#define MPD_SONG_LOADER_HXX
#include "check.h"
#include "util/Compiler.h"
#include "config.h"
#include <cstddef>

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "SongPrint.hxx"
#include "song/LightSong.hxx"
#include "Partition.hxx"
@@ -28,7 +27,7 @@
#include "TagPrint.hxx"
#include "client/Response.hxx"
#include "fs/Traits.hxx"
#include "util/ChronoUtil.hxx"
#include "time/ChronoUtil.hxx"
#include "util/UriUtil.hxx"
#define SONG_FILE "file: "

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "SongSave.hxx"
#include "AudioParser.hxx"
#include "db/plugins/simple/Song.hxx"
@@ -28,7 +27,7 @@
#include "tag/ParseName.hxx"
#include "tag/Tag.hxx"
#include "tag/Builder.hxx"
#include "util/ChronoUtil.hxx"
#include "time/ChronoUtil.hxx"
#include "util/StringAPI.hxx"
#include "util/StringBuffer.hxx"
#include "util/StringStrip.hxx"

@@ -79,17 +79,22 @@ Song::UpdateFile(Storage &storage) noexcept
TagBuilder tag_builder;
auto new_audio_format = AudioFormat::Undefined();
const auto path_fs = storage.MapFS(relative_uri.c_str());
if (path_fs.IsNull()) {
const auto absolute_uri =
storage.MapUTF8(relative_uri.c_str());
if (!tag_stream_scan(absolute_uri.c_str(), tag_builder,
&new_audio_format))
return false;
} else {
if (!ScanFileTagsWithGeneric(path_fs, tag_builder,
try {
const auto path_fs = storage.MapFS(relative_uri.c_str());
if (path_fs.IsNull()) {
const auto absolute_uri =
storage.MapUTF8(relative_uri.c_str());
if (!tag_stream_scan(absolute_uri.c_str(), tag_builder,
&new_audio_format))
return false;
return false;
} else {
if (!ScanFileTagsWithGeneric(path_fs, tag_builder,
&new_audio_format))
return false;
}
} catch (...) {
// TODO: log or propagate I/O errors?
return false;
}
mtime = info.mtime;
@@ -98,8 +103,6 @@ Song::UpdateFile(Storage &storage) noexcept
return true;
}
#endif
#ifdef ENABLE_ARCHIVE
Song *
@@ -145,6 +148,8 @@ Song::UpdateFileInArchive(ArchiveFile &archive) noexcept
#endif
#endif /* ENABLE_DATABASE */
bool
DetachedSong::LoadFile(Path path) noexcept
{
@@ -153,8 +158,14 @@ DetachedSong::LoadFile(Path path) noexcept
return false;
TagBuilder tag_builder;
if (!ScanFileTagsWithGeneric(path, tag_builder))
try {
if (!ScanFileTagsWithGeneric(path, tag_builder))
return false;
} catch (...) {
// TODO: log or propagate I/O errors?
return false;
}
mtime = fi.GetModificationTime();
tag_builder.Commit(tag);
@@ -173,8 +184,14 @@ DetachedSong::Update() noexcept
return LoadFile(path_fs);
} else if (IsRemote()) {
TagBuilder tag_builder;
if (!tag_stream_scan(uri.c_str(), tag_builder))
try {
if (!tag_stream_scan(uri.c_str(), tag_builder))
return false;
} catch (...) {
// TODO: log or propagate I/O errors?
return false;
}
mtime = std::chrono::system_clock::time_point::min();
tag_builder.Commit(tag);

@@ -119,7 +119,7 @@ try {
TextFile file(config.path);
#ifdef ENABLE_DATABASE
const SongLoader song_loader(partition.instance.database,
const SongLoader song_loader(partition.instance.GetDatabase(),
partition.instance.storage);
#else
const SongLoader song_loader(nullptr, nullptr);

@@ -24,6 +24,7 @@
#include "event/TimerEvent.hxx"
#include "fs/AllocatedPath.hxx"
#include "util/Compiler.h"
#include "config.h"
#include <string>
#include <chrono>

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "StateFileConfig.hxx"
#include "config/Data.hxx"

@@ -20,7 +20,6 @@
#ifndef MPD_STATE_FILE_CONFIG_HXX
#define MPD_STATE_FILE_CONFIG_HXX
#include "check.h"
#include "fs/AllocatedPath.hxx"
#include <chrono>

@@ -28,10 +28,10 @@
#include "db/Stats.hxx"
#include "system/Clock.hxx"
#include "Log.hxx"
#include "util/ChronoUtil.hxx"
#include "time/ChronoUtil.hxx"
#include "util/Math.hxx"
#include <chrono>
#include <cmath>
#ifndef _WIN32
/**
@@ -121,10 +121,10 @@ stats_print(Response &r, const Partition &partition)
#else
(unsigned)std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - start_time).count(),
#endif
std::lround(partition.pc.GetTotalPlayTime().count()));
lround(partition.pc.GetTotalPlayTime().count()));
#ifdef ENABLE_DATABASE
const Database *db = partition.instance.database;
const Database *db = partition.instance.GetDatabase();
if (db != nullptr)
db_stats_print(r, *db);
#endif

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "TagArchive.hxx"
#include "TagStream.hxx"
#include "archive/ArchiveFile.hxx"

@@ -20,8 +20,6 @@
#ifndef MPD_TAG_ARCHIVE_HXX
#define MPD_TAG_ARCHIVE_HXX
#include "check.h"
class ArchiveFile;
class TagHandler;
class TagBuilder;

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "TagFile.hxx"
#include "tag/Generic.hxx"
#include "tag/Handler.hxx"
@@ -48,11 +47,11 @@ public:
handler(_handler),
is(nullptr) {}
bool ScanFile(const DecoderPlugin &plugin) noexcept {
bool ScanFile(const DecoderPlugin &plugin) {
return plugin.ScanFile(path_fs, handler);
}
bool ScanStream(const DecoderPlugin &plugin) noexcept {
bool ScanStream(const DecoderPlugin &plugin) {
if (plugin.scan_stream == nullptr)
return false;
@@ -74,14 +73,14 @@ public:
return plugin.ScanStream(*is, handler);
}
bool Scan(const DecoderPlugin &plugin) noexcept {
bool Scan(const DecoderPlugin &plugin) {
return plugin.SupportsSuffix(suffix) &&
(ScanFile(plugin) || ScanStream(plugin));
}
};
bool
ScanFileTagsNoGeneric(Path path_fs, TagHandler &handler) noexcept
ScanFileTagsNoGeneric(Path path_fs, TagHandler &handler)
{
assert(!path_fs.IsNull());
@@ -101,7 +100,7 @@ ScanFileTagsNoGeneric(Path path_fs, TagHandler &handler) noexcept
bool
ScanFileTagsWithGeneric(Path path, TagBuilder &builder,
AudioFormat *audio_format) noexcept
AudioFormat *audio_format)
{
FullTagHandler h(builder, audio_format);

@@ -20,8 +20,6 @@
#ifndef MPD_TAG_FILE_HXX
#define MPD_TAG_FILE_HXX
#include "check.h"
struct AudioFormat;
class Path;
class TagHandler;
@@ -32,22 +30,26 @@ class TagBuilder;
* but does not fall back to generic scanners (APE and ID3) if no tags
* were found (but the file was recognized).
*
* Throws on I/O error.
*
* @return true if the file was recognized (even if no metadata was
* found)
*/
bool
ScanFileTagsNoGeneric(Path path, TagHandler &handler) noexcept;
ScanFileTagsNoGeneric(Path path, TagHandler &handler);
/**
* Scan the tags of a song file. Invokes matching decoder plugins,
* and falls back to generic scanners (APE and ID3) if no tags were
* found (but the file was recognized).
*
* Throws on I/O error.
*
* @return true if the file was recognized (even if no metadata was
* found)
*/
bool
ScanFileTagsWithGeneric(Path path, TagBuilder &builder,
AudioFormat *audio_format=nullptr) noexcept;
AudioFormat *audio_format=nullptr);
#endif

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "TagPrint.hxx"
#include "tag/Tag.hxx"
#include "tag/Settings.hxx"
@@ -26,8 +25,9 @@
void
tag_print_types(Response &r) noexcept
{
const auto tag_mask = global_tag_mask & r.GetTagMask();
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++)
if (IsTagEnabled(i))
if (tag_mask.Test(TagType(i)))
r.Format("tagtype: %s\n", tag_item_names[i]);
}

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "TagSave.hxx"
#include "tag/Tag.hxx"
#include "fs/io/BufferedOutputStream.hxx"

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "TagStream.hxx"
#include "tag/Generic.hxx"
#include "tag/Handler.hxx"
@@ -46,7 +45,7 @@ CheckDecoderPlugin(const DecoderPlugin &plugin,
}
bool
tag_stream_scan(InputStream &is, TagHandler &handler) noexcept
tag_stream_scan(InputStream &is, TagHandler &handler)
{
assert(is.IsReady());
@@ -74,19 +73,17 @@ tag_stream_scan(InputStream &is, TagHandler &handler) noexcept
}
bool
tag_stream_scan(const char *uri, TagHandler &handler) noexcept
try {
tag_stream_scan(const char *uri, TagHandler &handler)
{
Mutex mutex;
auto is = InputStream::OpenReady(uri, mutex);
return tag_stream_scan(*is, handler);
} catch (const std::exception &e) {
return false;
}
bool
tag_stream_scan(InputStream &is, TagBuilder &builder,
AudioFormat *audio_format) noexcept
AudioFormat *audio_format)
{
assert(is.IsReady());
@@ -103,12 +100,10 @@ tag_stream_scan(InputStream &is, TagBuilder &builder,
bool
tag_stream_scan(const char *uri, TagBuilder &builder,
AudioFormat *audio_format) noexcept
try {
AudioFormat *audio_format)
{
Mutex mutex;
auto is = InputStream::OpenReady(uri, mutex);
return tag_stream_scan(*is, builder, audio_format);
} catch (const std::exception &e) {
return false;
}

@@ -20,8 +20,6 @@
#ifndef MPD_TAG_STREAM_HXX
#define MPD_TAG_STREAM_HXX
#include "check.h"
struct AudioFormat;
class InputStream;
class TagHandler;
@@ -31,29 +29,39 @@ class TagBuilder;
* Scan the tags of an #InputStream. Invokes matching decoder
* plugins, but does not invoke the special "APE" and "ID3" scanners.
*
* Throws on I/O error.
*
* @return true if the file was recognized (even if no metadata was
* found)
*/
bool
tag_stream_scan(InputStream &is, TagHandler &handler) noexcept;
tag_stream_scan(InputStream &is, TagHandler &handler);
/**
* Throws on I/O error.
*/
bool
tag_stream_scan(const char *uri, TagHandler &handler) noexcept;
tag_stream_scan(const char *uri, TagHandler &handler);
/**
* Scan the tags of an #InputStream. Invokes matching decoder
* plugins, and falls back to generic scanners (APE and ID3) if no
* tags were found (but the file was recognized).
*
* Throws on I/O error.
*
* @return true if the file was recognized (even if no metadata was
* found)
*/
bool
tag_stream_scan(InputStream &is, TagBuilder &builder,
AudioFormat *audio_format=nullptr) noexcept;
AudioFormat *audio_format=nullptr);
/**
* Throws on I/O error.
*/
bool
tag_stream_scan(const char *uri, TagBuilder &builder,
AudioFormat *audio_format=nullptr) noexcept;
AudioFormat *audio_format=nullptr);
#endif

@@ -17,10 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "TimePrint.hxx"
#include "client/Response.hxx"
#include "util/TimeISO8601.hxx"
#include "time/ISO8601.hxx"
void
time_print(Response &r, const char *name,

@@ -0,0 +1,56 @@
/*
* Copyright 2003-2020 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "AudioManager.hxx"
#include "java/Class.hxx"
#include "java/Exception.hxx"
#include "java/File.hxx"
#define STREAM_MUSIC 3
AudioManager::AudioManager(JNIEnv *env, jobject obj) noexcept
: Java::GlobalObject(env, obj)
{
Java::Class cls(env, env->GetObjectClass(Get()));
jmethodID method = env->GetMethodID(cls, "getStreamMaxVolume", "(I)I");
assert(method);
maxVolume = env->CallIntMethod(Get(), method, STREAM_MUSIC);
getStreamVolumeMethod = env->GetMethodID(cls, "getStreamVolume", "(I)I");
assert(getStreamVolumeMethod);
setStreamVolumeMethod = env->GetMethodID(cls, "setStreamVolume", "(III)V");
assert(setStreamVolumeMethod);
}
int
AudioManager::GetVolume(JNIEnv *env)
{
if (maxVolume == 0)
return 0;
return env->CallIntMethod(Get(), getStreamVolumeMethod, STREAM_MUSIC);
}
void
AudioManager::SetVolume(JNIEnv *env, int volume)
{
if (maxVolume == 0)
return;
env->CallVoidMethod(Get(), setStreamVolumeMethod, STREAM_MUSIC, volume, 0);
}

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2020 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,24 +17,26 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_CHECK_H
#define MPD_CHECK_H
#ifndef MPD_ANDROID_AUDIO_MANAGER_HXX
#define MPD_ANDROID_AUDIO_MANAGER_HXX
/*
* All sources must include config.h on the first line to ensure that
* Large File Support is configured properly. This header checks
* whether this has happened.
*
* Usage: include this header before you use any of the above types.
* It will stop the compiler if something went wrong.
*
* This is Linux/glibc specific, and only enabled in the debug build,
* so bugs in this headers don't affect users with production builds.
*
*/
#include "java/Object.hxx"
#ifndef PACKAGE_VERSION
#error config.h missing
#endif
class AudioManager : public Java::GlobalObject {
int maxVolume;
jmethodID getStreamVolumeMethod;
jmethodID setStreamVolumeMethod;
public:
AudioManager(JNIEnv *env, jobject obj) noexcept;
AudioManager(std::nullptr_t) noexcept { maxVolume = 0; }
~AudioManager() noexcept {}
int GetMaxVolume() { return maxVolume; }
int GetVolume(JNIEnv *env);
void SetVolume(JNIEnv *env, int);
};
#endif

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,14 +17,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "Context.hxx"
#include "java/Class.hxx"
#include "java/File.hxx"
#include "java/String.hxx"
#include "fs/AllocatedPath.hxx"
#include "AudioManager.hxx"
AllocatedPath
Context::GetCacheDir(JNIEnv *env) const
Context::GetCacheDir(JNIEnv *env) const noexcept
{
assert(env != nullptr);
@@ -41,3 +43,21 @@ Context::GetCacheDir(JNIEnv *env) const
return Java::File::ToAbsolutePath(env, file);
}
AudioManager *
Context::GetAudioManager(JNIEnv *env) noexcept
{
assert(env != nullptr);
Java::Class cls(env, env->GetObjectClass(Get()));
jmethodID method = env->GetMethodID(cls, "getSystemService",
"(Ljava/lang/String;)Ljava/lang/Object;");
assert(method);
Java::String name(env, "audio");
jobject am = env->CallObjectMethod(Get(), method, name.Get());
if (Java::DiscardException(env) || am == nullptr)
return nullptr;
return new AudioManager(env, am);
}

@@ -1,5 +1,5 @@
/*
* Copyright 2003-2018 The Music Player Daemon Project
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,13 +23,18 @@
#include "java/Object.hxx"
class AllocatedPath;
class AudioManager;
class Context : public Java::Object {
class Context : public Java::GlobalObject {
public:
Context(JNIEnv *env, jobject obj):Java::Object(env, obj) {}
Context(JNIEnv *env, jobject obj) noexcept
:Java::GlobalObject(env, obj) {}
gcc_pure
AllocatedPath GetCacheDir(JNIEnv *env) const;
AllocatedPath GetCacheDir(JNIEnv *env) const noexcept;
gcc_pure
AudioManager *GetAudioManager(JNIEnv *env) noexcept;
};
#endif

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "Environment.hxx"
#include "java/Class.hxx"
#include "java/String.hxx"

@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "LogListener.hxx"
#include "java/Class.hxx"
#include "java/String.hxx"

@@ -22,9 +22,9 @@
#include "java/Object.hxx"
class LogListener : public Java::Object {
class LogListener : public Java::GlobalObject {
public:
LogListener(JNIEnv *env, jobject obj):Java::Object(env, obj) {}
LogListener(JNIEnv *env, jobject obj):Java::GlobalObject(env, obj) {}
void OnLog(JNIEnv *env, int priority, const char *fmt, ...) const;
};

40
src/apple/AudioObject.cxx Normal file

@@ -0,0 +1,40 @@
/*
* Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "AudioObject.hxx"
#include "StringRef.hxx"
Apple::StringRef
AudioObjectGetStringProperty(AudioObjectID inObjectID,
const AudioObjectPropertyAddress &inAddress)
{
auto s = AudioObjectGetPropertyDataT<CFStringRef>(inObjectID,
inAddress);
return Apple::StringRef(s);
}

105
src/apple/AudioObject.hxx Normal file

@@ -0,0 +1,105 @@
/*
* Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef APPLE_AUDIO_OBJECT_HXX
#define APPLE_AUDIO_OBJECT_HXX
#include "Throw.hxx"
#include "util/AllocatedArray.hxx"
#include <CoreAudio/AudioHardware.h>
#include <cstddef>
namespace Apple {
class StringRef;
}
inline std::size_t
AudioObjectGetPropertyDataSize(AudioObjectID inObjectID,
const AudioObjectPropertyAddress &inAddress)
{
UInt32 size;
OSStatus status = AudioObjectGetPropertyDataSize(inObjectID,
&inAddress,
0, nullptr, &size);
if (status != noErr)
Apple::ThrowOSStatus(status);
return size;
}
template<typename T>
T
AudioObjectGetPropertyDataT(AudioObjectID inObjectID,
const AudioObjectPropertyAddress &inAddress)
{
OSStatus status;
UInt32 size = sizeof(T);
T value;
status = AudioObjectGetPropertyData(inObjectID, &inAddress,
0, nullptr,
&size, &value);
if (status != noErr)
Apple::ThrowOSStatus(status);
return value;
}
Apple::StringRef
AudioObjectGetStringProperty(AudioObjectID inObjectID,
const AudioObjectPropertyAddress &inAddress);
template<typename T>
AllocatedArray<T>
AudioObjectGetPropertyDataArray(AudioObjectID inObjectID,
const AudioObjectPropertyAddress &inAddress)
{
OSStatus status;
UInt32 size;
status = AudioObjectGetPropertyDataSize(inObjectID,
&inAddress,
0, nullptr, &size);
if (status != noErr)
Apple::ThrowOSStatus(status);
AllocatedArray<T> result(size / sizeof(T));
status = AudioObjectGetPropertyData(inObjectID, &inAddress,
0, nullptr,
&size, result.begin());
if (status != noErr)
Apple::ThrowOSStatus(status);
return result;
}
#endif

111
src/apple/AudioUnit.hxx Normal file

@@ -0,0 +1,111 @@
/*
* Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef APPLE_AUDIO_UNIT_HXX
#define APPLE_AUDIO_UNIT_HXX
#include "Throw.hxx"
#include <AudioUnit/AudioUnit.h>
template<typename T>
T
AudioUnitGetPropertyT(AudioUnit inUnit, AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement)
{
UInt32 size = sizeof(T);
T value;
OSStatus status = AudioUnitGetProperty(inUnit, inID, inScope,
inElement,
&value, &size);
if (status != noErr)
Apple::ThrowOSStatus(status);
return value;
}
template<typename T>
void
AudioUnitSetPropertyT(AudioUnit inUnit, AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
const T &value)
{
OSStatus status = AudioUnitSetProperty(inUnit, inID, inScope,
inElement,
&value, sizeof(value));
if (status != noErr)
Apple::ThrowOSStatus(status);
}
inline void
AudioUnitSetCurrentDevice(AudioUnit inUnit, const AudioDeviceID &value)
{
AudioUnitSetPropertyT(inUnit, kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global, 0,
value);
}
inline void
AudioUnitSetInputStreamFormat(AudioUnit inUnit,
const AudioStreamBasicDescription &value)
{
AudioUnitSetPropertyT(inUnit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, 0,
value);
}
inline void
AudioUnitSetInputRenderCallback(AudioUnit inUnit,
const AURenderCallbackStruct &value)
{
AudioUnitSetPropertyT(inUnit, kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input, 0,
value);
}
inline UInt32
AudioUnitGetBufferFrameSize(AudioUnit inUnit)
{
return AudioUnitGetPropertyT<UInt32>(inUnit,
kAudioDevicePropertyBufferFrameSize,
kAudioUnitScope_Global, 0);
}
inline void
AudioUnitSetBufferFrameSize(AudioUnit inUnit, const UInt32 &value)
{
AudioUnitSetPropertyT(inUnit, kAudioDevicePropertyBufferFrameSize,
kAudioUnitScope_Global, 0,
value);
}
#endif

75
src/apple/ErrorRef.hxx Normal file

@@ -0,0 +1,75 @@
/*
* Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef APPLE_ERROR_REF_HXX
#define APPLE_ERROR_REF_HXX
#include <CoreFoundation/CFError.h>
#include <utility>
namespace Apple {
class ErrorRef {
CFErrorRef ref = nullptr;
public:
explicit ErrorRef(CFErrorRef _ref) noexcept
:ref(_ref) {}
ErrorRef(CFAllocatorRef allocator, CFErrorDomain domain,
CFIndex code, CFDictionaryRef userInfo) noexcept
:ref(CFErrorCreate(allocator, domain, code, userInfo)) {}
ErrorRef(ErrorRef &&src) noexcept
:ref(std::exchange(src.ref, nullptr)) {}
~ErrorRef() noexcept {
if (ref)
CFRelease(ref);
}
ErrorRef &operator=(ErrorRef &&src) noexcept {
using std::swap;
swap(ref, src.ref);
return *this;
}
operator bool() const noexcept {
return ref != nullptr;
}
CFStringRef CopyDescription() const noexcept {
return CFErrorCopyDescription(ref);
}
};
} // namespace Apple
#endif

73
src/apple/StringRef.hxx Normal file

@@ -0,0 +1,73 @@
/*
* Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef APPLE_STRING_REF_HXX
#define APPLE_STRING_REF_HXX
#include <CoreFoundation/CFString.h>
#include <utility>
namespace Apple {
class StringRef {
CFStringRef ref = nullptr;
public:
explicit StringRef(CFStringRef _ref) noexcept
:ref(_ref) {}
StringRef(StringRef &&src) noexcept
:ref(std::exchange(src.ref, nullptr)) {}
~StringRef() noexcept {
if (ref)
CFRelease(ref);
}
StringRef &operator=(StringRef &&src) noexcept {
using std::swap;
swap(ref, src.ref);
return *this;
}
operator bool() const noexcept {
return ref != nullptr;
}
bool GetCString(char *buffer, std::size_t size,
CFStringEncoding encoding=kCFStringEncodingUTF8) const noexcept
{
return CFStringGetCString(ref, buffer, size, encoding);
}
};
} // namespace Apple
#endif

67
src/apple/Throw.cxx Normal file

@@ -0,0 +1,67 @@
/*
* Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Throw.hxx"
#include "ErrorRef.hxx"
#include "StringRef.hxx"
#include <stdexcept>
namespace Apple {
void
ThrowOSStatus(OSStatus status)
{
const Apple::ErrorRef cferr(nullptr, kCFErrorDomainOSStatus,
status, nullptr);
const Apple::StringRef cfstr(cferr.CopyDescription());
char msg[1024];
if (!cfstr.GetCString(msg, sizeof(msg)))
throw std::runtime_error("Unknown OSStatus");
throw std::runtime_error(msg);
}
void
ThrowOSStatus(OSStatus status, const char *_msg)
{
const Apple::ErrorRef cferr(nullptr, kCFErrorDomainOSStatus,
status, nullptr);
const Apple::StringRef cfstr(cferr.CopyDescription());
char msg[1024];
strcpy(msg, _msg);
size_t length = strlen(msg);
cfstr.GetCString(msg + length, sizeof(msg) - length);
throw std::runtime_error(msg);
}
} // namespace Apple

45
src/apple/Throw.hxx Normal file

@@ -0,0 +1,45 @@
/*
* Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef APPLE_THROW_HXX
#define APPLE_THROW_HXX
#include <CoreFoundation/CFBase.h>
namespace Apple {
void
ThrowOSStatus(OSStatus status);
void
ThrowOSStatus(OSStatus status, const char *msg);
} // namespace Apple
#endif

Some files were not shown because too many files have changed in this diff Show More