aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix a few more warnings from -WshadowEric Wong2008-04-121-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7300 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use the notify API in the main threadMax Kellermann2008-04-121-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7283 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use the notify API in the playerMax Kellermann2008-04-121-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7282 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Start using song pointers in core data structuresEric Wong2008-04-121-3/+2
| | | | | | | Instead of copying URLs everywhere... [merged r7186 from branches/ew] git-svn-id: https://svn.musicpd.org/mpd/trunk@7244 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Drop metadata updates from HTTP for now (input HTTP, and shout)Eric Wong2008-04-121-7/+0
| | | | | | | | It is way more complicated than it should be; and locking it for thread-safety is too difficult. [merged r7183 from branches/ew] git-svn-id: https://svn.musicpd.org/mpd/trunk@7241 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Initial cut of fork() => pthreads() for decoder and playerEric Wong2008-04-121-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-3/+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
* playerCloseAudio() is staticEric Wong2008-01-031-2/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7127 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Merge branches/ew r7104Eric Wong2007-12-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* playerInit() is staticEric Wong2007-09-081-2/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6868 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Set a flag if we've sent the player process SIGSTOP so that we know not toJ. Alexander Treuman2007-06-041-0/+1
| | | | | wait for it to complete an action which it never will. git-svn-id: https://svn.musicpd.org/mpd/trunk@6488 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't kill the player process (and effectively the decode process) whenJ. Alexander Treuman2007-06-041-2/+1
| | | | | | completely stopped. Instead, send them SIGSTOP to pause the process until they're needed again. Then send them SIGCONT instead of re-spawning them. git-svn-id: https://svn.musicpd.org/mpd/trunk@6485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Tell the player process (and thus also the decode process) to quit whenJ. Alexander Treuman2007-06-011-0/+3
| | | | | | | | | | playback is stopped completely. This means the player process will no longer have to wake up 100 times per second to see if it's been told to start playing (the main process will just spawn a new player process when it needs to). On the downside, this means an extra pair of forks() and the re-initializing of the player and decode processes each time playback is restarted. git-svn-id: https://svn.musicpd.org/mpd/trunk@6446 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix warnings for -Wmissing-prototypesAvuton Olrich2006-08-201-21/+21
| | | | | | Add -Wmissing-prototypes if compiling with gcc Static where possible git-svn-id: https://svn.musicpd.org/mpd/trunk@4657 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* renamce cstrtok to buffer2array. please don't rename functions; especially ↵Warren Dukes2006-08-061-0/+2
| | | | | to names that look extremely std-lib-ish. also, don't use isspace, apparently it's local dependent and potentially consideres ' ' or '\t' not to be a space, or considers other characters to be a space. git-svn-id: https://svn.musicpd.org/mpd/trunk@4574 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* merge changes from mpd-tree:Warren Dukes2006-08-061-2/+0
| | | | | | -use tree for tagTracker -eliminate the master process git-svn-id: https://svn.musicpd.org/mpd/trunk@4571 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* interface/connection malloc reductions from mpd-keEric Wong2006-07-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch massively reduces the amount of heap allocations at the interface/command layer. Most commands with minimal output should not allocate memory from the heap at all. Things like repeatedly polling status, currentsong, and volume changes should be faster as a result, and more importantly, not a source of memory fragmentation. These changes should be safe in that there's no way for a remote-client to corrupt memory or otherwise do bad stuff to MPD, but an extra set of eyes to review would be good. Of course there's never any warranty :) No longer do we use FILE * structures in the interface, which means we don't have to allocate any new memory for most connections. Now, before you go on about losing the buffering that FILE * +implies+, remember that myfprintf() never took advantage of any of the stdio buffering features. To reduce the diff and make bugs easier to spot in the diff, I've kept myfprintf in places where we write to files (and not network interfaces). Expect myfprintf to go away entirely soon (we'll use fprintf for writing regular files). git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-9/+9
| | | | | | Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix the undefined reference to `playerInitReal'Avuton Olrich2006-07-141-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4343 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* [CLEANUP] Remove unused functionAvuton Olrich2006-07-141-6/+0
| | | | | | | | Remove unused functions from the header, static where possible Cleanup whitespace->tabs git-svn-id: https://svn.musicpd.org/mpd/trunk@4341 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Change shank's email addressJ. Alexander Treuman2006-07-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Huge header update, update the copyright and addAvuton Olrich2006-07-131-1/+1
| | | | | the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix a big time bug in metadataChunk (off by one in an array assignment)Warren Dukes2004-10-251-0/+1
| | | | | also, now we have metadata in our streams git-svn-id: https://svn.musicpd.org/mpd/trunk@2337 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* potential bugfixes for handling metadata in player/decoderWarren Dukes2004-06-071-1/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1369 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* mechanism for updating metadata while decodingWarren Dukes2004-06-061-5/+2
| | | | | | | vorbis comments are updated on the fly for streams need to decode icy metadata buffering of metadata needs to be hardened, to ensure that player has already read a particular metachunk or passed over it git-svn-id: https://svn.musicpd.org/mpd/trunk@1358 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* todo updateWarren Dukes2004-06-061-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1352 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* better method for computing total time playedWarren Dukes2004-06-031-1/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* ogg voribs comment parsing on the fly in the decoderWarren Dukes2004-06-011-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1279 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* some stream metadata fixesWarren Dukes2004-05-311-0/+8
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1266 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* icynames are now copied to title of streamsWarren Dukes2004-05-311-2/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1258 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* mp3 and ogg plugin stuffWarren Dukes2004-05-311-2/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1245 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* just a we bit of changesWarren Dukes2004-05-191-3/+5
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1075 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* rework stuff so that we can use mime-type of streams to detect type of fileWarren Dukes2004-05-181-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1062 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* don't stat() the db to get the modtime everytime, instead store it when we ↵Warren Dukes2004-04-151-0/+2
| | | | | read the db git-svn-id: https://svn.musicpd.org/mpd/trunk@779 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* log cycling and a few cleanupsWarren Dukes2004-04-151-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@772 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add vim shiznit to end of all source filesWarren Dukes2004-04-141-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* when doing signal functions (like sigaction) make sure it wasn't interrupted ↵Warren Dukes2004-04-131-0/+2
| | | | | by a signal (errno==EINTR) git-svn-id: https://svn.musicpd.org/mpd/trunk@729 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* volatile fun-nessWarren Dukes2004-04-121-24/+24
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@705 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* more volatile stuffWarren Dukes2004-04-111-3/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@699 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add volatile qualifiers to some shared mem buffer stuff, to enusre compilerWarren Dukes2004-04-111-11/+11
| | | | | doesn't optimize out order sensitive stuff git-svn-id: https://svn.musicpd.org/mpd/trunk@698 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* adjust scaling of software volumeWarren Dukes2004-04-111-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@681 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* make "update" command background/non-blockingWarren Dukes2004-04-111-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@665 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* bunch of autotool cleanupsWarren Dukes2004-03-181-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@271 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* put decode_pid in shared mem, so if player process dies, the masterWarren Dukes2004-02-271-0/+1
| | | | | can still kill the decode process. git-svn-id: https://svn.musicpd.org/mpd/trunk@107 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add xfade and audio to status, remove crossfade no args optionsWarren Dukes2004-02-271-14/+25
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@75 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* some cleanups for utf8 in playerSeek and using strncpy for copying filenamesWarren Dukes2004-02-251-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@54 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* have pause take an optional arugmentWarren Dukes2004-02-251-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@43 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* import from SF CVSWarren Dukes2004-02-231-0/+126
git-svn-id: https://svn.musicpd.org/mpd/trunk@1 09075e82-0dd4-0310-85a5-a0d7c8717e4f