Commit Graph

302 Commits

Author SHA1 Message Date
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
Max Kellermann
e6e7d6dbd6 fs/io/Reader: use C++ exceptions instead of class Error 2015-12-18 01:08:16 +01:00
Max Kellermann
d256a0e98f config/ConfigFile: use std::exception on syntax error 2015-12-16 11:13:16 +01:00
Max Kellermann
36239895bd player/Control: add Lock prefix to locking method names 2015-11-11 16:50:57 +01:00
Max Kellermann
ce0d896492 unix/Daemon, playlist/pls, ...: remove unused Domain variables 2015-09-17 23:15:54 +02:00
Max Kellermann
eae9cb4afe Main: use config_domain for inotify error 2015-09-17 23:15:54 +02:00
Max Kellermann
5fba8d773c PlayerThread, ...: move to src/player/ 2015-08-15 15:55:46 +02:00
Max Kellermann
ac03871174 Main: remove g_set_application_name() call
Since we are removing GLib, this call is useless.
2015-06-26 07:59:58 +02:00
Max Kellermann
334bd73792 lib/icu/Collate: fall back to strcoll() instead of strcasecmp() 2015-06-23 13:26:45 +02:00
Max Kellermann
7b575f61d0 Main: notify systemd when MPD is ready 2015-03-21 14:27:54 +01:00
Max Kellermann
1c3f5517fa config/Option: convert to strictly-typed enum 2015-01-21 23:30:00 +01:00
Max Kellermann
fe85fa3bea ConfigData: move struct config_param to Param.hxx 2015-01-21 21:23:02 +01:00
Max Kellermann
712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann
5cbc319e96 configure.ac: require GLib 2.32 (if enabled)
Since version 2.32, g_thread_init() is deprecated and a no-op.  Let's
upgrade that (optional) dependency so we can remove all those
g_thread_init() calls.
2014-12-05 00:21:48 +01:00
Max Kellermann
563db580ae fs/Charset: add DeinitFSCharset() 2014-11-29 23:47:48 +01:00
Max Kellermann
fd2c6b8a4b fs/Charset: return Error on SetFSCharset() failure
Don't abort the process, let the caller decide instead.
2014-11-29 23:36:44 +01:00
Max Kellermann
ed001e0cfb configure.ac: add option "--disable-daemon" 2014-11-20 20:38:37 +01:00
Misty De Meo
134cb6a017 Main: fix compilation on OS X using non-Apple compilers
Commit d42c0f1dc5 added an OS X-specific
method of calling mpd_main_after_fork(), which uses Grand Central
Dispatch. Since this uses a block literal, it breaks compilation on
compilers which don't support the block extension, e.g. non-Apple
compilers. This affects users on older OS X releases with GCD (which
depend on older Clang releases, or Apple GCCs, which don't support the
C++11 features MPD needs); or which don't support GCD at all (10.5 and
lower).

This patch changes the #ifdef so that the non-GCD code is used
as it was on OS X before this patch if blocks aren't available, via
checking __BLOCKS__ macro.
2014-11-11 06:22:24 +01:00
NanoTech
d42c0f1dc5 Main: run the OS X native event loop after forking 2014-10-31 15:03:53 +01:00
NanoTech
6ad1e4d99a Revert "Main: run the OS X native event loop"
This reverts commit f0be48ff90
(except for the NEWS entry).

