Commit Graph

251 Commits

Author SHA1 Message Date
Max Kellermann 114b3c1e78 replay_gain: no CamelCase
Renamed functions and variables.
2008-11-11 15:55:34 +01:00
Max Kellermann 54ad08ab37 replay_gain: renamed sources to replay_gain.c, replay_gain.h
No CamelCase file names.
2008-11-11 15:55:34 +01:00
Max Kellermann 7f880ab8ba main: print usage to stdout
Using the logging library here is inappropriate.
2008-11-05 20:52:14 +01:00
Max Kellermann 08aaf57ff0 log: removed warning buffer
The warning buffer is a complex piece of code for no good reason.
Remove it and find a better solution, e.g. open the log file earlier.
2008-11-05 18:37:40 +01:00
Max Kellermann b35ca9e5c4 main: initialize locale (LC_CTYPE)
Initialize libc's locale functions.  Currently, we are only interested
in LC_CTYPE (character classification), because this is what is used
by GLib's g_get_charset().
2008-11-05 18:37:39 +01:00
Max Kellermann 3002fd18cb path: no CamelCase
Rename variables and functions.
2008-11-05 18:21:52 +01:00
Max Kellermann 259c6ed164 enable GLib threading
Call g_thread_init() from main() to enable the GLib features which
make it thread safe.
2008-11-05 18:21:49 +01:00
Max Kellermann 06f9b6c379 main: don't close all file descriptors on startup
Removed closeAllFDs().  The caller is responsible for closing all file
handles.
2008-11-05 18:21:36 +01:00
Max Kellermann fd0f195bb7 music_pipe: renamed ob_* functions to music_pipe_*
Rename all functions to the new prefix.
2008-11-02 14:18:34 +01:00
Max Kellermann 767b4c95bd renamed outputBuffer.[ch] to pipe.[ch]
No CamelCase in the file name.  The output_buffer struct is going to
be renamed to music_pipe.  There are so many buffer levels in MPD, and
calling this one "output buffer" is wrong, because it's not the last
buffer before the music reaches the output devices.
2008-11-02 14:12:52 +01:00
Max Kellermann 016d996131 utils: use g_str_has_prefix() instead of prefixcmp()
Remove duplicated code from MPD.
2008-10-28 20:33:56 +01:00
Max Kellermann dbc7e9ba2f input_stream: no CamelCase
Renamed all functions and variables.
2008-10-26 20:34:47 +01:00
Max Kellermann bbaedb17d5 input_stream: renamed sources, no CamelCase
Renamed inputStream.c and inputStream_file.c.
2008-10-26 19:38:50 +01:00
Max Kellermann 6b09e4daef input_stream: added input_stream_global_finish()
The hook input_stream_global_finish() deinitializes global structures
of all input stream implementations.
2008-10-26 19:30:13 +01:00
Max Kellermann 51a6ee88f7 command: no CamelCase
Eliminate CamelCase in all public and static functions.
2008-10-22 21:40:44 +02:00
Max Kellermann 7366191f0d mapper: moved musicDir initialization from path.c
Moved the musicDir variable and its initialization code from path.c to
mapper.c.
2008-10-15 19:36:33 +02:00
Max Kellermann a3e3d2c950 command: added command "idle"
"idle" waits until something noteworthy happens on the server,
e.g. song change, playlist modified, database updated.  This allows
clients to keep up to date without polling.
2008-10-14 22:38:14 +02:00
Max Kellermann ba892cbcb0 changed package name to "mpd-mk", updated version number
This git branch has become a real MPD fork now.  Time to change the
package name to the code name "mpd-mk".  Set the version number to
"0.14~git" to mark this as a non-released version.
2008-10-14 17:21:27 +02:00
Max Kellermann 7dd099a60f update: don't export updateDirectory()
If the user requests database update during startup, call
directory_update_init().  This should be changed to fully asynchronous
update later.

For this to work, main_notify has to be initialized before db_init().
2008-10-09 19:11:54 +02:00
Max Kellermann bb8a9533b1 database: renamed functions, "db_" prefix and no CamelCase
Yet another CamelCase removal patch.
2008-10-08 11:07:55 +02:00
Max Kellermann 8a50e8a266 directory: moved code to database.c
Taming the directory.c monster, part II: move the database management
stuff to database.  directory.c should only contain code which works
on directory objects.
2008-10-08 11:07:35 +02:00
Max Kellermann 7b9bed8398 directory: moved code to update.c
The source directory.c mixes several libraries: directory object
management, database management and database update, resulting in a
1000+ line monster.  Move the whole database update code to update.c.
2008-10-08 10:48:48 +02:00
Eric Wong a0364d38d3 directory: remove "Mp3" references
MPD has supported more audio formats than just MP3
for over five years...
2008-09-29 13:17:42 +02:00
Max Kellermann a0272c2d61 notify: added notify_deinit()
Destroy the mutex when it is not used anymore.
2008-09-24 07:14:11 +02:00
Eric Wong 3f0ae13c4b directory: update do its work inside a thread
A lot of the preparation was needed (and done in previous
months) in making update thread-safe, but here it is.

