Commit Graph

251 Commits

Author SHA1 Message Date
Thomas Jansen 28bcb8bdf5 eliminate g_error() usage
Replaced all occurrences of g_error() with MPD_ERROR() located in a new header
file 'mpd_error.h'. This macro uses g_critical() to print the error message
and then exits gracefully in contrast to g_error() which would internally call
abort() to produce a core dump.

The macro name is distinctive and allows to find all places with dubious error
handling. The long-term goal is to get rid of MPD_ERROR() altogether. To
facilitate the eventual removal of this macro it was added in a new header
file rather than to an existing header file.

This fixes #2995 and #3007.
2010-09-25 15:00:43 +02:00
Denis Krjuchkov e8ebb1af91 main: Add Windows Service support
I've added PIPE_EVENT_SHUTDOWN because calling g_main_loop_quit() do not work when called from another thread.
Main thread was sleeping in g_poll() so I needed some way to wake it up.

By some strange reason call close(event_pipe[0]) in event_pipe_deinit() hangs.
In current implementation that code never reached so that was not a problem :-)
I've added a conditional to leave event_pipe[0] open on Win32.
2010-09-23 20:42:33 +02:00
Max Kellermann 393bcd961a inotify: added setting "auto_update_depth"
Limits the depth of the watched directories.  This is useful to keep
resource usage down and speed up MPD startup.
2010-04-13 21:31:57 +02:00
Max Kellermann 241e94936f replay_gain: moved code to replay_gain_config.c 2010-01-04 21:02:47 +01:00
Avuton Olrich 9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann 870436a592 output_init: use the normalize filter plugin
Use the plugin instead of the glue code in normalize.c.  This is used
wrapped inside a "autoconv" filter, to enable normalization for all
input file formats.
2009-12-25 17:51:08 +01:00
Max Kellermann 786c1f035f input_plugin: method init() returns errors with GError
Not used by any plugin currently, but this eliminates the g_error()
call in input_plugin_config(), so it's worth it.
2009-12-14 23:16:18 +01:00
Max Kellermann f70d2f58a1 input_stream: moved input_stream_global_init() to input_init.c 2009-12-14 22:53:13 +01:00
Max Kellermann 5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann b722d3d7f3 configure.ac: require GLib 2.12
Drop the required GLib version from 2.16 to 2.12, because many current
systems still don't have GLib 2.16.  This requires several new
compatibility functions in glib_compat.h.
2009-11-10 21:14:22 +01:00
Max Kellermann 6ef428af2e decoder_control: removed the global variable "dc"
Allocate a decoder_control object where needed, and pass it around.
This will allow more than one decoder thread one day.
2009-10-31 19:22:56 +01:00
Max Kellermann 25a806a347 player_control: protect command, state, error with a mutex
Use GMutex/GCond instead of the notify library.  Manually lock the
player_control object before accessing the protected attributes.  Use
the GCond object to notify the player thread and the main thread.
2009-10-31 17:02:12 +01:00
Viliam Mateicka f67426871b mpd.conf: new bool config value for enabling/disabling inotify update 2009-10-26 19:14:40 +01:00
Viliam Mateicka 7b343eaf50 add --disable-inotify for configure to disable inotify when autodetected 2009-10-24 18:24:29 +02:00
Max Kellermann e53ca368a5 output_plugin: added methods enable() and disable()
With these methods, an output plugin can allocate some global
resources only if it is actually enabled.  The method enable() is
called after daemonization, which allows for more sophisticated
resource allocation during that method.
2009-10-23 10:55:52 +02:00
Max Kellermann a05d0d5d94 audio: removed function finishAudioConfig()
There's no point in clearing the audio format before exiting.
2009-10-22 17:12:32 +02:00
Max Kellermann 0107ef2aad main: put #ifdef inside winsock_init()
This way, the function call in the main() function does not need
another pair of #ifdef/#endif.
2009-10-22 17:12:28 +02:00
Max Kellermann 2e9e34aa40 main: call g_set_application_name()
I'm not sure about the advantages of calling g_set_application_name(),
because I don't use a task manager (except for ps and kill), but it
sure doesn't hurt.
2009-10-20 21:02:00 +02:00
Max Kellermann 319149254d main: initialize playlist plugins 2009-10-13 18:01:11 +02:00
Max Kellermann 4390d72b14 configure.ac: require GLib 2.16
Accidently, MPD has been using several GLib 2.16 functions for a
while, and nobody noticed yet.  To simplify the code base, let's bump
the minimum GLib version for MPD to 2.16.  That version is old enough,
and it's reasonable to expect users to have it.
2009-10-13 16:12:43 +02:00
Max Kellermann e5857cb722 player_control: no CamelCase 2009-10-08 21:12:57 +02:00
Max Kellermann 8f261af5c1 automatically update the database with Linux inotify
This patch implements a light-weight inotify library, and watches all
directories below the music directory.  It updates all directories
where files changed after a delay of 5 seconds.
2009-09-25 18:32:00 +02:00
Max Kellermann 89ba540e6d command: added command "rescan"
"rescan" is the same as "update", but it discards existing songs in
the database.
2009-09-24 21:55:40 +02:00
Max Kellermann 1b227e0145 cmdline: handle fatal errors with GError
Don't call g_error(), which will abort the process and dump core.
2009-09-24 21:40:05 +02:00
Max Kellermann 308b3f2337 listen: handle fatal errors with GError
Don't call g_error(), which will abort the process and dump core.
2009-09-24 21:40:04 +02:00
Max Kellermann 1cc4914b24 update: renamed directory_update_init() to update_enqueue() 2009-09-24 17:57:39 +02:00
Max Kellermann a86f9b8035 cmdline: removed options --create-db and --no-create-db
Both options are deprecated, and should not be used anymore.  Many
users get confused by their presence.
2009-09-20 23:31:35 +02:00
Eugeny N Dzhurinsky bdb1965b50 cmdline: renamed options.stderr to options.log_stderr
On FreeBSD, "stderr" is a macro, and using this name for a struct
member breaks the build.