If libdispatch (GCD) is used before forking, it
can't safely be used again after forking.
2014-10-31 15:03:46 +01:00
nanotech
f0be48ff90 Main: run the OS X native event loop 2014-10-10 19:51:44 +02:00
Max Kellermann
3d2558bde6 StoragePlugin: pass EventLoop to constructor 2014-10-09 07:45:25 +02:00
Thomas Guillem
74fcbb382f android/Bridge: add shutdown()
Break the mainloop and terminate run call.
2014-09-16 18:25:45 +02:00
Max Kellermann
42af040fbd StateFile: configurable interval 2014-08-24 13:24:20 +02:00
Max Kellermann
6e84a03a35 PlayerThread: rename player_create() to StartPlayerThread() 2014-08-16 10:33:19 +02:00
Max Kellermann
82ecebb393 Main: don't require mpd.conf on Android
Don't fail to start if mpd.conf does not exist; just use default
values.
2014-07-30 10:22:22 +02:00
Max Kellermann
dfcb572985 Main: delete the Storage instance on shutdown 2014-06-10 23:21:09 +02:00
Max Kellermann
37b3190752 lib/icu: add IcuInit(), IcuFinish() 2014-06-10 23:21:09 +02:00
Max Kellermann
d77c83f4ba Main: auto-configure state file on Android 2014-03-02 00:35:37 +01:00
Max Kellermann
8cf3ac200b Main: use getExternalStorageDirectory() for locating mpd.conf 2014-03-02 00:24:31 +01:00
Max Kellermann
b8f1850bba db/Configured: store database file in cache directory
Add class Context which wraps the Android/Java Context class and add a
JNI wrapper for method Context.getCacheDir().
2014-03-01 22:20:28 +01:00
Max Kellermann
14168eadb2 Main: inline mpd_main() on Android 2014-03-01 19:09:31 +01:00
Max Kellermann
58771fc41c Android: obtain music directory from Environment.getExternalStoragePublicDirectory() 2014-03-01 18:48:20 +01:00
Max Kellermann
1e06c66c77 java: new helper library for the Android port 2014-03-01 18:48:20 +01:00
Max Kellermann
c73771e3ce Main: load mpd.conf from /sdcard/ on Android
Hard-coded path.  Will be replaced soon.
2014-03-01 18:48:20 +01:00
Max Kellermann
e9a85aa4e4 db/simple: mount points
A SimpleDatabase instance can now "mount" other Database instances at
certain locations.  This is used to use a new SimpleDatabase instance
for each storage mount (issued with the "mount" protocol command).
Each such instance has its own database file, stored in the directory
that is specified with the "cache_directory" option.
2014-02-27 20:49:13 +01:00
Max Kellermann
681e012fb5 db/update: cancel the update on shutdown 2014-02-27 16:58:35 +01:00
Max Kellermann
4d73e4d605 db/simple: create dedicated directory 2014-02-26 09:17:41 +01:00
Max Kellermann
33fc3af775 SongSort, ...: use libicu instead of GLib's g_utf8_*() 2014-02-24 20:39:37 +01:00
Max Kellermann
bfae92e307 Main: use INT_MAX instead of G_MAXUINT 2014-02-24 18:57:03 +01:00
Max Kellermann
4dcf0b8ae0 first Android release
Finally, MPD runs on Android.  For some small value of "runs".  Very
much work left, too much to describe.
2014-02-22 01:39:08 +01:00
Max Kellermann
3d4689756c Main: disable command-line parser and signal handlers on Android 2014-02-22 00:18:46 +01:00
Max Kellermann
04ba433ca6 Main: initialize Partition before Listener
Fixes nullptr dereference (regression by commit df5f9f4a).
2014-02-20 00:04:23 +01:00
Max Kellermann
df5f9f4a15 Listen: add Partition reference 2014-02-19 23:43:36 +01:00
Max Kellermann
150443b014 DatabasePlugin: add FLAG_REQUIRE_STORAGE
Ignore the storage configuration if FLAG_REQUIRE_STORAGE is not set in
the DatabasePlugin.
2014-02-19 23:24:17 +01:00
Max Kellermann
85b8675e7a db/Interface: add attribute "plugin"
The new method IsPlugin() replaces the "is_simple" flag.
2014-02-19 23:17:21 +01:00
Max Kellermann
8d6fedf817 Mixer: add class MixerListener
Use a listener interface instead of GlobalEvents.
2014-02-19 21:40:14 +01:00
Max Kellermann
0053cd0d0d Main: disable inotify check without database
Fix build failure.
2014-02-18 21:47:01 +01:00
Max Kellermann
91729437a0 Main: initialize Database before Storage 2014-02-17 22:14:00 +01:00
Max Kellermann
3af7af0b8f Main: move code to InitDatabaseAndStorage() 2014-02-17 22:13:53 +01:00