This was the first thing I made work inside a thread when I
started mpd-uclinux many years ago, and also the last thing I've
done in mainline mpd to work inside a thread, go figure.
2008-09-23 22:37:18 +02:00
Eric Wong 27fad52c6b start using prefixcmp()
LOC reduction and less noise makes things easier for
tired old folks to follow.
2008-09-23 20:48:12 +02:00
Max Kellermann be046b25a4 output: static audio_output_plugin list as array
Instead of having to register each output plugin, store them
statically in an array.  This eliminates the need for the List library
here, and saves some small allocations during startup.
2008-09-08 11:43:13 +02:00
Max Kellermann 91502cd71e tag: renamed functions, no CamelCase 2008-08-29 09:38:21 +02:00
Max Kellermann c0197c58ba client: renamed all public functions
Functions which operate on the whole client list are prefixed with
"client_manager_", and functions which handle just one client just get
"client_".
2008-08-28 20:03:02 +02:00
Max Kellermann deb29e0884 renamed interface.c to client.c
I don't believe "interface" is a good name for something like
"connection by a client to MPD", let's call it "client".  This is the
first patch in the series which changes the name, beginning with the
file name.
2008-08-28 20:02:43 +02:00
Max Kellermann 1560a70b01 include cleanup
Only include headers which are really needed.
2008-08-28 20:01:08 +02:00
Max Kellermann e2c8b960de moved code to pc_init(), dc_init() 2008-08-26 08:45:14 +02:00
Max Kellermann 5e51fa020d renamed player.c to player_control.c
Give player.c a better name, meaning that the code is used to control
the player thread.
2008-08-26 08:44:38 +02:00
Max Kellermann a2b24462e8 renamed decoderInit() to decoder_thread_start() 2008-08-26 08:44:29 +02:00
Max Kellermann dff8c6450b renamed decode.c to decoder_thread.c
It should be obvious in which thread or context a function is being
executed at runtime.  The code which was left in decode.c is for the
decoder thread itself; give the file a better name.
2008-08-26 08:44:12 +02:00
Max Kellermann 4255bba0f7 moved global variable "pc" to player.h
This is the last of the three variables.  Now we don't need
playerData.h anymore in most sources.
2008-08-26 08:41:05 +02:00
Max Kellermann 1c03c721ea moved variable "dc" to decode.h
Now that "dc" is available here, we don't have to pass it to
decoder_is_idle() and decoder_is_starting() anymore.
2008-08-26 08:40:47 +02:00
Max Kellermann e8bd9ddc9f moved code to player_thread.c
Move code which runs in the player thread to player_thread.c.  Having
a lot of player thread code in decode.c isn't easy to understand.
2008-08-26 08:27:09 +02:00
Max Kellermann e754ed01a7 renamed functions in decoder_list.h
InputPlugin to decoder_plugin, and no camelCase.
2008-08-26 08:27:09 +02:00
Max Kellermann 41c5fbbb07 renamed inputPlugin.* to decoder_list.*
Since inputPlugin.c manages the list of registered decoders, we should
rename the source file.
2008-08-26 08:27:08 +02:00
Max Kellermann a383f45117 enable -Wpointer-arith, -Wstrict-prototypes
Also enable -Wunused-parameter - this forces us to add the gcc
"unused" attribute to a lot of parameters (mostly library callback
functions), but it's worth it during code refactorizations.
2008-08-26 08:27:02 +02:00
Eric Wong f57be50d73 remove audioDeviceStates from playerData and getPlayerData
git-svn-id: https://svn.musicpd.org/mpd/trunk@7372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-06-02 10:10:26 +00:00
Eric Wong dec6b1612e Stop passing our single DecoderControl object everywhere
This at least makes the argument list to a lot of our plugin
functions shorter and removes a good amount of line nois^W^Wcode,
hopefully making things easier to read and follow.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13 01:16:03 +00:00
Eric Wong 98acfa8ac5 Get rid of PlayerControl inside the PlayerData struct
It actually increases our image size a small bit and may even
hurt performance a very small bit, but makes the code less
verbose and easier to manage.

