Commit Graph

13974 Commits

Author SHA1 Message Date
Shen-Ta Hsieh
c46f97454a src/output: Reopen device on error 2021-03-04 18:49:28 +01:00
Shen-Ta Hsieh
844dbd2ec5 src/output: Use WinEvent for as a condition_variable without lock 2021-03-04 18:46:26 +01:00
Shen-Ta Hsieh
db7caa2dac src/output: Move event and spsc_queue into thread object 2021-03-04 18:45:56 +01:00
Shen-Ta Hsieh
2974737746 src/win32: Add ComWorker to run all COM function on same thread 2021-03-04 18:43:43 +01:00
Shen-Ta Hsieh
b1d7567226 win32: Add ComWorker to run all COM function on same thread 2021-03-04 18:43:16 +01:00
Max Kellermann
5103eb3039 meson.build: compile Win32Main.cxx only on Windows 2021-03-04 18:43:00 +01:00
Shen-Ta Hsieh
0cccdcf9b2 src/win32: Add support for COINIT_APARTMENTTHREADED 2021-03-04 18:37:56 +01:00
Shen-Ta Hsieh
22b840c2f1 win32/Com: use if with init-statement 2021-03-04 18:37:35 +01:00
Shen-Ta Hsieh
ed1a995bff thread: Add Future implement for mingw32 without pthread 2021-03-04 18:26:46 +01:00
Shen-Ta Hsieh
0f39dc1edb output/wasapi: use AUDCLNT_BUFFERFLAGS_SILENT for paused output 2021-03-04 18:17:57 +01:00
Max Kellermann
dc9103befe util/AllocatedString: remove Null(), IsNull() 2021-03-04 18:05:29 +01:00
Max Kellermann
67760f5283 util/AllocatedString: support casting a nulled instance to string_view 2021-03-04 18:05:29 +01:00
Max Kellermann
99405a4c93 util/AllocatedString: add operator=() 2021-03-04 18:05:26 +01:00
Max Kellermann
b833c5d2c7 util/AllocatedString: replace Clone() with copy constructor 2021-03-04 18:04:21 +01:00
Max Kellermann
bca5d79f88 util/AllocatedString: add const_pointer constructor 2021-03-04 18:04:17 +01:00
Max Kellermann
6e1c8edf09 util/AllocatedString: add string_view constructor
Replaces the static Duplicate() method.
2021-03-04 18:04:11 +01:00
Max Kellermann
32b7b2e2fa util/AllocatedString: add default constructor 2021-03-04 18:04:06 +01:00
Max Kellermann
cfb7f8ab84 util/AllocatedString: rename to BasicAllocatedString
To make things simpler, AllocatedString is now a non-template class.
2021-03-04 18:03:56 +01:00
Max Kellermann
d4bbb8c851 Merge branch 'struc' of git://github.com/neheb/MPD 2021-03-04 17:50:53 +01:00
Érico Rolim
8d80280ab9 time/ISO8601: don't use glibc extension in strptime.
Per the manual for strptime, %F is equivalent %Y-%m-%d, so use that
directly.
2021-03-04 17:49:51 +01:00
Érico Rolim
c95e3dc065 storage/plugins/CurlStorage: don't use glibc extension in
ParseTimePoint.

%Z is a glibc extension to strptime, and is a no-op there, due to the
mapping between timezone names and their definition (especially when the
name comes from a different machine) being ambiguous / impossible.  Time
in HTTP headers is guaranteed to be UTC.

Passing an unknown format to strptime() implementations that don't
support it will generally cause them to return NULL, which will lead to
ParseTimePoint throwing an exception and ParseTimeStamp using an
unnecessary fallback.

Since the timezone name goes at the end of the string, we don't need to
use %Z to skip it (could be an issue in a different time stamp format),
so simply removing %Z works best.
2021-03-04 17:48:23 +01:00
Max Kellermann
428f769c38 output/pipewire: new output plugin
Very rough draft.  Barely works.
2021-03-03 18:44:39 +01:00
Max Kellermann
133c8834df output/httpd: update API documentation 2021-03-02 18:24:57 +01:00
Max Kellermann
a6eb264770 util/IntrusiveList: add type alias "Hook"
By casting to SafeLinkIntrusiveListHook if appropriate, this fixes a
bug in the erase() method, where erase() calls
IntrusiveListHook::unlink() instead of
SafeLinkIntrusiveListHook::unlink().
2021-03-02 17:51:50 +01:00
Max Kellermann
f5f296b13a event/TimerWheel: add a "ready" list as a special case
This reduces delays of zero-duration timers from up to 1 second to
zero.  libavahi-client schedules zero-duration timers often.
2021-03-02 17:14:33 +01:00
Max Kellermann
0091c4e12b util/Exception: add FindNested() 2021-03-02 17:13:29 +01:00
Max Kellermann
80172e17ac util/Exception: remove redundant std::exception catch clause
The "std::nested_exception" catch block already covers this perfectly.
2021-03-02 17:13:21 +01:00
Max Kellermann
ec0c1f0d02 util/Exception: fix comment typo 2021-03-02 17:12:20 +01:00
Max Kellermann
946b3c1f80 util/IntrusiveList: add method erase_and_dispose() 2021-02-25 14:12:47 +01:00
Max Kellermann
a0dc398f36 util/IntrusiveList: erase() returns an iterator 2021-02-25 14:12:39 +01:00
Max Kellermann
b54d2d984a util/IntrusiveList: use ToHook() in erase() 2021-02-25 14:12:10 +01:00
Max Kellermann
4ab73f9de9 util/IntrusiveList: add missing ToNode() cast in iterator_to() 2021-02-25 14:10:55 +01:00
Max Kellermann
5ebe23e4bb db/upnp/Discovery: use class IntrusiveList 2021-02-24 20:39:42 +01:00
Max Kellermann
aa227cded1 input/qobuz: use class IntrusiveList 2021-02-24 20:31:47 +01:00
Max Kellermann
e406bdbb80 input/tidal: use class IntrusiveList 2021-02-24 20:31:13 +01:00
Max Kellermann
1048f23680 util/IntrusiveList: add hook class SafeLinkIntrusiveListHook
Similar to boost::intrusive::safe_link.
2021-02-24 20:29:16 +01:00
Max Kellermann
8fe8f09027 util/IntrusiveList: add noexcept 2021-02-24 20:17:28 +01:00
Max Kellermann
78670c0941 util/IntrusiveList: add constexpr 2021-02-24 20:16:54 +01:00
Max Kellermann
34f735890e output/snapcast: remove obsolete TODO comment 2021-02-24 17:05:14 +01:00
Max Kellermann
f08810b202 output/snapcast: add missing #ifdef HAVE_ZEROCONF 2021-02-24 17:04:15 +01:00
Max Kellermann
7a68775e6c output/snapcast: Zeroconf support 2021-02-24 17:03:30 +01:00
Max Kellermann
e4fccc85c8 Main: move Zeroconf to the I/O thread
This will allow using Zeroconf in output plugins (preparing for
Snapcast with Zeroconf).
2021-02-24 16:29:33 +01:00
Max Kellermann
2efa142ec9 output/init: use the real-time I/O thread only for the ALSA plugin 2021-02-24 16:09:11 +01:00
Max Kellermann
29b49dd630 zeroconf/{bonjour,avahi}: pass service_type as parameter 2021-02-24 15:11:11 +01:00
Max Kellermann
5f34508aae zeroconf/Glue: move code to the ZeroconfHelper constructor 2021-02-24 15:09:10 +01:00
Max Kellermann
2d8ecd561b zeroconf: return a publisher object 2021-02-24 15:09:10 +01:00
Max Kellermann
2059195ae9 zeroconf: add dependency on event_dep 2021-02-24 15:09:10 +01:00
Max Kellermann
d89856f77b zeroconf/avahi/Helper: make class SharedAvahiClient final 2021-02-24 15:09:10 +01:00
Max Kellermann
975d5be046 zeroconf/avahi/Init: return a std::unique_ptr<AvahiHelper> 2021-02-24 14:41:37 +01:00
Max Kellermann
b01ef1b9a6 zeroconf/Bonjour: return a std::unique_ptr<BonjourHelper> 2021-02-24 14:25:06 +01:00
Max Kellermann
ceb76b6a82 zeroconf/Bonjour: pass a context pointer to the callback 2021-02-24 14:18:35 +01:00
Max Kellermann
a7e697b588 zeroconf/Bonjour: add const 2021-02-24 14:18:17 +01:00
Max Kellermann
3ecd918442 zeroconf/Bonjour: move the DNSServiceRegister() call to the constructor 2021-02-24 14:17:59 +01:00
Max Kellermann
4fbdb3a2d5 zeroconf/Bonjour: convert the callback function to a method 2021-02-24 14:15:26 +01:00
Max Kellermann
0157643667 zeroconf/Glue: add noexcept 2021-02-24 14:15:26 +01:00
Max Kellermann
fe741bd767 zeroconf/Glue: allow ZeroconfInit() to throw 2021-02-24 14:15:04 +01:00
Max Kellermann
06b9bdba2c zeroconf/Bonjour: disallow copying 2021-02-24 13:53:36 +01:00
Max Kellermann
bd0aa74bdd zeroconf/Bonjour: rename class BonjourMonitor to BonjourHelper 2021-02-24 13:53:35 +01:00
Max Kellermann
47461df59c zeroconf/Bonjour: don't call DNSServiceRefDeallocate() if DNSServiceRegister() fails
According to
https://developer.apple.com/documentation/dnssd/1804733-dnsserviceregister
the DNSServiceRef is initialized only if DNSServiceRegister() returns
kDNSServiceErr_NoError.  The faulty error handling code could
therefore crash.
2021-02-24 13:49:03 +01:00
Max Kellermann
04d5588fe5 zeroconf/Zeroconf*: drop prefix from file names 2021-02-24 13:33:59 +01:00
Max Kellermann
40d061621b zeroconf/Avahi: remove useless log messages 2021-02-24 13:33:58 +01:00
Max Kellermann
a312629aad zeroconf: pass global port to init function 2021-02-24 06:40:26 +01:00
Max Kellermann
d527d4b530 zeroconf/avahi/Publisher: new class, replacing lots of code from ZeroconfAvahi.cxx 2021-02-23 22:07:57 +01:00
Max Kellermann
978d2638d8 zeroconf/avahi/Client: new class, replacing lots of code from ZeroconfAvahi.cxx 2021-02-23 21:53:07 +01:00
Max Kellermann
cfcafdf822 zeroconf/avahi: add class AvahiGlue 2021-02-23 21:53:00 +01:00
Max Kellermann
07865d0707 zeroconf/avahi/Poll: move to namespace Avahi 2021-02-23 21:41:16 +01:00
Max Kellermann
1ac16516a1 event/TimerList: add option to avoid the Boost dependency 2021-02-22 23:35:16 +01:00
Max Kellermann
75e8795e3f util/IntrusiveList: add method insert() 2021-02-22 23:32:51 +01:00
Max Kellermann
4912466d50 util/IntrusiveList: add method erase() 2021-02-22 23:32:47 +01:00
Max Kellermann
664674913e event/Loop: include cleanup 2021-02-22 23:32:39 +01:00
Max Kellermann
31e3658823 Merge branch 'v0.22.x' 2021-02-22 23:25:07 +01:00
Max Kellermann
abd416735d output/snapcast: implement SendTag() 2021-02-22 23:20:56 +01:00
Max Kellermann
6090bd2095 lib/yajl/Gen: new class 2021-02-22 23:12:08 +01:00
Max Kellermann
1777592ec0 lib/yajl/Handle: fix API documentation 2021-02-22 22:56:52 +01:00
Max Kellermann
8e8fbe14b1 output/snapcast: implement Drain() 2021-02-22 22:49:32 +01:00
Max Kellermann
a8a39b6a38 output/snapcast: queue chunks 2021-02-22 22:41:31 +01:00
Max Kellermann
f84cb6de5e output/snapcast/client: remove obsolete TODO comment
See commit dfc67c45c7
2021-02-22 22:39:32 +01:00
Max Kellermann
dfc67c45c7 output/snapcast: calculate the latency for TIME responses 2021-02-22 21:57:20 +01:00
Max Kellermann
e875da5d38 output/snapcast/protocol: swap "received" and "sent"
Snapcast's protocol documentation is wrong, see
https://github.com/badaix/snapcast/pull/811
2021-02-22 21:42:42 +01:00
Max Kellermann
9b9522e3f5 zeroconf/avahi/Poll: rename internal variables 2021-02-22 15:01:01 +01:00
Max Kellermann
87963685fb zeroconf/avahi/Poll: use C++11 initializer 2021-02-22 15:00:20 +01:00
Max Kellermann
0405a57f26 zeroconf/avahi/Poll: make EventLoop the first parameter 2021-02-22 14:52:21 +01:00
Max Kellermann
f29c69d6a9 zeroconf/avahi/Poll: rename timer to event 2021-02-22 14:39:28 +01:00
Max Kellermann
7ec4de841e zeroconf/avahi/Poll: add constexpr 2021-02-22 14:34:32 +01:00
Max Kellermann
1f08d2d03c zeroconf/avahi/Poll: add noexcept 2021-02-22 14:31:37 +01:00
Max Kellermann
c1a695d1ac zeroconf/avahi/Poll: add method GetEventLoop() 2021-02-22 14:31:10 +01:00
Max Kellermann
ec05056e38 zeroconf/avahi/Poll: forbid copying 2021-02-22 14:26:08 +01:00
Max Kellermann
c0b9339d31 zeroconf/AvahiPoll: move to lib/avahi/ 2021-02-22 14:24:00 +01:00
Max Kellermann
6eba621045 decoder/ffmpeg: fix build problem with FFmpeg 3.4
Regression by commit a22d1c88d7

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1097
2021-02-22 13:36:46 +01:00
Max Kellermann
a9ad8fa505 decoder/ffmpeg: move code to IsSeekable(AVFormatContext) 2021-02-22 13:33:25 +01:00
Max Kellermann
c729f16dcd song/DetachedSong: copy the AudioFormat from LightSong
Enables the "Format" row in "playlistinfo" responses.

