aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2007-09-07decode: fix seek when pausedEric Wong1-0/+1
We need to SIGCONT the decoder process to allow for seeking while paused. git-svn-id: https://svn.musicpd.org/mpd/trunk@6864 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-09-06Once again get rid of busy waiting and use SIGSTOP for pauseEric Wong1-4/+10
The problems I had were related to the OSS driver and USB device I was using. The problems existed even with the old busy-waiting scheme enabled. OSS - Bithead USB => bad ALSA - Bithead USB => OK OSS - Onboard i8x0 => OK ALSA - Onboard i8x0 => OK bad - slow shutdown, pauses, dropped audio after pause/resume git-svn-id: https://svn.musicpd.org/mpd/trunk@6861 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-09-06return to busy-waiting on pause for now..Eric Wong1-10/+4
Until we can fix it properly (or replace it with a cleaner event system), I don't want this in trunk. Currently there are strange pauses when queueing and during shutdown that I can't seem to figure out right away. git-svn-id: https://svn.musicpd.org/mpd/trunk@6860 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-08-27removing debug messages from signal handlersJ. Alexander Treuman1-3/+5
As unfortunate as it is to remove such useful debugging messages, it's necessary to fix a potential deadlock with signal handling. A bunch of functions the debug functions call aren't safe to call from a signal handler. There are some alternate solutions, but they're neither pretty nor simple. So just remove them entirely for now. git-svn-id: https://svn.musicpd.org/mpd/trunk@6828 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-08-27send SIGSTOP to player and decoder processes on pause, tooEric Wong1-4/+10
as with the stop command, this will cause the player and decoder to suspend and not wake up hundreds of times a second to poll a variable for wakeup. This will reduce power consumption on some CPUs while mpd is paused and not playing. tests: pause && unpause => OK pause && stop && play => OK pause && exit && restart w/statefile && unpause => OK pause && block sound device && \ unpause => failed to open sound device \ => still paused and suspended => unblock sound device && unpause => OK (playing) In all cases, the player process releases the audio device when paused before going into the suspended state. git-svn-id: https://svn.musicpd.org/mpd/trunk@6822 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-08-12decode: close audio device after initial open if pausedJ. Alexander Treuman1-1/+5
Currently, if we start decoding while the pause flag is set, we open the audio device and leave it opened, blocking other apps from using it. The obvious thing to do is to not open the audio device if the pause flag is set, but the open call also sets the audio format. Therefore I'm leaving the open call in, and just closing it immediately afterwards if the pause flag is set. git-svn-id: https://svn.musicpd.org/mpd/trunk@6745 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-08-12decode: reformatting for better readabilityJ. Alexander Treuman1-6/+9
git-svn-id: https://svn.musicpd.org/mpd/trunk@6742 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-25decode: prefer fileDecodeFunc over streamDecodeFunc for filesJ. Alexander Treuman1-9/+10
Only wavpack implements both fileDecodeFunc and streamDecodeFunc, and it's fileDecodeFunc provides more functionality. So try using that first. This commit also fixes a bug where the plugin test loop wouldn't break once a suitable plugin was found if it used fileDecodeFunc. git-svn-id: https://svn.musicpd.org/mpd/trunk@6655 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-09Remove a useless if (quit) block. It's enclosed in two while loops: theJ. Alexander Treuman1-4/+0
top depending on !quit, which doesn't set it anywhere before the if (quit) block is reached, and the inner one which doesn't set quit at all. Since it's a local variable and can't be modified externally, it'll never be hit. git-svn-id: https://svn.musicpd.org/mpd/trunk@6524 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-07Send SIGCONT to the decode process before sending it SIGTERM.J. Alexander Treuman1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@6503 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-04Don't send the main process SIGUSR1 until we've sent the decode processJ. Alexander Treuman1-1/+2
SIGSTOP. git-svn-id: https://svn.musicpd.org/mpd/trunk@6486 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-04Don't kill the player process (and effectively the decode process) whenJ. Alexander Treuman1-4/+16
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
2007-06-04Cleanup some formatting in decode.c.J. Alexander Treuman1-10/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@6480 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-03Don't stop decoding when unpausing fails because no audio device can beJ. Alexander Treuman1-5/+5
opened. Instead just remain in paused state. git-svn-id: https://svn.musicpd.org/mpd/trunk@5820 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-03Reformatting some code.J. Alexander Treuman1-5/+5
git-svn-id: https://svn.musicpd.org/mpd/trunk@5819 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-11#1) fix a few potential deadlock conditons in decode.c when crossfading is ↵Warren Dukes1-5/+6
enabled #2) fix a deadlock condition when attempting to seek if the decoder quit and returned to playerInit() git-svn-id: https://svn.musicpd.org/mpd/trunk@5325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-24on second thought, comment out the debug statement so that users aren't ↵Warren Dukes1-1/+1
potentially flooded git-svn-id: https://svn.musicpd.org/mpd/trunk@5270 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-24add debug statement for bug #1380Warren Dukes1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5269 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14Don't initialize globals to zero (or NULL)Eric Wong1-1/+1
Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-12-24Do not set metadataState to PLAYER_METADATA_STATE_READ when decoding stops.J. Alexander Treuman1-1/+0
This fixes a bug where streams that won't play somehow appear with the metadata of a previously played stream. As far as I can tell, the only reason this is done is to sync any buffered metadata with the displayed metadata when decoding stops, so there should be no other adverse effects. git-svn-id: https://svn.musicpd.org/mpd/trunk@5161 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-12-23Adding support for seeking HTTP streams.J. Alexander Treuman1-1/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@5159 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong1-2/+2
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-20Fix warnings for -Wmissing-prototypesAvuton Olrich1-1/+1
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
2006-08-14Revert leaks from r4311, and also the leak fixes as a result of thatEric Wong1-7/+3
utf8ToFsCharset() and fsCharsetToUtf8() got very broken in r4311, and resulted in several commits to fix those leaks. Unfortunately, not all of those newly introduced leaks were fixed, nor was the result pretty. Also, fixed a double-free in lsPlaylists(). This is very hard to trigger (and therefore exploit) at the moment because we check printDirectoryInfo() beforehand. Intended behavior for utf8ToFsCharset() and fsCharsetToUtf8() as God^H^H^Hshank originally intended is now documented in path.h to prevent future errors like this. mpd could still use some good valgrind testing before the 0.12.0 release. <plug>In addition to reducing heap fragmentation, malloc reductions from mpd-ke greatly reduces the chance of leaks from happening due to programming errors.</plug> git-svn-id: https://svn.musicpd.org/mpd/trunk@4639 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-08more sparse cleanupsEric Wong1-1/+1
* less-commonly compiled things like ao/mvp outputs * Adding -Wno-transparent-union to SPARSE_FLAGS makes it check inside decode.c, directory.c, player.c, and sig_handlers.c * remove unused variables leftover from the master process in sig_handlers.c git-svn-id: https://svn.musicpd.org/mpd/trunk@4598 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01logging cleanupsEric Wong1-2/+2
* 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-07-30remove clumsy strncpy useEric Wong1-18/+8
strncpy isn't really safe because it doesn't guarantee null termination, and we have had to work around it in several places. strlcpy (from OpenBSD) isn't great, either because it often leaves errors going unchecked (by truncating strings). So we'll add the pathcpy_trunc() function with is basically strlcpy with a hardcoded MAXPATHLEN as the limit, and we'll acknowledge truncation since we only work on paths and MAXPATHLEN should be set correctly by the system headers[1]. file-specific notes: inputStream_http: eyeballing the changes here, it seems to look alright but I haven't actually tested it myself. ls: don't even bother printing a file if the filename is too long (and when is it ever?) since we won't be able to read it anyways. metadataChunk: it's only metadata, and it's only for showin the user, so truncating it here souldn't be a big issue. memset to zero in init is unecessary, so lets not waste cycles [1] - If the system headers are screwed up, then we're majorly screwed regardless of what we do :x git-svn-id: https://svn.musicpd.org/mpd/trunk@4491 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20Add mpd-indent.shAvuton Olrich1-258/+253
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
2006-07-16Fixing a whopping 4 memory leaksJ. Alexander Treuman1-1/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@4371 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14[CLEANUP] Cleanup spaces->tabsAvuton Olrich1-87/+87
Make functions static where it makes sense git-svn-id: https://svn.musicpd.org/mpd/trunk@4335 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Change shank's email addressJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Remove test on a local variable that won't have been modified yetJ. Alexander Treuman1-1/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@4324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Remove unused playSilenceOrSleep macroJ. Alexander Treuman1-6/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@4323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Remove some misleading comments, fix shanks terrible spellingJ. Alexander Treuman1-6/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4322 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13Huge header update, update the copyright and addAvuton Olrich1-1/+1
the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-16merge with mpd/trunk up to r3925Eric Wong1-21/+60
git-svn-id: https://svn.musicpd.org/mpd/trunk@3926 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-12-17call dropBufferedAudio() when pausingWarren Dukes1-1/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@3732 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-11-19gcc 2.95 fixesEric Wong1-1/+1
audioOutput_osx.c, aac_decode.c, mp4_decode.c have NOT been thoroughly checked, but I nevertheless managed to eyeball and fix one incompatibility in audioOutput_osx.c All other files have been build successfully with gcc 2.95 git-svn-id: https://svn.musicpd.org/mpd/trunk@3688 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-11-16DJWLindenaar balanced tree and master process patchQball Cow1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3669 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-08-20"&", not "&&" (the bug itself was harmless, but a bug nevertheless)Eric Wong1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3445 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-21drop the current audio buffer when seekingWarren Dukes1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3107 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-19fix some signal handlingWarren Dukes1-9/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-10todo update, and remove a potentially gratutious playSilence() callWarren Dukes1-1/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@3051 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-09*) add support for pid filesWarren Dukes1-36/+39
*) 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-08undo fix for killall not preserving the current format properly, it causes ↵Warren Dukes1-2/+5
problems for alsa and other things that spawn extra process w/o us knowing git-svn-id: https://svn.musicpd.org/mpd/trunk@3039 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-08now player and decoder processes should only exit() when receiving term ↵Warren Dukes1-2/+3
signal from their respective parent processes git-svn-id: https://svn.musicpd.org/mpd/trunk@3034 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-05implemented dropping of current buffered audio, works for oss, but there seemsWarren Dukes1-0/+1
to be a "blip" for alsa devices, needs more work git-svn-id: https://svn.musicpd.org/mpd/trunk@3011 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-10merge changes from metadata-rewrite branchWarren Dukes1-4/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@2589 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-03forgot a '\n' at the end of a error statementWarren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@2490 09075e82-0dd4-0310-85a5-a0d7c8717e4f