Commit Graph

11091 Commits

Author SHA1 Message Date
Max Kellermann
c1221c5c87 Main: cancel the update on shutdown even if inotify is unavailable
Fixup for commit 681e012fb5
2018-01-29 23:37:56 +01:00
Max Kellermann
befd669075 Instance: rename Shutdown() to Break() 2018-01-29 23:31:41 +01:00
Max Kellermann
b6013a92e0 lib/curl/Request: merge two "try" blocks 2018-01-29 23:25:03 +01:00
Max Kellermann
19af364400 event/Thread: add "noexcept" 2018-01-29 23:11:15 +01:00
Max Kellermann
3fd9a86f3c event/Call: invoke function directly if the EventLoop is dead
Works around a deadlock bug which happens when waiting for an
EventLoop which isn't running anymore.
2018-01-29 23:06:43 +01:00
Max Kellermann
ce68701c0c event/Loop: add flag "dead" 2018-01-29 22:52:13 +01:00
Max Kellermann
6ea2cb3644 event/Thread: remove unused method StopAsync() 2018-01-29 22:50:21 +01:00
Max Kellermann
199c8aaa25 event/Loop: move code to HandleTimers() 2018-01-29 22:40:12 +01:00
Max Kellermann
9ce6828d72 filter/convert: call PcmConvert::Flush() only if initialized
Fixes another part of #208, the one which caused the bogus exception.
2018-01-29 22:35:28 +01:00
Max Kellermann
7ff5cf8372 filter/convert: add method IsActive() 2018-01-29 22:33:54 +01:00
Max Kellermann
eb771eaf0d output/Thread: re-lock the mutex after flush error
Fixes deadlock due to mutex double lock.
2018-01-29 22:30:56 +01:00
Max Kellermann
6908555ed3 filter/Observer: drop bogus "noexcept"
Closes #208.
2018-01-29 22:14:27 +01:00
Max Kellermann
3890bc5a96 event/Loop: add "noexcept" 2018-01-29 22:05:58 +01:00
Max Kellermann
2c65f986d6 event/EPoll: use C++11 initializer 2018-01-29 22:05:13 +01:00
Max Kellermann
ea402b765c event/WinSelect: pass const reference to copy constructor 2018-01-29 22:05:13 +01:00
Max Kellermann
497e0669ff event/PollResult: use size_t for size and index 2018-01-29 21:56:12 +01:00
Max Kellermann
13ac74e0a2 system/EPollFD: update API documentation 2018-01-29 21:49:27 +01:00
Max Kellermann
c2f23d92dc system/EPollFD: add "noexcept" 2018-01-29 21:48:39 +01:00
Max Kellermann
7027da3cd3 Instance: un-inline the destructor
Allows more forward declarations.
2018-01-29 18:43:10 +01:00
Max Kellermann
005bb59797 test/run_input: move code from Scan() to input/ScanTags.cxx 2018-01-29 16:57:44 +01:00
Max Kellermann
88bc3a9271 input/qobuz: implement InputPlugin::scan_tags() 2018-01-26 20:08:01 +01:00
Max Kellermann
2e32cf7b87 input/tidal: implement InputPlugin::scan_tags() 2018-01-26 20:08:01 +01:00
Max Kellermann
3e9c3c8ae8 input/Plugin: add method scan() with asynchronous callback class
To be used when a URL gets added.
2018-01-26 19:29:38 +01:00
Max Kellermann
ec31e8df1d input/qobuz: remove obsolete prototypes 2018-01-26 19:29:38 +01:00
Max Kellermann
b56bfbae26 input/tidal: add setting "audioquality" 2018-01-26 19:18:13 +01:00
Max Kellermann
f55b1415d4 input/qobuz: move code to ExtractQobuzTrackId() 2018-01-26 18:48:15 +01:00
Max Kellermann
67693c6ad0 input/qobuz: add setting "format_id" 2018-01-26 17:30:28 +01:00
Max Kellermann
fce061b544 input/tidal: move code to ExtractTidalTrackId() 2018-01-26 17:29:58 +01:00
Max Kellermann
93765fcb30 input/{tidal,qobuz}: remove unused list_base_hook 2018-01-26 16:56:56 +01:00
Max Kellermann
b221bd7472 input/qobuz: remove bogus "noexcept"
This change was missing in 47fa8c4cf6
2018-01-25 15:19:33 +01:00
Max Kellermann
fd0a5a1116 decoder/{dsdiff,dsf,mpg123,wavpack}: avoid exceptions in scan methods
The scan methods must be "noexcept".
2018-01-25 13:01:39 +01:00
Max Kellermann
47fa8c4cf6 input/{tidal,qobus}: add bogus "noexcept"
The CurlRequest constructor can throw exceptions, therefore we must
not use "noexcept".
2018-01-25 12:58:58 +01:00
Max Kellermann
7640609b41 input/tidal: retry if session is expired 2018-01-24 15:35:02 +01:00
Max Kellermann
e8e6357b73 input/tidal/Error: add method IsInvalidSession() 2018-01-24 15:34:59 +01:00
Max Kellermann
4398101706 input/tidal: parse subStatus in error responses 2018-01-24 15:34:57 +01:00
Max Kellermann
2e1481f49d input/tidal: add exception class TidalError
Allows catchers to inspect the HTTP status.
2018-01-24 15:34:54 +01:00
Max Kellermann
c7c087a0d2 input/tidal: add some debug logging 2018-01-24 15:29:30 +01:00
Max Kellermann
97f670658f util/StringFormat: new utility library 2018-01-24 13:28:28 +01:00
Max Kellermann
4324fb2fbe input/Offset: add macro PRIoffset 2018-01-24 13:26:43 +01:00
Max Kellermann
e4cb74cf7b input/curl: remove obsolete Windows sprintf() fallback
See commit be137a191e
2018-01-24 13:26:18 +01:00
Max Kellermann
be137a191e util/FormatString: remove obsolete Windows fallback
Since 7d353bbe2a, _GNU_SOURCE is always
defined, which implies __USE_MINGW_ANSI_STDIO and thus switches to
the mingw implementations of the printf() family.  That's
standards-compliant, unlike Microsoft's CRT implementations.
2018-01-24 13:22:43 +01:00
Max Kellermann
fe1f3df36e util/StringBuffer: add "noexcept" 2018-01-24 12:52:05 +01:00
Max Kellermann
4a330a4c33 input/qobuz: use class DelegateCurlResponseHandler to eliminate duplicate code 2018-01-24 11:33:01 +01:00
Max Kellermann
75e60669a7 input/tidal: include cleanup 2018-01-24 11:33:01 +01:00
Max Kellermann
db379c6172 player/Thread: remove bogus "noexcept" from play_chunk()
Closes #203
2018-01-24 11:21:28 +01:00
Max Kellermann
1da64fb79c lib/curl/Delegate: helper class for response body parsers
Eliminate duplicate code.
2018-01-23 16:48:43 +01:00
Max Kellermann
2c401f1102 decoder/{adplug,sidplay}: add missing "noexcept"
Closes #202
2018-01-23 10:02:36 +01:00
Max Kellermann
bb1e369f30 playlist/SoundCloud: fix -Wunused-lambda-capture 2018-01-23 09:57:52 +01:00
Max Kellermann
d084950b1a input/qobuz: dispose the TidalLoginRequest earlier 2018-01-21 20:17:50 +01:00
Max Kellermann
2ce10f2fed input/qobuz: dispose the QobuzTrackRequest 2018-01-21 19:59:17 +01:00
Max Kellermann
036094799b input/qobuz: pass std::string by value to OnQobuzTrackSuccess() 2018-01-21 19:58:21 +01:00
Max Kellermann
2da6ab2a45 input/qobuz: dispose the QobuzLoginRequest earlier 2018-01-21 19:45:03 +01:00
Max Kellermann
91a512606b input/qobuz: remove unused variable 2018-01-21 15:01:31 +01:00
Max Kellermann
b6d858f4d6 lib/expat/Parser: make the "is_final" argument optional 2018-01-21 14:37:10 +01:00
Max Kellermann
dedede3caa lib/expat/Parser: add method CompleteParse() 2018-01-21 14:35:47 +01:00
Max Kellermann
b14fc907f9 lib/expat/Parser: forward Parse() arguments 2018-01-21 14:34:53 +01:00
Max Kellermann
542bbb0889 input/qobuz: parse and report message from error responses 2018-01-21 12:52:54 +01:00
Max Kellermann
714e69e708 input/qobuz: create JSON parser on demand 2018-01-21 12:49:10 +01:00
Max Kellermann
cb87ed29d8 input/tidal: invoke login handlers on second request
Fixes a freeze bug.
2018-01-21 12:41:19 +01:00
Max Kellermann
570c6765b0 input/tidal: parse and report userMessage from error responses 2018-01-21 12:30:46 +01:00
Max Kellermann
12a2285ba5 input/tidal: create JSON parser on demand 2018-01-21 12:29:52 +01:00
Max Kellermann
1c023eac70 db/update/Walk: add "noexcept" 2018-01-21 11:53:59 +01:00
Max Kellermann
1e3f0650df SongUpdate: add "noexcept" 2018-01-21 11:53:42 +01:00
Max Kellermann
1e9da09f62 TagFile: add "noexcept" 2018-01-21 11:53:42 +01:00
Max Kellermann
5caf351c44 TagArchive: add "noexcept" 2018-01-21 11:53:42 +01:00
Max Kellermann
7d789a984a decoder/Plugin: add "noexcept" 2018-01-21 11:47:17 +01:00
Max Kellermann
d921114832 db/Helpers: add "noexcept" 2018-01-21 11:37:13 +01:00
Max Kellermann
39a1f03d5c db/PlaylistVector: add "noexcept" 2018-01-21 11:36:16 +01:00
Max Kellermann
c6a4a4edf1 playlist/Print: add "noexcept" 2018-01-21 11:35:31 +01:00
Max Kellermann
45748a2bb0 playlist/Song: add "noexcept" 2018-01-21 11:35:28 +01:00
Max Kellermann
9b13d862c1 playlist/Registry: add "noexcept" 2018-01-21 11:35:27 +01:00
Max Kellermann
590edc648a playlist/Plugin: add "noexcept" 2018-01-21 11:35:25 +01:00
Max Kellermann
3326c87a88 db/Count: add "noexcept" 2018-01-21 11:33:53 +01:00
Max Kellermann
0ec1863fcb db/Print: add "noexcept" 2018-01-21 11:32:22 +01:00
Max Kellermann
2b67a14155 SongPrint: add "noexcept" 2018-01-21 11:32:10 +01:00
Max Kellermann
eac8caa4de TagPrint: add "noexcept" 2018-01-21 11:30:47 +01:00
Max Kellermann
61eb2aa328 storage/Interface: wrap StorageDirectoryReader in std::unique_ptr 2018-01-21 11:04:30 +01:00
Max Kellermann
a9847ebf54 playlist/Queue: use "auto" 2018-01-20 20:14:19 +01:00
Max Kellermann
4ca1089f60 input/TextInputStream: ReadLine() throws exception on error 2018-01-20 20:13:08 +01:00
Max Kellermann
926d4150c5 playlist/SongEnumerator: allow NextSong() to throw exceptions 2018-01-20 20:11:15 +01:00
Max Kellermann
6f267adc14 playlist/SongEnumerator: add "noexcept" 2018-01-20 20:10:46 +01:00
Max Kellermann
0095e2d7d8 playlist/Plugin: use std::unique_ptr<SongEnumerator> 2018-01-20 19:59:42 +01:00
Max Kellermann
147f64e1fc playlist/Plugin: remove useless wrapper functions 2018-01-20 19:58:11 +01:00
Max Kellermann
b8e5932506 tag/{Tag,Builder}: use std::lock_guard 2018-01-20 19:53:38 +01:00
Max Kellermann
1ea04cd8cc tag/Pool: add "noexcept" 2018-01-20 19:53:38 +01:00
Max Kellermann
b334643b68 tag/Pool: use C++11 initializers 2018-01-20 19:53:38 +01:00
Max Kellermann
6e6a0275b5 tag/Pool: use uint8_t instead of unsigned char 2018-01-20 19:53:38 +01:00
Max Kellermann
f5590806e0 tag/Handler: add "noexcept" 2018-01-20 19:53:38 +01:00
Max Kellermann
f686e838fe tag/Builder: add "noexcept" 2018-01-20 19:53:38 +01:00
Max Kellermann
ea8642dec9 tag/Builder: use C++11 initializers 2018-01-20 19:53:38 +01:00
Max Kellermann
eef5b58211 tag/Tag: add "noexcept" 2018-01-20 19:39:46 +01:00
Max Kellermann
1de68b72b9 tag/Tag: use C++11 initializers 2018-01-20 19:39:06 +01:00
Max Kellermann
720df085e5 input/TextInputStream: add "noexcept" 2018-01-20 19:35:09 +01:00
Max Kellermann
f90f17227b input/Domain: remove obsolete variable 2018-01-20 19:19:29 +01:00
Max Kellermann
36f7eaadef input/LocalOpen: make assert() more strict 2018-01-20 19:15:51 +01:00
Max Kellermann
1eb9300658 input/LocalOpen: include cleanup 2018-01-20 19:14:42 +01:00
Max Kellermann
27e4656515 input/{file,archive}: remove the dummy InputPlugin instances
These have no use, exception for creating an artificial dependency
from input_plugins[] to all archive plugins.
2018-01-20 19:07:34 +01:00
Max Kellermann
e0a09dbd69 input/thread: add "noexcept" 2018-01-20 18:54:29 +01:00
Max Kellermann
30832ab33a input/InputStream: add "noexcept" to constructor 2018-01-20 18:53:37 +01:00
Max Kellermann
d20b545a94 input/InputStream: remove methods Lock() and Unlock()
These methods are not exception-safe; std::lock_guard should better be
used.
2018-01-20 18:51:23 +01:00
Max Kellermann
20d01be1ad input/mms: use class ScopeUnlock 2018-01-20 18:51:00 +01:00
Max Kellermann
d6b62d7512 input/tidal: delete request objects upon completion 2018-01-20 00:34:44 +01:00
Max Kellermann
ab9d9541a8 input/tidal: pass std::string by value
Don't keep any references to the owner, as the handler method may
delete the owner.
2018-01-20 00:33:01 +01:00
Max Kellermann
c3b8568560 lib/curl/Handler: add API documentation 2018-01-20 00:28:54 +01:00
Max Kellermann
8bd95a4eb1 db/update/Container: include cleanup 2018-01-20 00:25:57 +01:00
Max Kellermann
2dac3ef58e client: eliminate client_printf() 2018-01-20 00:24:18 +01:00
Max Kellermann
86c7ab29f4 client/Idle: pass Response instead of Client to WriteIdleResponse() 2018-01-20 00:22:47 +01:00
Max Kellermann
db89e5ec28 client/Idle: move code to WriteIdleResponse() 2018-01-20 00:22:30 +01:00
Max Kellermann
d096f75fb8 client/Idle: apply idle_subscriptions mask once 2018-01-20 00:22:09 +01:00
Max Kellermann
854424a758 client/Idle: use std::exchange() 2018-01-20 00:21:26 +01:00
Max Kellermann
fe5d0ce827 Merge branch 'v0.20.x' 2018-01-20 00:04:35 +01:00
Max Kellermann
8376578921 db/simple/Mount: drop mount point prefix from LOCATE_TAG_BASE_TYPE
Fixes search within mount points, resulting in error "No such
directory".

