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