[mk: renamed _stderr to log_stderr]
2009-07-22 13:40:19 +02:00
Michal Nazarewicz d718a8b59d daemon: added "group" configuration option
The "group" configuration option is similar to "user" as it
sets user set what group MPD shall run as.  With "user"
option, MPD changed GID to the GID of the user, however,
more control could be desired.

Moreover, the patch changes the way of checking whether no
setuid(2)/setgid(2) is required -- previously user names
were compered, now UID and GIDs are compered (ie. the one we
already have (getuid(2)/getgid(2)) with the one we want to
change to).
2009-07-19 08:17:55 +02:00
Max Kellermann c134adbcbf mapper: pass music and playlist directory to mapper_init()
Added another glue function in main().
2009-07-15 18:58:19 +02:00
Max Kellermann 7bc8c7518b main: moved complex initialization code to glue functions
The glue_*() functions act as a glue between MPD's main() function and
its libraries.  They handle disabled features, and pass validated
configuration options.
2009-07-15 18:58:12 +02:00
Max Kellermann 739984f920 main: renamed openDB() to glue_db_init_and_load()
No CamelCase.
2009-07-15 18:58:10 +02:00
Max Kellermann 62f9df98b4 cmdline: no CamelCase
Renamed type, variables and functions.
2009-07-15 18:22:49 +02:00
Max Kellermann d897170455 playlist: no CamelCase 2009-07-14 21:28:36 +02:00
Max Kellermann 45df3e5e54 main: fix "unused local variable" warning
The variables "success" and "error" are only used if SQLite support is
enabled.
2009-07-06 22:48:34 +02:00
Max Kellermann 0c2ab17e91 sticker: use GError for error handling 2009-07-05 08:29:47 +02:00
Max Kellermann 637c6a1850 conf: log unused/unknown block parameters 2009-06-25 08:42:25 +02:00
Sean McNamara 9c63ffa546 Winsock2 is needed on MinGW (or other pure Win32 toolchains) for
networking, select(), ntohl(), etc.
2009-03-27 18:02:31 +01:00
Max Kellermann a899c210b9 log: removed DEBUG() and FATAL()
Use GLib the logging functions g_debug(), g_error() instead.
2009-03-15 18:23:00 +01:00
Avuton Olrich 0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann 01cf7feac7 pipe: added music_buffer, rewrite music_pipe
Turn the music_pipe into a simple music_chunk queue.  The music_chunk
allocation code is moved to music_buffer, and is now managed with a
linked list instead of a ring buffer.  Two separate music_pipe objects
are used by the decoder for the "current" and the "next" song, which
greatly simplifies the cross-fading code.
2009-03-06 00:42:03 +01:00
Max Kellermann c655f804a9 music_pipe: moved struct music_chunk to chunk.h 2009-03-03 22:23:25 +01:00
Max Kellermann c0ffec2fd1 database: db_load() returns GError
Do error reporting with GLib's GError library.
2009-03-02 15:42:21 +01:00
Max Kellermann 9bb3f2d060 listen: no CamelCase
Renamed functions.
2009-02-24 17:42:36 +01:00
Max Kellermann 4493a96425 output_all: no CamelCase
Renamed functions and variables.
2009-02-10 18:51:51 +01:00
Max Kellermann a3a6eefcfe audio: moved code to output_all.c
Moved code which deals with all audio outputs at once into a separate
library.
2009-02-10 18:51:49 +01:00
Max Kellermann 8d3205871c playlist: renamed global "playlist" variable to "g_playlist"
Export the "g_playlist" variable, and pass it to all playlist
functions.  This way, we can split playlist.c easier into separate
parts.  The code which initializes the singleton variable is moved to
playlist_global.c.
2009-02-04 18:56:41 +01:00
Max Kellermann fdb80e74b7 main: don't pass argv[0] to openDB()
Don't mention the program name in the error message.
2009-02-02 16:58:51 +01:00
Max Kellermann 37bcd711b5 main: create database after daemonization
When the update thread is started before MPD has forked (for
daemonization), it is killed, because threads do not survive a fork().
This induces an inconsistent state where MPD won't start any update
thread at all, because it thinks the thread is already running.
2009-02-02 16:57:24 +01:00
Max Kellermann 188f9e663c mixer: configure legacy mixer before the audio outputs
Reimplemented the legacy mixer configuration: copy the deprecated
configuration values into the audio_output section.  Don't configure
the mixers twice (once for the audio_output, and a second time for the
legacy values).

This requires volume_init() to be called before initAudioDriver().
2009-01-25 17:38:02 +01:00