Closes #190
2018-01-19 23:52:57 +01:00
Max Kellermann
ed2354cd9d SongFilter: allow copying items 2018-01-19 23:52:03 +01:00
Max Kellermann
386688b87a SongFilter: use std::string instead of AllocatedString 2018-01-19 23:51:42 +01:00
Max Kellermann
38d56dddf1 lib/icu/Compare: allow copying 2018-01-19 23:49:50 +01:00
Max Kellermann
3ca80a7336 util/RefCount, db/simple/Mount: remove obsolete libc++ workarounds
No longer a problem with NDK r16.
2018-01-19 23:19:46 +01:00
Max Kellermann
2fed3b5e5b input/Tidal*Request: add Start() method
The caller should be able to safely store the instance pointer before
his callback is invoked.
2018-01-19 16:03:05 +01:00
Max Kellermann
1ecad094bd input/tidal: add API documentation 2018-01-19 16:03:03 +01:00
Stefan Roellin
187cc573a7 db/upnp/Directory: fix parsing of durations with fractions of seconds
The duration of a song can have fractions of seconds
(quote from http://www.upnp.org/schemas/av/didl-lite-v2.xsd):

    The format of the duration string is:
    H+:MM:SS[.F+], or H+:MM:SS[.F0/F1]
    Where:
    +H              one or more digits to indicate elapsed hours,
    MM              exactly 2 digits to indicate minutes (00 to 59),
    SS              exactly 2 digits to indicate seconds (00 to 59),
    F+              any number of digits (including no digits) to indicate fractions of seconds,
    F0/F1   a fraction, with F0 and F1 at least one digit long,
                    and F0 < F1.
    The string may be preceded by an optional + or - sign, and the
    decimal point itself may be omitted if there are no fractional  seconds digits.

Until now, a duration with fractions of seconds could not be parsed and
resulted in an unknown duration. Only durations in the format "H+:MM:SS"
were feasible. This commit enables to read durations in the first format,
i.e. "H+:MM:SS[.F+]"
2018-01-19 15:53:18 +01:00
Max Kellermann
0ead72a404 lib/upnp/ContentDirectoryService: work around GCC 5 bug
Closes #193
2018-01-18 21:55:58 +01:00
Max Kellermann
bbc5212436 fs/AllocatedPath: make the nullptr_t constructor public 2018-01-17 12:17:41 +01:00
Max Kellermann
c4f7740b80 fs/Path: replace method Null() with nullptr_t constructor 2018-01-17 12:16:21 +01:00
Max Kellermann
3e2e0d062b util/OptionParser: support option values 2018-01-17 11:14:57 +01:00
Max Kellermann
c45fe3517c util/OptionParser: add struct Result
Prepare for option values.
2018-01-17 11:08:05 +01:00
Max Kellermann
d588da69e5 CommandLine: convert pointer to reference 2018-01-17 11:08:03 +01:00
Max Kellermann
ec54a5c72c CommandLine: use C++11 initializers 2018-01-17 11:08:02 +01:00
Max Kellermann
735a371249 util/OptionParser: pass array of OptionDefs to constructor 2018-01-17 10:24:06 +01:00
Max Kellermann
5ab086e337 util/OptionParser: loop in ParseNext() until a new option is found 2018-01-16 11:25:18 +01:00
Max Kellermann
68f660dbcc util/OptionParser: collect remaining arguments
Allow the caller to use a simple "for" loop without checking
arguments.
2018-01-16 11:08:23 +01:00
Max Kellermann
0066f7a818 util/{Const,Writable}Buffer: add constructor with two pointers 2018-01-16 11:06:33 +01:00
Max Kellermann
65059f2add util/{Const,Writable}Buffer: eliminate static method Null(), use nullptr cast instead 2018-01-16 11:04:51 +01:00
Max Kellermann
23dff4f209 util/OptionParser: use ConstBuffer<const char*> to store argv/argc 2018-01-16 10:22:06 +01:00
Max Kellermann
4a304bf34e util/OptionParser: make string pointers "const" 2018-01-16 10:20:53 +01:00
Max Kellermann
36a6405e8b util/OptionParser: add "constexpr" 2018-01-16 10:20:52 +01:00
Max Kellermann
42c1fe963b util/OptionParser: add "noexcept" 2018-01-16 10:13:39 +01:00
Max Kellermann
465b154fc0 util/OptionParser: use C++11 initializers 2018-01-16 10:12:48 +01:00
Max Kellermann
a0c4102b5a util/OptionDef: add "constexpr" 2018-01-16 10:11:35 +01:00
Max Kellermann
9420066895 input/qobuz: new input plugin to receive Qobuz streams 2018-01-15 21:50:20 +01:00
Max Kellermann
74eac1d449 lib/curl/Request: add constructor without "url" parameter
Allows constructing the request first and set the URL later.  This is
needed because curl_easy_escape() is needed to construct the URL,
which however needs the CURL "easy" handle created by the Request class.
2018-01-15 10:36:48 +01:00
Max Kellermann
96676f8f3b Merge branch 'v0.20.x' 2018-01-15 09:06:31 +01:00
Max Kellermann
93b51d56aa input/tidal: new input plugin to receive Tidal streams 2018-01-12 14:33:22 +01:00
Max Kellermann
86c50574d2 lib/yajl/Callbacks: add wrappers for start_array and end_array 2018-01-12 14:33:22 +01:00
Max Kellermann
efb528f979 player/Thread: wake up the decoder when the pipe has run empty
This is another instance of the kludge we already have a few lines
above that.  It works around a deadlock/race condition revealed by
commit 98a7c62d7a
2018-01-12 14:33:22 +01:00
Max Kellermann
edcd0b9913 lib/curl/Request: add methods StartIndirect(), StopIndirect() 2018-01-11 20:51:23 +01:00
Max Kellermann
55d1473918 lib/yajl/Callbacks: OO wrapper for yajl_callbacks 2018-01-11 20:25:17 +01:00
Max Kellermann
0211c7f7f3 lib/yajl/ParseInputStream: use InputStream::LockRead() to reduce lock duration 2018-01-11 20:11:04 +01:00
Max Kellermann
5913994169 lib/yajl/ParseInputStream: eliminate variable "done" 2018-01-11 20:09:52 +01:00
Max Kellermann
26b1573cbe playlist/SoundCloud: move code to Yajl::Parse(InputStream&) 2018-01-11 20:08:02 +01:00
Max Kellermann
7fe07324d7 playlist/SoundCloud: soundcloud_parse_json() throws exception 2018-01-11 20:08:01 +01:00
Max Kellermann
8e29430f21 lib/yajl/Handle: libyajl C++ bindings 2018-01-11 19:25:46 +01:00
Max Kellermann
cb86023bd7 lib/curl/Form: new library 2018-01-11 17:27:25 +01:00
Max Kellermann
bd2cb40424 lib/curl/Easy: add curl_easy_escape() wrapper 2018-01-11 17:27:25 +01:00
Max Kellermann
e9a3ff0e70 input/failing: new class 2018-01-11 16:18:15 +01:00
Max Kellermann
5148e229e0 input/proxy: allow input==nullptr
Allow implementations to install the "real" input later.
2018-01-11 15:57:57 +01:00
Max Kellermann
1ad21c27c9 input/curl: add public function to construct an instance 2018-01-11 15:53:46 +01:00
Max Kellermann
f392e13077 input/curl: pass additional request headers to constructor
Prepare to allow callers to pass custom request headers.
2018-01-11 15:43:59 +01:00
Max Kellermann
3fe5b42b2b input/curl: pass IcyMetaDataParser to constructor
Allows the caller to decide whether to enable the feature.
2018-01-11 15:32:19 +01:00
Max Kellermann
70c4b621cf input/curl: remove impossible "icy" checks
The IcyMetaDataParser cannot be initialized already in OnHeaders(),
because it will be initialized late in that method; and there will not
be another OnHeaders() call, because streams with Icy metadata are not
seekable, thus there will not be another HTTP request.
2018-01-11 14:55:29 +01:00
Max Kellermann
a8df5e109b input/curl: use StringView::StartsWith() 2018-01-11 14:52:35 +01:00
Max Kellermann
ba4f1da466 input/curl: create the request_headers list only once 2018-01-11 12:49:01 +01:00
Max Kellermann
0bfbe6771e input/curl: un-inline constructor 2018-01-11 12:46:52 +01:00
Max Kellermann
d1df0fec19 input/curl: add "noexcept" 2018-01-11 12:36:31 +01:00
Max Kellermann
031ccce8b7 input/curl: convert struct to class 2018-01-11 12:31:29 +01:00
Max Kellermann
1f50bdb230 event/Loop: use std::atomic_bool for the "quit" variable
Fixes thread sanitizer warnings.
2018-01-08 10:06:23 +01:00
Max Kellermann
2eef4e6716 thread/Thread: add debug attribute "inside_handle"
This attribute shall be used only for IsInside() to make this safe
against a race condition described in #188:

> There is no requirement on the implementation that the ID of the
> created thread be available before the newly created thread starts
> executing.

http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_create.html):