I don't see a reason for mpd to ever support playing multiple
files at the same time (users can run multiple instances of mpd
if they really want to play Zaireeka, but that's such an edge
case it's not worth ever supporting in our code).

git-svn-id: https://svn.musicpd.org/mpd/trunk@7352 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13 01:15:50 +00:00
Eric Wong baf9b94ecf Fix the problem of songs not advancing without client activity
The select() in the main event loop blocks now (saving us many
unnecessary wakeups).  This interacted badly with the threads
that were trying to wakeup the main task via
pthread_cond_signal() since the main task was not blocked
on a condition variable, but on select().

So now if we detect a need to wakeup the player, we write
to a pipe which select() is watching instead of blindly
calling pthread_cond_signal().

git-svn-id: https://svn.musicpd.org/mpd/trunk@7347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 09:46:11 +00:00
Max Kellermann 14529af732 pass dc to decoder_task()
git-svn-id: https://svn.musicpd.org/mpd/trunk@7323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:19:50 +00:00
Max Kellermann 1465bfab82 pass pc to player_task()
Another global variable cleanup patch.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:19:38 +00:00
Max Kellermann 4ee8396f41 use the notify API in the main thread
git-svn-id: https://svn.musicpd.org/mpd/trunk@7283 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:14:45 +00:00
Eric Wong 9cf66d0e8a Initial cut of fork() => pthreads() for decoder and player
I initially started to do a heavy rewrite that changed the way processes
communicated, but that was too much to do at once.  So this change only
focuses on replacing the player and decode processes with threads and
using condition variables instead of polling in loops; so the changeset
itself is quiet small.

* The shared output buffer variables will still need locking
to guard against race conditions.  So in this effect, we're probably
just as buggy as before.  The reduced context-switching overhead of
using threads instead of processes may even make bugs show up more or
less often...

* Basic functionality appears to be working for playing local (and NFS)
audio, including:
play, pause, stop, seek, previous, next, and main playlist editing

* I haven't tested HTTP streams yet, they should work.

* I've only tested ALSA and Icecast.  ALSA works fine, Icecast
metadata seems to get screwy at times and breaks song
advancement in the playlist at times.

* state file loading works, too (after some last-minute hacks with
non-blocking wakeup functions)

* The non-blocking (*_nb) variants of the task management functions are
probably overused.  They're more lenient and easier to use because
much of our code is still based on our previous polling-based system.

* It currently segfaults on exit.  I haven't paid much attention
to the exit/signal-handling routines other than ensuring it
compiles.  At least the state file seems to work.  We don't
do any cleanups of the threads on exit, yet.

* Update is still done in a child process and not in a thread.
To do this in a thread, we'll need to ensure it does proper
locking and communication with the main thread; but should
require less memory in the end because we'll be updating
the database "in-place" rather than updating a copy and
then bulk-loading when done.

* We're more sensitive to bugs in 3rd party libraries now.
My plan is to eventually use a master process which forks()
and restarts the child when it dies:
locking and communication with the main thread; but should
require less memory in the end because we'll be updating
the database "in-place" rather than updating a copy and
then bulk-loading when done.

* We're more sensitive to bugs in 3rd party libraries now.
My plan is to eventually use a master process which forks()
and restarts the child when it dies:

master - just does waitpid() + fork() in a loop
\- main thread
\- decoder thread
\- player thread

At the beginning of every song, the main thread will set
a dirty flag and update the state file.  This way, if we
encounter a song that triggers a segfault killing the
main thread, the master will start the replacement main
on the next song.

* The main thread still wakes up every second on select()
to check for signals; which affects power management.

[merged r7138 from branches/ew]

git-svn-id: https://svn.musicpd.org/mpd/trunk@7240 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:08:00 +00:00
Max Kellermann c6ceceae8a moved handlePendingSignals() check into while() condition
For code unification: for me, it looks ugly to do a break in the
command in a while() block.  This belongs into the while condition.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7193 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26 10:37:02 +00:00
Eric Wong cb8f1af3bd Cleanup #includes of standard system headers and put them in one place
This will make refactoring features easier, especially now that
pthreads support and larger refactorings are on the horizon.

Hopefully, this will make porting to other platforms (even
non-UNIX-like ones for masochists) easier, too.

os_compat.h will house all the #includes for system headers
considered to be the "core" of MPD.  Headers for optional
features will be left to individual source files.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03 07:29:49 +00:00
Eric Wong b79f6b882a Merge branches/ew r7104
thread-safety work in preparation for rewrite to use pthreads

Expect no regressions against trunk (r7078), possibly minor
performance improvements in update (due to fewer heap
allocations), but increased stack usage.

Applied the following patches:

* maxpath_str for reentrancy (temporary fix, reverted)
* path: start working on thread-safe variants of these methods
* Re-entrancy work on path/character-set conversions
* directory.c: exploreDirectory() use reentrant functions here
* directory/update: more use of reentrant functions + cleanups
* string_toupper: a strdup-less version of strDupToUpper
* get_song_url: a static-variable-free version of getSongUrl()
* Use reentrant/thread-safe get_song_url everywhere
* replace rmp2amp with the reentrant version, rmp2amp_r
* Get rid of the non-reentrant/non-thread-safe rpp2app, too.
* buffer2array: assert strdup() returns a usable value in unit tests
* replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants
* fix storing playlists w/o absolute paths
* parent_path(), a reentrant version of parentPath()
* parentPath => parent_path for reentrancy and thread-safety
* allow "make test" to automatically run embedded unit tests
* remove convStrDup() and maxpath_str()
* use MPD_PATH_MAX everywhere instead of MAXPATHLEN
* path: get rid of appendSlash, pfx_path and just use pfx_dir
* get_song_url: fix the ability to play songs in the top-level music_directory

git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-12-28 02:56:25 +00:00
J. Alexander Treuman 1b68d00b3b Don't initialize zeroconf until after we've daemonized and log output has
been redirected.  This prevents zeroconf from blocking daemonization, and
makes sure any errors get sent to the logs and not stdout.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6477 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-04 17:41:18 +00:00
J. Alexander Treuman bba444524e Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a single
call to FATAL().

git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26 18:15:54 +00:00
J. Alexander Treuman f67b6b896f Removing references to options.updateDB in main.c.
git-svn-id: https://svn.musicpd.org/mpd/trunk@5944 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-25 18:47:34 +00:00
Avuton Olrich a061da8fb5 The massive copyright update
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05 03:22:33 +00:00
J. Alexander Treuman 7b1e14b8e8 Reverting all of my localization changes. It was a horrible
implementation, and fixing it is a big enough job that I don't know when
I'll get around to it.  Probably best just starting from scratch anyhow.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-18 00:42:22 +00:00
J. Alexander Treuman 9a222cab6c Call initLocalization() earlier so that errors, --version, etc. output
correctly.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5264 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-17 16:06:21 +00:00
Jim Ramsay 5d79aced8c Added zeroconf service publishing using avahi
git-svn-id: https://svn.musicpd.org/mpd/trunk@5238 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-11 20:41:17 +00:00
J. Alexander Treuman 438c1add9d Convert log messages sent to stdout to the current locale's charset.
git-svn-id: https://svn.musicpd.org/mpd/trunk@5227 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-08 04:31:44 +00:00
J. Alexander Treuman bcb493cfd3 Moving localization stuff from path.c to localization.c so we can reuse it
for log messages when outputting to console.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5225 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-08 03:15:33 +00:00
Eric Wong 90847fc881 Replace strdup and {c,re,m}alloc with x* variants to check for OOM errors
I'm checking for zero-size allocations and assert()-ing them,
so we can more easily get backtraces and debug problems, but we'll
also allow -DNDEBUG people to live on the edge if they wish.

We do not rely on errno when checking for OOM errors because
some implementations of malloc do not set it, and malloc
is commonly overridden by userspace wrappers.

I've spent some time looking through the source and didn't find any
obvious places where we would explicitly allocate 0 bytes, so we
shouldn't trip any of those assertions.

We also avoid allocating zero bytes because C libraries don't
handle this consistently (some return NULL, some not); and it's
dangerous either way.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26 06:25:57 +00:00
Eric Wong e5df85db15 Several bugfixes during exit found by valgrind
First, make sure we call finishPlaylist() before
closeMp3Directory() since the latter will free non-SONG_TYPE_URL
songs in playlist, which causes an invalid read when we try to
look for SONG_TYPE_URL songs to free in finishPlaylist.

Secondly, make sure our children have all exited before freeing
the playerData.  If we do not, slowly-delivered signals can
trigger a race condition in the signal handlers of the decode
and player processes which rely on getPlayerData.  To avoid
waitpid-ing too long (or at all), move the freePlayerData() call
farther down in main() (this won't affect anything else)
to give the OS a better chance to deliver signals and finish running
sig handlers for terminated children.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4640 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-14 23:31:08 +00:00
Eric Wong ae97bcdfa2 sparse / gcc-2.95 / -pedantic fixes
Not everybody has access to the latest and greatest compilers.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4595 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 20:49:20 +00:00
Warren Dukes 31de97a42b merge changes from mpd-tree:
-use tree for tagTracker
-eliminate the master process

git-svn-id: https://svn.musicpd.org/mpd/trunk@4571 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 06:40:11 +00:00
Eric Wong 980c717749 main.c: initialize the verbose flag correctly
git-svn-id: https://svn.musicpd.org/mpd/trunk@4533 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 01:57:52 +00:00
Eric Wong 89073cfbba logging cleanups
* Moved all logging-related stuff into log.c
(and not myfprintf.c)

* ISO C90-compliant strftime usage:
%e and %R replaced with %d and %H:%M respectively

* Got rid of variadic macros since some old-school compilers
don't like them

* compiling with -DNDEBUG disables the DEBUG() macro

git-svn-id: https://svn.musicpd.org/mpd/trunk@4512 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 04:18:53 +00:00
Eric Wong 12aec5738b Standardize state_file handling routines.
This way it's easier to manage and extend.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4494 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:47 +00:00
Eric Wong 381d7232a0 remove deprecated myfprintf wrapper
This shaves another 5-6k because we've removed the paranoid
fflush() calls after every fprintf.  Now we only fflush()
when we need to

git-svn-id: https://svn.musicpd.org/mpd/trunk@4493 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:39 +00:00
J. Alexander Treuman 22b16884a2 Use AudioCompress for volume normalization
git-svn-id: https://svn.musicpd.org/mpd/trunk@4474 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 00:50:59 +00:00
J. Alexander Treuman e880a878bc Open the db file before daemonizing/creating the master process, so we can handle failures gracefully
git-svn-id: https://svn.musicpd.org/mpd/trunk@4454 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-24 19:21:27 +00:00
J. Alexander Treuman 95af15ce8f Initialize more stuff before daemonizing so we exit properly on fatal errors
git-svn-id: https://svn.musicpd.org/mpd/trunk@4421 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-21 17:48:54 +00:00
J. Alexander Treuman 160dbe080c Rolling back change to when we redirect to logs. Turns out it silenced fatal audio_output errors.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4415 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20 22:47:34 +00:00
Avuton Olrich 00e67be7c9 Add mpd-indent.sh
Add a few new options for indent to try to make
things a bit cleaner

git-svn-id: https://svn.musicpd.org/mpd/trunk@4411 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20 18:53:56 +00:00
J. Alexander Treuman adcc266250 Redirect to log files earlier to prevent some debug spam on console
git-svn-id: https://svn.musicpd.org/mpd/trunk@4406 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-19 18:22:06 +00:00
Avuton Olrich 0905630073 Fix whitespace->tabs in main.c, it was afu
git-svn-id: https://svn.musicpd.org/mpd/trunk@4405 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-19 18:04:15 +00:00
J. Alexander Treuman e6b0d82c2e Don't bother freeing a bunch of stuff at exit, since it takes far too long and accomplishes nothing.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4396 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-18 15:50:10 +00:00
J. Alexander Treuman b38157fc76 Committing qball's patch to list supported audio outputs in --version
git-svn-id: https://svn.musicpd.org/mpd/trunk@4357 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-16 14:57:26 +00:00
Eric Wong 563e4c95fd main: static-fication, ANSI fixes
git-svn-id: https://svn.musicpd.org/mpd/trunk@4354 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-15 13:16:52 +00:00
Eric Wong 37bdf3f3d2 Avoid spewing messages to the console
Just setupLogOutput and redirect things to the logs before
spawning the main process.  We've already daemonized at this
point, so we've already proven that we can fork, but we haven't
done it yet.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-15 12:41:18 +00:00
J. Alexander Treuman ecb26ef1b0 Update copyright in --version
git-svn-id: https://svn.musicpd.org/mpd/trunk@4334 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 19:45:13 +00:00
J. Alexander Treuman 2fa7125cce Change shank's email address
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 19:37:45 +00:00
Avuton Olrich a37348a74f Huge header update, update the copyright and add
the GPL header where necessary

git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13 19:20:34 +00:00
Avuton Olrich 8f37161c34 Declare functions not used outside dbUtils.c static.
Remove a disabled function from dbUtils.c out of main.c

git-svn-id: https://svn.musicpd.org/mpd/trunk@4314 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13 18:46:58 +00:00
Eric Wong 10cf5add40 main.c: fix gcc-2.95 compilation problem
git-svn-id: https://svn.musicpd.org/mpd/trunk@4251 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-06-05 22:26:04 +00:00
J. Alexander Treuman 9b06d2cd4a Made pid_file an optional config parameter.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4250 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-06-05 20:05:24 +00:00
Eric Wong 5cbfdf3517 correctly check for setenv() function
git-svn-id: https://svn.musicpd.org/mpd/trunk@4245 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-06-04 11:36:06 +00:00
Qball Cow 66e4379d69 Jat/Q patch for checking permission on database before creating it
git-svn-id: https://svn.musicpd.org/mpd/trunk@4140 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-08 21:03:47 +00:00
Qball Cow 37c9265357 Commit Jat's patch for bug 1281
git-svn-id: https://svn.musicpd.org/mpd/trunk@4136 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-08 08:14:37 +00:00
Qball Cow e1a15f74fd update help text
git-svn-id: https://svn.musicpd.org/mpd/trunk@4128 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-04-30 14:52:58 +00:00
Avuton Olrich 8220d3deac Fix for the macro, use gitsetenv, thanks to normalperson, eleusis, jat
git-svn-id: https://svn.musicpd.org/mpd/trunk@4098 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-04-22 22:18:15 +00:00
Avuton Olrich 3accf44add Solaris is reported to not have a setenv() thus
breaking compilation. This fixes that problem with
a macro that emulates setenv() with putenv().

git-svn-id: https://svn.musicpd.org/mpd/trunk@4097 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-04-22 21:30:48 +00:00
Eric Wong a25acbc94f rewrite statefile code for audio devices
In the words of the original author, it was 'crappy'.  I tend to
agree :)

The code has also been broken for at least the past few months,
and nobody bothered fixing it

The previous format it was overly complex: 5 lines to describe
each device.  The new format is one-line per-device:

audio_device_state:%d:%s

%d - 0 for disabled, any integer for enabled
%s - name of the device as specified in the config file,
whitespace and all

Incompatibilities:

* Output names are now _required_ to be unique.

This is required because the new format relies solely on the
name of the audio device.

Relying on the device IDs internal to MPD was a bad idea
anyways since the user usually has none or very little idea
how they're generated, and adding a new device or removing
one from a config would throw things off completely.

This is also just a Good Idea(TM) because it makes things
less confusing to users when they see it in their clients.

* Output states are not preserved from the previous format.

Not a big deal, since the previous code was never officially
released.  Also, it's been broken for months now, so I doubt
anybody would notice :)

