aboutsummaryrefslogtreecommitdiffstats
path: root/src/Main.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.cxx')
-rw-r--r--src/Main.cxx30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index b45e2c3ae..da8458340 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -50,11 +50,12 @@
#include "IOThread.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/Config.hxx"
+#include "fs/StandardDirectory.hxx"
#include "PlaylistRegistry.hxx"
#include "ZeroconfGlue.hxx"
#include "DecoderList.hxx"
#include "AudioConfig.hxx"
-#include "pcm/PcmResample.hxx"
+#include "pcm/PcmConvert.hxx"
#include "Daemon.hxx"
#include "system/FatalError.hxx"
#include "util/Error.hxx"
@@ -78,12 +79,11 @@
#include "ArchiveList.hxx"
#endif
+#ifdef HAVE_GLIB
#include <glib.h>
+#endif
-#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
@@ -94,6 +94,8 @@
#include <ws2tcpip.h>
#endif
+#include <limits.h>
+
static constexpr unsigned DEFAULT_BUFFER_SIZE = 4096;
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
@@ -135,13 +137,9 @@ glue_mapper_init(Error &error)
return false;
if (music_dir.IsNull()) {
- const char *path =
- g_get_user_special_dir(G_USER_DIRECTORY_MUSIC);
- if (path != nullptr) {
- music_dir = AllocatedPath::FromUTF8(path, error);
- if (music_dir.IsNull())
- return false;
- }
+ music_dir = GetUserMusicDir();
+ if (music_dir.IsNull())
+ return false;
}
mapper_init(std::move(music_dir), std::move(playlist_dir));
@@ -365,15 +363,17 @@ int mpd_main(int argc, char *argv[])
setlocale(LC_CTYPE,"");
#endif
+#ifdef HAVE_GLIB
g_set_application_name("Music Player Daemon");
#if !GLIB_CHECK_VERSION(2,32,0)
/* enable GLib's thread safety code */
g_thread_init(nullptr);
#endif
+#endif
- io_thread_init();
winsock_init();
+ io_thread_init();
config_global_init();
success = parse_cmdline(argc, argv, &options, error);
@@ -431,7 +431,7 @@ int mpd_main(int argc, char *argv[])
archive_plugin_init_all();
#endif
- if (!pcm_resample_global_init(error)) {
+ if (!pcm_convert_global_init(error)) {
LogError(error);
return EXIT_FAILURE;
}
@@ -479,7 +479,7 @@ int mpd_main(int argc, char *argv[])
}
if (!glue_state_file_init(error)) {
- g_printerr("%s\n", error.GetMessage());
+ LogError(error);
return EXIT_FAILURE;
}
@@ -544,7 +544,6 @@ int mpd_main(int argc, char *argv[])
playlist_list_global_finish();
input_stream_global_finish();
audio_output_all_finish();
- volume_finish();
mapper_finish();
delete instance->partition;
command_finish();
@@ -554,7 +553,6 @@ int mpd_main(int argc, char *argv[])
archive_plugin_deinit_all();
#endif
config_global_finish();
- stats_global_finish();
io_thread_deinit();
SignalHandlersFinish();
delete instance;