This means that on some pthread implementations (e.g. Haiku), the
assert(thread.IsInside()) could fail.

Closes #188
2018-01-08 09:58:18 +01:00
Max Kellermann
d989dbfec4 thread/Thread: make IsInside() debug-only
This method is only used inside assert().
2018-01-08 09:56:39 +01:00
Max Kellermann
ca9fcec364 thread/Thread: fix indent 2018-01-08 09:49:08 +01:00
Max Kellermann
354104f9a9 thread/{Thread,Id}: use defaul-initialized pthread_t as "undefined" value
Use the "==" operator instead of pthread_equal().

This allows us to eliminate two boolean flags which are there to avoid
race conditions, and made the thing so fragile that I got tons of
(correct) thread sanitizer warnings.
2018-01-07 17:20:26 +01:00
Max Kellermann
8649ea3d6f thread/Thread: use BoundMethod 2018-01-07 17:20:26 +01:00
Max Kellermann
752ff12c37 thread/Thread: move code to Run() 2018-01-07 17:20:26 +01:00
Max Kellermann
4bb89b1755 MusicPipe: lock the mutex in Peek() and GetSize() 2018-01-07 17:20:22 +01:00
Max Kellermann
be068f360d Merge remote-tracking branches 'mmuman/configure-sockaddr-sin-len' and 'mmuman/haiku-build-fix' 2018-01-06 13:19:58 +01:00
François Revol
5b18b66282 Haiku: fix build
Convert the fill_buffer to a class method, to allow accessing the private method.

