Commit Graph

351 Commits

Author SHA1 Message Date
Max Kellermann
330a4cf573 Main: remove exception handler from mpd_main_after_fork()
Let MainOrThrow() forward it to mpd_main().
2018-08-01 20:15:54 +02:00
Max Kellermann
6ffbb151a0 Main: move log_deinit() call to mpd_main()
Deinitialize the logging library after the last exception handler,
because that one could still need it.

Use `AtScopeExit()` to ensure it's always called, even if an exception
was thrown.
2018-08-01 20:14:31 +02:00
Max Kellermann
271e49db5d Main: move code to MainOrThrow(), leaving exception handler in mpd_main() 2018-08-01 20:13:27 +02:00
Max Kellermann
8d2101ccb4 Main: move libdbus cleanup to class ODBus::ScopeInit 2018-08-01 19:24:50 +02:00
Max Kellermann
bcc1e51097 StateFile: add struct StateFileConfig 2018-07-17 23:27:50 +02:00
Max Kellermann
0c8ffa1ac3 output/MultipleOutputs: use struct ConfigData 2018-07-17 23:13:35 +02:00
Max Kellermann
4f678aa244 neighbor/Glue: use struct ConfigData 2018-07-17 23:11:33 +02:00
Max Kellermann
3a4a430f6c fs/Config: use struct ConfigData 2018-07-17 23:09:56 +02:00
Max Kellermann
36db40b224 client/Global: use struct ConfigData 2018-07-17 23:07:50 +02:00
Max Kellermann
426b9672cf db/Configured: use struct ConfigData 2018-07-17 23:06:17 +02:00
Max Kellermann
4d80419982 pcm/ConfiguredResampler: use struct ConfigData 2018-07-17 23:04:26 +02:00
Max Kellermann
3983caa2c8 Listen: use struct ConfigData 2018-07-17 23:02:53 +02:00
Max Kellermann
0b4e0b7bcb LogInit: use struct ConfigData 2018-07-17 23:02:06 +02:00
Max Kellermann
a9b8d5ecb6 Permission: use struct ConfigData 2018-07-17 23:00:42 +02:00
Max Kellermann
d2594c6380 storage/Configured: use struct ConfigData 2018-07-17 22:57:08 +02:00
Max Kellermann
2fc0a738ce Main: use struct ConfigData 2018-07-17 22:54:16 +02:00
Max Kellermann
86c531b37d config/Data: move std::chrono parsers from Global.hxx 2018-07-17 22:53:17 +02:00
Max Kellermann
a5b14a2ea7 Main: add local ConfigData reference 2018-07-17 22:48:43 +02:00
Max Kellermann
bf582bd969 ZeroconfGlue: use struct ConfigData 2018-07-17 22:44:16 +02:00
Max Kellermann
ad866f7a7d db/update/Config: use struct ConfigData 2018-07-17 22:41:28 +02:00
Max Kellermann
24a86dce21 tag/Config: use struct ConfigData 2018-07-17 22:34:11 +02:00
Max Kellermann
0209bc4ba7 ReplayGainGlobal: use struct ConfigData 2018-07-17 22:32:56 +02:00
Max Kellermann
dd57b81989 PlaylistFile: use struct ConfigData 2018-07-17 22:31:33 +02:00
Max Kellermann
61a119b607 playlist/Registry: use struct ConfigData 2018-07-17 22:10:32 +02:00
Max Kellermann
0ff0aca2e2 input/Init: use struct ConfigData 2018-07-17 22:05:27 +02:00
Max Kellermann
57d77cc8a0 decoder/List: use struct ConfigData 2018-07-17 22:05:21 +02:00
Max Kellermann
99d5b61698 fs/Path: add operator/(Path,Path)
Modeled after std::filesystem::operator/() from C++17.
2018-07-17 18:33:32 +02:00
Max Kellermann
816603fd9a config/Config*: rename files, drop "Config" prefix 2018-07-16 19:50:07 +02:00
Max Kellermann
86a37d0ed6 Main, pcm/SampleFormat, command/Error: remove obsolete GCC version checks 2018-07-16 11:04:05 +02:00
Max Kellermann
adf2d3aff2 zeroconf/Avahi: move dbus_shutdown() call to the end of Main()
Calling dbus_shutdown() too early will break the "udisks2" neighbor
plugin.
2018-06-03 10:37:54 +02:00
Max Kellermann
5b0e8c6de0 Merge branch 'v0.20.x' 2018-03-05 11:13:42 +01:00
Christian Kröner
79535212c8 Get rid of GCD on macOS which breaks debug builds
With Grand Central Dispatch used in Main.cxx, debug builds on macOS
crash as the IsInside() assertion gets triggered in the event loop. As
a simple fix, usage of GCD is removed. Plugging and unplugging
headphones or changes of the default output device was tested without
issues. Whatever the original commit tried to fix by GCD probably does
not need fixing anymore.
2018-03-04 10:43:55 +01:00
Max Kellermann
b30a510b45 release v0.20.18
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlqR3zoQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEqNGEACGhsZJbhqls0EawfHhpOz/x7JcloMLWvoX
 GzuvVinhdFmmFId0akLsg3TCyGElNA+4YzfDjB1TyMpPFBUxM/nnthYPrSmjiT68
 t+0IV6OnqFVLE2PF6pHV2Gia0Km746GZBJ+TRLeZSIksADH7nU+soepIA6idwNRN
 x8Wo0ashsRIPG3FyL6f/2W/vUvD/enoxohCBB/tvnZ73Px0k2bYAwlBNW/i9/yrX
 ktJ2yJqbCkKOhBQnbUvsG72Nrd4/Iz2m7cA//KBVrDEGwNv5hxNKiK/hCq3YK2W9
 Ndnl0+EQxNLT1NUwF5e1LS3GtU2Mh3FQwrcq81Cj7o/wEH5e7piKBZhwDCBgOYYH
 vLbaLYWK+XW/EqitkRZx5ZBrfNoqOrLreX0d2+AZJOjKDjAWgMZXoOEjmQC9/Dcj
 pGcRow4jAusBRJKVN0Wmu6eeVQMjiYJNWehhyhhruShHL2ZAjJSuDhygAFW5YB3I
 N2kfhwZWMHVFpA0HvcVx5JwNx7U1OyJGs0lRGThV/6jhnklGzoujvomRNJ6VNx10
 ppYhmcLaHm19GR1eb8KCYnZYL2QWoQT5YLVlm0vybTX9i1k3wdf9ezU/n5hB52rP
 j20Ol1I9YQw4/L985SV1W+8ll1i71o9paoJx17C8AQpxWWamQLe+vgENt9fPKIPl
 aLBYU7hq9Q==
 =ndLr
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.18'

