aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* oggflac_plugin: fix build with libOggFLAC lib (libFLAC <= 7)Eric Wong2008-06-011-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7370 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* make DecoderControl.state an enumMax Kellerman2008-06-011-4/+6
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7369 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* notify: don't use camelCase in notify.[ch]Max Kellerman2008-06-015-26/+26
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7367 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* assert dc.state == DECODE_STATE_STOPMax Kellerman2008-06-011-1/+2
| | | | | | | During the decoder thread main loop, dc.state must be DECODE_STATE_STOP. Explicitly assigning it after the "dc.stop" check is redundant. git-svn-id: https://svn.musicpd.org/mpd/trunk@7366 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix race condition in main_notify.cMax Kellermann2008-04-171-1/+6
| | | | | | | | | | | | The function wait_main_task() is racy: if the function wakeup_via_cond() sees the mutex is locked just before wait_main_task() executes pthread_cond_wait(), the main thread blocks forever. Work around this issue by adding a "pending" flag just like in my notify.c code. A standards-compliant solution should be implemented later. git-svn-id: https://svn.musicpd.org/mpd/trunk@7365 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* added ob_set_lazy()Max Kellermann2008-04-153-2/+26
| | | | | | | | | In lazy mode (previously the default), outputBuffer.c only wakes up the player when it was previously empty. That caused a deadlock when the player was waiting for buffered_before_play, since the decoder wouldn't wake up the player when buffered_before_play was reached. In non-lazy mode, always wake up the player when a new chunk was decoded. git-svn-id: https://svn.musicpd.org/mpd/trunk@7364 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use dc.current_song instead of pc.current_songMax Kellermann2008-04-151-1/+1
| | | | | | When we are in an input plugin, dc.current_song should already be set. Use it instead of pc.current_song. git-svn-id: https://svn.musicpd.org/mpd/trunk@7363 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* const pointers in decode.cMax Kellermann2008-04-151-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7362 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* const pointers in normalize.cMax Kellermann2008-04-152-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7361 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* more const pointers in pcm_utils.[ch]Max Kellermann2008-04-152-6/+8
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7360 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix XFADE_DISABLED=-1Max Kellermann2008-04-151-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7359 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* decode.c: make the crossfade state variable self-documentingEric Wong2008-04-141-15/+18
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7358 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* command.c: remove dead commented codeEric Wong2008-04-141-1/+0
| | | | | We have revision control for a reason :) git-svn-id: https://svn.musicpd.org/mpd/trunk@7357 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Always compile ioops.h, since main_notify uses it nowEric Wong2008-04-132-11/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7356 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Make the OutputBuffer API more consistentEric Wong2008-04-1317-146/+146
| | | | | | | | | | We had functions names varied between outputBufferFoo, fooOutputBuffer, and output_buffer_foo That was too confusing for my little brain to handle. And the global variable was somehow named 'cb' instead of the more obvious 'ob'... git-svn-id: https://svn.musicpd.org/mpd/trunk@7355 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Stop passing our single OutputBuffer object everywhereEric Wong2008-04-1318-215/+199
| | | | | | | All of our main singleton data structures are implicitly shared, so there's no reason to keep passing them around and around in the stack and making our internal API harder to deal with. git-svn-id: https://svn.musicpd.org/mpd/trunk@7354 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Stop passing our single DecoderControl object everywhereEric Wong2008-04-1320-374/+337
| | | | | | | 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-137-246/+184
| | | | | | | | | | | | 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
* main_notify: just use cond_signal to wakeup, no need to trylockEric Wong2008-04-131-11/+1
| | | | | pthread_cond_signal is a no-op if nothing is waiting on it git-svn-id: https://svn.musicpd.org/mpd/trunk@7351 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* main_notify: use pthread_cond_signal instead of broadcastEric Wong2008-04-121-1/+1
| | | | | | signal is all we need since we only have one waiter and likely faster git-svn-id: https://svn.musicpd.org/mpd/trunk@7349 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix a deadlock after pause/nextEric Wong2008-04-121-0/+1
| | | | | Oops, forgot to unlock a mutex git-svn-id: https://svn.musicpd.org/mpd/trunk@7348 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix the problem of songs not advancing without client activityEric Wong2008-04-128-20/+173
| | | | | | | | | | | | | 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
* command.h: include sllist.h which defines struct strnodeEric Wong2008-04-121-2/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7346 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* const pointers in audioOutput.cMax Kellermann2008-04-122-2/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7345 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* const pointers in audio.cMax Kellermann2008-04-122-10/+11
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* flush after loop in sendDataToOutputBuffer()Max Kellermann2008-04-121-5/+4
| | | | | | Since tailChunk() automatically flushes full buffers, we do not have to check this in every iteration of sendDataToOutputBuffer(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7343 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* constant pointers in replayGain.cMax Kellermann2008-04-122-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7342 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* yet another migration to size_tMax Kellermann2008-04-121-4/+4
| | | | | We can also get rid of one the two variables. git-svn-id: https://svn.musicpd.org/mpd/trunk@7341 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* check cb->stop in the while loopMax Kellermann2008-04-121-4/+4
| | | | | | Checking dc->stop in the while condition and again after the while loop costs some CPU cycles we should save. git-svn-id: https://svn.musicpd.org/mpd/trunk@7340 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* eliminate OutputBuffer.currentChunkMax Kellermann2008-04-122-31/+51
| | | | | | | | | | | OutputBuffer.currentChunk contains redundant data: it is either -1 when there is no chunk which is currently being written, or it equals "end". If we always keep chunk[end] in a valid state, we can remove OutputBuffer.currentChunk. This patch may look a bit clumsy, especially flushOutputBuffer(), but that will be fixed later with an major OutputBuffer API overhaul. git-svn-id: https://svn.musicpd.org/mpd/trunk@7339 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* added output_buffer_expand()Max Kellermann2008-04-121-13/+22
| | | | | | | output_buffer_expand() moves the cb->end to the new position (only its current successor is allowed) and wakes up the player if is waiting for the decoder. This simplifies flushOutputBuffer(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7338 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* initialize all elements in initOutputBuffer()Max Kellermann2008-04-121-0/+2
| | | | | | | The current OutputBuffer object is allocated statically, i.e. it is zeroed. To be safe for other cases in the future, also initialize the other elements. git-svn-id: https://svn.musicpd.org/mpd/trunk@7337 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* wake up player on demandMax Kellermann2008-04-121-1/+9
| | | | | | | | The decoder should not wake up the player when it did not produce a flushed chunk. Move the decoder_wakeup_player() call to flushOutputBuffer() and invoke it only if the buffer was previously empty. git-svn-id: https://svn.musicpd.org/mpd/trunk@7336 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* unlink the socket before bind()Max Kellermann2008-04-121-0/+2
| | | | | | If a unix domain socket already exists, bind() fails. Unlink the socket file. git-svn-id: https://svn.musicpd.org/mpd/trunk@7335 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* replaced assertion with checkMax Kellermann2008-04-121-2/+1
| | | | | | | During my tests, it happened that data->position>newPosition. I have not yet fully understood why this can happen; for now, replace this with a run-time check. git-svn-id: https://svn.musicpd.org/mpd/trunk@7334 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix several errors/warnings which only appear with -O3Max Kellermann2008-04-122-1/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* multiply num_samples with bytes_per_channelMax Kellermann2008-04-121-1/+1
| | | | | | | The patch "convert blocks until the buffer is full" did not update data->chunk_length correctly: it added the number of samples, not the number of bytes. Multiply that with bytes_per_channel git-svn-id: https://svn.musicpd.org/mpd/trunk@7332 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* missing num_channels check in previous patchMax Kellermann2008-04-121-1/+1
| | | | | | In the patch "special optimized case for 16bit stereo", the check for "num_channels==2" was missing. git-svn-id: https://svn.musicpd.org/mpd/trunk@7331 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* special optimized case for 16bit stereoMax Kellermann2008-04-121-3/+20
| | | | | | | Not having to loop for every sample byte (depending on a variable unknown at compile time) saves a lot of CPU cycles. We could consider reimplementing this function with liboil... git-svn-id: https://svn.musicpd.org/mpd/trunk@7330 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* read num_channels onceMax Kellermann2008-04-121-3/+4
| | | | | | Read frame->header.channels once, and pass only this integer to flac_convert(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7329 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* assume the buffer is empty in flacWrite()Max Kellermann2008-04-121-4/+3
| | | | | | | flacWrite() is the only function which sets data->chunk_length. If we flush the buffer before we return, we can assume that it is always empty upon entering flacWrite(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7328 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* convert blocks until the buffer is fullMax Kellermann2008-04-121-23/+43
| | | | | | | | | Move the inner loop which converts samples to flac_convert(). There it is isolated and easier to optimize. This function does not have to worry about buffer boundaries; the caller (i.e. flacWrite()) calculates how much is left and is responsible for flushing. That saves a lot of superfluous range checks within the loop. git-svn-id: https://svn.musicpd.org/mpd/trunk@7327 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* calculate bytes_per_channel, check for buffer flush onceMax Kellermann2008-04-121-11/+14
| | | | | | Check for flushing the chunk buffer only once per sample, before iterating over channels and bytes. This saves another 5% CPU cycles. git-svn-id: https://svn.musicpd.org/mpd/trunk@7326 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* don't calculate bytes per sample within the loopMax Kellermann2008-04-121-1/+2
| | | | | | | AudioFormat.bits is volatile, and to read it, 3 pointers had to be deferenced. Calculate this value once. This speeds up this function by 5%. git-svn-id: https://svn.musicpd.org/mpd/trunk@7325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use unsigned integers and size_t in the flac pluginMax Kellermann2008-04-122-4/+9
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* pass dc to decoder_task()Max Kellermann2008-04-123-6/+6
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* pass pc to set_current_song()Max Kellermann2008-04-121-6/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7322 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* pass pc to player_task()Max Kellermann2008-04-123-6/+6
| | | | | Another global variable cleanup patch. git-svn-id: https://svn.musicpd.org/mpd/trunk@7321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* whitespace cleanupMax Kellermann2008-04-121-14/+14
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7320 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* clean up CPP includesMax Kellermann2008-04-1255-110/+33
| | | | | | | | | Try to only include headers which are really needed. We should particularly check all "headers including other headers". The long-term goal is to have a manageable, small API for plugins (decoders, output) without so many mpd internals cluttering the namespace. git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f