Commit Graph

10204 Commits

Author SHA1 Message Date
Thomas Zander
d50b30a498 Add missing include for cstdlib, otherwise free() is undefined 2017-03-07 20:02:36 +01:00
Max Kellermann
42a3a87f13 util/HugeAllocator: paranoid check for sysconf()<0
Just in case.
2017-03-01 21:50:26 +01:00
Ben Boeckel
9dfedbe619 ReusableArray: fix build error on GCC7
GCC7 outputs the following error without this change:

    src/util/ReusableArray.hxx:61:35: error: no matching function for call to ‘swap(size_t&, const size_t&)’
       std::swap(capacity, src.capacity);

which can be resolved by just using an rvalue-reference rather than a
const rvalue-reference.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
2017-03-01 19:38:41 +01:00
Max Kellermann
b2f2c9322b db/simple/Mount: workaround for libc++ 2017-03-01 17:31:26 +01:00
Max Kellermann
3be2051808 decoder/Thread: check ENABLE_FFMPEG, not HAVE_FFMPEG
This repairs the damage to commit 74dbaade6f done by commit
b3f5b4932c
2017-03-01 17:06:23 +01:00
Max Kellermann
ff32b0dc9b input/curl: use %lu instead of %llu
Fixes a GCC warning because %llu appears to be unsupported by the
Windows standard library.
2017-03-01 16:44:11 +01:00
Max Kellermann
c1869a11af input/curl: format Range offset as unsigned 2017-03-01 16:44:08 +01:00
Max Kellermann
e22a4fdba4 command/Error: improve libstdc++ 4.9.x detection for std::rethrow_if_nested() workaround 2017-03-01 16:38:22 +01:00
Max Kellermann
29a7b2c5b5 decoder/mpcdec: ignore empty frames
https://bugs.musicpd.org/view.php?id=4656 describes a crash due to
division by zero because frame.samples==0.  This should never happen,
but apparently can happen after seeking.  The best we can do is to
just ignore this frame.
2017-03-01 16:13:21 +01:00
Max Kellermann
e9e853b19a command/Partition: add command "partition" to switch to another partition 2017-02-25 10:26:33 +01:00
Max Kellermann
e48ea5f23a Instance: add method FindPartition() 2017-02-25 10:26:33 +01:00
Max Kellermann
a99bab935a Client: add method SetPartition() 2017-02-25 10:25:16 +01:00
Max Kellermann
3eee35e1f7 Client: convert partition to pointer
Prepare to make it mutable.
2017-02-25 10:23:23 +01:00
Max Kellermann
c7396b0675 Client: add method GetPartition(), make partition private 2017-02-25 10:20:09 +01:00
Max Kellermann
e3ee60e7af command/storage: use Instance::EmitIdle()
These events are relevant for all partitions.
2017-02-25 10:20:07 +01:00
Max Kellermann
05b8ddac4c Client: add method GetInstance() 2017-02-25 10:20:05 +01:00
Max Kellermann
668724de4e Client: replace playlist and player_control with getter methods
Prepare to convert "partition" to a mutable pointer.
2017-02-25 09:24:19 +01:00
Max Kellermann
71ce1a25dd SongPrint: remove Storage::MapToRelativeUTF8() call
This code (added 7 years ago with commit b233c145f) has been obsoleted
by the SongLoader class (added 3 years ago).
2017-02-24 13:56:13 +01:00
Max Kellermann
cd522f524d fs/Traits: allow base to end with a slash in Relative()
Fixes false negatives:

 http://foo/dav/example.ogg mismatches http://foo/dav/

.. because StringAfterPrefix() returns just "example.ogg", without
trailing slash (it existed, but was eaten already by the base
matcher).
2017-02-24 13:50:29 +01:00
Max Kellermann
ca559b1db6 input/curl: use %lu instead of %llu
Fixes a GCC warning because %llu appears to be unsupported by the
Windows standard library.
2017-02-21 12:06:56 +01:00
Max Kellermann
a8e76fb345 input/curl: format Range offset as unsigned 2017-02-21 12:06:03 +01:00
Max Kellermann
1d445d1039 SongPrint: move duplicate code into PrintRange() 2017-02-20 22:00:11 +01:00
Max Kellermann
29d03ab937 release v0.20.5
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlirVtMQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEgbaD/9tgcgcnbiWGkNDMf0qfqfaiY80wA4HbSBT
 qbKzan/kuiPXL6xcgw8YRYdAjyaIyw//f1q0SL8/LKvVQ4CrlTEQzOQUzrAOe02n
 m35/6YKZVzziMRwuSZY4oQ4WH7SE87gthYIykRt59adznr2QNtQe53SnXd8ukGtf
 l8xlLNuIiEwIo5PZ8ObEZH1dUP1PWtfJlxQfbJ2JhZTOR/qPfrpIzSK4GVY0ZXdz
 EO6BIZyDgPfeZCPBZqiKmw4vcdIHBhG9ZgtOhX3YATV7ZSYqmjrUcjzEsoyQlOaH
 rhe/whl272TQYdj95//BnqI899NVSNRYg6XXGlCB5TXqFscoDCW6JXvVAaTfB0Yg
 vMV7ZYX8auu2i013O51yoj8/ofNmOjqbX9eui+gJx6Xb6Zr9Ttma5woYRh14NXwd
 15KObGCd1LADpiOZ2XQ8Snlu8QlZ+PXr8RpLh9uSwDe7heemMRKqDZEf3AxfP3wO
 GUOK4EHfZ5kZQHlWLA3u59Zopo1ZJjL6EJUTG3Qk+n/Wob/S2F/v5IFIdyaEFTKI
 hrcTEQ/EmXZ9vc5Iw/LnIM49pO3kZXKQ9bSrZoi0kjk2AN6XBMmJNoYv/+huc2U9
 JiCcyM8olCWcSQnPGjoHWxBGLhxNXtR+WYu/tEEq3+D2PFdkfOap3ApP1qdi+JPd
 JFps/sOkgQ==
 =4+OJ
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.5'