git-svn-id: https://svn.musicpd.org/mpd/trunk@3928 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-18 03:58:31 +00:00
Eric Wong 867ca276ad Hopefully the last of the spelling fixes :>
git-svn-id: https://svn.musicpd.org/mpd/trunk@3923 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-16 06:41:41 +00:00
Eric Wong 63475b5a68 r1067@BL4ST: normalperson | 2005-12-30 19:21:28 -0800
Fix a couple of warnings (sbh, from oggflac branch)

git-svn-id: https://svn.musicpd.org/mpd/trunk@3752 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-12-31 03:23:46 +00:00
Qball Cow a34c4af172 Configure fix, so when no glib found it gives a error, and another race condition fix in the master proces patch.
git-svn-id: https://svn.musicpd.org/mpd/trunk@3730 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-12-14 10:32:48 +00:00
Qball Cow 4b00c62587 DJWLindenaar's fix race condition and some memory leaks patch
git-svn-id: https://svn.musicpd.org/mpd/trunk@3681 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-11-18 12:09:05 +00:00
Qball Cow 32e5f4ca2b DJWLindenaar balanced tree and master process patch
git-svn-id: https://svn.musicpd.org/mpd/trunk@3669 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-11-16 14:43:04 +00:00
Qball Cow 2aba0437a6 Saving state of output-device in state-file. (This is a temporary solution, rewrite of state-file is planned for 0.13)
git-svn-id: https://svn.musicpd.org/mpd/trunk@3449 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-08-23 12:01:37 +00:00
Warren Dukes aa7b698086 *) slight code cleanup
*) now --kill will not check for /proc/<pid>/exe (this is linux specific)

