diff options
Diffstat (limited to 'src/Main.cxx')
-rw-r--r-- | src/Main.cxx | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index b45e2c3ae..d7ff12815 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -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)); @@ -188,7 +186,7 @@ glue_db_init_and_load(void) return true; Error error; - if (!DatabaseGlobalInit(*param, error)) + if (!DatabaseGlobalInit(*main_loop, *instance, *param, error)) FatalError(error); delete allocated; @@ -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; |