release v0.20.5
2017-02-20 21:59:40 +01:00
Max Kellermann
bc1c927952 util/TimeFormat: suppress -Wunused on Windows 2017-02-20 21:44:01 +01:00
François Revol
46aa4d2f91 haiku: fix build
Some missing bits when converted to C++ exceptions...
2017-02-20 11:25:00 +01:00
Max Kellermann
512e81c629 output/httpd: use emplace() instead of push() 2017-02-19 20:48:17 +01:00
Max Kellermann
452666f742 output/httpd: wake up the I/O thread only if pages have been read from encoder 2017-02-19 20:46:20 +01:00
Max Kellermann
72008d951b output/httpd: no mutex lock while reading data from encoder 2017-02-19 20:45:16 +01:00
Max Kellermann
72146e7800 output/httpd: use std::lock_guard 2017-02-19 20:43:45 +01:00
Max Kellermann
f7af1bb8e2 output/httpd: cancel the DeferredMonitor in Close() 2017-02-19 20:41:34 +01:00
Max Kellermann
f88f1fca3f output/httpd: move Close() lock into the I/O thread
Fixes a potential deadlock introduced by commit 945287358b
2017-02-19 20:41:06 +01:00
Max Kellermann
26e4a40cc7 output/httpd/Page: use std::shared_ptr instead of class RefCount 2017-02-19 20:17:57 +01:00
Max Kellermann
8b1931072a output/httpd/Page: no variable size, use AllocatedArray
Using variable-size objects is not worth the trouble here.  Let's drop
this and use existing and simpler code.
2017-02-19 20:13:41 +01:00
Max Kellermann
45e15b6cc6 output/httpd/Page: make all attributes private 2017-02-19 20:13:35 +01:00
Max Kellermann
be7e52c882 output/httpd/Page: remove unused method Concat() 2017-02-19 20:13:19 +01:00
Max Kellermann
4162ce0bc5 output/httpd/Page: use uint8_t instead of unsigned char 2017-02-19 19:49:53 +01:00
Max Kellermann
7e46277016 Merge branch 'v0.20.x' 2017-02-19 19:46:18 +01:00
Max Kellermann
f3b788703e tag/Handler: improve snprintf() return value check 2017-02-19 19:34:13 +01:00
Max Kellermann
4bb83781e8 output/httpd/IcyMetaDataServer: cast length to unsigned
Fixes another buffer overflow: if the stream has a very long title or
URL, resulting in a metadata string of more than 2 kB, icy_string[0]
is a negative value, which gets casted to size_t - ouch!

 https://bugs.musicpd.org/view.php?id=4652
2017-02-19 19:28:52 +01:00
Max Kellermann
a73195b7cc output/httpd/IcyMetaDataServer: pad the string with 15 spaces
Fixes a buffer overflow due to the bad formula rounding the buffer
size up.  At the same time, remove the "+1" from the meta_length
calculation, which takes the padding into account and at the same time
implements proper rounding.
2017-02-19 19:27:37 +01:00
Max Kellermann
1bd00b8a9a output/httpd/IcyMetaDataServer: remove the int cast
Why did this cast exist??
2017-02-19 19:27:37 +01:00
Max Kellermann
3b84b99804 IdleFlags: add a "partition" event 2017-02-17 23:59:06 +01:00
Max Kellermann
1786f9b1bb command/Partition: add command "newpartition" 2017-02-17 23:53:49 +01:00
Max Kellermann
1e972174a6 output/MultipleOutputs: add method AddNullOutput() 2017-02-17 23:53:49 +01:00
Max Kellermann
77178e0590 Instance: make "partition" a std::list
With this commit, multi-player support becomes possible... it's just
not wired to the frontend yet.

This is based on massive amounts of refactoring work I did over the
past 9 years.
2017-02-17 23:22:29 +01:00
Max Kellermann
9a909d9f27 Instance: un-inline the constructor 2017-02-17 23:22:05 +01:00
Max Kellermann
90d25a40a0 Instance: use C++11 initializer 2017-02-17 23:21:55 +01:00
Max Kellermann
c335f18be7 Partition: add "name" attribute 2017-02-17 23:18:51 +01:00
Max Kellermann
7dc3e73782 command: add command "listpartitions"
The first step to multi-player support.  Not much, just a dummy
command.
2017-02-17 23:07:31 +01:00
Max Kellermann
47dffe66aa output/alsa: fix race condition on early snd_pcm_writei() error
During UnlockActivate() while the mutex is unlocked, the IOThread can
set a new error condition, and will never again wake up the
OutputThread.  This race condition can cause a deadlock in the
OutputThread.
2017-02-15 11:23:44 +01:00
Max Kellermann
6636c69a11 storage/FileInfo: convert mtime to std::chrono::system_clock::time_point 2017-02-11 23:45:15 +01:00
Max Kellermann
0ccaf4a1ff storage/FileInfo: add initializing constructor 2017-02-11 23:45:14 +01:00
Max Kellermann
5cdbad7937 db/simple/Directory: make parent and path const 2017-02-11 23:45:14 +01:00
Max Kellermann
fc0508c047 db/simple/Directory: use C++11 initializers 2017-02-11 23:45:14 +01:00
Max Kellermann
78ca5491e6 db/Interface: GetUpdateStamp() returns std::chrono::system_clock::time_point 2017-02-11 23:02:17 +01:00
Max Kellermann
4146475c73 util/ChronoUtil: new utility library for std::chrono 2017-02-11 22:23:33 +01:00
Max Kellermann
329c3ab21b fs/FileInfo: use std::chrono::system_clock 2017-02-10 23:48:21 +01:00
Max Kellermann
3b7f6641d2 TimePrint: std::chrono::system_clock support 2017-02-10 23:48:21 +01:00
Max Kellermann
781487c4dd thread/Thread: use BoundMethod 2017-02-10 22:46:09 +01:00
Max Kellermann
5ba5bc8ba1 thread/Thread: move code to Run() 2017-02-10 22:43:55 +01:00
Max Kellermann
82c66ce078 thread/Thread: Start() returns void
Since we switched to C++ exceptions, there is no code path which
returns false.
2017-02-10 22:41:29 +01:00
Max Kellermann
9324fbf921 event/Thread: remove the Mutex
We don't need to access Thread::handle early inside the EventThread,
so we don't need this trick anymore.
2017-02-10 22:29:31 +01:00
Max Kellermann
5e081de14a IOThread: move EventThread instance into struct Instance
Eliminate global variables.
2017-02-10 22:25:06 +01:00
Max Kellermann
115af4f565 event/Loop: Break() is no-op if "quit" is already set 2017-02-10 22:24:48 +01:00
Max Kellermann
822724d1aa event/Thread: auto-stop in the destructor 2017-02-10 22:24:46 +01:00
Max Kellermann
87c9856b20 input/alsa: use the EventLoop& passed to init() instead of io_thread_get() 2017-02-10 22:24:44 +01:00
Max Kellermann
835136dcd3 output/Thread: add assertion on the ao_plugin_play() result 2017-02-10 22:24:36 +01:00
Max Kellermann
4a80e9cb25 output/alsa: copy the PcmExport result to the ring_buffer
.. and not the input data.