git-svn-id: https://svn.musicpd.org/mpd/trunk@3063 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-12 22:38:49 +00:00
Warren Dukes 8583a3bc4e if no audioOutput specified, we no attempt to detect if there exists a usable oss or alsa device
git-svn-id: https://svn.musicpd.org/mpd/trunk@3057 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-12 03:10:09 +00:00
Warren Dukes 384ecd09c1 fix segfault in error message
git-svn-id: https://svn.musicpd.org/mpd/trunk@3046 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-09 03:45:30 +00:00
Warren Dukes 5f8bf2b4bb add ability to forcefully kill pid listed in pid file with '-kill -kill'
git-svn-id: https://svn.musicpd.org/mpd/trunk@3045 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-09 03:40:02 +00:00
Warren Dukes 70463a1dac don't print out config line in error message about pid file missing
git-svn-id: https://svn.musicpd.org/mpd/trunk@3044 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-09 03:30:34 +00:00
Warren Dukes c673bc86cd fix an error message
git-svn-id: https://svn.musicpd.org/mpd/trunk@3043 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-09 03:29:30 +00:00
Warren Dukes 4c7c6ca4a6 *) add support for pid files
*) we now require pid_file to specified in the config
*) new prefered method for killing mpd: mpd --kill
*) cleaned up some nastiness with decode_pid handling

