Commit Graph

12002 Commits

Author SHA1 Message Date
Eugene Gorodinsky
8d18b4c24b Fix meson.build to work properly with '-Ddatabase=false' 2019-04-18 08:55:13 +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
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 #184.

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
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
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
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
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
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
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
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
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
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
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 #487
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
834ad7a58f TagPrint: omit tags which were disabled by the client
Closes #471
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
bbaeea1ab7 storage/udisks2: use existing mount point if already mounted
Fixes the "org.freedesktop.UDisks2.Error.AlreadyMounted" error.

Closes #485
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 #482
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 #477
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
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
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
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
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 #453
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 #462
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
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
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: #405
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
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
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 #343
2019-01-04 19:04:52 +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
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 #437.  I don't want to declare those variables; instead, I'd
like to remove libwrap support.

Closes #437
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
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
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
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 #425).

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
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
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 (#420).

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 #420
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 #423
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
060908d5c4 song/Filter: add operator "contains"
Closes #410
2018-11-12 12:49:01 +01:00
Max Kellermann
228bf7eb09 output/thread: cancel the AudioOutputSource() instead of closing it
This fixes the assertion failure due to calling
AudioOutputSource::Close() twice.
2018-11-12 12:24:25 +01:00
Max Kellermann
5eaf2b8fc3 output/control: always close the AudioOutputSource in RELEASE
Fixes a crash bug with `always_on` outputs which occurs because the
`AudioOutputSource` still has a pointer to an outdated `MusicChunk`.

Fixes #415
2018-11-12 12:21:59 +01:00
Max Kellermann
e097fef79e output/control: add command RELEASE
With the new command, the decision to pause or close the output moves
into the output thread.
2018-11-12 12:09:37 +01:00
Max Kellermann
9a813cd3b1 output/Thread: update comment 2018-11-12 12:09:02 +01:00
Max Kellermann
1c60c8e014 output/Filtered: catch Drain() exceptions in CloseOutput() 2018-11-12 12:05:54 +01:00
Max Kellermann
eddda95900 output/interface: document that Drain() may throw 2018-11-12 12:04:42 +01:00
Max Kellermann
72184dccfc song/StringFilter: support regular expressions with "=~" and "!~"
This feature requires `libpcre`.
2018-11-11 12:55:35 +01:00
Max Kellermann
fee75dc766 {output,mixer}/alsa: use snd_pcm_poll_descriptors_revents()
This call was missing, causing very high CPU usage when the ALSA
output plugin was used with dmix.

Closes #391
2018-11-11 12:37:29 +01:00
Max Kellermann
ba5c856f15 events/MultiSocketMonitor: add method ForEachResult() 2018-11-11 12:37:28 +01:00
Max Kellermann
12308a0f55 lib/alsa/NonBlock: move the functions into a class managing the state 2018-11-11 12:37:25 +01:00
Max Kellermann
a958abde2f Merge branch 'fix_362' of git://github.com/miccoli/MPD 2018-11-11 12:37:13 +01:00
Max Kellermann
583208db7e output/httpd: fix nullptr dereference crash bug
When `metadata_sent` is `false`, the plugin assumes there is metadata
which must be sent, even if no metadata page was passed to the plugin.
Initializing it to `true` avoids dereferencing this `nullptr`.

Fixes #412
2018-11-08 09:37:18 +01:00
Max Kellermann
7b5ba15170 song/Filter: move code to ParseStringFilter() 2018-11-08 00:02:10 +01:00
Max Kellermann
d5e0d49f86 song/{Tag,Uri}SongFilter: pass StringFilter&& to constructor 2018-11-07 23:57:42 +01:00
Max Kellermann
73b22d82aa song/StringFilter: move negated flag from containing class 2018-11-07 23:47:31 +01:00
Max Kellermann
db51cc4e02 lib/zlib/meson.build: add zlib_dep to declare_dependency
Fixes potential compiler error when zlib is installed in a
non-standard directory.
2018-11-07 23:32:23 +01:00
Max Kellermann
ad597a8ff0 lib/zlib/meson.build: define ENABLE_ZLIB
Fixes #414
2018-11-07 23:24:58 +01:00
Max Kellermann
b1fe105904 output/Source: reset current_chunk in Open()
If the output is already open, the `current_chunk` pointer may be
bogus and out of sync with `SharedPipeConsumer::chunk`, leading to an
assertion failure in `SharedPipeConsumer::Consume()`.

Fixes #411
2018-11-07 00:17:48 +01:00
Max Kellermann
451b142e3a player/Thread: finish decoder startup before checking the buffer
This fixes a valgrind warning because `buffer_before_play`
initialization needs to know the audio format from the decoder.
2018-11-06 23:52:26 +01:00
Max Kellermann
98985c03b0 check.h: remove obsolete ENABLE_LARGEFILE check
Meson always enables large file support on the compiler command line,
thus config.h doesn't need to be included anymore.  We'll remove the
whole `check.h` header soon.

Closes #409
2018-11-05 21:25:59 +01:00
Max Kellermann
793fd8c479 decoder/ffmpeg: eliminate GetSampleFormat() 2018-11-04 22:36:17 +01:00
Max Kellermann
6c602811df decoder/ffmepg: fill AudioFormat from AVCodecContext, not AVCodecParameters
`AVCodecParameters` contains values from the codec detected by
avformat_find_stream_info(), but after avcodec_open2(), a different
codec might be selected with a different `AVSampleFormat`.  This leads
to misinterpretation of data returned from FFmpeg, leading to random
noise or silence.

This was observed with FFmpeg 4.0.2 and a TS container file containing
MP2.  A mp3-float codec was detected returning `AV_SAMPLE_FMT_FLTP`,
but finally the `mpegaudiodec_fixed.c` was used, returning
`AV_SAMPLE_FMT_S16`.

By using the audio format from `AVCodecContext`, we ensure that MPD
and FFmpeg always agree on the actual audio format in the buffer.

This removes the FFmpeg bug workaround from commit e1b032cbad which I
assume is obsolete after 7 years.

Fixes #380
2018-11-04 22:30:50 +01:00
Stefano Miccoli
6d48a5684a clamp 'set_normalized_volume' to valid values also for ALSA softvol
ensure that valid mixer values are set also when the ALSA driver
does not report a valid dB range ('set_raw' fallback)

correct a bug in which volume is assumed to lie in [0..100]
instead of [0..1]
2018-11-04 22:21:56 +01:00
Max Kellermann
bd115a4008 decoder/ffmpeg: use AtScopeExit() to call av_packet_unref() 2018-11-04 22:01:33 +01:00
Max Kellermann
08272cdee2 decoder/ffmpeg: require FFmpeg 3.1 or later
Drop some compatibility code.
2018-11-04 21:55:06 +01:00
Max Kellermann
ac0852b4e3 song/Filter: operator "==" never searches substrings in filter expressions
The protocol documentation says that the difference between `find` and
`search` is that `search` is case insensitive, but that's only half
the truth: `search` also searches for sub strings instead of matching
the whole string.  This part is undocumented and unfortunate, but at
this point, we can't change it.

However leaking this surprising behavior to the new filter expressions
was a bad idea; the "==" operator should never match substrings.  For
people who need that, we should add a new operator.
2018-11-04 13:57:34 +01:00
Max Kellermann
6fe43ed969 song/StringFilter: add flag substring
Prepare to stop using substrings for filter expressions.
2018-11-04 13:49:47 +01:00
Max Kellermann
b34bc06624 song/StringFilter: use std::string::operator== 2018-11-04 13:49:38 +01:00
Max Kellermann
86f1074905 lib/xiph/meson.build: the Vorbis encoder requires the Vorbis decoder
Without the Vorbis decoder, `libvorbis` is never detected, leading to
linker failures when attempting to build the Vorbis encoder.
2018-11-04 12:21:23 +01:00
Max Kellermann
6f242836e6 lib/xiph/meson.build: fix typo, replace and with or
Fixes linker failure when building without FLAC support.

Closes #400
2018-11-04 11:36:28 +01:00
Max Kellermann
f2c926f3b6 zeroconf/glue: add fallback value for HOST_NAME_MAX
`HOST_NAME_MAX` is not a portable macro; it is undefined on some
systems.

Closes #402
2018-11-04 11:12:03 +01:00
Max Kellermann
528f5b9cb9 song/Filter: allow escaping quotes in filter expressions
Closes #397
2018-11-02 19:15:08 +01:00
Max Kellermann
5a5229b499 net/IPv[46]Address: make the initializers more portable
Thanks to C++14, we can declare and fill variables inside `constexpr`
functions.  This means me can stop make assumptions on the `struct`
layouts without losing `constexpr`.

Closes #393
2018-11-02 17:47:43 +01:00
Max Kellermann
bba22c9c8c system/FileDescriptor: check __linux__ instead of __linux
`__linux` is the deprecated non-standard macros which appears to be
not present at all on PowerPC.

Closes #398
2018-11-02 16:50:38 +01:00
Max Kellermann
2a926063b2 src/lib/ffmpeg/meson.build: copy dependencies into ffmpeg_dep
Apparently, Meson propagates the linker flags but not the compiler
flags from a `static_library`'s dependencies list.

Closes #392
2018-11-01 19:14:00 +01:00
Max Kellermann
657ef48518 zeroconf/glue: use strstr() and std::string::replace() instead of std::regex_replace()
std::regex_replace() is heavily bloated and overkill for this feature.
2018-10-31 19:26:37 +01:00
Max Kellermann
8a492c8f39 Merge branch 'bug516974' of git://github.com/fschlich/MPD 2018-10-31 19:20:41 +01:00
Max Kellermann
901a48c9a4 command/sticker: return ACK_ERROR_NO_EXIST for "no such sticker"
Closes #389
2018-10-31 19:19:07 +01:00
Max Kellermann
f5c9071494 *: copyright year 2018 2018-10-31 17:54:59 +01:00
Florian Schlichting
d1f85240a2 include hostname in zeroconf_name (fixes #387)
expand %h to the system hostname and default to a zeroconf string that
contains %h
2018-10-31 17:54:45 +01:00
Max Kellermann
2148d4bb31 fs/io/FileOutputStream: fix -Wcomment 2018-10-31 17:18:44 +01:00
Max Kellermann
e79d06d595 fs/io/FileOutputStream: don't use O_TMPFILE on Android
Fixes writing to Context.getCacheDir().
2018-10-31 17:12:21 +01:00
Max Kellermann
c60cf944f5 fs/io/FileOutputStream: add macro HAVE_O_TMPFILE 2018-10-31 17:10:52 +01:00
Max Kellermann
06ca08ce55 output/roar: remove
Bugs in libroar which broke the MPD build have been annoying me for
quite some time, and the newest bug has now hit my main build machine:

 https://github.com/MusicPlayerDaemon/MPD/issues/377

Problem is the usage of the typedef `_IO_off64_t` in libroar's
`vio_stdio.h`:

 int roar_vio_to_stdio_lseek (void *__cookie, _IO_off64_t *__pos, int __w);

This `_IO_off64_t` is an internal implementation detail of glibc and
was removed in version 2.28.  Nobody must ever use it.  Why the ****
did the RoarAudio developers use it?  Not using internal typedefs
isn't exactly rocket science.

This annoys me enough to finally remove the plugin.  Anyway, I've
never heard of anybody using RoarAudio, so my best guess is that
nobody will notice.
2018-10-31 15:03:28 +01:00
Max Kellermann
9fc00a817b Listen: use fs/XDG.hxx
This keeps one central place for the XDG switch.  Specifically, this
disables the XDG listener on Apple, where XDG is not supported.
2018-10-31 14:30:34 +01:00
Max Kellermann
f47696f5f8 fs/StandardDirectory: move USE_XDG to XDG.hxx 2018-10-31 13:39:20 +01:00
Florian Schlichting
db21d7de0b fix compilation errors on Debian GNU/Hurd
Apparently on hurd-i386 __GLIBC__ is defined, but the pthread
implementation is special and cannot be used with constexpr. Hence
exclude __gnu_hurd__.
2018-10-31 12:24:34 +01:00
Max Kellermann
56112a237c Listen: listen on $XDG_RUNTIME_DIR/mpd/socket by default 2018-10-30 22:14:54 +01:00
Max Kellermann
64da9399ca event/ServerSocket: allow mixing AddFD() with other Add*() methods 2018-10-30 22:14:53 +01:00
Max Kellermann
0ec31b4aa4 Listen: eliminate listen_add_config_param() 2018-10-30 21:14:39 +01:00
Max Kellermann
a943f4063c event/ServerSocket: add AddFD() overload with AllocatedSocketAddress&& 2018-10-30 20:44:56 +01:00
Max Kellermann
ce9f09c69a event/ServerSocket: make AddAddress() a template 2018-10-30 20:43:52 +01:00
Max Kellermann
3ddc7a5353 event/ServerSocket: include cleanup 2018-10-30 20:19:07 +01:00
Max Kellermann
e575392b94 event/ServerSocket: use class IPv6Address 2018-10-30 20:19:04 +01:00
Max Kellermann
c6f61a699c event/ServerSocket: make OneServerSocket an inner class 2018-10-30 20:16:26 +01:00
Max Kellermann
0307b49f43 event/ServerSocket: make OnAccept() noexcept 2018-10-30 20:13:07 +01:00
Max Kellermann
413ab80295 event/ServerSocket: use C++11 initializer 2018-10-30 20:11:58 +01:00
Max Kellermann
daffefdb10 event/ServerSocket: pass UniqueSocketDescriptor to AddFD() 2018-10-30 20:05:57 +01:00
Max Kellermann
5fb21fbdb1 event/ServerSocket: add noexcept 2018-10-30 19:57:39 +01:00
Max Kellermann
f5857c4689 net/SocketUtil: update API documentation 2018-10-30 19:56:10 +01:00
Max Kellermann
c97469283c pcm: build dsd2pcm only if -Dtest=true 2018-10-30 13:31:43 +01:00
Max Kellermann
9b1f44e758 LogInit: work around two Android compiler warnings 2018-10-30 13:23:10 +01:00
Max Kellermann
804ccddf7e pcm/Clamp: convert to constexpr 2018-10-30 00:08:25 +01:00
Max Kellermann
bb5918932b pcm/PcmUtils: rename to Clamp.hxx 2018-10-30 00:05:58 +01:00
Max Kellermann
aa77bc323f pcm/FloatConvert: make IntegerToFloatSampleConvert::Convert() constexpr 2018-10-29 23:52:25 +01:00
Max Kellermann
9b6a2589e5 Merge branch 'v0.20.x' 2018-10-29 23:06:32 +01:00
Max Kellermann
cc5fab28af pcm/FloatConvert: fix compile-time integer overflow for S32
The compile-time calculation for `factor` overflows because `1<<31`
cannot be represented by `int`.  By casting to `uintmax_t` first, we
can avoid this overflow.

Closes #380
2018-10-29 22:50:54 +01:00
Max Kellermann
a3f7127e72 pcm/FloatConvert: use FloatToIntegerSampleConvert::factor for IntegerToFloatSampleConvert::factor 2018-10-29 22:50:06 +01:00
Max Kellermann
b0a6a569df pcm/FloatConvert: add static_assert on the factor
This assertion currently fails for S32 due to integer overflow (#380).
2018-10-29 22:38:32 +01:00
Max Kellermann
92523f8cf2 input/CdioParanoia: parse_cdio_uri() returns CdioUri
The `bool` return value isn't used anymore, so we can just return the
parsed object instead of passing it as an output parameter.
2018-10-29 14:34:33 +01:00
Max Kellermann
e33c08357a input/CdioParanoia: rename struct cdio_uri to CdioUri 2018-10-29 14:34:30 +01:00
Max Kellermann
2dc5648e57 input/CdioParanoia: use StringAfterPrefixIgnoreCase() 2018-10-29 14:34:30 +01:00
Max Kellermann
d0349880da util/StringCompare: add StringAfterPrefixIgnoreCase() 2018-10-29 14:34:29 +01:00
Max Kellermann
7aa1dceef6 player/Control: move IDLE_PLAYER to Player::SeekDecoder()
This emits the event even if PlayerControl::Play() is used to replay
the current song, which emits the missing "player" idle event.

Closes #381
2018-10-29 12:01:48 +01:00
Max Kellermann
f76544be4c db/update: catch all exceptions 2018-10-29 11:05:50 +01:00
Max Kellermann
1e6c445320 configure.ac: add -funwind-tables to work around clang bug
Replaces the workaround from commit
751fff07fb which fixed only one of many
crash locations.

See:

 https://github.com/MusicPlayerDaemon/MPD/issues/373
 https://github.com/android-ndk/ndk/issues/831
 https://bugs.llvm.org/show_bug.cgi?id=32611
2018-10-29 11:05:35 +01:00
Max Kellermann
eeae9a04d3 input/Registry: add missing include 2018-10-25 09:21:13 +02:00
Max Kellermann
8bb35e7bb6 decoder/Thread: reimplement HasRemoteTagScanner() using the InputPlugin list 2018-10-25 09:09:21 +02:00
Max Kellermann
3e78c9ab48 input/Plugin: add attribute prefixes 2018-10-24 20:25:32 +02:00
Max Kellermann
9ec86acb9c decoder/Thread: enable output tags for Tidal and Qobuz
Fixes formatted paths in the `recorder` output, closing #345.
2018-10-24 16:38:26 +02:00
Max Kellermann
426bde3f75 decoder/Thread: move check to SongHasVolatileTags() 2018-10-24 16:32:41 +02:00
Max Kellermann
30e22b753b tag/Chromaprint: OO wrapper for a ChromaprintContext 2018-10-24 10:52:45 +02:00
Max Kellermann
f7141c9201 decoder/Control: convert to class, make various attributes private 2018-10-24 10:47:34 +02:00
Max Kellermann
c2a2573aa5 release v0.20.22
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlvPX+UQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFElO8EACgPMaiN3m/x1hzJ3QTLzCXgeqSG1vuv1tC
 F+sFISLPx/IoVjTpvd9H8jMt7lD+SYB620pAfNyLIGZpWcTxu1wmaviOghqCqnGP
 sql0vtS9CrRGhsKDi5earox3zecylWJ3PRPXpy/4NjFuFUxE2ij/wbXzDb9UbtMg
 1WnVL++fAlFj54CnPR35XHglYU+X7/bMWApkVUfsKBgyX9aghqLYUIm0jaUjj3Bs
 xB/2Nemd1A88yrc4kqyzbFsN96S/W2eXhDYfPlDwFdplfoRJ8nrEMdwrsn0nabIF
 7x+OsAGAfrz3e00TZdiDSaIy7VU4EFV9ctZVonoCGUluBHL0iG7G7bj2cnd+hVnZ
 ecidfHMUqVO99elmUtWsUQwzbhL/TxM6Fzn2qDwqdwcCWDgHcn4fpXfsY0MRt6NK
 cUhCyspMTuhqS3ohLO6RfiWDActm6QL2IHiDty/WAe1Td0VjOiRQMq7CADHlgn/D
 IalN8kGyWHK5ew+3Iiw5zRoYjNXG4ALZN8cEqVh2R7i2uxh8+qm46HkhticAjfDM
 4mETs3oAZdpOGCgv6Q0eY7tQDKB13DD/303NJaVFb6Iew2TZCWDbFz5HjqYShCZi
 PgnPosdRg0LoQbMah4Uhsj6frs6LEBMpg6c7nScJN/1MoRaOyVNDg03X+rBmPe5z
 XULvdsZ8Sw==
 =8OQx
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.22'

release v0.20.22
2018-10-23 20:10:57 +02:00
Max Kellermann
751fff07fb input/Error: work around clang bug leading to crash
Closes #373
2018-10-23 19:52:22 +02:00
Max Kellermann
005e691339 decoder/fluidsynth: adapt to API change in version 2.0
Closes #360
2018-10-23 18:44:28 +02:00
Max Kellermann
c26703b7e6 SongFilter: check value.empty() after checking tag fallbacks
In this new order, a filter 'AlbumArtist ""' matches only on songs
which neither have `AlbumArtist` nor `Artist`.
2018-10-22 18:34:47 +02:00
Max Kellermann
66ab2de578 Merge branch 'v0.20.x' 2018-10-22 18:20:29 +02:00
Max Kellermann
db27bb76e2 db: fix broken command "list ... group"
Grouping in the "list" command was completely broken from the start,
unlike "count group".  I have no idea what I have been thinking when I
wrote commit ae178c77bd, but it didn't
make any sense.

This commit is a rewrite of the feature.

For clients to be able to detect this feature, this commit also
increments the protocol version.
2018-10-22 13:08:24 +02:00
Max Kellermann
7cfe929c36 db/Count: print empty group if song without grouped tag exists
Be consistent with "list" responses.
2018-10-22 12:42:18 +02:00
Max Kellermann
6c06244e83 db/Count: move code to tag/VisitCallback.hxx 2018-10-22 11:50:51 +02:00
Max Kellermann
53448e4633 tag/Fallback: add tag fallbacks for AlbumArtistSort, ArtistSort
Just like AlbumArtist falls back to Artist, AlbumArtistSort should
fall back tom AlbumArtist, ArtistSort and finally Artist.

Closes #355
2018-10-22 10:52:42 +02:00
Max Kellermann
21adc78713 SongFilter: use ApplyTagFallback() 2018-10-22 10:46:26 +02:00
Max Kellermann
0340b01392 db/Count: use ApplyTagFallback() 2018-10-22 10:46:26 +02:00
Max Kellermann
94aed92e9a tag/Set: move code to ApplyTagWithFallback() 2018-10-22 10:10:43 +02:00
Max Kellermann
6b9966e969 tag/Set: include cleanup 2018-10-22 10:09:56 +02:00
Max Kellermann
4bc5333995 tag/Set: use TagBuilder::AddItemUnchecked()
This improves the workaround from commit
b5ba94f1de and actually gives a useful
result for "list" with a disabled tag.
2018-10-22 10:06:04 +02:00
Max Kellermann
ff58b8d255 tag/Builder: move code to AddItemUnchecked() 2018-10-22 10:03:47 +02:00
Max Kellermann
e28d1e0f65 decoder/mad: convert Tag** parameter to just Tag* 2018-10-22 09:44:54 +02:00
Max Kellermann
a491d8ae24 decoder/mad: use class UniqueId3Tag 2018-10-22 09:44:50 +02:00
Max Kellermann
3cd5dd15f8 decoder/mad: don't initialize xing::frames 2018-10-22 09:44:48 +02:00
Max Kellermann
562ae44d38 decoder/mad: remove unused attribute from xing::magic 2018-10-22 09:44:46 +02:00
Max Kellermann
92541dedc0 Merge branch 'master' of git://github.com/skidoo23/MPD 2018-10-22 09:44:36 +02:00
Max Kellermann
650a67dc38 decoder/mad: use mad_bit_skip() where appropriate 2018-10-19 20:24:16 +02:00
Max Kellermann
c63f24e58e decoder/audiofile: larger stack buffer to reduce overhead 2018-10-19 20:04:28 +02:00
Max Kellermann
3be8b02cc2 decoder/sndfile: make vio constexpr
Use `const_cast` to be able to pass it to sf_open_virtual() which has
a wrong parameter declaration.
2018-10-19 19:51:17 +02:00
Max Kellermann
bdfaea0c25 decoder/mad: move parse_id3_mixramp() to src/tag/Id3ReplayGain.cxx 2018-10-19 19:45:32 +02:00
Max Kellermann
ed5c0d6546 tag/Id3Scan: make struct id3_tag pointers const 2018-10-19 19:43:03 +02:00
Max Kellermann
86dc621086 tag/Rva2: make struct id3_tag pointers const 2018-10-19 19:41:59 +02:00
skidoo23
fbea965c70 tag: new tag Label 2018-10-17 20:33:03 +02:00
Max Kellermann
eefc0f5d80 input/Error: add noexcept 2018-10-16 21:26:04 +02:00
skidoo23
69749eb591 decoder/sidplay: fix typo to avoid linker error with meson (libsidplayfp) 2018-10-16 14:56:40 +02:00
Max Kellermann
94592c1406 build with Meson instead of autotools
So long, autotools!  This is my last MPD related project to migrate
away from it.  It has its strengths, but also very obvious weaknesses
and weirdnesses.  Today, many of its quirks are not needed anymore,
and are cumbersome and slow.  Now welcome our new Meson overlords!
2018-10-14 23:41:38 +02:00
skidoo23
f80ebf68b0 decoder/wavpack: fix warning 'unused variable is_dsd' when compiled with --enable-dsd=no 2018-10-12 01:02:34 +02:00
Max Kellermann
1155a29096 Merge branch 'cdda_set_cdspeed' of git://github.com/andrewbasterfield/MPD 2018-10-08 21:16:52 +02:00
Max Kellermann
030e603940 decoder/gme: fix include
Broken since commit 08f77c2b60
2018-10-07 22:33:52 +02:00
Andrew Basterfield
9c1bf9ac5f Remove some extraneous leftover debugging 2018-10-07 19:21:38 +01:00
Andrew Basterfield
2f07b8f482 Set cdrive speed hint for cdparanoia 2018-10-06 20:18:19 +01:00
Max Kellermann
6c40a27809 db/update/ExcludeList: fix variable name in #else block 2018-10-01 08:40:53 +02:00
Max Kellermann
8736a3533b db/update/ExcludeList: add missing #ifdef 2018-10-01 08:40:15 +02:00
Max Kellermann
608d232373 util/SliceBuffer: re-add line which got lost in the last commit 2018-09-23 19:33:34 +02:00
Max Kellermann
1702e98fdf util/SliceBuffer: move code to DiscardMemory() 2018-09-23 19:15:28 +02:00
Max Kellermann
2ec94c0497 player/Control: start thread on demand
Keep MPD's footprint small until playback is requested.
2018-09-23 17:32:34 +02:00
Max Kellermann
bf372e3e1f player/Control: move public methods up 2018-09-23 17:28:41 +02:00
Max Kellermann
0d971963fd player/Control: make several methods private 2018-09-23 17:27:42 +02:00
Max Kellermann
287cff40b9 player/Control: remove Lock(), Unlock() 2018-09-23 17:27:42 +02:00
Max Kellermann
0e0bc7976f player/Control: add LockGetSyncInfo() 2018-09-23 17:17:57 +02:00
Max Kellermann
8c638c50a3 player/Thread: remove obsolete buffered_before_play attribute 2018-09-23 16:50:04 +02:00
Max Kellermann
5b2374b949 player/Thread: calculate buffered_before_play based on a fixed duration
Previously, there was the setting `buffered_before_play` which
specified a percentage of the audio buffer, defaulting to `10%`.  That
was working well enough for quite some time, until high-quality audio
formats became common.

At 44.1 kHz, 16 bit stereo, MPD collected 2.3 seconds worth of data in
the buffer before starting playback.  With the same default settings
and 192 kHz, 24 bit stereo, that was only 0.27 seconds.

Making this depend on the byte size only leads to high latency at low
quality, and too little data at high quality.  The natural choice
would be to use a duration instead of a byte size, which should give
the same good experience with all audio formats.

Since the `buffered_before_play` configuration setting was not
understood well by users and caused more harm than good, this commit
deprecates it.  It has now no effect.
2018-09-23 15:46:29 +02:00
Max Kellermann
c1600bcf3d player/Thread: copy buffered_before_play 2018-09-23 15:46:27 +02:00
Max Kellermann
a82d864c91 config/File: print warning about deprecated options 2018-09-23 15:43:38 +02:00
Max Kellermann
dcac32a6c4 AudioFormat: add implicit cast to duration::rep
Fixes integer truncation bugs (closes #359).
2018-09-23 15:15:53 +02:00
Max Kellermann
5286477f73 Chrono: remove unnecessary typedef rep
It is already inherited by the base class, and we don't need to import
it explicitly.
2018-09-23 15:15:18 +02:00
Max Kellermann
2f3845ef51 player/Thread: remove buffered_before_play from decoder_wakeup_threshold formula
Simplify the formula, and I guess this makes the formula more
reliable.  Imagine somebody configured `buffered_before_play` larger
than 25%; then the decoder would be woken up all the time.  This
doesn't seem logical.  On the other hand, it's easy to understand that
the decoder should be woken up below 75% buffer fill.
2018-09-23 15:00:47 +02:00
Max Kellermann
1191025bbf player/Thread: add attribute decoder_wakeup_threshold
Calculate the value only once.
2018-09-22 19:56:00 +02:00
Max Kellermann
bfd261929e AudioFormat: remove obsolete method GetTimeToSize() 2018-09-22 19:39:20 +02:00
Max Kellermann
84de88841b player/CrossFade: use AudioFormat::SizeToTime() instead of GetTimeToSize() 2018-09-22 19:37:45 +02:00
Max Kellermann
224400074c player/CrossFade: use std::chrono::duration 2018-09-22 19:37:02 +02:00
Max Kellermann
863722545f player/CrossFade, ...: use lround() 2018-09-22 19:08:03 +02:00
Max Kellermann
d3d1d37782 AudioFormat: add TimeToSize(), SizeToTime() 2018-09-21 20:51:08 +02:00
Max Kellermann
1a2012a97e player/Control: convert total_play_time to FloatDuration 2018-09-21 20:50:15 +02:00
Max Kellermann
90f4e97751 decoder/Client: use std::chrono::duration<double> instead of raw double 2018-09-21 20:42:34 +02:00
Max Kellermann
d1bcd98f79 Chrono: add FloatDuration 2018-09-21 20:42:30 +02:00
Max Kellermann
39542de69d Chrono: add static method Cast() 2018-09-21 20:41:23 +02:00
Max Kellermann
1d00d55d53 player/Thread: stop buffering if buffer is full
Shouldn't ever happen, but who knows...
2018-09-21 19:05:25 +02:00
Max Kellermann
a190db0873 player/Thread: simplify loop condition 2018-09-21 18:58:38 +02:00
Max Kellermann
e3142312bb player/Control: convert to class 2018-09-21 18:12:28 +02:00
Max Kellermann
e5d1ac0bd0 player/Thread: move functions into PlayerControl 2018-09-21 18:09:14 +02:00
Max Kellermann
c0411fa412 decoder/Thread: add noexcept 2018-09-21 17:58:34 +02:00
Max Kellermann
781e690012 player/Thread: catch and log initialization errors 2018-09-21 17:35:32 +02:00
Max Kellermann
9a2d71341e player/Control: apply CamelCase to struct player_status 2018-09-21 17:22:35 +02:00
Max Kellermann
6db6d3c50c player/Thread: move StartPlayerThread() into PlayerControl 2018-09-21 17:14:19 +02:00
Max Kellermann
0e2c597884 MusicBuffer: remove noexcept from constructor
The `SliceBuffer` constructor can throw.
2018-09-21 17:11:52 +02:00
Max Kellermann
debdf9bb96 decoder/{Thread,Control,...}: rename source files, drop prefix 2018-09-21 17:01:24 +02:00
Max Kellermann
218d9383d7 decoder/Thread: move decoder_thread_start() into DecoderControl 2018-09-21 16:57:54 +02:00
Max Kellermann
af64bd5088 Thread/Thread: disallow copying 2018-09-21 16:55:09 +02:00
Max Kellermann
050f81c4fe Thread/Thread: document Start() exception 2018-09-21 16:53:52 +02:00
Max Kellermann
ab678787f4 java/Ref: API doc line breaks 2018-09-06 20:04:46 +02:00
Max Kellermann
23556585ca java/Ref: add LocalRef::GetEnv() 2018-09-06 20:04:40 +02:00
Max Kellermann
728e4e9a38 util/StringCompare: add StringEndsWithIgnoreCase(), StringStartsWithIgnoreCase() 2018-09-06 19:52:43 +02:00
Max Kellermann
2d6f9f9a9c Util/WStringAPI: non-Windows implementation of _wcs*cmp() 2018-09-06 19:49:45 +02:00
Max Kellermann
c2e2e5543e util/WStringAPI: add wcscoll() wrapper 2018-09-06 19:39:28 +02:00
Max Kellermann
349d8eb248 util/WStringCompare: add "noexcept" 2018-09-06 19:35:09 +02:00
Max Kellermann
94b96bde9b util/WStringCompare: wcpcpy() and wcsdup() are available on Android 2018-09-06 19:33:50 +02:00
Max Kellermann
45ffc864c5 util/StringCompare: add more function attributes 2018-09-06 19:23:13 +02:00
Max Kellermann
19d9ce260a fs/io/FileOutputStream: disallow copying 2018-09-03 14:36:01 +02:00
Max Kellermann
0701333ec1 db/proxy: forward filter as expression to server
This adds support for the full set of MPD 0.21 filter types.
2018-09-02 22:39:45 +02:00
Max Kellermann
a8e70f0901 db/proxy: forward sort and window to server 2018-09-02 17:51:30 +02:00
Max Kellermann
c7c32a3ce9 db/Print: move sort/window emulation code to class DatabaseVisitorHelper
That way, each plugin can decide to implement it better.
2018-09-02 17:37:02 +02:00