Max Kellermann
6de57b36c7
song/TagSongFilter: eliminate the std::fill_n() call
2019-03-14 20:31:22 +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
cb100f2e5c
input/ffmpeg: use avio_feof(), eliminate eof
attribute
2019-03-13 10:41:12 +01:00
Max Kellermann
bfb7b0117f
lib/ffmpeg/IOContext: allow partial reads
2019-03-13 10:39:43 +01:00
Max Kellermann
f6a705c769
input/ffmpeg: add AVIOContext wrapper class
2019-03-13 10:01:17 +01:00
Max Kellermann
0c01840a7e
input/ffmpeg: use C++11 initializer
2019-03-13 09:59:45 +01:00
Max Kellermann
b0b75c54de
input/ffmpeg: convert to class
2019-03-13 09:59:20 +01:00
Max Kellermann
3fc201d985
input/ffmpeg: add noexcept
2019-03-13 09:58:33 +01:00
Max Kellermann
5aa453ada3
input/ffmpeg: include cleanup
2019-03-13 09:57:50 +01:00
Max Kellermann
0009d53b3f
decoder/ffmpeg: add AVCodecContext wrapper class
2019-03-13 09:41:52 +01:00
Max Kellermann
05f7a6d1ff
decoder/ffmpeg: add AVFormatContext wrapper class
2019-03-13 00:27:21 +01:00
Max Kellermann
0256bbbbaf
decoder/ffmpeg: wider try/catch in ffmpeg_scan_stream()
2019-03-13 00:27:21 +01:00
Max Kellermann
bce608cdbc
decoder/ffmpeg: ffmpeg_decode() may throw
...
Don't catch and log exceptions. Let the caller handle the error.
2019-03-13 00:20:13 +01:00
Max Kellermann
38a0844cdf
decoder/ffmpeg: add AVFrame wrapper class
2019-03-12 23:51:46 +01:00
Max Kellermann
9acc6617d2
filter/registry: move extern
lines to plugin headers
2019-03-12 12:26:12 +01:00
Max Kellermann
4f72f49216
filter/normalize: clean up forward declarations
2019-03-12 12:24:31 +01:00
Max Kellermann
af9840daf7
util/Clamp: remove redundant inline
keywords from constexpr
functions
2019-03-12 11:54:51 +01:00
Max Kellermann
a67a9c9980
tag/Pool: remove redundant inline
keywords from constexpr
functions
2019-03-12 11:54:44 +01:00
Max Kellermann
732b2acf35
lib/upnp: remove redundant inline
keywords from constexpr
functions
2019-03-12 11:54:38 +01:00
Max Kellermann
16906cdcbe
fs/FileInfo: remove redundant inline
keywords from constexpr
functions
2019-03-12 11:54:31 +01:00
Max Kellermann
96e70659f0
lib/xiph/FlacAudioFormat: remove redundant inline
keywords from constexpr
functions
2019-03-12 11:53:13 +01:00
Max Kellermann
f2cacaf6b6
AudioFormat, pcm/Dsd*: remove redundant inline
keywords from constexpr
functions
2019-03-08 10:29:03 +01:00
Max Kellermann
24cde31328
lib/ffmpeg/Time: remove redundant inline
keywords from constexpr
functions
2019-03-08 10:28:02 +01:00
Max Kellermann
f6c0688684
util/ByteOrder: remove redundant inline
keywords from constexpr
functions
2019-03-08 10:23:14 +01:00
Max Kellermann
c176d94598
system/ByteOrder: move to util/
2019-03-08 10:21:10 +01:00
borine
c5df879cf9
decooder/plugins/PcmDecoderPlugin: add missing config for preproceesor macro definitions
2019-03-07 12:31:43 +00:00
borine
0762e5c289
decoder/plugins/PcmDecoderPlugin: guard alsa specific code with pre-processor macro test
2019-03-07 08:26:04 +00:00
borine
5d18559c1c
input/plugins/AlsaInputPlugin: change default device to default and default format to 48000:16:2
...
using the device "default" brings this plugin into line with the AlsaOutputPlugin; and a sample rate of 48kHz is more widely used as a native default for modern hardware than 44.1kHz
Also fixes an inconsistency between the docs and code.
2019-03-06 19:37:19 +00:00
borine
7db9c7f24e
input/plugins/AlsaInputPlugin: introduce mpd.conf config block to allow user to override the builtin defaults
2019-03-06 14:18:10 +00:00
borine
c834eb4590
input/plugins/AlsaInputPlugin: extend the alsa uri parsing to permit specification of the desired pcm audio format in the uri
2019-03-06 08:53:00 +00:00
borine
945ea51bd4
decoder/plugins/PcmDecoderPlugin: introduce new internal mime type "audio/x-mpd-alsa-pcm"
...
This mime type is to enable the AlsaInputPlugin to communicate the pcm stream audio format to the decoder
2019-03-06 08:39:47 +00: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