git-svn-id: https://svn.musicpd.org/mpd/trunk@3042 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-09 03:13:33 +00:00
Warren Dukes 522bb6b61f update usage and mpd man page to indicate that we now require a config file
git-svn-id: https://svn.musicpd.org/mpd/trunk@3028 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-06 19:03:25 +00:00
Warren Dukes 586a21688f config file change! now 'port' is optional and 'db_file' is required!
also, should have better error reporting when failing to open playlist or
music directory's, or writing the db, etc

git-svn-id: https://svn.musicpd.org/mpd/trunk@3027 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-06 19:00:58 +00:00
Warren Dukes 3a89afdd80 remove --update-db option
git-svn-id: https://svn.musicpd.org/mpd/trunk@2719 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-20 20:28:32 +00:00
Warren Dukes 2c08fa619b a few DEBUG statements
git-svn-id: https://svn.musicpd.org/mpd/trunk@2642 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-13 23:22:22 +00:00
Warren Dukes 1d123cd496 better saved memmory display
git-svn-id: https://svn.musicpd.org/mpd/trunk@2607 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11 05:25:05 +00:00
Warren Dukes 4ec3df0339 implement saved memory by not storing full path
git-svn-id: https://svn.musicpd.org/mpd/trunk@2601 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11 02:36:25 +00:00
Warren Dukes c5d27d8eaa merge changes from metadata-rewrite branch
git-svn-id: https://svn.musicpd.org/mpd/trunk@2589 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-10 21:58:27 +00:00
Warren Dukes 405ad9e58b now one can specify multiple bind_to_addresses
git-svn-id: https://svn.musicpd.org/mpd/trunk@2501 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-03 19:42:54 +00:00
Warren Dukes 69176148bf enabling and disabling individual audioOutputs is mostly done, just need
to add the command hooks