Regression from commit b1c7649edb (integer underflow).

 https://bugs.musicpd.org/view.php?id=4639
2017-02-10 22:23:00 +01:00
Max Kellermann
de80c270bd IOThread: move code to class EventThread 2017-02-10 21:40:39 +01:00
Max Kellermann
b92bff2658 IOThread: remove unused function io_thread_inside() 2017-02-10 21:40:30 +01:00
Max Kellermann
42f1e26540 IOThread: remove unused Cond variable 2017-02-10 21:29:54 +01:00
Max Kellermann
cfd056231b output/alsa: use the EventLoop& parameter instead of io_thread_get() 2017-02-10 21:21:15 +01:00
Max Kellermann
20ae84bff9 {input,mixer}/alsa: cancel the DeferredMonitor in the destructor
Yet another potential crash bug fix.
2017-02-10 15:05:49 +01:00
Max Kellermann
b1c7649edb output/alsa: non-blocking mode
Use SND_PCM_NONBLOCK, and perform all snd_pcm_writei() calls in the
IOThread.  Use a lockless queue to copy data from the OutputThread to
the IOThread.

This rather major change aims to improve MPD's internal latency.  All
waits are now under MPD's control, instead of blocking inside
libasound2.

As a side effect, an output's filter is now decoupled from the actual
device I/O, which solves a major latency problem with the conversion
filter on slow CPUs and small period buffers.  See:

 https://bugs.musicpd.org/view.php?id=3900
2017-02-09 21:36:18 +01:00
Max Kellermann
853740f1e2 Main: use the IOThread for outputs and mixers
The main EventLoop can block for a long time while a client's command
runs, and is therefore inappropriate for internal engine I/O.  This
fixes a serious regression for at least the "httpd" output, which used
to be hard-coded for the IOThread, but now receives the main EventLoop
as an initialization parameter.

For the mixers, this doesn't make much of a difference.  They are not
latency critical.
2017-02-09 21:33:49 +01:00
Max Kellermann
14986b153a event/Loop: use std::lock_guard 2017-02-09 21:26:55 +01:00
Max Kellermann
9e503b21c1 {input,mixer}/alsa: move code to lib/alsa/NonBlock.cxx 2017-02-09 21:24:24 +01:00
Max Kellermann
67a958a326 Merge branch 'v0.20.x' 2017-02-09 21:24:20 +01:00
Max Kellermann
7372c931b3 event/Loop: make IsInsideOrNull() available in the NDEBUG build
Fixes build breakage by commit 4e5271fcdf7; and this method does make
sense in non-debug builds.
2017-02-09 21:21:49 +01:00
Max Kellermann
29e1b6e465 mixer/alsa: reset the MultiSocketMonitor in the destructor
Fixes potential crash bug.
2017-02-09 21:13:19 +01:00
Max Kellermann
eda06993f8 event/MultiSocketMonitor: add method Reset() 2017-02-09 21:12:23 +01:00
Max Kellermann
4b30ef1cf2 event/MultiSocketMonitor: use C++11 initializer 2017-02-09 21:12:23 +01:00
Max Kellermann
e92e5e8eb8 event/MultiSocketMonitor: more API documentation
Now ClearSocketList() may only be called from PrepareSockets().
Calling it before destroying the object doesn't work properly, because
it doesn't unregister the TimeoutMonitor and the IdleMonitor.  Some of
its callers need to be fixed.
2017-02-09 21:12:23 +01:00
Max Kellermann
4e5271fcdf event/Call: allow usage during shutdown
Change EventLoop::IsInside() call to EventLoop::IsInsideOrNull().
This means that BlockingCall() may be used during shutdown, after the
main EventLoop::Run() has finished.  This is important because mixers
are currently registered in the main EventLoop.
2017-02-09 21:12:23 +01:00
Max Kellermann
76a1cae5d8 {input,mixer}/alsa: fix off-by-one bug in count check
Doesn't make a practical difference - but it's more correct this way.
2017-02-09 12:46:49 +01:00
Max Kellermann
3850716522 command/Database: add "sort" parameter to "find" and "search"
Implement the second part of https://bugs.musicpd.org/view.php?id=3990
2017-02-08 11:22:08 +01:00
Max Kellermann
e9c99e0518 DetachedSong: add LightSong cast operator 2017-02-08 10:38:25 +01:00
Max Kellermann
332baa4f67 DetachedSong: don't declare empty destructor
An explicit destructor prevents usage of implicit move operators, even
if it's empty.  Therefore, declaring a defaulted destructor with GCC
attribute "noinline" does what we want without preventing those
implicit operators.
2017-02-08 10:24:45 +01:00
Max Kellermann
08879d2a20 DetachedSong: add move operator 2017-02-08 10:24:40 +01:00
Max Kellermann
1292af4768 Revert "DetachedSong: remove explicitly-defaulted copy/move constructors"
This reverts commit 67b7d46432.