Also remove the leftover Wrapper stuff.
2018-01-05 23:10:58 +01:00
François Revol
7b2283c28b configure.ac: autodetect sin_len member in struct sockaddr_in.
This fixes a build issue on Haiku as it does have sin_len.
Tested on Linux as well.

For some reason AC_CHECK_MEMBER doesn't generate the proper define
in config.h.in, so I used AC_CHECK_MEMBERS.
2018-01-05 22:20:47 +01:00
Max Kellermann
c74e018359 Merge branch 'v0.20.x' 2018-01-05 18:11:04 +01:00
Max Kellermann
cab77e35e0 queue/PlaylistControl: fix crash after seek failure
This completes the bug fix commit
2065e3290452377b2931f3129b230c8cc536cbc8; if we clear "queued" then we
must clear "queued_song" as well, or another variant of the assertion
fails.
2018-01-05 13:00:24 +01:00
Max Kellermann
4a120f8090 Merge branch 'v0.20.x' 2018-01-05 10:10:17 +01:00
Max Kellermann
c2cbb7b8ce output/haiku: remove unimplemented Cancel() method 2018-01-05 10:05:14 +01:00
Max Kellermann
79b0f97a3f output/Interface: clarify Play() API documentation 2018-01-05 08:35:40 +01:00
Max Kellermann
329f9cd9fe thread/Util: no ioprio_set() on Android due to seccomp/SIGSYS 2018-01-04 19:33:14 +01:00
Max Kellermann
e3ef3e8d71 output/Control: unlock mutex during expensive operations 2018-01-04 10:36:18 +01:00
Max Kellermann
7574dfd339 output/Control: move code from FinishDestroy() to destructor 2018-01-04 10:34:27 +01:00
Max Kellermann
a5b93008f5 output/Filtered: remove redundant nullptr assignments from Setup() 2018-01-04 10:32:10 +01:00
Max Kellermann
0227af5bb7 output/Filtered: remove BeginDestroy()
All it does is "sometimes" close the mixer, but that is also done in
the destructor.
2018-01-04 10:29:27 +01:00
Max Kellermann
ef71df60f6 output/Multiple: use std::unique_ptr<FilteredAudioOutput> 2018-01-04 10:14:26 +01:00
Max Kellermann
f52b3b4e04 output/Multiple: dispose the AudioOutputControl instances
Fixes shutdown memory leak.
2018-01-04 10:11:23 +01:00
Max Kellermann
7e4e32cfe0 output/Filtered: eliminate FinishDestroy()
This is implicitly done by the destructor.
2018-01-04 10:05:31 +01:00
Max Kellermann
9f8649884b output/Control: dispose the FilteredAudioOutput
Fixes shutdown memory leak.
2018-01-04 10:01:34 +01:00
Max Kellermann
f1ee4caddd output/Init: fix configuration option name in error message 2018-01-04 09:57:28 +01:00
Max Kellermann
051b8fbb31 output/Thread: add "noexcept" 2018-01-04 09:54:35 +01:00
Max Kellermann
b0ea32f660 output/Control: remove unused method StopThread() 2018-01-04 09:20:22 +01:00
Max Kellermann
8322ae5a4c output/Control: use class ScopeUnlock() 2018-01-04 08:41:19 +01:00
Max Kellermann
98a7c62d7a player/Thread: don't send silence if decoder is slow
The output plugin shall decide whether to insert silence or do nothing
at all.  The ALSA output plugin has already implemented this.
Inserting silence is not necessary or helpful for some plugins, and
may even hurt them (e.g. "recorder").
2018-01-03 17:36:41 +01:00
Max Kellermann
859e59262e player/Thread: remove unnecessary "continue" keywords 2018-01-03 17:17:22 +01:00
Max Kellermann
ec113420f1 player/Thread: hold mutex while calling SongBorder()
Eliminates unnecessary mutex locks.
2018-01-03 17:12:21 +01:00
Max Kellermann
1954e94de2 Merge branch 'work_tag' of git://github.com/loujine/MPD
Closes #181
2018-01-03 11:47:02 +01:00
Max Kellermann
f6ec43b9ec pcm/Resampler: add virtual method Flush()
Wired to Filter::Flush().