git-svn-id: https://svn.musicpd.org/mpd/trunk@2484 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02 21:48:53 +00:00
Warren Dukes aba67249cb if a home directory is available for 'user', set env variable $HOME
git-svn-id: https://svn.musicpd.org/mpd/trunk@2426 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-31 04:34:54 +00:00
Warren Dukes ac44e94f2f fix user being parsed as a path
git-svn-id: https://svn.musicpd.org/mpd/trunk@2377 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-28 05:30:22 +00:00
Warren Dukes 58dbe4bb5d merge shank-rewrite-config changes
git-svn-id: https://svn.musicpd.org/mpd/trunk@2375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-28 05:14:55 +00:00
Warren Dukes df50ddf545 some slight cleanup in setuid code
git-svn-id: https://svn.musicpd.org/mpd/trunk@2078 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-08-29 13:37:09 +00:00
Warren Dukes 2afc2f8c0d fix typo in todo, thanx gnarf!
git-svn-id: https://svn.musicpd.org/mpd/trunk@2038 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-08-17 19:53:35 +00:00
Warren Dukes d344e8b4ed patch from Benoit.Boissinot@ens-lyon.fr to remove getgroups and setgroups
git-svn-id: https://svn.musicpd.org/mpd/trunk@2028 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-08-13 16:18:05 +00:00
Warren Dukes ba798c5e65 http proxy mostly working, need to implement http authentication
git-svn-id: https://svn.musicpd.org/mpd/trunk@1588 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-20 20:15:05 +00:00
Warren Dukes 5c6765ea52 use getdtablesize() to get the max number of fd's
git-svn-id: https://svn.musicpd.org/mpd/trunk@1579 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-20 04:37:17 +00:00
Warren Dukes aed9c23ec6 when we create log files, be sure to they're umasked to 066
git-svn-id: https://svn.musicpd.org/mpd/trunk@1443 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-12 02:29:36 +00:00
Warren Dukes 43b355734c Add WARNING log method. it's the same as ERROR, except that when mpd starts,
warnings are buffered until the error log is opened, and then flushed to the
error log.