Turns out I was wrong, and mentioning these does make a difference:
the implicit move constructor is not defined in the presence of a
user-declared destructor.
2017-02-08 10:21:35 +01:00
Max Kellermann
4d88a099f9 Compiler.h: add gcc_noinline 2017-02-08 10:17:21 +01:00
Max Kellermann
777e15bd78 db/DatabaseSong: make the Storage optional
Some database plugins don't use a Storage (e.g. UPnP), and with this
plugin, DatabaseDetachSong() can crash.
2017-02-08 10:05:55 +01:00
Max Kellermann
f689e28958 SongLoader: return instance, not pointer 2017-02-08 10:02:08 +01:00
Max Kellermann
d184231169 db/DatabaseSong: DatabaseDetachSong(uri) returns instance, not pointer 2017-02-08 09:59:12 +01:00
Max Kellermann
7225e919fc db/DatabaseSong: use AtScopeExit() 2017-02-08 09:58:40 +01:00
Max Kellermann
7a185f1ead queue/PlaylistUpdate: assert Database::GetSong()!=nullptr 2017-02-08 09:53:14 +01:00
Max Kellermann
c1fa5279f4 db/Interface: clarify GetSong() error handling 2017-02-08 09:50:30 +01:00
Max Kellermann
4f0fe66f69 DetachedSong: make the LightSong constructor public
Sometimes, it's useful to construct a DetachedSong from a LightSong
even without having real_uri initialized.
2017-02-08 09:45:37 +01:00
Max Kellermann
76380b2b45 DetachedSong: pass std::string&& to uri initializer
Eliminate one temporary allocation.
2017-02-08 09:42:09 +01:00
Max Kellermann
67b7d46432 DetachedSong: remove explicitly-defaulted copy/move constructors
Mentioning these doesn't make a difference.
2017-02-08 09:40:29 +01:00
Max Kellermann
29453ba196 client: add tag_mask attribute
The "tagtypes" command now has several sub commands which can be used
to edit that mask.
2017-02-08 09:06:11 +01:00
Max Kellermann
599d77643b client/Response: add method GetClient() 2017-02-08 09:06:11 +01:00
Max Kellermann
09d87d5ef1 command/Other: move some functions to ClientCommands.cxx
handle_tagtypes() is also being moved to ClientCommands.cxx, because
that command will be extended to access client-specific settings.
2017-02-08 09:06:11 +01:00
Max Kellermann
2f3f075e4f tag/Mask: wrap in class 2017-02-08 09:04:45 +01:00
Max Kellermann
17097d96b7 db/{Count,Print}: use tag_print(), eliminate duplicate code 2017-02-08 09:04:41 +01:00
Max Kellermann
a3e28c2d1a tag/Tag: move tag_name_parse() to ParseName.cxx 2017-02-08 08:57:22 +01:00
Max Kellermann
03a97d87ea tag/Tag*: rename several source files 2017-02-08 08:49:42 +01:00
Max Kellermann
8cbf099054 tag/Id3Load: update API documentation 2017-02-08 08:48:44 +01:00
Max Kellermann
07ce915c66 Merge branch 'v0.20.x' 2017-02-08 08:45:24 +01:00
Max Kellermann
53c14d97a6 lib/nfs/FileReader: remove debug line 2017-02-08 08:43:56 +01:00
Max Kellermann
69a82eec17 tag/TagId3: use AtScopeExit() for exception-safety 2017-02-06 23:32:07 +01:00
Max Kellermann
45cadef22f configure.ac: prepare for 0.20.5 2017-02-06 23:28:36 +01:00
Max Kellermann
73f58c57e8 storage/curl: use CURLOPT_POSTFIELDS instead of CURLOPT_READFUNCTION 2017-02-06 23:25:03 +01:00
Max Kellermann
43348a3e13 decoder/Control: improve locking in Start() and Seek()
Previously, both methods accessed a lot of attributes which require
mutex protection.
2017-02-05 13:37:20 +01:00
Max Kellermann
e716b1f4d7 Client: remove redundant "virtual" keywords 2017-02-03 22:27:11 +01:00
Max Kellermann
82e74a4ebd Client: make client_vprintf() static 2017-02-03 20:47:41 +01:00
Max Kellermann
16b260e371 Client: eliminate client_puts(), use Client::Write() instead 2017-02-03 20:46:53 +01:00
Max Kellermann
3102e05da4 Client: make attributes "uid" and "num" const 2017-02-03 20:41:31 +01:00
Max Kellermann
df4af2b550 release v0.20.4
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAliSTDkQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEsIQD/4iNkylzLp8mID2aFT690MFzv4TRXi2XS7v
 r3Rlx3hpGyDdzeXZeFc5zxsc9Ei8OfLcdFC/Umj9LjQanXakOxwsdhagrW9cadNX
 YLxkyVcREXalmzUvoWeRnya1LjoTdYA8llvG2tAJosXVr0o/GHZi56aHcrYnW2a6
 XD8kEk5k9beuEcBLk1rdZCTGPbVLwCFvMcpZ7j5Hd4kDGQjjw2aoEaPWchJdhLQh
 p+GRSU+A8hyTo9zy+aNO3cKvq6zqVxDLlHnIqh8XPWQoLPyWuD7ETvwERKmdmiPZ
 bSo0MR7azTlhkWbNZxjPHgZuacJDlwKvXPg1ofjn8VVcaVe5ONeX+1WP0ozUYqyU
 fmhLxMHKuwZcKo6do/jNhAVp//VBWhSwJHPA8kjBTuZHHc0HvgyTxlAgvzlrSswe
 dxc8vnvzgJfUKz5k7mf3amVg6Cu1CmNi59CkyL0NL+8N0inyMfdeQuQEYgbPoI6X
 jIRwACfXpMX75VtiDaNpnFLBjL5emE6u2bDoU2c5ezgpthaWjb0PqSmoLBBF8TNm
 k0ecXlIwCjT3pDcqmFdqgG3AJiYLTgX0rETC8PInl6toLzr2oVMVlijU3YK5PjMl
 nTvgs8TwprTWImgcBnidqRMb39p3AKs12pHfZ4Y5Iu82Bm60acZQMkv6sQh43Wyc
 +W2+T3D2IA==
 =b2Fz
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.4'