https://github.com/MusicPlayerDaemon/MPD/issues/1094
2021-02-18 22:16:11 +01:00
Max Kellermann
81d0c04ed4 song/DetachedSong: add noexcept 2021-02-18 22:01:52 +01:00
Max Kellermann
0924b63e10 event/TimerWheel: add empty flag to optimize a common case 2021-02-17 19:52:45 +01:00
Max Kellermann
ce6afe9379 output/httpd/Page: convert to type alias on AllocatedArray 2021-02-17 18:01:27 +01:00
Max Kellermann
6f04b2230a output/httpd/Page: use std::byte 2021-02-17 17:54:38 +01:00
Max Kellermann
8d90b831e1 output/snapcast/Timestamp: drop static 2021-02-17 14:39:20 +01:00
Max Kellermann
9c8da03c5c output/snapcast: new output plugin
New experimental code, first draft - it works, but there's a lot left
to do.  Just look at all the TODO comments.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/975
2021-02-17 14:25:23 +01:00
Max Kellermann
85adefd9a4 encoder/wave: remove constexpr because memcpy() is not allowed 2021-02-17 14:19:02 +01:00
Max Kellermann
8a4b88a59d encoder/wave: use the structs from RiffFormat.hxx 2021-02-16 19:50:52 +01:00
Max Kellermann
d2371af120 encoder/wave: add static_assert on sizeof(WaveHeader) 2021-02-16 19:50:46 +01:00
Max Kellermann
aa2e1bb310 encoder/wave: refactor fill_wave_header() to function 2021-02-16 19:50:43 +01:00
Max Kellermann
6153fca4fc tag/RiffFormat: add struct RiffFmtChunk 2021-02-16 19:50:40 +01:00
Max Kellermann
f090af0a22 tag/RiffFormat: add static_asserts on sizeof() 2021-02-16 19:50:25 +01:00
Max Kellermann
58f420fdca tag/RiffFormat: use CamelCase 2021-02-16 19:24:51 +01:00
Max Kellermann
ded2b31fbc tag/Riff: split into RiffId3.?xx and RiffFormat.hxx 2021-02-16 19:23:01 +01:00
Max Kellermann
75c8d2235b util/ByteOrder: add classes PackedBE16, PackedLE16, PackedLE32 2021-02-16 17:37:25 +01:00
Max Kellermann
f679961564 release v0.22.6
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmArwO4QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEjvyD/9M2icQCKSQheXVD0UWvDZlTaOG6dJtZIfM
 1M9eLC/WG9F6ss2eQy69mfd1IkxO0qx7pPG5NN7zKp7msyK8Hbq6QAoqygKIU9S/
 m5jbrdpuy8A09Mae62b0eapphhtp+Lbpl6RN8QpeROQPd3nX/eSsTngMu//5e4g8
 3qbqkh8Z802FdppcLdBj7f2nUkNoW77bIbVsbm3BQd8EIiVwis9wMgs9Oh9ZEtC9
 krUuij8WjTurSORC/IvqvvOh3QUmb7q7+YwoUrcEBOF1ABcpjf//qVUb4rhOwuVh
 s8BxW+L8sxv3dCSrjG3msbxXLLIVXU8H2pafHyS/rosrnHmTHshiraG1ZMlOh0dE
 kk8piE+7cLERR4JufEnmDtMLQdJfGVTs7QIAsOqtXWNaihsDKA2cZy9AcW3UZTxE
 Vf0PDWl5W8+ibWJ/m9CVWYUEssZ3Jvbi3X0IFAgfYYT8PkIQEqNUWJFelr20Cr6H
 5GNGUooiOGUXBWotrQO8Blhcx3rzwGxzeRLV0JFBqhl7zPnXdQ3Wzo70U714V+rT
 ZRKSisLVbb7vVY2S5OlQf17mGSZufdNc6yzNar9CKwEaUqS64bdzo13NmiIyKqpO
 tuSJlL4otO4/nsdKVj1Pcdr+LKJLFLLR9V5W6DLCiyPChR5adZ9rjN7RS9fChkBn
 9G4ifkbK0w==
 =NeqR
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.6'

release v0.22.6
2021-02-16 13:58:47 +01:00
Max Kellermann
80531ef8d8 db/simple: fix ExportedSong move constructor for non-owning sources
If the constructor moves from an ExportedSong instance which refers to
somebody else's "Tag" instance, the newly constructed instance will
instead refer to its own empty "tag_buffer" field.  This broke
SimpleDatabase::GetSong(), i.e. all songs on the queue restored from
the state file or added using the "addid" command.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1089
2021-02-16 13:52:25 +01:00
Max Kellermann
471c37be59 queue/PlaylistEdit: convert start/end parameters to RangeArg 2021-02-15 22:51:09 +01:00
Max Kellermann
157ddcbab1 protocol/RangeArg: add methods ClipRelaxed(), CheckClip(), CheckAdjustEnd() 2021-02-15 22:50:49 +01:00
Max Kellermann
ab160aa359 queue/PlaylistEdit: check "current>=0" before updating it 2021-02-15 22:50:37 +01:00
Max Kellermann
ecc07e4e98 release v0.22.5
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmAq1woQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFElB1EACItrIKgEywkzW3l+gmgSjtwwQOiLfg+0Zg
 Z3YgpegDvhmjBVXAHFDlhnXf//zCr286ZmCCVItrz2eGHYX2lvul0SdYxp/+Kebk
 WrCez6LMecaoGjbgiwQ70u/stNkX85ZT62CznNyYvwMx4bRhXXgOuBdKYTAZTvT8
 ABvfL+Ari7TBi88qCAaufmxyv7VFOaZg8+GpV1unIlHE6vu3febzDffPdjfODmOe
 BpLILJJIzUd9p1tGmSCvNCUUHdElktbK1aSVS/0x2xdKG3eDKmPIhSdxdqOdunr7
 9us4Mg7ZB5REaRC0ZfxR6P+vId0uIT3kpyDqs5i8Zao1WwmCdZhvaMMxJ3KF0MVs
 q4Lb99LMF2xAvsoA4x+wY0E0SlFrBhySrFY/i4gaBd9ctzQsbxID3cOZhSbEmQnk
 VNlPK/cYtWVHouLzSOUZeg3/nyMMWXTXy87esB/JdKWqushYLFqy/WIIJvKh4dRL
 YTEJtGeAe7wn9BPoD5Sf1xaj9ULw5CG/Z72inMk1rdzQBn+sWypb8HwJiGtHH43Q
 3YwTSAg/Z3MuxcMM1F9ce/IeE+sqCtOZKgTTpdp56hPlHMV9Fa0v7mnMHz508jB/
 4ZwAm3eEbCy14IKtW1jfKwA/IgPnF6bR6D1nn7F9SKnBG+hdHsyAVyHaTsXbfO4u
 0RZ5Y9vxdQ==
 =I2BI
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.5'

release v0.22.5
2021-02-15 22:50:16 +01:00
Max Kellermann
6b1d264b35 command/queue: better error message for open-ended range with "move"
The "move" command doesn't allow open-ended ranges because they don't
make a lot of sense; moving an open-ended range is only possible if
the destination index is before the range, and in that case, the
client should be well aware how many songs there are.