Closes #153
2018-01-02 23:17:25 +01:00
Max Kellermann
6d0d8cf9cf filter/Filter: add virtual method Flush()
This will be used by filters which have internal buffers which need to
be flushed at the end, e.g. the "soxr" resampler.
2018-01-02 23:15:51 +01:00
Max Kellermann
5ede02aed8 filter/FilterConfig: rename to LoadChain.cxx 2018-01-02 23:09:36 +01:00
Max Kellermann
bbabb7a14c filter/Plugin: move filter_configured_new() to LoadOne.cxx 2018-01-02 23:06:53 +01:00
Max Kellermann
b13ebe3ddb filter/Plugin: eliminate filter_new() 2018-01-02 23:00:16 +01:00
Max Kellermann
17b0add058 filter/Observer: pass Reset() to underlying Filter
Wohooooo, the method Filter::Reset() has been broken because no
implementation of it has ever been called for a loooong time.
And nobody ever noticed it.  WTF.
2018-01-02 22:13:14 +01:00
Max Kellermann
c68ed40661 pcm/SoxrResampler: implement method Reset() 2018-01-02 21:53:09 +01:00
Max Kellermann
b0199245d5 output/Thread: move code to method InternalDrain() 2018-01-02 18:03:48 +01:00
Max Kellermann
b93e3b2cf6 output/Thread: move code to method InternalCloseError() 2018-01-02 18:02:14 +01:00
Max Kellermann
ae7fcf4c6b output/Thread: move common code to method Failure() 2018-01-02 18:00:20 +01:00
Max Kellermann
1607754771 output/Thread: update "last_error" after filter/play errors 2018-01-02 17:59:37 +01:00
Max Kellermann
028f659c40 output/Thread: move error handling code into the catch block 2018-01-02 17:48:14 +01:00
Max Kellermann
8dfdacf128 output/Thread: AudioOutput::Play() must not return zero 2018-01-02 17:47:46 +01:00
Max Kellermann
f4a56f839f output/haiku: remove size==0 check from Play()
By API contract, this parameter must not be zero.
2018-01-02 17:45:14 +01:00
Max Kellermann
67a8eedca0 output/ao: round write_size down to a multiple of the frame size 2018-01-02 17:33:33 +01:00
Max Kellermann
be65c7d5d0 config/Block: add method GetPositiveValue()
Adds missing checks to several plugins.
2018-01-02 17:24:34 +01:00
Max Kellermann
7c5306a841 config/{Block,Global}: add missing strtoul() check 2018-01-02 17:23:10 +01:00
Max Kellermann
201210cfe1 neighbor/Plugin: std::unique_ptr<NeighborExplorer> 2018-01-02 17:04:23 +01:00
Max Kellermann
cd6de3b24e neighbor/{Explorer,Listener}: add "noexcept" 2018-01-02 16:58:14 +01:00
Max Kellermann
dcd483bd99 storage/Composite: use std::unique_ptr<Storage> 2018-01-02 16:18:34 +01:00
Max Kellermann
3c5e4e2788 storage/Plugin: return std::unique_ptr<Storage> 2018-01-02 16:11:17 +01:00
Max Kellermann
3f4f7b0a53 lib/upnp/Discovery: protect "downloaders" accesses with mutex 2018-01-02 14:55:57 +01:00
Max Kellermann
0a4b866d8a db/upnp: use SplitString() instead of stringToTokens() 2018-01-02 14:16:57 +01:00
Max Kellermann
8c7d7dfa5b lib/upnp/Util: remove unused function csvToStrings() 2018-01-02 14:16:57 +01:00
Max Kellermann
cdf615f783 lib/upnp/ContentDirectoryService: use SplitString() instead of csvToStrings() 2018-01-02 14:16:57 +01:00
Max Kellermann
7d96883d64 lib/upnp/Util: use std::string::erase() instead of ..::replace() 2018-01-02 14:16:57 +01:00
Max Kellermann
28c5e7e6a7 Merge branch 'v0.20.x' 2018-01-02 14:16:47 +01:00
Max Kellermann
ff624075a8 storage/State: check if a CompositeStorage exists; fixes nullptr dereference
Fixes another crash bug caused by commit
64d141f71e
2018-01-02 14:13:26 +01:00
Max Kellermann
08db28469d storage/State: make mount errors non-fatal
Fixes crash bug caused by commit
64d141f71e
2018-01-02 14:07:52 +01:00
Max Kellermann
a20b326807 storage/State: fix memory leak after database mount failure
Caused by commit 64d141f71e