release v0.20.4
2017-02-01 22:05:33 +01:00
Max Kellermann
591afa0647 lib/nfs/Connection: detect socket hangup and unregister from epoll
Fixes race condition when epoll_ctl() gets called after the socket has
been closed, which may affect a different socket created by another
thread meanwhile.
2017-02-01 21:44:20 +01:00
Max Kellermann
05eac20ffe lib/nfs/Connection: detect libnfs reconnect
When rpc_reconnect_requeue() gets called from inside nfs_service(),
the NfsInputStream can stall completely because the old socket has
been unregistered from epoll automatically, but the new one has never
been registered.  Therefore, nfs_service() will never be called again.

This kludge attempts to detect this condition by checking
nfs_which_events()==POLLOUT.

https://bugs.musicpd.org/view.php?id=4081
2017-02-01 21:36:58 +01:00
Max Kellermann
38d263ac19 output/sndio: work around a libroar C++ incompatibility
Same as in commit e02d8ad8d2, but this time for the sndio plugin
which can be emulated by libroar.
2017-02-01 19:53:23 +01:00
Thomas Zander
f71c204eef Correct method types to match Interface.hxx 2017-01-31 21:22:02 +01:00
Thomas Zander
51147203be free() require cstdlib to be included 2017-01-31 21:21:37 +01:00
Max Kellermann
a931686317 pcm/SampleFormat: workaround for GCC 4.9 "constexpr" bug
GCC 4.9 has incomplete C++14 support.  Specifically, it doesn't allow
switch/case in "constexpr" functions.
2017-01-27 11:02:58 +01:00
Max Kellermann
add953fb6e lib/curl/Global: decouple from the IOThread library 2017-01-26 09:29:49 +01:00
Max Kellermann
3854211694 input/Plugin: pass EventLoop& to init()
Eliminate dependency on io_thread_get().
2017-01-26 09:26:25 +01:00
Max Kellermann
58ac72f79d input/nfs: use NfsFileReader::GetEventLoop() 2017-01-26 09:25:56 +01:00
Max Kellermann
6d5904801e lib/nfs/FileReader: use nfs_get_event_loop()
Make sure we're using the same EventLoop as the NfsManager.
2017-01-26 09:23:49 +01:00
Max Kellermann
d4993c405e lib/nfs/Glue: add EventLoop& accessor 2017-01-26 09:23:25 +01:00
Max Kellermann
7af8e3937f lib/nfs/FileReader: use C++11 initializers 2017-01-26 09:21:57 +01:00
Max Kellermann
f8eeded528 input/async: pass EventLoop& to constructor 2017-01-25 23:18:33 +01:00
Max Kellermann
c3fa7e13cf input/Plugin: include cleanup 2017-01-25 23:18:17 +01:00
Max Kellermann
5c18b0a94d input/curl: use CurlGlobal::GetEventLoop() 2017-01-25 23:16:56 +01:00
Max Kellermann
ecbad638f1 input/async: add method GetEventLoop() 2017-01-25 23:15:52 +01:00
Max Kellermann
611ce6e756 lib/nfs/{FileReader,Glue}: pass EventLoop&
Eliminate dependency on io_thread_get().
2017-01-25 23:02:02 +01:00
Max Kellermann
4140e9b857 IOThread: make io_thread_run() static 2017-01-25 23:00:31 +01:00
Max Kellermann
8fd9d91974 output/Plugin: pass EventLoop& to init()
Eliminate dependency on io_thread_get().
2017-01-25 22:54:41 +01:00
Max Kellermann
d3f35dab1e output/ao: convert to class, make attributes private 2017-01-25 10:46:09 +01:00
Max Kellermann
487e2618cd output/ao: use AudioOutputWrapper 2017-01-25 10:45:20 +01:00
Max Kellermann
30d5186db4 output/ao: use const_cast instead of the union hack 2017-01-25 10:44:19 +01:00
Max Kellermann
cbe59714d4 output/solaris: convert to class, make attributes private 2017-01-25 10:33:38 +01:00
Max Kellermann
704a28ca17 output/solaris: use AudioOutputWrapper 2017-01-25 10:29:42 +01:00
Max Kellermann
8d70d10aba output/httpd: use AudioOutputWrapper 2017-01-25 10:05:08 +01:00
Max Kellermann
ddd8b16f2b output/roar: use AudioOutputWrapper::Init() 2017-01-25 10:05:08 +01:00
Max Kellermann
b79ce77ec5 output/Wrapper: add missing include 2017-01-25 10:05:08 +01:00
Max Kellermann
fead4bbfd9 output/Plugin: convert pointers to references 2017-01-25 09:48:59 +01:00
Max Kellermann
68bb738af2 input/alsa: use snd_pcm_?w_params_alloca() 2017-01-25 08:47:20 +01:00
Max Kellermann
6b968beede output/alsa: convert to class, make attributes private 2017-01-24 23:08:16 +01:00
Max Kellermann
f68dd1bffb output/alsa: make AlsaSetup() an AlsaOutput method 2017-01-24 23:06:33 +01:00
Max Kellermann
f92b71ca99 output/alsa: move code from AlsaSetup() to AlsaSetupSw() 2017-01-24 23:05:29 +01:00
Max Kellermann
2b79fe2d6a output/alsa: move code from AlsaSetup() to AlsaSetupHw() 2017-01-24 22:48:48 +01:00
Max Kellermann
44dd9af276 lib/upnp/Util: pass single delimiter character to stringToTokens() 2017-01-23 19:34:55 +01:00
Max Kellermann
d3013d4f8c lib/upnp/Util: remove parameter "skipinit", always true 2017-01-23 19:28:07 +01:00
Max Kellermann
678524ad21 lib/upnp/WorkQueue: fix race condition
With "ok==false", newly created threads may quit instantly.
2017-01-23 19:25:30 +01:00
Max Kellermann
32a64481f2 lib/upnp: fix bad std::chrono cast
libupnp provides seconds, not whatever time unit is used by
std::chrono::steady_clock.
2017-01-23 19:16:14 +01:00
Max Kellermann
1776015c6c db/simple: drop redundant "virtual" 2017-01-23 18:57:23 +01:00
Max Kellermann
f1c71a26e3 db/proxy: drop redundant "virtual" 2017-01-23 18:56:45 +01:00
Max Kellermann
e78ab767d3 db/proxy: make connect errors during startup non-fatal 2017-01-23 18:55:40 +01:00
Max Kellermann
f01eb2f95d db/proxy: improve Connect() error message 2017-01-23 18:55:18 +01:00
Max Kellermann
1450e45d97 Main, db/Glue: improve error messages 2017-01-23 18:52:16 +01:00
Max Kellermann
ec8cba369c lib/upnp/WorkQueue: disallow copying 2017-01-23 18:35:58 +01:00
Max Kellermann
f4c248f406 lib/upnp/WorkQueue: make constructor explicit 2017-01-23 18:35:47 +01:00
Max Kellermann
f3b2a58646 lib/upnp/WorkQueue: use C++11 initializers 2017-01-23 18:35:22 +01:00
Max Kellermann
c6f89c42b2 db/proxy: make the base class of LibmpdclientError public
If the base class is not accessible, the "catching" the base class
won't work.  This caused the fatal error:

 terminate called after throwing an instance of 'LibmpdclientError'
