aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* input_stream: no CamelCaseMax Kellermann2008-10-261-1/+1
| | | | Renamed all functions and variables.
* input_stream: renamed sources, no CamelCaseMax Kellermann2008-10-261-1/+1
| | | | Renamed inputStream.c and inputStream_file.c.
* input_stream: added input_stream_global_finish()Max Kellermann2008-10-261-0/+1
| | | | | The hook input_stream_global_finish() deinitializes global structures of all input stream implementations.
* command: no CamelCaseMax Kellermann2008-10-221-2/+2
| | | | Eliminate CamelCase in all public and static functions.
* mapper: moved musicDir initialization from path.cMax Kellermann2008-10-151-0/+3
| | | | | Moved the musicDir variable and its initialization code from path.c to mapper.c.
* command: added command "idle"Max Kellermann2008-10-141-0/+9
| | | | | | "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.
* changed package name to "mpd-mk", updated version numberMax Kellermann2008-10-141-1/+2
| | | | | | 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.
* update: don't export updateDirectory()Max Kellermann2008-10-091-1/+2
| | | | | | | | 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().
* database: renamed functions, "db_" prefix and no CamelCaseMax Kellermann2008-10-081-6/+6
| | | | Yet another CamelCase removal patch.
* directory: moved code to database.cMax Kellermann2008-10-081-1/+1
| | | | | | 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.
* directory: moved code to update.cMax Kellermann2008-10-081-0/+1
| | | | | | 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.
* directory: remove "Mp3" referencesEric Wong2008-09-291-3/+3
| | | | | MPD has supported more audio formats than just MP3 for over five years...
* notify: added notify_deinit()Max Kellermann2008-09-241-0/+4
| | | | Destroy the mutex when it is not used anymore.
* directory: update do its work inside a threadEric Wong2008-09-231-1/+1
| | | | | | | | | 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.
* start using prefixcmp()Eric Wong2008-09-231-1/+1
| | | | | LOC reduction and less noise makes things easier for tired old folks to follow.
* output: static audio_output_plugin list as arrayMax Kellermann2008-09-081-1/+0
| | | | | | 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.
* tag: renamed functions, no CamelCaseMax Kellermann2008-08-291-1/+1
|
* client: renamed all public functionsMax Kellermann2008-08-281-4/+4
| | | | | | Functions which operate on the whole client list are prefixed with "client_manager_", and functions which handle just one client just get "client_".
* renamed interface.c to client.cMax Kellermann2008-08-281-1/+1
| | | | | | | 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.
* include cleanupMax Kellermann2008-08-281-1/+0
| | | | Only include headers which are really needed.
* moved code to pc_init(), dc_init()Max Kellermann2008-08-261-0/+6
|
* renamed player.c to player_control.cMax Kellermann2008-08-261-1/+1
| | | | | Give player.c a better name, meaning that the code is used to control the player thread.
* renamed decoderInit() to decoder_thread_start()Max Kellermann2008-08-261-1/+1
|
* renamed decode.c to decoder_thread.cMax Kellermann2008-08-261-1/+1
| | | | | | 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.
* moved global variable "pc" to player.hMax Kellermann2008-08-261-0/+1
| | | | | This is the last of the three variables. Now we don't need playerData.h anymore in most sources.
* moved variable "dc" to decode.hMax Kellermann2008-08-261-0/+1
| | | | | Now that "dc" is available here, we don't have to pass it to decoder_is_idle() and decoder_is_starting() anymore.
* moved code to player_thread.cMax Kellermann2008-08-261-2/+2
| | | | | 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.
* renamed functions in decoder_list.hMax Kellermann2008-08-261-4/+4
| | | | InputPlugin to decoder_plugin, and no camelCase.
* renamed inputPlugin.* to decoder_list.*Max Kellermann2008-08-261-1/+1
| | | | | Since inputPlugin.c manages the list of registered decoders, we should rename the source file.
* enable -Wpointer-arith, -Wstrict-prototypesMax Kellermann2008-08-261-2/+2
| | | | | | 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.
* remove audioDeviceStates from playerData and getPlayerDataEric Wong2008-06-021-1/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Stop passing our single DecoderControl object everywhereEric Wong2008-04-131-1/+1
| | | | | | | 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
* Get rid of PlayerControl inside the PlayerData structEric Wong2008-04-131-1/+1
| | | | | | | | | | | | 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
* Fix the problem of songs not advancing without client activityEric Wong2008-04-121-16/+2
| | | | | | | | | | | | | 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
* pass dc to decoder_task()Max Kellermann2008-04-121-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* pass pc to player_task()Max Kellermann2008-04-121-1/+1
| | | | | Another global variable cleanup patch. git-svn-id: https://svn.musicpd.org/mpd/trunk@7321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use the notify API in the main threadMax Kellermann2008-04-121-0/+16
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7283 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Initial cut of fork() => pthreads() for decoder and playerEric Wong2008-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* moved handlePendingSignals() check into while() conditionMax Kellermann2008-03-261-3/+2
| | | | | | 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
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-14/+1
| | | | | | | | | | | | | 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
* Merge branches/ew r7104Eric Wong2007-12-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Don't initialize zeroconf until after we've daemonized and log output hasJ. Alexander Treuman2007-06-041-3/+2
| | | | | | 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
* Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman2007-05-261-29/+15
| | | | | call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Removing references to options.updateDB in main.c.J. Alexander Treuman2007-04-251-9/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5944 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Reverting all of my localization changes. It was a horribleJ. Alexander Treuman2007-02-181-3/+0
| | | | | | 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
* Call initLocalization() earlier so that errors, --version, etc. outputJ. Alexander Treuman2007-01-171-1/+1
| | | | | correctly. git-svn-id: https://svn.musicpd.org/mpd/trunk@5264 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Added zeroconf service publishing using avahiJim Ramsay2007-01-111-0/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5238 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Convert log messages sent to stdout to the current locale's charset.J. Alexander Treuman2007-01-081-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5227 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Moving localization stuff from path.c to localization.c so we can reuse itJ. Alexander Treuman2007-01-081-0/+3
| | | | | for log messages when outputting to console. git-svn-id: https://svn.musicpd.org/mpd/trunk@5225 09075e82-0dd4-0310-85a5-a0d7c8717e4f