Closes https://github.com/MusicPlayerDaemon/MPD/pull/1057
2021-02-15 20:57:22 +01:00
Max Kellermann
a6c10e9a1c protocol/ArgParser: check for invalid ranges
Catch errors like that early, before invalid ranges get passed to
internal MPD subsystems.
2021-02-15 20:55:30 +01:00
Max Kellermann
19a46064e9 protocol/RangeArg: add methods IsWellFormed(), IsEmpty(), HasAtLeast(), Count() 2021-02-15 20:54:51 +01:00
Max Kellermann
b57eeaa720 protocol/RangeArg: add static method Single() 2021-02-15 20:29:37 +01:00
Max Kellermann
ad059d5804 protocol/RangeArg: add method IsOpenEnded() 2021-02-15 20:29:35 +01:00
Max Kellermann
6e1940e930 protocol/RangeArg: add static method OpenEnded() 2021-02-15 20:29:34 +01:00
Max Kellermann
103194e32d protocol/RangeArg: add missing noexcept 2021-02-15 19:56:02 +01:00
Shen-Ta Hsieh
481c330c17 src/output: Set thread name for Wasapi output thread 2021-02-15 17:51:49 +01:00
Shen-Ta Hsieh
7ef489e057 src/win32: run clang-format 2021-02-15 17:50:51 +01:00
Shen-Ta Hsieh
d9e5d5ff5b src/win32: Add error message for NO_ERROR 2021-02-15 17:45:25 +01:00
Max Kellermann
d4d06da2f8 db/simple: fix dangling LightSong::tag reference in moved ExportedSong
After commit 1afa33c3c7, an old bug was revealed:
SimpleDatabase::GetSong() constructs an ExportedSong instance by
moving the return value of Song::Export(), which causes the
LightSong::tag field to be dangling on the moved-from
ExportedSong::tag_buffer.  This broke tags from CUE sheets.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1070
2021-02-15 17:38:37 +01:00
Max Kellermann
efde78db77 output/Thread: skip drain calls if there is no data to be played
Keep track of whether there is data being played, and don't call
AudioOutput::Drain() after Cancel() has been called already.
2021-02-15 16:39:13 +01:00
Max Kellermann
f1b8bcd6b2 output/pulse: don't drain if stream is suspended or corked
In this state, we can't make any progress.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1084
2021-02-15 16:07:16 +01:00
Max Kellermann
c2bc3704e1 output/pulse: move code to virtual method Drain()
Drain only if it was requested explicitly.
2021-02-15 15:59:54 +01:00
Max Kellermann
def120aca4 output/pulse: eliminate the pause field
It is useless, because we're always checking pa_stream_is_corked().
2021-02-15 15:59:46 +01:00
AndriiZ
f5460b35a3
Add cacert option for Curl plugin. Allows to set cacert for curl lib (#3)
Add cacert option for curl plugin

    add cacert option for Curl plugin. Allows to set cacert for curl lib
    Added documentation line into doc/plugins.rst with explanation for cacert option
2021-02-13 13:49:15 +02:00
Max Kellermann
3456b1e50d use std::size_t 2021-02-12 18:39:28 +01:00
Max Kellermann
fe6abe1750 zlib/Error: add noexcept 2021-02-12 18:37:32 +01:00
Max Kellermann
6cdb3ff21e use [[gnu::pure]] instead of gcc_pure
This is semi-standard and doesn't require the util/Compiler.h header.
2021-02-12 18:34:16 +01:00
Max Kellermann
01af2778ab time/ISO8601: throw std::invalid_argument on error
Throwing std::runtime_error was slightly wrong.
2021-02-12 18:31:56 +01:00
Max Kellermann
ad03c70753 event/TimerWheel: workaround for GCC9 bug 2021-02-12 18:29:02 +01:00
Max Kellermann
7fe0095fa7 util/IntrusiveList: add noexcept to defaulted constructor 2021-02-11 21:22:15 +01:00
Max Kellermann
a4b236348f Merge branch 'v0.22.x' 2021-02-07 22:04:07 +01:00
Max Kellermann
e7da5b104d archive/iso9660: another fix for unaligned reads
Commit 79b2366387 added the field `skip`
to support unaligned reads, but set the `offset` field to a wrong
value.  This resulted in miscalculation of `remaining`, causing
an assertion failure.

The fix is to assign `offset` the correct value, but consider the
`skip` value in the assertion.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1067
2021-02-07 21:41:51 +01:00
Max Kellermann
4be76f3c8f archive/iso9660: check "skip==0" before doing optimized large read
After a Seek() to an odd offset, some data needs to be skipped from
the start of the block, and reading right into the given buffer
doesn't work.
2021-02-07 21:38:13 +01:00
vkostas
a59f1b21a6 Fix: Separate Conductor from Performer
Conductor was incorrectly saved to Performer tag in MPD database
2021-02-07 20:45:01 +01:00
Max Kellermann
5a16e3ffa3 event/TimerWheel: optimized container for CoarseTimerEvent 2021-02-05 18:24:25 +01:00
Max Kellermann
d1957b83c8 event/Chrono: add type alias TimePoint 2021-02-05 18:19:23 +01:00
Max Kellermann
1b4fd74575 event/TimerEvent: rename to FineTimerEvent
... and make TimerEvent a type alias for FineTimerEvent (i.e. swap
names).
2021-02-05 18:18:05 +01:00
Max Kellermann
def962b6cb event/{Coarse,Fine,Far}TimerEvent: aliases for TimerEvent
Preparing for a variant of TimerEvent with coarse 1-second
granularity, but cheaper (with a timer wheel).
2021-02-05 18:16:05 +01:00
Max Kellermann
e802f1f61a event/Loop: move TimerSet to separate class 2021-02-05 18:09:21 +01:00
Max Kellermann
271b287356 event/TimerEvent: assign due in Schedule() 2021-02-05 17:57:05 +01:00
Max Kellermann
2a30acd99c event/Loop: use [[gnu::pure]] 2021-02-05 17:55:33 +01:00
Max Kellermann
a8e70f18fd event/*: use using instead of typedef 2021-02-05 17:54:16 +01:00
Max Kellermann
ddd9f20a0b fs/io/GunzipReader: document that the constructor throws 2021-02-04 17:29:00 +01:00
Max Kellermann
f4a5d671fe util/{Const,Writable}Buffer: include cleanup 2021-02-04 17:27:48 +01:00
Richard Backhouse
c72006dbcc zeroconf/ZeroconfBonjour: Cleanup formatting from previous commit 2021-01-23 06:13:05 -05:00
Richard Backhouse
06fe30e2bd zeroconf/ZeroconfBonjour: Fix compile errors resulting from "refactor to SocketEvent" and reenable bonjour for darwin build 2021-01-23 06:06:49 -05:00
Max Kellermann
08e76815ba io/FileDescriptor: use std::byte 2021-01-22 12:50:16 +01:00
Max Kellermann
33ac3eb551 lib/curl/Easy: add methods SetVerify{Host,Peer}() 2021-01-22 12:34:04 +01:00
Max Kellermann
d56a51cb5e Merge branch 'v0.22.x' 2021-01-21 22:28:11 +01:00
Max Kellermann
9e2d09dabc net/SocketError: add syscall specific check functions
Fixes Windows compatibility.
2021-01-21 22:05:21 +01:00
Max Kellermann
2719f62feb net/SocketError: relicense to BSD-2 2021-01-21 21:31:02 +01:00
Max Kellermann
065a0c09f8 fs/io/StdioOutputStream: include cleanup 2021-01-21 21:13:40 +01:00
Max Kellermann
04731fb7cc util/StringPointer: add operator==(std::nullptr_t) 2021-01-21 21:08:52 +01:00
Max Kellermann
12ff5a547f fs/io/FileOutputStream: add noexcept 2021-01-21 21:04:19 +01:00
Max Kellermann
9b2eb74f95 util/AllocatedString: fix operator= parameter type 2021-01-21 20:44:07 +01:00
Max Kellermann
84084baa65 util/AllocatedString: remove wrong std:: prefix 2021-01-21 20:16:32 +01:00
Max Kellermann
3bc45fbf68 util/AllocatedString: remove Null(), IsNull() 2021-01-21 20:12:05 +01:00
Max Kellermann
36168a24f5 util/AllocatedString: support casting a nulled instance to string_view 2021-01-21 20:06:01 +01:00
Max Kellermann
5e67443a1a util/{Const,Writable}Buffer: always enable assertions 2021-01-21 20:04:00 +01:00
Max Kellermann
17858143b3 util/{Const,Writable}Buffer: enable constexpr on more methods 2021-01-21 20:03:53 +01:00
Max Kellermann
c44a7b2705 util/AllocatedArray: add operator=(nullptr) 2021-01-21 20:03:38 +01:00
Max Kellermann
0ded23591b util/AllocatedString: add operator=() 2021-01-21 20:02:52 +01:00
Max Kellermann
c1a7aa652d util/AllocatedString: replace Clone() with copy constructor 2021-01-21 20:02:41 +01:00
Max Kellermann
8d47f51399 util/AllocatedString: add const_pointer constructor 2021-01-21 18:06:10 +01:00
Max Kellermann
a81c9bfb81 util/AllocatedString: add string_view constructor
Replaces the static Duplicate() method.
2021-01-21 18:05:51 +01:00
Max Kellermann
1caf57644f util/AllocatedString: add default constructor 2021-01-21 18:05:50 +01:00
Max Kellermann
c70b63c183 util/AllocatedString: rename to BasicAllocatedString
To make things simpler, AllocatedString is now a non-template class.
2021-01-21 18:04:03 +01:00
Max Kellermann
8279cafd6d release v0.22.4
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmAJqgAQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEg2QEACJLeN2mk2RU7Iqxbh/ekwm6aTM8D6bx8RH
 Xys4l1YAFQ0cg7sKZwMqefedGJG2j8CORbihYIF6Z8EvFsAiI6I3LjElfXrmnAc0
 Y9SnWHIR5vxlSQgyqPlJ0jl213uzoHHpel8PpEJbTtYONT+8f3fQEuLpO4/uWOIT
 S6mlX16vI0/Ydp//8UIazUUvjar1pPvBnSEZ0JZsZl8RTYlS/4SOfqpHnhhWnWpO
 9RXlLP9Zo68rJzNhUPwRj7NkyVEkg74xpjHOWoyeTMNQ6tKMQn8b4jb/LcBfj6hk
 I7mof5oX0aS+GyYaehKi9c9Az7wUcBxnnaN02qlAaSutcuox7ce70fKMtiAXRN0o
 T9mFSJm1JKqHZb1dFvxqSqFjVr7eO9XCxHqaEqTbXCT+CL/6AJQZi5SVcX4gCY1P
 NSM3Jnydjr73WFLmEfjCkWLTdtiJhY/2Q/J6+vcILMb3W2y5FaSHZTOFbxVG4nMM
 spoQ27b7PoB9MbxLR3QJkYLa0WE3FrTORYgsH8Po7ZcCU9+JvqDSBnGXxx+Yv+JJ
 dKMI5bEAvPziodSHHQXgD4lhx744JuiLAJNtlSYJvev1s2Irf2TtMHdmGERHQZwH
 5cr9sQLgyHCLvTBDGt1dVZq/Z0T/PCkweIa5cT6ZBAim1hs7g20g8ksyFK2ZPUbB
 vEGBNcuMIg==
 =CEEr
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.4'

release v0.22.4
2021-01-21 17:42:26 +01:00
Max Kellermann
995aafe9cc protocol: add command "binarylimit"
Increasing the protocol version to 0.22.4 to allow clients to detect
this feature.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1038
2021-01-21 17:17:10 +01:00
Max Kellermann
6e33566cee client/FileCommands: validate the given offset 2021-01-21 16:57:38 +01:00
Max Kellermann
3b3c1d466d event/FullyBufferedSocket: add method GetOutputMaxSize() 2021-01-21 16:49:38 +01:00
Max Kellermann
056ab199ab util/PeakBuffer: add method max_size() 2021-01-21 16:45:56 +01:00
Max Kellermann
eea0e084af util/PeakBuffer: use std::byte instead of std::uint8_t 2021-01-21 16:45:31 +01:00
Max Kellermann
fa82f558be util/PeakBuffer: add noexcept 2021-01-21 16:45:17 +01:00
Max Kellermann
6b555b7017 util/PeakBuffer: use std::size_t 2021-01-21 16:45:14 +01:00
Max Kellermann
dafba203e7 util/ForeignFifoBuffer: use auto 2021-01-21 16:38:32 +01:00
Max Kellermann
a5d382348e command/Request: ParseUnsigned() returns unsigned
Of course, it should do that!
2021-01-21 16:33:17 +01:00
Max Kellermann
74396448df input/curl: disable verify_peer on Android by default
I havn't yet figured out how to use Android's system CA certificates
with CURL/OpenSSL, so a temporary workaround is to disable verify_peer
by default.  The data MPD transfers isn't extremely important, so the
servers's authenticity isn't extremely important either.
2021-01-21 14:55:09 +01:00
Max Kellermann
014c2a82bd event/SignalMonitor: fix non-Linux build failure
Regression by commit cd4b673b6c

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1060
2021-01-21 14:05:23 +01:00
Max Kellermann
1afa33c3c7 db/simple/Song: Export() merges tags with "target"
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1048
2021-01-21 13:57:59 +01:00
Max Kellermann
3a7c9c7c84 db/simple/ExportedSong: add option to own a Tag 2021-01-21 13:52:01 +01:00
Max Kellermann
6d08e761c8 db/simple/ExportedSong: new class 2021-01-21 13:52:01 +01:00
Max Kellermann
fee282f49c SongPrint: use LightSong::GetDuration()
This properly prints the "Time"/"duration" values for songs in virtual
CUE folders.

This is loosely related to
https://github.com/MusicPlayerDaemon/MPD/issues/1048
2021-01-21 13:52:00 +01:00
Max Kellermann
07d2bc6898 util/StringView: add method SplitLast() 2021-01-21 13:20:01 +01:00
Max Kellermann
9551166f27 command/file: use %zu to format a size_t
`PRIoffset` was wrong, because it expects an `offset_type`
(i.e. `uint64_t`).  This broke on 32 bit machines where `size_t` has
32 bits.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1058
2021-01-20 20:44:47 +01:00
Max Kellermann
2a8c420cff client/Response: add printf attribute 2021-01-20 20:43:16 +01:00
Max Kellermann
ec1e04a65d Merge branch 'bugfix/1043/remove-basepath-handling' of git://github.com/PVince81/MPD into v0.22.x 2021-01-20 20:02:31 +01:00
Max Kellermann
4949cd98f3 output/sles: add missing include for assert() 2021-01-19 20:17:17 +01:00
Max Kellermann
a14ce4c7cb lib/pcre/RegexPointer: work around bogus -Wmaybe-uninitialized with GCC 11 2021-01-19 19:58:04 +01:00
Rosen Penev
594dfe572b
clang-tidy: mark a bunch of variables constexpr
Found with cppcoreguidelines-interfaces-global-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-01-16 18:35:31 -08:00
Max Kellermann
906e82f600 event/Loop: fix assertion failure due to wrong "busy" value
If an InjectEvent callback schedules a timer, the loop will restart,
but the "busy" flag is still false.  The fix is to move the "again"
check before the "busy" setting.
2021-01-12 17:28:42 +01:00
Max Kellermann
bcb7e954e9 net/Resolver: add simple getaddrinfo() wrapper 2021-01-12 15:43:26 +01:00
Max Kellermann
866c87c65e net/ToString: include cleanup 2021-01-12 12:22:44 +01:00
Max Kellermann
4ba36d7cb9 net/SocketError: relicense to BSD-2 2021-01-11 22:31:46 +01:00
Max Kellermann
13f8a912e3 event/Loop: simplify wake_event initializer 2021-01-11 20:14:20 +01:00
Max Kellermann
51f110a990 system/EventPipe: use class Unique{Socket,File}Descriptor 2021-01-11 17:51:22 +01:00
Max Kellermann
17eae74c1c system/EventFD: Get() returns FileDescriptor 2021-01-11 17:38:30 +01:00
Max Kellermann
cd4b673b6c event/WakeFD: convert macro to class with a GetSocket() method 2021-01-11 17:02:54 +01:00
Ethan Halsall
0d606c743b add additional opus encoder options 2021-01-09 22:04:00 -06:00
Vincent Petry
ec0d3ac95d
Remove relative path handling which was not needed
The original base relative path was introduced due to an erroneous test
where the URL started with three slashes: "https:///" instead of two,
which led to implementing handling for such cases but broke the two
slashes case.

This fix removes the base relative path handling because with two
slashes the path is anyway always relative to the host (aka absolute
URI, without host).

This reverts 216f62ea14 and part of 74b2fc7fdc

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-08 16:50:27 +01:00
Max Kellermann
81ea749248 Merge branch 'v0.22.x' 2021-01-05 13:11:29 +01:00
Vincent Petry
74b2fc7fdc
Use uri_has_scheme for Webdav response href
Use uri_has_scheme to find out if the href in Webdav responses is absolute
to use the matching base path extraction.

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-05 12:04:08 +01:00
Vincent Petry
216f62ea14
Webdav href in response can be relative
Fixed Webdav base path stripping in cases where href is a relative path.

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-04 21:50:03 +01:00
Vincent Petry
b7d0001390
Fix parsing propstat blocks
There can be more than one propstat block each with their own status
code. We're only interested in the one with the 200 status, the found
properties.

This fixes parsing to make sure we process all propstat blocks instead
of just the last one, which might have a 404 status for not-found
properties.

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-04 21:49:38 +01:00
Vincent Petry
687788e4d3
Fix Webdav storage PROPFIND request
Remove additional "a:prop" in PROPFIND request to match RFC 4918 section 9.1.3.
Added Content-Type header as the body is not a true multipart POST.

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-04 14:28:42 +01:00
Max Kellermann
e009ad1a72 thread/Id: relicense to BSD-2 2021-01-03 19:25:20 +01:00
Max Kellermann
abbd980671 Merge branch 'v0.22.x' 2021-01-01 19:59:15 +01:00
Max Kellermann
5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Max Kellermann
937da63ba6 util/StringView: add {Starts,Ends}With(char) 2020-12-15 17:04:39 +01:00
Max Kellermann
1f312b2e42 curl/Handler: disallow OnData() to throw
This eliminates some complexity from class CurlRequest.
2020-12-15 17:03:24 +01:00
Max Kellermann
1e3089ffb7 curl/Request: move struct Pause to class CurlResponseHandler 2020-12-15 17:01:18 +01:00
Max Kellermann
5d7ff150dd curl/Request: add more wrapper methods 2020-12-15 16:56:20 +01:00
Max Kellermann
7a56837141 odbus/Watch: support DBUS_WATCH_{ERROR,HANGUP} 2020-12-14 15:10:19 +01:00
Max Kellermann
ed1caffc79 odbus/Watch: use SocketEvent::ReleaseSocket() to allow another Open() 2020-12-14 15:10:15 +01:00
Max Kellermann
65473b5113 lib/dbus/FilterHelper: new class 2020-12-14 15:07:12 +01:00
Max Kellermann
178d115ccb lib/dbus/Glue: add noexcept 2020-12-14 13:19:51 +01:00
Max Kellermann
10e5b0759c lib/dbus/Glue: relicense to BSD-2 2020-12-14 13:02:37 +01:00
arcnmx
0a81e462db event/SocketEvent: remove FD before closing socket
SocketEvent knows the FD is still open and is about to close it, so
it's unnecessary to rely on the kernel (via AbandonFD) to clean up the
epoll_wait list.

### Why this is relevant

- `AbandonFD` assumes that upon closing the socket, the FD will be automatically removed from the epoll list. That fd is associated with a reference to the `SocketEvent`, so this is an important and dangerous assumption to get wrong. In the case that the FD isn't immediately removed from the list by the kernel, the event loop can crash due to the `SocketEvent` being destroyed and it being a use-after-free bug at that point.
- If a socket FD happens to be duplicated, then closing the SocketEvent FD will not automatically remove it from epoll, and will trigger said bug/crash. It is only automatically removed when all FD references to the underlying socket/resource are closed?
- A `fork()` is one example where a socket FD can be duplicated and result in this situation.
    - `CLOEXEC` might be considered mitigation for this but also introduces a race condition where the crash can occur between a `fork()` and `exec()` without additional synchronization to freeze the event loop.

One could argue the mpd event loop isn't fork-safe, and thus should be allowed to use `AbandonFD` however it likes. A decision on whether this is intended should probably be declared; but either way this fix seems appropriate in cases where `Abandon` isn't actually necessary. It also might be possible to fix `AbandonFD` to mark the `SocketEvent` as removed without using `EPOLL_CTL_DEL`?

[edit: made this dependent on HAVE_THREADED_EVENT_LOOP which is always
true for MPD, but not for ncmpc, for example - mk]
2020-12-04 10:32:46 +01:00
Max Kellermann
5cbbe8ae2e event/TimerEvent: update API documentation 2020-12-04 09:57:19 +01:00
Max Kellermann
00fafa16c7 event/SocketEvent: remove assert(), reduce header dependencies 2020-12-04 09:56:28 +01:00
Max Kellermann
cea8db7eaa event/SocketEvent: add comment 2020-12-04 09:55:08 +01:00
Max Kellermann
b56c0e69e4 event/SocketEvent: add another assert() to Open() 2020-12-04 09:24:02 +01:00
Max Kellermann
b27e82e4a9 event/SocketEvent: allow Schedule() with IMPLICIT_FLAGS
Relax the API (instead of tightening it further like commit
7bc1c9925b tried to do unsuccessfully).
2020-12-04 09:17:45 +01:00
Max Kellermann
ad48834469 Revert "event/SocketEvent: add assert()"
This reverts commit 7bc1c9925b.  It
caused a crash with the ALSA plugin family (through
MultiSocketMonitor::ReplaceSocketList() and
MultiSocketMonitor::AddSocket()).  Until we have a proper fix, the
assertion patch is reverted.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1020
2020-12-02 20:43:29 +01:00
Max Kellermann
9d6b5e2ba1 event/TimerEvent: rename IsActive() to IsPending() 2020-12-02 15:41:11 +01:00
Max Kellermann
33ba190bec event/TimerEvent: add ScheduleEarlier() 2020-12-02 15:30:37 +01:00
Max Kellermann
3783350d25 event/SocketEvent: document Dispatch() 2020-12-02 15:24:23 +01:00
Max Kellermann
173405a343 event/SocketEvent: make Dispatch() private 2020-12-02 15:14:51 +01:00
Max Kellermann
7bc1c9925b event/SocketEvent: add assert() 2020-12-02 15:12:30 +01:00
Max Kellermann
618f94f589 util/TemplateString: add StringView cast operator 2020-12-02 15:00:49 +01:00
Max Kellermann
ad2c22844c util/TemplateString: add FromLiteral() 2020-12-02 15:00:39 +01:00
Max Kellermann
b8df851414 io/FileDescriptor: use std::size_t 2020-12-02 14:56:00 +01:00
Max Kellermann
a584141cae io/Open: add flags parameter to OpenReadOnly() 2020-12-02 14:52:51 +01:00
Max Kellermann
4e88f95f94 event/Loop: move the "again" check out of the mutex scope 2020-12-01 20:29:21 +01:00
Max Kellermann
790e540c19 event/Loop: use ClockCache 2020-12-01 20:25:42 +01:00
Max Kellermann
16074c565f time/ClockCache: new library 2020-12-01 20:22:26 +01:00
Max Kellermann
2a1dd55b11 event/Loop: include cleanup 2020-12-01 20:19:40 +01:00
Max Kellermann
be20f760ab event/Loop: disallow copying 2020-12-01 20:18:33 +01:00
Max Kellermann
8050394003 event/Loop: add noexcept 2020-12-01 20:10:53 +01:00
Max Kellermann
ff8b5bc61b event/Loop: reorder methods 2020-12-01 20:09:25 +01:00
Max Kellermann
ef8797821f event/Loop: inline field initializers 2020-12-01 20:07:35 +01:00
Max Kellermann
5f2797e7cc event/Loop: add more assertions to dtor 2020-12-01 20:05:54 +01:00
Max Kellermann
e286702f4c event/Loop: rename AddDeferred() to AddDefer() 2020-12-01 17:26:39 +01:00
Max Kellermann
c58aaf545f event/IdleEvent: make a special case of DeferEvent 2020-12-01 17:14:24 +01:00
Max Kellermann
990f2dc1cf event/DeferEvent: use class IntrusiveList instead of boost::intrusive::list 2020-12-01 17:14:24 +01:00
Max Kellermann
774b4313f2 event/DeferEvent: split the thread-safe version into new class InjectEvent 2020-12-01 17:14:24 +01:00
Max Kellermann
1ecbc2ff0f event/DeferEvent: explicitly forbid copying 2020-12-01 17:14:24 +01:00
Max Kellermann
fd8e38f8cd event/DeferEvent: use using instead of typedef 2020-12-01 17:14:24 +01:00
Max Kellermann
e86d4db55c Merge branch 'v0.22.x' 2020-12-01 17:14:21 +01:00
Max Kellermann
d9583faf06 input/{tidal,qobus}: add missing includes for assert() 2020-12-01 17:14:11 +01:00
Max Kellermann
2788cf9330 input/tidal: add missing include for assert() 2020-12-01 17:13:13 +01:00
Max Kellermann
9420c74101 util/AllocatedArray: add nullptr constructor 2020-11-30 22:30:57 +01:00
Max Kellermann
b1bef9c21d util/AllocatedArray: add method data() 2020-11-30 22:30:28 +01:00
Max Kellermann
5b0ef7ea98 util/AllocatedArray: add types pointer, const_pointer 2020-11-30 22:30:25 +01:00
Max Kellermann
ab53c414bc util/StringView: add method SplitLast() 2020-11-30 22:29:38 +01:00
Max Kellermann
d547ace749 io/FileDescriptor: use std::size_t 2020-11-30 22:27:16 +01:00
Max Kellermann
b47e0cffdd util/TemplateString: rename CharAsString() to FromChar() 2020-11-30 22:23:28 +01:00
Max Kellermann
3af35aee9e util/TemplateString: add cast operators 2020-11-30 22:22:24 +01:00
Max Kellermann
02314ac7dd util/TemplateString: rewrite as constexpr functions
Hooray C++17!
2020-11-30 22:19:57 +01:00
Max Kellermann
e7c4e87ac4 util/TemplateString: remove unnecessary implementation for static variable
This is obsolete since C++17.
2020-11-30 22:13:13 +01:00
Max Kellermann
de58bfbb7f util/TemplateString: use std::size_t 2020-11-30 22:13:08 +01:00
Max Kellermann
0dda4c06b1 util/TemplateString: no indent after namespace 2020-11-30 22:13:04 +01:00
Max Kellermann
79fd6143ec lib/dbus/Values: use T::Traits, not T
This template was never instantiated, so the problem never occurred.
2020-11-30 22:11:18 +01:00
Max Kellermann
8f89e3f7f4 lib/dbus/Values: use using instead of typedef 2020-11-30 22:11:14 +01:00
Max Kellermann
fc01d11b8d odbus/Types: use using instead of typedef 2020-11-30 22:08:37 +01:00
Max Kellermann
0c28d8dcbe time/ISO8601: support YYYY-MM (without day of month) 2020-11-30 21:55:12 +01:00
Max Kellermann
764eaadd25 time/Math: new library 2020-11-30 21:55:05 +01:00
Max Kellermann
273771ffec net/SocketAddress: add CastTo() 2020-11-30 21:51:07 +01:00
Max Kellermann
32ce9ce919 net/IPv[46]Address: pass SocketAddress by value to Cast() 2020-11-30 21:49:07 +01:00
Max Kellermann
34a070f5a6 net/IPv[46]Address: add Cast(const sockaddr_in&) 2020-11-30 21:49:02 +01:00
Danilo Spinella
92bfdffa42 lib/ffmpeg/Filter: Add define required for avutil 2020-11-30 20:06:21 +01:00
Max Kellermann
ac4975cd7a util/MimeType: relicense to BSD-2 2020-11-18 15:28:21 +01:00
Max Kellermann
fbbbfb9668 Merge branch 'v0.22.x' 2020-11-16 09:41:20 +01:00
Max Kellermann
38b41fc3fd filter/ffmpeg: detect the output sample format
Some FFmpeg filters change the sample format, and since MPD assumes
this never happens, this results in loud noise instead of music.  This
commit finally implements the TODO comment by sending one frame of
silence to the filter and checking the output frame's format.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1009
2020-11-16 09:39:34 +01:00
Max Kellermann
394f69bee1 output/Control: allow copy elision (fix -Wpessimizing-move) 2020-11-15 19:55:11 +01:00
Stapper
ba5531f9dd Fixes #994 - moveoutput: new AudioOutputControl created from copyMoving an output to a partition is now done via MultipleOutputs::AddCopy(),using a new AudioOutputControl constructor. Tags and always_on settings willpersist when moving outputs between partitions. 2020-11-15 19:47:53 +01:00
Max Kellermann
eb9f5339b6 Merge branch 'v0.22.x' into master 2020-11-11 12:43:50 +01:00
Max Kellermann
a9714e73c8 Merge branch 'bind' of git://github.com/neheb/MPD into master 2020-11-10 16:02:34 +01:00
Max Kellermann
1092882f38 decoder/dsdiff: apply padding to odd-sized chunks
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1001
2020-11-10 15:55:33 +01:00
Max Kellermann
a99bc91eb0 release v0.22.3
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl+lZ/cQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEpfmD/wPsQl/bLHuU1su2OqOAtFfPEhkJAetllE5
 vpkXUqATEiBFKTDj2tpherZsioGpExoNmypgehVp0oDSuWvF+wbYf+SNpsqW4Ck0
 +RoOg1Nr5tKtjc7dCQA8AricguR4nU9ecfXPKU/Q62AJbdlUhi5Ly4QcFyT3NZUK
 SK0yp4i83osWMEAEhn1k7ducqljSyjIBt1dvK3FK9JY3lYXXARVG5THDnlbbXhxP
 Hn9Jygd7bJ3J3g0I45q4Nfop7BiPBowmiqDxe6scL/owW+5MXlC+nkX1OIYRA37E
 Byud/kV5/gi5YyK4Z6hNI5p1By4ggJ8N5O7h2CiktMvkd4KQMUm4SfMH3ah3o2JG
 CiC90WgwdWeTbRaZvSKWSPo3V2htbzObeglvyUjnmV2HTNN0vRWzS5vrbvWK81+R
 XMqICrJNwlQduCNbl1UcnCdIN+0tS1Ecg8xEDkbe6VVHAoxwIsWASYgKr3fxXnuQ
 N2vWkqLXHrgJWtpVU8aP2ufnkbHDWA1T1vgPsgNUKv/vEQAaRP0XkMIc+VW3u8H8
 AWj87r+qxjjWCfAbg9nxdGzen+KHZnq0/hiPLq1C2skm4JP+LsWuI4mjB/oGfJ6y
 aZsXHxCV/aKakDucpmkMfC/oYnXD+dvBXTgIr68teEuLnmLauZa3oXocdRqQdCUW
 qKh9rVD7vg==
 =FEmy
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.3' into master

release v0.22.3
2020-11-06 16:14:46 +01:00
Max Kellermann
f849b07766 storage/curl: fix nullptr dereference
Pass a std::string to PathTraitsUTF8::Relative(), implicitly casting
it to std::string_view.  This selects the right overload which returns
std::string_view instead of `const char *`; the latter could return
`nullptr` which would cause the implicit conversion of the return
value to std::string_view to crash.

Regression caused by commits ead208987d and a98d627c0b.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/995
2020-11-06 15:35:47 +01:00
Rosen Penev
071d3c71d8
clang-tidy: replace std::bind with lambdas
Found with modernize-avoid-bind

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-11-05 18:09:30 -08:00
Max Kellermann
afbcac9fb1 util/MimeType: use IterableSplitString() in ParseMimeTypeParameters() 2020-11-04 21:29:42 +01:00
Max Kellermann
51e5b56b3a playlist/registry: remove duplicate function ExtractMimeTypeMainPart()
This is the same as GetMimeTypeBase(), which has already been applied.
2020-11-04 21:20:43 +01:00
Max Kellermann
bb07fd42ce util/MimeType: migrate GetMimeTypeBase() to std::string_view 2020-11-04 21:20:03 +01:00
Max Kellermann
bab626c325 util/UriExtract: remove the query string at the beginning of uri_get_suffix() 2020-11-04 21:15:41 +01:00
Max Kellermann
2a9131498f util/UriExtract: pass std::string_view to uri_get_suffix() 2020-11-04 21:13:57 +01:00
Max Kellermann
35a232105e util/UriExtract: uri_get_suffix() returns std::string_view
No need to copy it to a buffer.
2020-11-04 21:08:26 +01:00
Max Kellermann
19dd1a25d7 {decoder,archive,playlist}/plugin: pass std::string_view to SupportsMimeType() 2020-11-04 21:00:49 +01:00
Max Kellermann
53396c0e50 Merge branch 'v0.22.x' into master 2020-11-04 20:37:25 +01:00
Max Kellermann
0b8208fe7f Merge branch 'clng11' of git://github.com/neheb/MPD into master 2020-11-04 20:34:55 +01:00
Max Kellermann
2da3cff1e8 filter/LoadChain: use the AutoConvertFilter
This adds support for input samples other than 16 bit to the FFmpeg
filter plugin.
2020-11-04 20:15:19 +01:00
Max Kellermann
0c965d0573 filter/AutoConvert: move the Filter class to TwoFilters.cxx 2020-11-04 20:15:19 +01:00
Max Kellermann
77c14692c9 filter/AutoConvert: eliminate AutoConvertFilter if possible
If no conversion is necessary, return the child Filter as-is.  This
allows removing all nullptr checks from AutoConvertFilter.
2020-11-04 20:15:19 +01:00
Max Kellermann
226eb26300 filter/ffmpeg: interleave the output AVFrame
If the FFmpeg filter outputs planar data, interleave it, just like the
FFmpeg decoder plugin does.
2020-11-04 20:15:19 +01:00
Max Kellermann
2d606fa989 decoder/ffmpeg: move code to lib/ffmpeg/Interleave.cxx
To be reused by the FFmpeg filter plugin.
2020-11-04 20:15:19 +01:00
Max Kellermann
7a0342c8bb decoder/ffmpeg: use AVFrame fields instead of AVCodecContext fields 2020-11-04 20:06:45 +01:00
Max Kellermann
42c9d765cf lib/ffmpeg/Buffer: add missing include 2020-11-04 20:06:41 +01:00
Max Kellermann
a8a80ee689 lib/ffmpeg/Buffer: disallow copying 2020-11-04 19:51:21 +01:00
Max Kellermann
f9bdb4b0b8 lib/ffmpeg/Buffer: add noexcept 2020-11-04 19:50:38 +01:00
Max Kellermann
9332527872 lib/ffmpeg/{Buffer,Time}: remove obsolete "#undef SampleFormat"
This compatibility macro has been removed from FFmpeg long ago.
2020-11-04 19:50:33 +01:00
Max Kellermann
84f772357e filter/convert: convert_filter_new() returns std::unique_ptr 2020-11-04 16:47:11 +01:00
Max Kellermann
f2b9785a67 filter/chain: pass std::string_view to filter_chain_append() 2020-11-04 16:37:53 +01:00
Max Kellermann
eeaec99c59 filter/LoadChain: use IterableSplitString() 2020-11-04 16:36:11 +01:00
Max Kellermann
b0002e3b73 filter/chain: copy the child name
filter_chain_parse() passes a temporary string pointer which results
in a use-after-free in the PreparedChainFilter::Child::Open() error
message.
2020-11-04 16:34:38 +01:00
Max Kellermann
27c589da97 filter/chain: remove unused field ChainFilter::Child::name 2020-11-04 16:26:50 +01:00
Max Kellermann
92a218b7a9 playlist/registry: add option "as_directory"
This allows users to disable the "CUE files as directories" feature
without having to disable the CUE playlist plugin completely.  This
feature has been annoying some users.
2020-11-04 16:13:12 +01:00
Max Kellermann
bb009daf66 playlist/registry: simplify ExtractMimeTypeMainPart() 2020-11-04 13:34:04 +01:00
Max Kellermann
3d276d50b4 event/PollBackend: use vector::push_back() instead of resize() 2020-10-30 16:35:20 +01:00
Max Kellermann
b1b731340e event/PollBackend: add Item constructor 2020-10-30 16:32:45 +01:00
Max Kellermann
b9b02b4ff2 event/PollBackend: use unordered_map::find() instead of operator[]
The latter creates a new object, but we know that the key already
exists.
2020-10-30 16:25:41 +01:00
Max Kellermann
ab5d23da11 event/PollBackend: use unordered_map::emplace() in Add() 2020-10-30 16:24:32 +01:00
Max Kellermann
0554fe3652 event/PollBackend: use std::size_t 2020-10-30 16:09:29 +01:00
Max Kellermann
b0282fe36f event/PollGroupWinSelect: add Item constructor 2020-10-30 16:07:23 +01:00
Max Kellermann
69b45e693b event/WinSelect: use unordered_map::find() instead of operator[]
The latter creates a new object, but we know that the key already
exists.
2020-10-30 16:05:25 +01:00
Max Kellermann
9e97acc28d event/WinSelect: merge duplicate code into ApplyReady() 2020-10-30 15:55:23 +01:00
Max Kellermann
b1e446a931 event/WinSelect: add missing const to deleted copy ctor/operator 2020-10-30 15:45:29 +01:00
Max Kellermann
938319cd44 event/WinSelect: reorder method prototypes 2020-10-30 15:45:12 +01:00
Max Kellermann
fee29001fa event/WinSelect: use unordered_map::emplace() in Add()
This allow using erase() with iterator, without a key lookup.
2020-10-30 15:32:11 +01:00
Max Kellermann
6d894a1806 event/WinSelect: use SOCKET as std::unordered_map key 2020-10-30 15:25:09 +01:00
Rosen Penev
f1fc5d79ca
clang-tidy: convert to all/any_of
Found with readability-use-anyofallof

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-28 15:51:21 -07:00
Rosen Penev
0fd2c74a66
use structured binding declarations
Shorter.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-28 15:41:31 -07:00
Max Kellermann
bb99cf37e3 release v0.22.2
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl+Zm30QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEm0BD/0eeuI09j2LPCCQQdOUxl3ydWDLVVqDbT/b
 wUYLFEIscr0Kr8k4Mcl3C5LBEeCJq4ZYQ/VqlgNVC11SXVhq7IHJALJ3rYQVIpx+
 7MGfd1M0G39d9nlEFeKG2iNKx78aiBTqkMC9MtctacIOiKmntXP0cZZxpqGMMVZs
 5t8l8i2CM35BWisu0PjSvPJMzGVf9lgEIqx1ejHBFrX6V6DEZ8d6KEbV9FulNo1Y
 bH1UmKdsz71LC1ZE9EescmL5kVvaXyWyJmDDiu2/sqcMRjAHl2+RIAsunv6SqdGH
 Sk4OZbtXB8M8EQHuSJESUS6SnQEyGdwCptBn4NHXkajzRJqKCq0FRDyQGT+qrmUr
 H+91rZeWRYFbBMStP9l9MMQiTTjXgfCnHExDK9AmrMhiuYnuVxV1deEP7FXswCkd
 yU3sPpcKgdzMEYzoTuzXJVyMIKr0WOmNGFMEUbxfBXZDCbT1i9SH+Bi0kQAYe9h9
 JQTSWeS5NDRcI/b6nHS6ccUGFEp1scbXQNLw+17UvrUwfeZW9N9/t6jPS4kdUNEm
 tnNmbM/3o7yT3B8BGKTl5qBVSjCcgqKfsBXvy9Qn2zE0TN4HQPiJSDXZEH9LuZR1
 c6b8aI94gZkN4av1OAjmZgLyn+Pr2gyrei4FQNXyjNJkV5F3wiiLhhDTEMc2WLNm
 Zf4qpZArww==
 =eRNp
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.2' into master

release v0.22.2
2020-10-28 17:33:10 +01:00
Max Kellermann
7b9295ff99 lib/yajl/Handle: strip newlines from error messages
Closes https://github.com/MusicPlayerDaemon/MPD/issues/981
2020-10-28 16:06:52 +01:00
Max Kellermann
5f61d440eb lib/yajl/Handle: un-inline the throwing code
Reduces header dependencies.
2020-10-28 16:02:14 +01:00
Max Kellermann
6bc73a9ebe util/FormatString: update API documentation 2020-10-28 15:48:42 +01:00
Max Kellermann
1195eb266e protocol/Ack: remove unused variable ack_domain 2020-10-28 15:47:05 +01:00
Max Kellermann
3562a3e51e Main: save the state_file on shutdown
This got lost in commit 5d597a3646 (v0.21.19), but it was never
noticed because the state_file_interval was way too short due to
commit 3413d1bf23, fixed recently by commit 27cc7b352d
2020-10-28 15:29:47 +01:00
Max Kellermann
7c47fe746c event/Loop: AbandonFD() unlinks the SocketEvent
Fixes use-after-free bugs causing assertion failures at shutdown,
because all "abandoned" SocketEvents are still in the linked list.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/986
Closes https://github.com/MusicPlayerDaemon/MPD/issues/987
2020-10-28 15:01:32 +01:00
Max Kellermann
65a1c4a016 event/Loop: pass SocketEvent& to AbandonFD() 2020-10-28 14:59:28 +01:00
Max Kellermann
46418d0f2d event/ServerSocket: remove obsolete API documentation 2020-10-28 14:52:31 +01:00
Max Kellermann
bbfa6fe632 db/simple: purge songs for unavailable decoder plugins on update 2020-10-28 14:36:20 +01:00
Max Kellermann
bf97d13d0b fs/Traits: add GetPathSuffix() 2020-10-28 14:29:46 +01:00
Max Kellermann
b5673b6333 db/simple/Directory: add pure attribute 2020-10-28 14:24:58 +01:00
Max Kellermann
ee802867df db/update/Walk: add code comments 2020-10-28 14:23:39 +01:00
Max Kellermann
ecaa51e322 db/simple: purge special directories for unavailable plugins on update 2020-10-27 19:14:31 +01:00
Max Kellermann
0779333064 db/update/Walk: adjust lamba indent 2020-10-27 19:14:31 +01:00
Max Kellermann
6f1a4a73b7 fs/Traits: add GetFilenameSuffix() 2020-10-27 19:14:31 +01:00
arcnmx
ad585e179f system/FileDescriptor: fix Duplicate result
dup2 returns new_fd on success, not 0
2020-10-20 09:32:43 -07:00
Max Kellermann
8348a1ec8f event/PollGroup: rename to PollBackend 2020-10-19 14:52:59 +02:00
Max Kellermann
c18e00daa4 event/PollGroup: move event flags to a separate header
Reduce header dependencies for SocketEvent.hxx.
2020-10-19 14:48:41 +02:00
Max Kellermann
418ba96334 event/SocketEvent: forbid copying 2020-10-18 20:07:49 +02:00
Max Kellermann
a60e782959 event/Loop: reorder assertions 2020-10-18 20:05:22 +02:00
Max Kellermann
8bab5733d7 event/Loop: add assertions 2020-10-18 20:04:16 +02:00
Max Kellermann
e3270dfd68 event/SocketEvent: use class IntrusiveList<> 2020-10-18 20:02:47 +02:00
Max Kellermann
a14997ffb8 event/Loop: manage all SocketEvents in a linked list
Not only those which are "ready".
2020-10-18 20:01:38 +02:00
Max Kellermann
dd94f97572 event/Loop: un-inline AddFD(), ModifyFD()
Prepare for adding more code here.
2020-10-18 19:58:42 +02:00
Max Kellermann
7d502fb448 event/Loop: round epoll_wait() timeout up
This implements proper rounding, amending commit dcbb9fe07c
2020-10-18 19:58:42 +02:00
Max Kellermann
3ac87bbcda io/uring/Queue: use IntrusiveList<> 2020-10-18 19:37:54 +02:00
Max Kellermann
f64799622d event/IdleEvent: use class IntrusiveList<> 2020-10-18 19:28:12 +02:00
Max Kellermann
6f0ad2b6c5 util/IntrusiveList: replacement for boost::intrusive::list 2020-10-18 19:23:34 +02:00
Max Kellermann
b5750afb24 event/IdleEvent: use auto 2020-10-18 19:23:34 +02:00
Max Kellermann
442dd5e955 event/IdleEvent: forbid copying 2020-10-18 19:23:25 +02:00
Max Kellermann
172c2ae1aa release v0.22.1
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl+K29wQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEh/YEACRSf+EJaSCnqDWICcqMqh5NfUMkZhq6IXA
 36Vk2njYkEiNdePLTkoB/L4fVHiUuTiyeRTUshL6uy2J37fYc9w3tmyTdSStbFP+
 LAH4wVT0PKNVCpit8CVL1lwABG1fmUohejztrf7dIDqUrESwLrTtSbKKYKofQ5hp
 zVgFkV+Kza9fL2FGiw0ySpkhNfOv+eJBhpi8xitnYT8TpYrLqJdMzGW8oP5CFagI
 9Ot5LFRKfhoKmh8TklKI2jlRCziQ3Y/kCvtJcOxE1d8BhXdgUbnF1KRUKxcM+oqP
 jcFZ949zHl4vIqgdZ+dYczUZV74KbMIhqhB1jTApPnTSrpizt2h1+UhB7Jnxo2uC
 CfXf88+I/BPx5UY7wGxDSJnOqTs2RVa64EZPf0pgB/aOdM4tM96HWzZrFF0CilgD
 E897O9eyNzNeESzbXuhZwoO4luGyoiicpzZ6rLiH0fbkhpngBlJmYLup7pDfXe2E
 6jDev0YKtfzXeM0NHHGeZRMcYyMq6swDvfHF7ndpXdUMgOSu6lVSoR+VTe0oPoIB
 zrJV0pge901Q4wByMsoebY8K3eX9W8bqXtuaVMu6ZdYnHeCy79QiZkIDHMGZWDJb
 YBrHd+/zkGgyB6XndmtNSg6Uo7RPKwQEBP/sk5YhJ04KUdYSdPMKG1WXSRy7NfzL
 yaUPBqay2Q==
 =LH6z
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.1' into master

release v0.22.1
2020-10-17 13:58:36 +02:00
Max Kellermann
6a65b4c305 lib/nfs/patches: disable the snprintf->sprintf_s alias
snprintf() is available on mingw, and the libnfs kludge broke the
build with mingw, because sprintf_s() was now both an inline function
and a "dllimport" function (because the macro renamed the inline
function snprintf() to sprintf_s() in mingw's stdio.h).
2020-10-17 13:56:02 +02:00
Max Kellermann
4f0e0af319 Merge branch 'v0.22.x' into master 2020-10-16 19:02:03 +02:00
Max Kellermann
cb382b1e7d event/PollGroupWinSelect: add missing return value
Fixes regression from commit 1473d8474f
2020-10-16 19:02:00 +02:00
Max Kellermann
31268ad7cd decoder/opus: fix track/album ReplayGain fallback
Fixes regression by commit 23d5a2b862 -
that commit always pretended that any Opus file has both track and
album gain, and thus disabled the fallback to the other if one is not
set.

This patch changes the logic to only submit ReplayGain if at least one
value is set, and apply the offset only to that value.  If none is
available, then the new check in HandleAudio() will submit only the
output gain.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/977
2020-10-16 18:45:18 +02:00
Max Kellermann
a0d43dd87f decoder/opus: submit output_gain even if there is no OpusTags packet 2020-10-16 18:41:16 +02:00
Max Kellermann
1db533c8cf decoder/opus: move formula to EbuR128ToReplayGain() 2020-10-16 18:39:29 +02:00
Max Kellermann
78ee663660 decoder/opus: move comment to output_gain field 2020-10-16 18:30:51 +02:00
Max Kellermann
c32a809d38 decoder/opus: convert field output_gain to float 2020-10-16 18:28:57 +02:00
Max Kellermann
871bf3b88f command: add command "getvol"
Closes https://github.com/MusicPlayerDaemon/MPD/issues/979
2020-10-16 17:51:51 +02:00
Max Kellermann
b611b1824a event/Loop: move code to Wait() 2020-10-15 20:21:00 +02:00
Max Kellermann
1473d8474f event/PollGroup: ReadEvents() returns PollResult 2020-10-15 20:15:09 +02:00
Max Kellermann
0ecc3394c3 Merge branch 'v0.22.x' into master 2020-10-15 20:14:36 +02:00
Max Kellermann
725985379a event/SocketEvent: add ScheduleImplicit(), Is{Read,Write}Pending() 2020-10-15 17:01:30 +02:00
Max Kellermann
8849b9b62c event/SocketEvent: move Abandon() up 2020-10-15 16:59:45 +02:00
Max Kellermann
caa2611ad5 event/SocketEvent: add Abandon() 2020-10-15 16:57:55 +02:00
Max Kellermann
f8ff597963 event/SocketEvent: document Close() 2020-10-15 16:55:31 +02:00
Max Kellermann
ff6e434caf event/SocketEvent: rename Steal() to ReleaseSocket() 2020-10-15 16:54:33 +02:00
Max Kellermann
95bb12880d net/UniqueSocketDescriptor: add noexcept 2020-10-15 16:46:29 +02:00
Max Kellermann
257196664a net/SocketAddress: add missing include 2020-10-15 16:45:50 +02:00
Max Kellermann
643bf95366 util/OffsetPointer: use std::ptrdiff_t 2020-10-15 16:41:39 +02:00
Max Kellermann
36a187da39 util/Cast: include cleanup 2020-10-15 16:40:26 +02:00
Max Kellermann
fec80f2835 util/Cast: use std::ptrdiff_t 2020-10-15 16:40:18 +02:00
Max Kellermann
4e47653cf6 lib/curl/Global: ignore curl_multi_socket_action() errors
Keep the logging library out of this low-level libcurl wrapper.
2020-10-15 16:31:31 +02:00
Max Kellermann
c13004f985 lib/curl/Multi: add Add(), Remove(), ... 2020-10-15 16:25:57 +02:00
Max Kellermann
baba41e304 lib/curl/Global: adjust parameter name 2020-10-15 16:16:02 +02:00
Max Kellermann
d87e09a8b4 lib/dbus/ReadIter: remove obsolete GCC warning workaround
We need at least GCC 8 anyway.
2020-10-15 16:08:29 +02:00
Max Kellermann
33146ac353 lib/dbus/Watch: adjust parameter name 2020-10-15 16:06:19 +02:00
Max Kellermann
1406144210 lib/dbus/Watch: add missing include for assert() 2020-10-15 16:05:05 +02:00
Max Kellermann
bb6ab67175 output/osx: fix several -Wdouble-promotion warnings 2020-10-15 15:01:28 +02:00
Max Kellermann
ed3d8222d6 net/SocketAddress: include cleanup 2020-10-15 15:01:19 +02:00
Max Kellermann
bb20af8f20 util/StringStrip: use std::strlen() 2020-10-15 12:54:47 +02:00
Max Kellermann
9355ec44e0 util/StringStrip: use std::size_t 2020-10-15 12:53:02 +02:00
Max Kellermann
c63bd323ce util/StringCompare: use std::memcmp() 2020-10-15 12:48:33 +02:00
Max Kellermann
55db7105c5 event/SocketEvent: check/clear scheduled_flags in Close()
Fixes regression by commit 521e573be9
2020-10-14 21:08:39 +02:00
Max Kellermann
1c079e554b io/UniqueFileDescriptor: add method Release() 2020-10-14 20:50:02 +02:00
Max Kellermann
48afb68f3a event/SocketEvent: remove assert() from GetScheduledFlags()
Fixes regression by commit 7901b04c78
2020-10-14 20:50:02 +02:00
Max Kellermann
21f409d5e2 event/SocketEvent: fix grammar 2020-10-14 16:30:38 +02:00
Max Kellermann
521e573be9 event/SocketEvent: use EventLoop::AbandonFD() in Close() 2020-10-14 16:29:49 +02:00
Max Kellermann
abf9ae2dd9 event/Loop: rename Abandon() to AbandonFD() 2020-10-14 16:26:06 +02:00
Max Kellermann
9f013f7de4 event/SocketEvent: allow Close() without socket 2020-10-14 16:26:01 +02:00
Max Kellermann
7fc04fd5cd event/SocketEvent: move Dispatch() down 2020-10-14 16:21:41 +02:00
Max Kellermann
7901b04c78 event/SocketEvent: allow Cancel() without socket 2020-10-14 16:20:43 +02:00
Max Kellermann
653eea5840 event/SocketEvent: remove unnecessary initializer 2020-10-14 16:18:39 +02:00
Max Kellermann
5a4055fb08 event/SocketMonitor: refactor to SocketEvent
Similar to commits 1686f4e857 and
30a5dd267b
2020-10-14 15:54:12 +02:00
Max Kellermann
4d68a12f03 event/Loop: split the AtScopeExit()
Fixes the !HAVE_THREADED_EVENT_LOOP build.
2020-10-14 14:47:59 +02:00
Max Kellermann
0e951da64b event/Loop: add missing #ifdef 2020-10-14 14:37:29 +02:00
Max Kellermann
38dab040b3 event/Loop: add compile-time option to disable multithreading
Not for MPD, but for other applications which might want to copy its
event loop, but do not need multi-threading.
2020-10-14 14:08:38 +02:00
Max Kellermann
e9f6af61f9 event/Loop: forward-declare class {Idle,Defer}Event 2020-10-14 14:05:17 +02:00
Max Kellermann
b06c4e2711 event/{Idle,Defer}Event: use base_hook instead of member_hook
Allows forward declaration.
2020-10-14 14:04:30 +02:00
Max Kellermann
1686f4e857 event/IdleMonitor: refactor to IdleEvent
Instead of using this as a base class implementing a virtual method,
the new class IdleEvent can be used as a variable, decoupling
IdleMonitor's internal state from the derived class.

This is similar to commit 30a5dd267b
which refactored TimeoutMonitor to TimerEvent.
2020-10-14 13:47:25 +02:00
Max Kellermann
329382c1da event/SignalMonitor: add noexcept 2020-10-13 17:26:33 +02:00
Max Kellermann
fadc03df21 meson.build: move macros to event/Features.h 2020-10-13 16:15:52 +02:00
Max Kellermann
54ee0e28ab event/PollGroup: check _WIN32 instead of USE_WINSELECT 2020-10-13 15:27:58 +02:00
Max Kellermann
92fc53ebef event/PollGroupWinSelect: use range-based for 2020-10-12 12:44:23 +02:00
Max Kellermann
7e7a1613cf event/PollGroupWinSelect: use std::copy_n() 2020-10-12 12:40:32 +02:00
Max Kellermann
f73c4643ef event/PollGroupWinSelect: move IsEmpty() check to GetPtr() 2020-10-12 12:39:10 +02:00
Max Kellermann
8b94e8f260 event/PollGroupWinSelect: use SOCKET instead of int 2020-10-12 12:13:46 +02:00
Max Kellermann
41bc17a27f event/SocketMonitor: add ready_flags
By making each SocketMonitor keep track of its ready flags, this
removes a lot of overhead from EventLoop::RemoveFD().
2020-10-09 17:28:11 +02:00
Max Kellermann
41c0bbab13 event/SocketMonitor: don't filter out ERROR/HANGUP
By bit-wise ANDing the reported flags with GetScheduledFlags(),
ERROR/HANGUP always get cleared.  This means the MPD event loop could
never report those conditions.
2020-10-08 21:16:18 +02:00
Max Kellermann
eeb96eb367 event/TimerEvent: add type alias for std::chrono::steady_clock::duration 2020-10-08 20:48:50 +02:00
Max Kellermann
ce93e58944 event/TimerEvent: use using instead of typedef 2020-10-08 20:46:18 +02:00
Max Kellermann
263b0ffdbb event/TimerEvent: use auto_unlink hook 2020-10-08 20:46:15 +02:00
Max Kellermann
22bea5c97e event/Loop: reorder includes
This just happened to break the Windows build because of the
`GetObject` macro in `windows.h`, so I added a kludge to
PollResultGeneric.hxx.
2020-10-08 20:43:21 +02:00
Max Kellermann
75802ebcc6 StateFileConfig, ...: drop obsolete out-of-class definition 2020-10-08 20:38:11 +02:00
Max Kellermann
27cc7b352d config/Data: cast to std::chrono::steady_clock::duration properly
Oh no, 3413d1bf23 was broken!  Instead of passing a number as
"seconds" to the duration constructor, it just abused the duration
constructor as cast operator, which caused custom state_file_interval
settings to be extremely short.
2020-10-08 20:30:33 +02:00
Max Kellermann
d64729065e config/Parser: use std::size_t 2020-10-08 20:26:39 +02:00
Max Kellermann
ab318200db config/{Data,Block}: use With() in GetUnsigned(), GetPositive() 2020-10-08 20:21:09 +02:00
Max Kellermann
947856ca8e event/Loop: forward-declare class TimerEvent 2020-10-08 17:24:32 +02:00
Max Kellermann
cd9ff9d9b0 event/TimerEvent: use base_hook instead of member_hook 2020-10-08 17:00:09 +02:00
Max Kellermann
4cd0f661d6 event/Loop: use using instead of typedef 2020-10-08 16:59:21 +02:00
Max Kellermann
ca0179b2a9 event/Loop: set the uring_initialized flag
Don't attempt to initialize the io_uring subsystem more than once.
2020-10-06 18:58:54 +02:00
Max Kellermann
6682cf749f playlist/cue/parser: use lambda to fix ambiguous overload
On Windows, there is an IsWhitespaceOrNull() overload with TCHAR, and
the compiler doesn't know which one to pass to std::find_if().
2020-10-05 21:15:10 +02:00
Max Kellermann
492607ecbe playlist/cue/parser: use StringView internally
Don't copy the input StringView.
2020-10-05 21:04:49 +02:00
Max Kellermann
e0c75da266 playlist/cue/parser: pass StringView to Feed() 2020-10-05 20:33:58 +02:00
Max Kellermann
34bb53a29f playlist/cue/parser: add noexcept 2020-10-05 20:33:50 +02:00
Max Kellermann
cb4fdac469 playlist/cue/parser: fix nullptr dereference
Closes https://github.com/MusicPlayerDaemon/MPD/issues/974
2020-10-05 20:26:42 +02:00
Max Kellermann
ac46a84391 playlist/cue/parser: fix off-by-one buffer overflow
cue_next_word() can return a pointer one past the end of the string if
the word is followed by the terminating null byte.
2020-10-05 20:26:02 +02:00
Max Kellermann
4484d7a5c2 output/jack: implement Interrupt() 2020-10-02 11:00:04 +02:00
Max Kellermann
b80a135cf3 output/pulse: implement Interrupt() 2020-10-02 10:52:25 +02:00
Max Kellermann
4ad525d939 output/alsa: implement Interrupt()
This allows canceling the blocking method LockWaitWriteAvailable(),
and thus allows breaking free of misbehaving ALSA drivers, avoiding a
MPD lockup.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/966
2020-10-02 10:35:18 +02:00
Max Kellermann
4cb5e69811 output/Interface: add virtual method Interrupt()
This allows interrupting the output thread (for some plugins which
implement this method).  This way, operations can be canceled
properly, instead of waiting for some external entity.
2020-10-02 10:20:39 +02:00
Max Kellermann
b0596291a8 output/Thread: simplify the main loop switch
Move the InternalPlay() call and the wake_cond.wait() call into the
`case Command::NONE` and revert all `continue` statements to a simple
`break`.
2020-10-02 10:10:53 +02:00
Max Kellermann
8f0a1a5d82 output/Interface: add noexcept 2020-10-01 20:44:14 +02:00
Max Kellermann
c0775d328c output/Filtered: move try/catch from IteratePause() to caller 2020-10-01 20:44:11 +02:00
Max Kellermann
362f391b76 Merge remote-tracking branches 'neheb/defa', 'neheb/auto' and 'neheb/clocale' into master 2020-09-30 11:48:05 +02:00
Rosen Penev
980e32f69c
remove clocale test
clocale is part of C++11.

In practical terms, gcc's libstdc++ comes with its own locale defines
when the libc does not have them.

Also reworked to be dependent on !ANDROID.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-29 14:51:17 -07:00
Rosen Penev
dd639e18b8
clang-tidy: remove pointless std::move
Found with performance-move-const-arg

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-26 21:34:25 -07:00
Rosen Penev
c883f178b8
clang-tidy: use auto
Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-26 21:33:35 -07:00
Max Kellermann
e9df4116fd db/upnp: store UPnPDirContent in local variable
Fixes use-after-free because the temporary goes out of scope.
2020-09-23 15:25:39 +02:00
Max Kellermann
c843bce9f5 LogLevel: rename DEFAULT to NOTICE
"DEFAULT" is a bad name - all it says is that it's the default value,
but it doesn't say what it means.  The name NOTICE mimics the syslog
level.
2020-09-23 14:22:33 +02:00
Max Kellermann
e3106a019d LogInit: provide mappings for LogLevel::{ERROR,WARNING} 2020-09-23 14:17:11 +02:00
Max Kellermann
3e0ceb12d5 LogInit: rename "secure" to "info"
Calling this "secure" never made sense.  Messages about client
connects are just a small part of what gets logged as "secure",
a.k.a. "info".
2020-09-23 14:15:58 +02:00
Max Kellermann
60bbc9f626 LogInit: use StringIsEqual() 2020-09-23 13:28:19 +02:00
Max Kellermann
065926d6a4 decoder/ffmpeg: support album art
Closes https://github.com/MusicPlayerDaemon/MPD/issues/892
2020-09-23 12:50:28 +02:00
Max Kellermann
85bab67083 input/uring: safe cancellation
My concept with `class CancellableOperation` doesn't work properly,
because the kernel may continue to write to the given buffer as soon
as the read finishes.

To fix this, this commit adds `class ReadOperation` which owns the
buffer and the `struct iovec`.  Instances of this class persist until
the read really finishes, even if the operation is canceled.
2020-09-23 11:07:26 +02:00
Max Kellermann
4001379663 io/uring/Operation: add method ReplaceUring() 2020-09-22 21:50:48 +02:00
Max Kellermann
382273abc5 io/uring/Operation: add API documentation 2020-09-22 21:49:48 +02:00
Max Kellermann
6825e1144e net/SocketError: work around -Wvla by defining a constexpr variable 2020-09-22 20:40:53 +02:00
Max Kellermann
bc47a16943 release v0.21.26
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl9op0MQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEvtmD/46dhcOHUXBreLkKmfy1d8YYrSUBfaNGNIa
 m32Lhh2Di27yd5uclQiOVnBghbPEdPobNB6dpZzM7VFkl0LXovbi2bOP0/IkfV0L
 0Aa8yacUjHo9zoSjGWnw0uJxLkMjwp7ybV/RI0yI9Z203zUdQX5BqAwc0GlDAhrq
 ZheuvHbZqr6PIdy+yFMvS7zhkeO7kMRxlT8xy7/6LskkSmc5wJ90X2vS1sD/6T+9
 NfAQkEE7PgKHir6xjZfPTi5PzIO+tK9/RVw705LDubsjFjEPBLWyvG4uD97dazbu
 EQZzj5E82wxwvZvx+/xuyyykkhaoBqtegD2DrkafFm20sIzsc9qLC24GXzWd4Oq0
 u7RQoO8hn6WI3mMUW/nJNSZk/c9xgeKcFBtgZiNFaDrnwKeWHNtafwqJlU0lanXH
 tpjRP0kWphAcTfa1JBcCN0SpqjlB+s18xM102hnIWxWlfSmlEyb9yLk+jbFDQcpP
 6i/UmWIDEBlNf68beg89wD4p/FJePgEuwBGrIMHxA41hqjmFCwuklcvhdbu0zBFy
 frr9kWMSp6Xun1lwW0jWdfbEBWujNGMEHx//SDoIKD22gpdtnajLhNqjiZuu1LN7
 RE7fF1v5c7cSGNVMLEam4bUXntzxTXhCCFbYUdh29TWqEr+pM+a429/jZMgYcGtz
 jVp2qqxc5w==
 =mDD4
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.26' into master

release v0.21.26
2020-09-21 15:20:02 +02:00
Max Kellermann
79b2366387 archive/iso9660: fix odd seeking bug (assertion failure)
Skip the beginning of a sector if the last seek was odd, and clear the
buffer on seek.
2020-09-21 15:11:21 +02:00
Max Kellermann
5acea014b0 archive/iso9660: remove unused macro CEILING() 2020-09-21 15:11:17 +02:00
Max Kellermann
5130acf3ea decoder/ffmpeg: implement protocols() and uri_decode() (for RTSP)
This implements the feature that was missing/broken in this bug
report: https://github.com/MusicPlayerDaemon/MPD/issues/930
2020-09-21 14:57:12 +02:00
Max Kellermann
a22d1c88d7 decoder/ffmpeg: pass InputStream by pointer
Prepare for an implementation without InputStream.
2020-09-21 14:53:18 +02:00
Max Kellermann
85849c9396 decoder/plugin: add method protocols()
Similar to commit 4e2a551f30 but for
decoder plugins.  This is tailored for the FFmpeg decoder plugin which
implements some protocols (e.g. RTSP) as demuxer plugin.
2020-09-21 14:53:18 +02:00
Max Kellermann
d3c257d97d CommandLine: reindent lambdas 2020-09-21 14:52:45 +02:00
Max Kellermann
c13fe63f10 archive/iso9660: fix odd seeking bug (assertion failure)
Skip the beginning of a sector if the last seek was odd, and clear the
buffer on seek.
2020-09-21 14:43:58 +02:00
Max Kellermann
07842abcb0 input/ffmpeg: add "hls+http://" to the list of supported protocols
Same as e10b867fe6 but it got lost in
the merge, because the v0.22 branch uses a different way to detect
supported protocols at runtime.
2020-09-21 12:55:32 +02:00
Max Kellermann
07e524509f input/Plugin: add noexcept 2020-09-21 11:43:18 +02:00
Max Kellermann
2c05752071 archive/iso9660: remove unused function CEILING() 2020-09-21 11:38:24 +02:00
Max Kellermann
7c8427b0f7 Merge branch 'v0.21.x' into master 2020-09-21 11:37:50 +02:00
Max Kellermann
b72801abf3 util/ByteOrder: add FromLE16S() 2020-09-21 11:15:45 +02:00
Desuwa
23d5a2b862 Support opus header gain tags and match opus playback volume to other tracks when ReplayGain is enabled. 2020-09-21 10:51:06 +02:00
Rosen Penev
7715311117 fix double promotions
Found with -Wdouble-promotion

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-21 09:13:51 +02:00
Max Kellermann
7552f70c8d Merge branch 'gcc5' of git://github.com/neheb/MPD into master 2020-09-21 09:07:19 +02:00
Max Kellermann
0acc398c52 Merge branch 'v0.21.x' into master 2020-09-17 14:44:20 +02:00
Max Kellermann
4c1cfca95b db/update/InotifyUpdate: pass path by value to recursive_watch_subdirectories() 2020-09-17 14:18:29 +02:00
Max Kellermann
e113ce9621 db/update/InotifyUpdate: obey .mpdignore files
Closes https://github.com/MusicPlayerDaemon/MPD/issues/846
2020-09-17 14:17:17 +02:00
Rosen Penev
821d08999a
remove GCC5 hacks
GCC5 cannot build mpd.

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

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

Closes https://github.com/MusicPlayerDaemon/MPD/issues/850
2020-09-16 20:36:19 +02:00
Max Kellermann
e29c06b718 player/Thread: add another code comment explaining OnPlayerSync() 2020-09-16 20:12:52 +02:00
Max Kellermann
d9d511f33e player/Thread: update function name in comment 2020-09-16 20:12:05 +02:00
Max Kellermann
c61a3b8d13 LogBackend: change the initial log_threshold to DEFAULT
The log levels have always been very confusing (and badly named), but
this was most confusing: if there's a log level called "default", why
is it not the default?

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

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

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

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

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

The data is set in the structs soxr_quality_spec and soxr_io_spec (found in soxr.h).
2020-09-04 18:32:03 +02:00