2017-01-23 18:28:40 +01:00
Max Kellermann
5e93cfdd9e output/Source: reset the ReplayGain serials ion OpenFilter()
Each close/open cycle resets the Filter's state, because a new Filter
instance is being created.  That results in the serials
(replay_gain_serial and other_replay_gain_serial) being out of sync
with the internal ReplayGainFilter state.

So instead of initializing those serials once, we need to initialize
them each time we create new ReplayGainFilter instances, i.e. in
OpenFilter().

 https://bugs.musicpd.org/view.php?id=4632
2017-01-23 17:55:04 +01:00
Max Kellermann
d91d5a3ab5 playlist/SoundCloud: eliminate unnecessary casted variable 2017-01-20 17:16:11 +01:00
Max Kellermann
df9a665994 pcm/Traits: add "SILENCE" attribute 2017-01-20 15:57:09 +01:00
Max Kellermann
7a098ca0ed pcm/Traits: add specialization for SampleFormat::DSD 2017-01-20 15:48:30 +01:00
Max Kellermann
33716732a1 pcm/PcmChannels: silence surround channels when converting from stereo
Previously, there was no special code to convert stereo to
multi-channel.  The generic solution for this was to convert to mono,
and then copy the result to all channels.  That's a pretty bad
solution, but at least something which always renders audio.  MPD does
something, instead of failing.

Now that MPD has proper support for multi-channel (by defining the
channel order), we can do better than that.  It is a (somewhat) common
case to play back stereo music on a DAC which can only do
multi-channel.  The best approach here is to copy the stereo channels
to front-left and front-right, and apply the "silence" pattern to all
other channels.
2017-01-19 10:53:41 +01:00
Max Kellermann
97ae594375 DetachedSong: use C++11 initializers 2017-01-18 13:13:36 +01:00
Max Kellermann
3f321ae9a0 pcm/SampleFormat: make the two inline functions "constexpr" 2017-01-17 22:52:09 +01:00
Max Kellermann
161d32a7e7 AudioFormat: update ToString() API documentatio 2017-01-17 22:48:34 +01:00
Max Kellermann
d7137586a9 Audio{Format,Parser}: use shortcuts such as "dsd64" in log messages 2017-01-17 22:42:23 +01:00
Max Kellermann
39114f91a7 AudioFormat: replace struct audio_format_string with class StringBuffer, return it 2017-01-17 22:18:21 +01:00
Max Kellermann
4f01387edf util/StringBuffer: new utility class 2017-01-17 22:03:42 +01:00
Max Kellermann
de3e0585f1 AudioFormat: move enum SampleFormat to pcm/SampleFormat.hxx 2017-01-17 22:01:01 +01:00
Max Kellermann
6eea56861b AUTHORS, ...: update my email address 2017-01-17 11:54:55 +01:00
Max Kellermann
dcbab8e37a PlaylistFile: "playlistadd" creates new playlist if it does not exist, as documented 2017-01-16 20:55:19 +01:00
Max Kellermann
5677278251 CommandLine: update copyright year 2017-01-16 12:04:04 +01:00
Max Kellermann
d14ec6aea5 output/Thread: reconfigure ConvertFilter for its new input AudioFormat
If the input AudioFormat changes but the out_audio_format doesn't
change (e.g. because there is a fixed "format" setting in this
"audio_output" section), the ConvertFilter needs to be reconfigured.
This didn't happen, resulting in awful static noise after changing
songs.
2017-01-15 01:24:17 +01:00
Max Kellermann
917cedf893 output/Thread: move AudioFormat logging code around 2017-01-15 01:23:49 +01:00
Max Kellermann
193dd71600 output/Thread: remember the original filter audio format in local variable 2017-01-15 01:21:14 +01:00
Max Kellermann
6c293a3d7f lib/nfs: add more API documentation 2017-01-15 00:58:49 +01:00
Max Kellermann
e847ddf011 DetachedSong: compare start_time and end_time in IsSame()
This method is used by DecoderControl::IsCurrentSong(), which is used
by the player thread to check whether the current decoder instance can
be reused to seek.  When switching to another song in the same CUE
sheet, previously DetachedSong::IsSame() returned true, and thus the
old decoder instance was used for the new song, not considering the
new end_time.  This led to the old decoder quickly quitting.
2017-01-15 00:54:25 +01:00
Max Kellermann
7e8b448985 input/alsa: set period_size=buffer_size/4
This way, we have four periods instead of the default of two.  With
only two periods, we don't get woken up often enough, and we
frequently encounter buffer overruns.  With four periods, we have more
time to breathe, and the buffer overruns magically disappear.
2017-01-14 21:50:28 +01:00
Max Kellermann
d1f3a87c08 input/alsa: remove the start_threshold setting
This setting is mostly useless for capture devices.  There's no point
in configuring it.
2017-01-14 21:47:37 +01:00
Max Kellermann
9f8145e590 input/alsa: dump buffer/period sizes 2017-01-14 21:09:57 +01:00
Steven O'Brien
791efc171a input/alsa: enable non-blocking mode 2017-01-14 20:59:57 +01:00
Steven O'Brien
144312a525 input/alsa: handle EAGAIN 2017-01-14 20:59:23 +01:00
Max Kellermann
92684112ed input/alsa: call snd_pcm_start() after snd_pcm_prepare()
This is necessary because we'll never get woken up again by
epoll_wait() after a buffer overrun recovery, unless we start the PCM
explicitly before returning to the I/O loop.
2017-01-14 20:58:30 +01:00
Max Kellermann
ef114ee6cb input/alsa: improve logging in Recover()
Copy yet more code from the ALSA output plugin.
2017-01-14 20:52:41 +01:00
Max Kellermann
667f209742 input/alsa: check snd_pcm_state() in Recover()
Copy some good code from the ALSA output plugin.
2017-01-14 20:51:51 +01:00
Max Kellermann
4ad0747c78 output/alsa: explicitly mention all snd_pcm_state() enums
I want a compiler warning when a new state needs to be considered
here.
2017-01-14 20:49:15 +01:00
Max Kellermann
c5cf66402c input/alsa: make two attributes "const" 2017-01-13 20:26:36 +01:00
Max Kellermann
05417049eb input/alsa: clear sockets from within IOThread
Fixes assertion failure in implicit destructor.
2017-01-13 20:17:16 +01:00
Max Kellermann
c7b0c46d9f output/recorder: fix typo in variable name
Fixes the dreaded error "Failed to create : No such file or
directory".

 https://bugs.musicpd.org/view.php?id=4625