release v0.20.18
2018-02-24 23:16:06 +01:00
Max Kellermann
5b80711d75 Main: move WinSock initialization to class ScopeNetInit 2018-02-24 22:44:27 +01:00
Max Kellermann
d29d186d62 output/alsa: use a new I/O thread with real-time scheduling
The normal I/O event thread can have a large latency, e.g. when
libgnutls loads all TLS CA certificates for a https connect.  This
makes it unreliable for the ALSA I/O notifications, and causes ring
buffer xruns.  To avoid interfering with high latency events such as
CURL's, we move the ALSA I/O events to a separate I/O thread which
also obtains real-time scheduling (if possible).

Closes #221
2018-02-16 22:38:55 +01:00
Max Kellermann
7d16d8c887 Listen: move ClientListener pointer to struct Partition 2018-01-29 23:53:52 +01:00
Max Kellermann
52da387a1d Main: move part of the shutdown code to Instance methods 2018-01-29 23:45:48 +01:00
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
d588da69e5 CommandLine: convert pointer to reference 2018-01-17 11:08:03 +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
914df18bf9 Main, ...: catch any exception, not just std::runtime_error 2017-12-19 10:56:23 +01:00
Max Kellermann
6246d36fe6 Merge branch 'v0.20.x' 2017-12-16 20:56:06 +01:00
Max Kellermann
dfaf08743c *: check defined(_WIN32) instead of defined(WIN32)
Only _WIN32 is defined by the compiler, and WIN32 is not standardized
and may be missing.