This wasn't a serious memory leak, because after a mount failure, MPD
would abort anyway, which is subject to the next commit.
2018-01-02 14:05:07 +01:00
Max Kellermann
4db1b1b250 storage/State: remove useless #ifdef ENABLE_DATABASE
This source file isn't compiled when the database is disabled.
2018-01-02 13:48:16 +01:00
Max Kellermann
dbfc4abfd6 thread/SafeSingleton: disallow copying 2018-01-02 12:39:05 +01:00
Max Kellermann
5544375002 thread/SafeSingleton: pass parameters to constructor 2018-01-02 12:26:53 +01:00
Max Kellermann
1fd8d46064 lib/upnp/ClientInit: return UpnpClient_Handle 2018-01-02 12:22:44 +01:00
Max Kellermann
46406d6cca output/ao: use class SafeSingleton for libao initialization 2018-01-02 12:13:51 +01:00
Max Kellermann
196df1ccd5 thread/SafeSingleton: new thread-safe utility class 2018-01-02 12:10:41 +01:00
Max Kellermann
d2358b42b6 output/Source: drop the "_instance" suffix from variable names 2018-01-02 09:59:22 +01:00
Max Kellermann
e387d94ff1 filter/Filter: add "noexcept" 2018-01-01 19:23:01 +01:00
Max Kellermann
3bb9c704de pcm/*: add "noexcept" 2018-01-01 19:07:33 +01:00
Max Kellermann
551ac56a33 Filter/Internal: split header 2018-01-01 18:48:34 +01:00
loujine
42959982a9 Add basic support for MUSICBRAINZ_WORKID tag 2017-12-30 19:05:21 +00:00
Max Kellermann
78c73fb9e7 MusicChunk: reorder attributes to reduce padding 2017-12-30 17:52:07 +01:00
Max Kellermann
a06bf388d9 MusicChunk: make the struct size exactly 4096 2017-12-30 17:50:25 +01:00
Max Kellermann
de0c3e717e MusicChunk: split struct MusicChunkInfo from struct MusicChunk 2017-12-30 17:47:16 +01:00
Max Kellermann
1194998ce9 CrossFade: use sizeof(MusicChunk::data) instead of CHUNK_SIZE 2017-12-30 17:43:56 +01:00
Max Kellermann
7171e23700 player/Thread: make seeking into a new song non-blocking 2017-12-30 11:31:26 +01:00
Max Kellermann
dee378b775 player/Thread: make SEEK (partially) non-blocking
When the decoder is still starting up while we handle a SEEK, finish
the "player SEEK" immediately and re-enter the player loop, being able
to handle commands (and even cancel the pending seek).

This is the first part in a series of patches to solve the "blocking
input blocks decoder, blocks player, blocks the main thread" problem.
There are many other blocking code locations left, and the main thread
isn't non-blocking either because it waits for "seeking" to become
false.
2017-12-29 17:32:12 +01:00
Max Kellermann
f76262ef79 poison.h: remove obsolete header 2017-12-29 17:29:52 +01:00
Max Kellermann
c40354bbcb player/Outputs: abstract interface wrapping class MultipleOutputs 2017-12-29 16:39:05 +01:00
Max Kellermann
c04aafb4e3 output/Multiple: add "noexcept" 2017-12-29 16:29:49 +01:00
Max Kellermann
e31abe6d6b player/Thread: remove redundant outputs.Cancel() call
The STOP, EXIT and CLOSE_AUDIO commands are not finished here; they
are propagated to PlayerControl::RunThread() where the
outputs.Cancel() call will be done again.
2017-12-28 08:39:48 +01:00
Max Kellermann
e1349ccadc player/Thread: ProcessCommand() returns bool
Allows signalling a failed seek, and replaces several redundant
command checks after the ProcessCommand() call.
2017-12-28 08:30:01 +01:00
Max Kellermann
8838bdc1e3 player/Thread: move CommandFinished() call out of SeekDecoder(SongTime)
Decouple this function from player command execution.
2017-12-27 14:28:56 +01:00
Max Kellermann
d6386bc80f player/Thread: update code comment 2017-12-27 14:26:14 +01:00
Max Kellermann
edef62df86 filter/Internal: return std::unique_ptr<Filter> 2017-12-27 11:56:05 +01:00
Max Kellermann
e2621d5e44 filter/Plugin: return std::unique_ptr<PreparedFilter> 2017-12-27 11:39:01 +01:00
Max Kellermann
0e3ff12dd3 filter/volume: remove from filter_plugins[]
Thsi filter doesn't make sense as manually configured plugin, because
nobody ever calls volume_filter_set() on it, making it a no-op.
2017-12-27 11:38:38 +01:00
Max Kellermann
b335ac4156 filter/{chain,convert}: remove unused FilterPlugin instances
These are not in filter_plugins[] and have dedicated constructors
anyway.
2017-12-27 11:33:15 +01:00
Max Kellermann
03cf6591c0 output/Source: convert prepared_filter to reference 2017-12-27 11:21:43 +01:00
Max Kellermann
2e0949d8e6 archive/Plugin: return std::unique_ptr<ArchiveFile> 2017-12-27 09:07:21 +01:00
Max Kellermann
5a728a069e fs/AllocatedPath: drop obsolete GCC check 2017-12-27 08:50:55 +01:00
Max Kellermann
7384ec199e Compiler.h: remove support for GCC 4.9
Supporting GCC 4.9 is becoming cumbersome as we refactor more code to
C++14.

This shouldn't be a problem for anybody, because Debian Stable
(Stretch) has version 6.3, and Ubuntu LTS (Xenial) has version 5.3.
2017-12-27 08:40:24 +01:00
Max Kellermann
7bce6329e3 archive/File, input/Plugin: return InputStreamPtr 2017-12-26 20:05:22 +01:00
Max Kellermann
49619fbd77 input/Proxy: use InputStreamPtr 2017-12-26 20:03:37 +01:00
Max Kellermann
fb9a2c5431 input/Icy: manage the parser in a std::shared_ptr
This resolves the circular dependency between IcyInputStream and
CurlInputStream.
2017-12-26 20:03:35 +01:00
Max Kellermann
cd38aa3b2a Merge branch 'v0.20.x' 2017-12-26 20:03:18 +01:00
Max Kellermann
eee10ad2ed input/curl: add missing mutex locks to OnEnd(), OnError() 2017-12-26 20:01:13 +01:00
Max Kellermann
daeb7ae949 input/InputStream: add "noexcept" 2017-12-26 11:39:34 +01:00
Max Kellermann
82a79565de input/InputStream: use C++11 initializers 2017-12-26 11:32:36 +01:00
Max Kellermann
078839c711 archive/zzip: convert struct to class 2017-12-26 11:22:46 +01:00
Max Kellermann
98472a8104 pcm/SampleFormat: remove wrong "malloc" attribute 2017-12-23 08:38:22 +01:00
Max Kellermann
90cc32f6f8 util/RefCount: remove obsolete class 2017-12-22 16:37:30 +01:00
Max Kellermann
9aec2f019a archive/File: eliminate Close(), make destructor virtual instead 2017-12-22 16:30:17 +01:00
Max Kellermann
5da455080b archive/iso9660: use std::shared_ptr instead of class RefCount 2017-12-22 16:25:08 +01:00
Max Kellermann
17558102f2 archive/zzip: use std::shared_ptr instead of class RefCount 2017-12-22 16:20:05 +01:00
Max Kellermann
e1c39f3fdc archive/bz2: use std::shared_ptr instead of class RefCount 2017-12-22 16:14:12 +01:00
Max Kellermann
20555c8e37 archive/File: remove unused attribute "plugin" 2017-12-22 16:13:29 +01:00
Max Kellermann
300a619991 Merge branch 'v0.20.x' 2017-12-22 16:10:05 +01:00
Max Kellermann
d094c168aa archive/{iso9660,zzip}: unlock the mutex during I/O
Similar to commit 31ab78ae8e
2017-12-22 16:09:03 +01:00
Max Kellermann
4b18460bc6 archive/bz2: unlock the archive mutex and lock the file mutex
Fixes deadlock because FileInputStream::Read() unlocks the mutex
(which was not locked) and then locks it, keeping it locked.  This can
result in a deadlock.  This happens because the archive and the file
mutex are different.
2017-12-22 16:02:23 +01:00
Max Kellermann
4319dedb23 db/update/Walk: use std::atomic_bool for the "quit" variable
Fixes thread sanitizer warnings.
2017-12-22 12:02:44 +01:00
Max Kellermann
f8bb66b4e0 event/Loop: use std::atomic_bool for the "quit" variable
Fixes thread sanitizer warnings.
2017-12-22 11:04:24 +01:00
Max Kellermann
5d6a8b3840 MusicPipe: lock the mutex in Peek() and GetSize() 2017-12-22 11:03:37 +01:00
Max Kellermann
6a8c2848f6 thread/{Thread,Id}: use defaul-initialized pthread_t as "undefined" value
Use the "==" operator instead of pthread_equal().

This allows us to eliminate two boolean flags which are there to avoid
race conditions, and made the thing so fragile that I got tons of
(correct) thread sanitizer warnings.
2017-12-22 10:37:07 +01:00
Max Kellermann
6439727afc player/Thread: use std::lock_guard in RunThread() 2017-12-22 09:35:31 +01:00
Max Kellermann
27b0a581a6 player/Thread: even more fine-grained unlocking
Use one single std::lock_guard in Run(), and replace the manual
Lock()/Unlock() calls.
2017-12-22 08:09:16 +01:00
Max Kellermann
15a54230f1 player/Thread: move unlock call down
Eliminate more unlock/lock transitions, making the code more robust.
2017-12-22 01:14:51 +01:00
Max Kellermann
f0d184884a player/Thread: remove obsolete commented code 2017-12-22 01:14:39 +01:00
Max Kellermann
8fca04f140 player/Thread: add missing lock for StartDecoder()
Regression from commit 0772e571b7
2017-12-22 01:12:15 +01:00
Max Kellermann
3b2b5edd26 player/Thread: move mutex lock out of SeekDecoder() 2017-12-22 01:07:13 +01:00
Max Kellermann
5bd1fbb0d6 player/Thread: merge four mutex locks in SeekDecoder() 2017-12-22 01:04:44 +01:00
Max Kellermann
0772e571b7 player/Thread: move mutex lock out of StartDecoder() 2017-12-22 01:03:12 +01:00
Max Kellermann
910496cea9 decoder/Control: caller must lock mutex for Start() 2017-12-22 01:03:01 +01:00
Max Kellermann
739e1da279 player/Thread: move mutex lock out of ActivateDecoder() 2017-12-22 00:58:57 +01:00
Max Kellermann
08b4a7aaf2 player/Thread: eliminate LockWaitDecoderStartup() 2017-12-22 00:58:42 +01:00
Max Kellermann
1f0770ca55 player/Thread: move code to SeekDecoder(SongTime) 2017-12-22 00:49:21 +01:00
Max Kellermann
505d0bfa51 player/Thread: move mutex lock out of StopDecoder() 2017-12-22 00:48:19 +01:00
Max Kellermann
860d13c7d8 decoder/Control: caller must lock mutex for Stop() 2017-12-22 00:48:12 +01:00
Max Kellermann
76d77af0f0 player/Thread: use std::lock_guard once more 2017-12-22 00:47:36 +01:00
Max Kellermann
ea8ab4ddf2 player/Thread: merge two mutex locks 2017-12-22 00:42:10 +01:00
Max Kellermann
4bcc38c749 player/Thread: move mutex lock out of WaitDecoderStartup() 2017-12-22 00:41:05 +01:00
Max Kellermann
5becffbba5 player/Thread: merge two mutex locks 2017-12-22 00:39:54 +01:00
Max Kellermann
d0194a6fb3 decoder/Control: caller must lock mutex for Seek() 2017-12-22 00:37:25 +01:00
Max Kellermann
e45d13d469 player/Thread: add missing mutex lock around PlayerControl::SetError() 2017-12-22 00:35:18 +01:00