git-svn-id: https://svn.musicpd.org/mpd/trunk@1442 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-12 02:06:16 +00:00
Warren Dukes 5b5dd126aa i'm a moron
git-svn-id: https://svn.musicpd.org/mpd/trunk@1377 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-07 20:44:41 +00:00
Warren Dukes a6fe459ee4 update copyright to 2004 for --version
git-svn-id: https://svn.musicpd.org/mpd/trunk@1375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-07 18:54:02 +00:00
Warren Dukes 817e79e3c1 fix bug with --no-create-db
git-svn-id: https://svn.musicpd.org/mpd/trunk@1373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-07 16:32:58 +00:00
Warren Dukes 630d33b234 finish ack error codes
git-svn-id: https://svn.musicpd.org/mpd/trunk@1325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-04 02:51:54 +00:00
Warren Dukes 53ac376cdc main() cleanup
git-svn-id: https://svn.musicpd.org/mpd/trunk@1298 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-02 04:05:09 +00:00
Warren Dukes decce92949 nice output of all suffix types supported in version
git-svn-id: https://svn.musicpd.org/mpd/trunk@1276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-01 04:29:34 +00:00
Warren Dukes 0244ec6247 make --create-db not daemonize, remove --only-create-db
git-svn-id: https://svn.musicpd.org/mpd/trunk@1272 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-01 01:47:49 +00:00
Warren Dukes 6a16e08f9a add --stdout and make --no-daemon by default output to log files
git-svn-id: https://svn.musicpd.org/mpd/trunk@1267 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-31 23:49:38 +00:00
Warren Dukes fd6aa25359 mp3 and ogg plugin stuff
git-svn-id: https://svn.musicpd.org/mpd/trunk@1245 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-31 01:21:17 +00:00
Warren Dukes c34d372a4d don't close STDIN_FILENO, not suppose to dup2 a closed fd
git-svn-id: https://svn.musicpd.org/mpd/trunk@1023 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-15 19:08:15 +00:00
Warren Dukes cd3180c701 stuff for configuring the audio output format (sampling rate, channels, bits)
git-svn-id: https://svn.musicpd.org/mpd/trunk@967 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-10 02:20:15 +00:00
Warren Dukes 822be0375e finish adding AliasMrJones replayGain stuff
git-svn-id: https://svn.musicpd.org/mpd/trunk@953 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-08 12:00:30 +00:00
Warren Dukes 13a3b507f2 clarify error for --no-create-db
git-svn-id: https://svn.musicpd.org/mpd/trunk@912 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-05 15:01:34 +00:00
Warren Dukes 963754b0d4 msells versions patch to list supported formats
git-svn-id: https://svn.musicpd.org/mpd/trunk@783 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-16 01:06:14 +00:00
Warren Dukes 5ea8e2d65b don't stat() the db to get the modtime everytime, instead store it when we read the db
git-svn-id: https://svn.musicpd.org/mpd/trunk@779 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-15 23:36:41 +00:00
Warren Dukes 7f29bb1a8d log cycling and a few cleanups
git-svn-id: https://svn.musicpd.org/mpd/trunk@772 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-15 05:07:04 +00:00
Warren Dukes df3af7d4f1 clean up a little bit main() code
git-svn-id: https://svn.musicpd.org/mpd/trunk@771 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-15 03:26:15 +00:00
Warren Dukes 549344d38a add vim shiznit to end of all source files
git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-14 14:53:41 +00:00
Warren Dukes 00c25b772e add --only-update-db command line option
git-svn-id: https://svn.musicpd.org/mpd/trunk@728 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-13 16:22:59 +00:00
Warren Dukes ae33b348af clean up signal handling using a polling method, from the genius that is mackstann
git-svn-id: https://svn.musicpd.org/mpd/trunk@697 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-11 23:07:43 +00:00
Warren Dukes 171a7752a8 add --only-create-db option from msells
have SIGHUP cause rereading db file

git-svn-id: https://svn.musicpd.org/mpd/trunk@663 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-11 00:52:05 +00:00
Warren Dukes 785cdb0114 use EXIT_SUCCESS and EXIT_FAILURE
git-svn-id: https://svn.musicpd.org/mpd/trunk@591 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-02 23:34:16 +00:00
Warren Dukes 53f728a0ae just to be carfile, make sure to null terminate when using strncpy
git-svn-id: https://svn.musicpd.org/mpd/trunk@506 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-27 02:52:59 +00:00
Warren Dukes 4c1eb9225d add aac_decode.[ch] and start working on it
also, if locale is C or POSIX, set fs charset to iso-8859-1

git-svn-id: https://svn.musicpd.org/mpd/trunk@347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-21 21:32:23 +00:00
Warren Dukes 68dc3517a6 move adding and removeing from tables from directory.c to song.c
git-svn-id: https://svn.musicpd.org/mpd/trunk@239 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-10 09:55:54 +00:00