Closes #169
2017-12-12 10:22:20 +01:00
Max Kellermann
28a2d41b85 db/DatabasePlugin: pass EventThread's EventLoop to create()
Allows database plugins to use the EventThread, e.g. for CURL
integration.
2017-08-24 19:53:52 +02:00
Max Kellermann
0a3a5a7c65 Merge branch 'v0.20.x' 2017-05-16 10:09:20 +02:00
Max Kellermann
64786ec12a Main: omit "constexpr" on MIN_BUFFER_SIZE with GCC 4.x 2017-05-16 07:20:47 +02:00
Max Kellermann
4faef28cc5 release v0.20.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlkaFL0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEr4ID/9iAQC+7fFv06uLOm48Ufu+PgoD8uJkAwF5
 QuLQkc85g9urn+bu9N7Qs7Vypp7aLyGcJKY0jyA8wxkOj24pUC3GYk80daUt561V
 5s20FnoS/Uoman3CSJL94IfCUBxejizE6vgIIHTc5bb6U0qIsPub/8JTTE2Ih7uP
 nvFZ5uBQ+YTc7at+iIH9123eUMKkitkh8osNblovqQT9v42++Tm4ztAytRHBjwUA
 Itew5HhlvahbLKqFs/7vmICh/YX1FcOV7cV+erEWYfkH0KCI2bhSle4u2d0CBOvD
 VJlDnBCo9bM7WKcPYqJiFFFXA0CRk06wbkkkAtwF4zjp8xos7aQcq4FyQnYL8KXo
 5lijIhRwBURBd+nt8oA9kuEhBt/T75otcemJkzVaYappHTJCLjhxSGcPt8mw+nE9
 9WQzsp/MIVzg9l5g3D9S/43xM7uhvn98Tn1Qf2s8YRd2o8CZeOhW+X3RvbCvVPv2
 mOlx4sFAv8DOJ3KxMdqiJT+PmylPyJluQdqH+tMc8BdPg/kpSpYIPTuSjjRqK1yh
 ld5do0HtAAwiHtvXfk5YVFjJSpO0c8yVn6xci2Cl4k/5ZHj2UE1ln+N5vCea2BRF
 2J3HAjROwtcwY3lU1jFnEAogf24KWiFJqhhC0EqBGUdlrM8Dn37P5cEWWjROIMNK
 lPEdovokNw==
 =CdDy
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.7'

release v0.20.7
2017-05-15 23:01:49 +02:00
Max Kellermann
fa2b59df4b Main: cap buffer_before_play at 80% to prevent deadlock
Closes #34
2017-05-15 22:49:31 +02:00
Max Kellermann
f41a169460 Main: enforce a reasonable minimum audio_buffer_size setting 2017-05-15 22:44:18 +02:00
Max Kellermann
f567083006 Main: refactor DEFAULT_BUFFER_SIZE to represent bytes 2017-05-15 22:40:23 +02:00
Max Kellermann
788e3b31e1 *: remove "pure" and "const" attributes from throwing functions
The "pure" and "const" attributes are not so well-defined, and a
recent clang version implements an optimization which pushes the
definition's boundary beyond what I believed it was.  clang now
assumes that functions declared "pure" cannot throw exceptions, even
if they lack the "noexcept" specification.