2017-01-12 21:36:32 +01:00
Max Kellermann
df578c91ad output/alsa: log DoP mode 2017-01-11 22:50:40 +01:00
Max Kellermann
70008c47c9 output/alsa: support DSD_U16 2017-01-11 22:47:21 +01:00
Max Kellermann
938affef32 pcm/export: support DSD_U16 2017-01-11 22:47:12 +01:00
Max Kellermann
a3c33000ee pcm/Dsd32: include cleanup 2017-01-11 22:47:12 +01:00
Max Kellermann
cc0dbcf3f4 pcm/Dsd32: fix the byte order
The byte order of DSD_U32 was wrong from the start.  The oldest bits
must be in the MSB, not in the LSB, according to
snd_pcm_format_descriptions in alsa-lib.
2017-01-11 22:25:54 +01:00
Max Kellermann
c5a2cadccc pcm/Export: convert to class, make members private 2017-01-11 21:48:43 +01:00
Max Kellermann
9aa43416b6 pcm/dop: remove unnecessary assertions 2017-01-11 21:48:43 +01:00
Max Kellermann
8364029db8 output/alsa: move code to PlayRaw() 2017-01-11 21:38:05 +01:00
Max Kellermann
d842d21be0 util/ReusableArray: add method GetCapacity() 2017-01-11 20:37:12 +01:00
Max Kellermann
3514fd2433 util/ReusableArray: add move constructor/operator 2017-01-11 20:37:12 +01:00
Max Kellermann
6778ff27ea util/ReusableArray: use C++11 initializers 2017-01-11 20:33:01 +01:00
Max Kellermann
f32315d699 pcm/Export: remove obsolete gcc warning suppression 2017-01-11 20:31:48 +01:00
Max Kellermann
8b754b24b6 pcm/Buffer: update API documentation 2017-01-11 20:24:32 +01:00
Max Kellermann
78a73eac53 pcm/Export: add (dummy) method Cancel()
We'll have some code for it soon.
2017-01-11 15:41:28 +01:00
Max Kellermann
533cb99c33 output/Source: reset all filters in Cancel() 2017-01-11 15:39:18 +01:00
Max Kellermann
79726940dc output/Source: un-inline Cancel() 2017-01-11 15:39:00 +01:00
Max Kellermann
27c7891169 filter/Internal: add method Reset() 2017-01-11 15:34:25 +01:00
Max Kellermann
7a3a793a12 decoder/Bridge: call PcmConvert::Reset() after seeking 2017-01-11 15:32:57 +01:00
Max Kellermann
8088469eca pcm/Convert: add method Reset() 2017-01-11 15:30:30 +01:00
Max Kellermann
3dcb082015 pcm/Resampler: add method Reset()
Hook for src_reset(), not yet used.
2017-01-11 15:26:48 +01:00
Max Kellermann
bece023028 pcm/PcmDsd: move Dsd8To32() to Dsd32.cxx 2017-01-11 15:22:43 +01:00
Max Kellermann
9c4df66925 pcm/Export: halve the sample rate for DoP
Move this sample rate fixup from the ALSA output plugin to PcmExport,
where it belongs.
2017-01-11 10:33:23 +01:00
Max Kellermann
2b43ceb6c6 pcm/Export: DSD_U32 quarters the sample rate
DSD_U32 packs four bytes instead of one large "sample", thus the
sample rate is one quarter of the input sample rate.  This fixes a
rather critical DSD_U32 playback problem.
2017-01-11 10:14:41 +01:00
Max Kellermann
c143adba91 pcm/Export: add CalcOutputSampleRate(), CalcInputSampleRate()
Prepare for DSD sample rate fixups.
2017-01-10 23:48:26 +01:00
Max Kellermann
142fdc8d86 decoder/flac: add options "probesize" and "analyzeduration"
https://bugs.musicpd.org/view.php?id=3876
2017-01-10 23:05:04 +01:00
Max Kellermann
c3fc84de12 input/curl: wake up client thread after seek to end of file
Call SeekDone() to avoid the freeze bug.
2017-01-09 18:08:33 +01:00
Max Kellermann
c82b03a74c decoder/wavpack: fix crash bug 2017-01-08 14:54:12 +01:00
Max Kellermann
58fb36bdb9 storage/http: new storage plugin 2017-01-08 14:40:20 +01:00
Max Kellermann
4297a7b0a4 lib/curl/Request: move exception handling out of the WRITEFUNCTION
libcurl's WRITEFUNCTION is pretty fragile; if we destroy the CURL*
instance or even unregister it using curl_multi_remove_handle(),
libcurl will crash instantly.  But still we need to be able to handle
exceptions from inside the WRITEFUNCTION, and call
CurlResponseHandler::OnError(), which may destroy the whole thing.  As
a workaround, I use DeferredMonitor to postpone the OnError() call
into a stack frame which is allowed to destroy the request.
2017-01-08 14:36:27 +01:00
Max Kellermann
1bab6d0dd7 lib/curl/Request: move catch clause out of FinishHeaders
Let the caller decide what to do with the exception.
2017-01-08 14:36:27 +01:00
Max Kellermann
13b85edbe2 lib/curl/Request: postpone the curl_easy_cleanup() call
When the request is done, only unregister the CURL* handle, but do not
delete it yet - it may still be needed for CURLINFO_RESPONSE_CODE.
2017-01-08 13:51:53 +01:00
Max Kellermann
dc53098e43 lib/curl/Request: allow Stop() to be called twice
Convert assertion to runtime check.  This is useful because this is a
public method, and the caller has no chance to check if the object is
still registered.
2017-01-08 13:51:53 +01:00
Max Kellermann
3c66feff5a lib/curl/Global: defer the ReadInfo() call
Fixes a crash that can occur due to recursion from InvalidateSockets()
to ReadInfo() to CurlRequest callbacks.
2017-01-08 12:46:35 +01:00
Max Kellermann
218c3bc0d5 lib/curl/Multi: fix typo 2017-01-08 12:46:35 +01:00
Max Kellermann
9f5eddcd13 lib/curl/Global: move code to UpdateTimeout() 2017-01-08 12:44:07 +01:00
Max Kellermann
3cba76552b lib/curl/Global: drop redundant ">=0" check 2017-01-08 12:44:04 +01:00
Max Kellermann
e98a8b624b lib/curl/Global: drop redundant "virtual" 2017-01-08 12:41:26 +01:00
Max Kellermann
6c6947b01f util/UriUtil: add uri_get_path() 2017-01-08 11:05:58 +01:00
Max Kellermann
44493ca0c4 util/TimeParser: add "pure" attribute 2017-01-08 10:41:08 +01:00
Max Kellermann
42acf78b09 util/TimeParser: wrapper for strptime()
Move code from SongFilter.cxx.
2017-01-07 22:11:45 +01:00
TermeHansen
3aa9f8af18 Rewrite of AlsaMixerPlugin to use volume_mapping
Changed AlsaMixerPlugin to use the get and set normalized functions from volume_mapping of alsa-utils/alsamixer
Changed volume_mapping set volume to be for all channels and not per channel
added volume_mapping files to Makefile.am
2017-01-07 16:30:19 +01:00
TermeHansen
8a32ee30a5 Adding volume_mapping from alsa-utils/alsamixer
source:
http://git.alsa-project.org/?p=alsa-utils.git;a=blob_plain;f=alsamixer/volume_mapping.c;hb=HEAD
http://git.alsa-project.org/?p=alsa-utils.git;a=blob_plain;f=alsamixer/volume_mapping.h;hb=HEAD
2017-01-07 16:26:36 +01:00
Max Kellermann
981dc0626b lib/expat/ExpatParser: add constructor overload for XML_ParserCreateNS() 2017-01-07 16:17:53 +01:00
Max Kellermann
8986d14e98 lib/expat/ExpatParser: make constructors "explicit" 2017-01-07 16:15:11 +01:00
Max Kellermann
5163b1a624 lib/curl/Request: require the caller to explicitly register the request
This allows constructing an instance in any thread, and register it
inside the IOThread later.
2017-01-07 16:01:58 +01:00
Max Kellermann
860aa9d6d0 lib/expat/ExpatParser: move InputStream overload to separate source file
Eliminate one unnecessary dependency for debug programs which don't
need the InputStream API.
2017-01-07 15:46:36 +01:00
Max Kellermann
6cff3214f3 lib/curl/Slist: new wrapper for curl_slist 2017-01-06 19:37:31 +01:00
Max Kellermann
fd910bd5e9 db/upnp: use "override" instead of "virtual" 2017-01-06 19:35:58 +01:00
Max Kellermann
c6086bed41 filter/Internal: remove the default constructor
Not used.  Force implementations to initialize out_audio_format.
2017-01-06 12:45:52 +01:00
Max Kellermann
1a9dfdfab8 filter/AutoConvert: initialize Filter::out_audio_format 2017-01-06 12:44:55 +01:00
Max Kellermann
5284cd11a9 filter/AutoConvert: remove obsolete NULL check 2017-01-06 12:35:06 +01:00
Max Kellermann
d1a47cffad filter/convert: remove obsolete method prototype 2017-01-06 12:34:39 +01:00
Max Kellermann
f469595eee filter/Internal: remove obsolete doxygen line 2017-01-06 12:34:39 +01:00