When compiled with this new clang version, MPD will crash randomly if
an exception happens to get thrown by such as "pure" function
(https://github.com/MusicPlayerDaemon/MPD/issues/41).

This commit removes all such misplaced "pure" and "const" attributes,
closing #41.
2017-05-08 17:25:06 +02:00
Max Kellermann
77178e0590 Instance: make "partition" a std::list
With this commit, multi-player support becomes possible... it's just
not wired to the frontend yet.

This is based on massive amounts of refactoring work I did over the
past 9 years.
2017-02-17 23:22:29 +01:00
Max Kellermann
c335f18be7 Partition: add "name" attribute 2017-02-17 23:18:51 +01:00
Max Kellermann
5e081de14a IOThread: move EventThread instance into struct Instance
Eliminate global variables.
2017-02-10 22:25:06 +01:00
Max Kellermann
853740f1e2 Main: use the IOThread for outputs and mixers
The main EventLoop can block for a long time while a client's command
runs, and is therefore inappropriate for internal engine I/O.  This
fixes a serious regression for at least the "httpd" output, which used
to be hard-coded for the IOThread, but now receives the main EventLoop
as an initialization parameter.

For the mixers, this doesn't make much of a difference.  They are not
latency critical.
2017-02-09 21:33:49 +01:00
Max Kellermann
03a97d87ea tag/Tag*: rename several source files 2017-02-08 08:49:42 +01:00
Max Kellermann
3854211694 input/Plugin: pass EventLoop& to init()
Eliminate dependency on io_thread_get().
2017-01-26 09:26:25 +01:00
Max Kellermann
1450e45d97 Main, db/Glue: improve error messages 2017-01-23 18:52:16 +01:00
Max Kellermann
5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann
39fd713b91 Main: invoke UpdateEffectiveReplayGainMode() after output init
Forward the configured ReplayGainMode to all outputs and decoders.
2017-01-03 13:44:38 +01:00
Max Kellermann
8f4769d2ac Stats: initialize start_time automatically 2016-12-28 10:22:15 +01:00
Max Kellermann
b042095ac2 event/Loop: use std::chrono 2016-12-28 01:15:08 +01:00
Max Kellermann
94e9e93fa4 ReplayGainGlobal: move replay_gain_config into struct Config
Yet another global variable removed.
2016-12-10 00:03:29 +01:00
Max Kellermann
d2a1294e9a Main: add struct Config, empty currently 2016-12-10 00:00:50 +01:00
Max Kellermann
5013de6770 LogInit: convert use_stdout flag to out_fd=STDOUT_FILENO 2016-12-04 20:15:45 +01:00
Max Kellermann
9fb7cc796b decoder/Control: add attribute configured_audio_format
Obsoletes the same variable from AudioConfig.cxx.
2016-12-03 14:12:08 +01:00
Max Kellermann
3472208c05 ReplayGainGlobal: move replay_gain_mode to struct Partition 2016-12-03 13:56:25 +01:00
Max Kellermann
fc30e1d559 Partition: pass ReplayGainConfig to constructor 2016-12-03 13:55:14 +01:00
Max Kellermann
e443513996 Main: call replay_gain_global_init() before forking 2016-12-03 13:27:59 +01:00
Max Kellermann
3000b9dcde filter/ReplayGain: add ReplayGainConfig copy
Remove dependency on ReplayGain global variables.
2016-12-03 12:51:02 +01:00
Max Kellermann
77c1f54876 ReplayGainConfig: add struct ReplayGainConfig, move globals to ReplayGainGlobal.cxx 2016-11-25 11:13:08 +01:00
Max Kellermann
0759d72108 Partition: add UpdateEffectiveReplayGainMode()
Move code from replay_gain_get_real_mode().
2016-11-24 15:18:57 +01:00
Max Kellermann
c8bb3c0b71 CommandLine: migrate from class Error to C++ exceptions 2016-11-02 10:30:46 +01:00
Max Kellermann
9990e8473c LogInit: migrate from class Error to C++ exceptions 2016-11-02 10:11:17 +01:00
Max Kellermann
d765182bbb config/Global: _get_path() throws exception on error 2016-11-02 10:07:57 +01:00
Max Kellermann
6d409d27ca lib/icu: migrate from class Error to C++ exceptions 2016-11-02 09:54:13 +01:00
Max Kellermann
78bf4ef5fa db/Configured: migrate from class Error to C++ exceptions 2016-10-29 10:01:50 +02:00
Max Kellermann
aead221184 event/ServerSocket: migrate from class Error to C++ exceptions 2016-10-28 21:22:25 +02:00
Max Kellermann
16d1c9f5d6 Main: catch exceptions in all of main() 2016-10-28 21:22:25 +02:00
Max Kellermann
5b2b4bf13c config/Param: use CamelCase 2016-10-28 11:38:37 +02:00
Max Kellermann
c598686bd9 storage: migrate from class Error to C++ exceptions 2016-10-27 21:35:19 +02:00
Max Kellermann
10e32454ef lib/sqlite, sticker: migrate from class Error to C++ exceptions 2016-10-27 07:50:08 +02:00
Max Kellermann
6ed77f2a27 input/Plugin: migrate init() from class Error to C++ exceptions 2016-09-09 15:16:47 +02:00
Max Kellermann
ae1eb9ccde pcm/Convert: migrate from class Error to C++ exceptions 2016-09-09 14:44:13 +02:00
Max Kellermann
871063dab7 neighbor/Plugin: migrate from class Error to C++ exceptions 2016-09-05 11:37:58 +02:00
Max Kellermann
01b68db30e lib/icu/Converter: Create() throws exception on error 2016-04-13 10:04:19 +02:00
Max Kellermann
f55bdf07d3 db/Interface: Open() throws exception on error 2016-03-19 00:05:11 +01:00
Max Kellermann
5ca6026787 Partition: use CallbackMaskMonitor, replacing class GlobalEvents::Monitor 2016-03-10 22:52:16 +01:00
Max Kellermann
5ffb82993e IdleMonitor: new class to replace GlobalEvents::IDLE
Use MaskMonitor to eliminate duplicate code.
2016-03-10 20:32:43 +01:00
Max Kellermann
031410c72b Instance: add StateFile* attribute 2016-03-05 21:00:38 +01:00
Max Kellermann
0e87ce4680 GlobalEvents: expose the internal class
Move the GlobalEvents::Monitor instance into class Instance.
Eliminate all global variables.
2016-03-05 20:23:30 +01:00
Max Kellermann
b4d594eeff Instance: embed EventLoop, no pointer 2016-03-05 20:20:12 +01:00
Max Kellermann
ce09379bae Main: use Instance::Shutdown() 2016-03-05 20:20:12 +01:00
Max Kellermann
eaa1590866 GlobalEvents: eliminate SHUTDOWN, use Instance::Shutdown() instead 2016-03-05 18:56:27 +01:00
Max Kellermann
23ab4e5e5f Instance: add method Shutdown() 2016-03-05 18:56:16 +01:00
Max Kellermann
1aee89f5ea *: include cleanup (using iwyu) 2016-03-01 22:08:13 +01:00
Max Kellermann
1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Max Kellermann
a2e008347c Main: catch and log C++ exceptions 2016-02-07 12:42:09 +01:00