aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
* removed "volatile" from OutputBufferChunk propertiesMax Kellermann2008-04-121-3/+3
| | | | | | | There is no danger that gcc will optimize access to OutputBufferChunk properties, since decoder and player work in different chunk objects. It is safe to remove "volatile" here. git-svn-id: https://svn.musicpd.org/mpd/trunk@7318 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* pass pc to player notify functionsMax Kellermann2008-04-123-30/+29
| | | | | Same as the previous patch: less global variables. git-svn-id: https://svn.musicpd.org/mpd/trunk@7317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* pass DecoderControl object to decoder_sleep()Max Kellermann2008-04-123-17/+14
| | | | | | | | | Less global variables: at any invocation of decoder_sleep(), we have a reference to the DecoderControl anyway, so we should pass it. This costs less than having to call getPlayerData() in every tiny function. Maybe some day we will be able to have multiple decoders at the same time... git-svn-id: https://svn.musicpd.org/mpd/trunk@7316 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* added output_buffer_free()Max Kellermann2008-04-123-0/+9
| | | | | | | To do proper cleanup before exiting, we have to provide a destructor for OutputBuffer. One day, valgrind will not complain about memory leaks! git-svn-id: https://svn.musicpd.org/mpd/trunk@7315 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove the local variable "end"Max Kellermann2008-04-121-5/+0
| | | | | | "end" is not being used anymore, since we moved most OutputBuffer struct accesses into methods. git-svn-id: https://svn.musicpd.org/mpd/trunk@7314 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* don't use short chunk numbersMax Kellermann2008-04-123-7/+7
| | | | | | | | | | | | Don't be mean with integer sizes. Although we will probably never have more than 32k buffered chunks, we should use 32 bit integers for addressing them. We do not save very much (some of the saved space is eaten by alignment anyway), but we save at least one assembler instruction for converting short to int. This change requires some more explicit casts, because gcc was less picky when comparing short with a full int. git-svn-id: https://svn.musicpd.org/mpd/trunk@7313 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* added output_buffer_skip()Max Kellermann2008-04-123-8/+9
| | | | | | | | First patch without camelCase ;) output_buffer_skip() lets us eliminate advanceOutputBufferTo(), and removes yet another external OutputBuffer struct access. git-svn-id: https://svn.musicpd.org/mpd/trunk@7312 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove buffered_chunks, use cb->sizeMax Kellermann2008-04-123-3/+3
| | | | | | | Second patch to make OutputBuffer self-contained: since OutputBuffer now knows its own size, we do not need the global variable "buffered_chunks" anymore. git-svn-id: https://svn.musicpd.org/mpd/trunk@7311 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* pass buffered_chunks to initOutputBuffer()Max Kellermann2008-04-123-16/+21
| | | | | | Try to make OutputBuffer self-contained, without depending on a global variable. git-svn-id: https://svn.musicpd.org/mpd/trunk@7310 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* make playerData_pd staticMax Kellermann2008-04-121-39/+32
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7309 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* allocate playerData_pd from heap instead of shmMax Kellermann2008-04-122-12/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7308 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fixed another shadow warningMax Kellermann2008-04-121-11/+11
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7307 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* don't allocate pd.auddioDeviceStates from shmMax Kellermann2008-04-121-5/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7306 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix typo in commentMax Kellermann2008-04-121-3/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7305 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* let initOutputBuffer() allocate memoryMax Kellermann2008-04-123-10/+6
| | | | | | This is the first patch in a series which removes the shared memory, and moves all the playerData objects into the normal libc heap. git-svn-id: https://svn.musicpd.org/mpd/trunk@7304 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix deadlock at end of songMax Kellermann2008-04-121-0/+1
| | | | | | | | | | | Now that we do proper locking and signalling instead of continuous polling for IPC, a deadlock was found: at the end of a song, the player thread waits until the main thread sets pc->queueState from PLAYER_QUEUE_DECODE to PLAYER_QUEUE_PLAY. He is never woken up, since syncPlaylistWithQueue() does not activate the notification. I added wakeup_player_nb() to setQueueState(), since the player must be signalled whenever pc->queueState changes. git-svn-id: https://svn.musicpd.org/mpd/trunk@7303 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* decode: fix some uninitialized variable warningsEric Wong2008-04-122-3/+3
| | | | | They're probably not needed, but less noise => faster debugging git-svn-id: https://svn.musicpd.org/mpd/trunk@7302 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* decode: fix unsigned comparision and add some paranoid assertionsEric Wong2008-04-121-8/+9
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7301 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix a few more warnings from -WshadowEric Wong2008-04-127-36/+38
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7300 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* configure: better CFLAGS checkingEric Wong2008-04-122-2/+28
| | | | | | | needed for compatibility with older gcc. Also, threw in some warnings for things I find offensive (declaration-after-statement, shadow) git-svn-id: https://svn.musicpd.org/mpd/trunk@7299 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* missing const in disabled code pathMax Kellermann2008-04-121-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7298 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* some assertions to check the unsigned changesMax Kellermann2008-04-121-0/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7297 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use size_t in audio.cMax Kellermann2008-04-122-5/+5
| | | | | | | Buffer sizes should be size_t. This is safe here, at least not unsafer than without the patch. I have no idea why audioBufferSize and audioBufferPos were explicitly declared as signed integer. git-svn-id: https://svn.musicpd.org/mpd/trunk@7296 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use free()/malloc() instead of realloc()Max Kellermann2008-04-121-2/+3
| | | | | | When growing the audioOutput->convBuffer, we can use free()+malloc() instead of realloc(), which saves a memcpy(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7295 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use size_t in audioOutput.c internalsMax Kellermann2008-04-122-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7294 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use size_t and constant pointer in ao pluginsMax Kellermann2008-04-1212-36/+66
| | | | | | | The audio output plugins should get a constant pointer, because they must not modify the buffer. Since the size is a non-negative buffer size in bytes, we should change its type to size_t. git-svn-id: https://svn.musicpd.org/mpd/trunk@7293 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use size_t for pcm_sizeOfConvBuffer() resultMax Kellermann2008-04-121-4/+4
| | | | | | | In my previous patch set, I forgot to change the pcm_sizeOfConvBuffer() invocation in convertAudioFormat() to also use size_t. git-svn-id: https://svn.musicpd.org/mpd/trunk@7292 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* yet more unsigned integersMax Kellermann2008-04-121-4/+4
| | | | | | | | | | calculateCrossFadeChunks() still returns int, although the caller uses it as an unsigned value. Since the function body checks for negative values, it is safe to cast to unsigned. crossFade() takes signed parameters, although it callers pass unsigned integers. Change declaration to unsigned. git-svn-id: https://svn.musicpd.org/mpd/trunk@7291 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* constant pointersMax Kellermann2008-04-123-9/+9
| | | | | | There were some const pointers missing in the previous const-cleanup patch. git-svn-id: https://svn.musicpd.org/mpd/trunk@7290 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix parameter types in the faad callsMax Kellermann2008-04-122-3/+3
| | | | | | libfaad wants uint32_t pointers. Passing a long pointer is bugged on amd64. git-svn-id: https://svn.musicpd.org/mpd/trunk@7289 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix compilation error in wavpack pluginMax Kellermann2008-04-121-3/+6
| | | | | | The patch "Start using song pointers in core data structures" removed dc->utf8url, and the adaption for wavpack_plugin.c was missing. git-svn-id: https://svn.musicpd.org/mpd/trunk@7288 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* yet more unsigned integersMax Kellermann2008-04-125-10/+9
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7287 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* whitespace cleanupMax Kellermann2008-04-121-67/+67
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7286 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* added inline function successor()Max Kellermann2008-04-121-11/+12
| | | | | | The new function successor() can be used to simplify a lot of code lines and saves a lot of "i+>=buffered_chunks" checks. git-svn-id: https://svn.musicpd.org/mpd/trunk@7285 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* moved currentChunk into OutputBufferMax Kellermann2008-04-122-10/+11
| | | | | | | | currentChunk is a global variable, which renders the whole output buffer code non-reentrant. Although this is not a real problem since there is only one global output buffer currently, we should move it to the OutputBuffer struct. git-svn-id: https://svn.musicpd.org/mpd/trunk@7284 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use the notify API in the main threadMax Kellermann2008-04-123-9/+19
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7283 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use the notify API in the playerMax Kellermann2008-04-123-6/+10
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7282 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use the notify API in the decoderMax Kellermann2008-04-123-6/+12
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7281 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use the pthread API in notify.cMax Kellermann2008-04-122-33/+66
| | | | | | | This patch rewrites notify.c to use the pthread API, namely pthread_mutex and pthread_cond. This is a lot cheaper and easier than the pipe() hack. git-svn-id: https://svn.musicpd.org/mpd/trunk@7280 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* rename the notify.c methodsMax Kellermann2008-04-122-6/+6
| | | | | Use "notify" as a prefix rather than suffix. git-svn-id: https://svn.musicpd.org/mpd/trunk@7279 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use break instead of quitDecode()+returnMax Kellermann2008-04-121-6/+3
| | | | | | | | The code paths which return from the functions all have to call quitDecode(). If we simply break instead of calling quitDecode() explicitly, this function gets called in the last line of this function anyway. git-svn-id: https://svn.musicpd.org/mpd/trunk@7278 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* moved expression to audioFormatSizeToTime()Max Kellermann2008-04-122-3/+6
| | | | | | | The multi-line expression which calculates sizeToTime is hard to read, partly because "cb->audioFormat." is too long. Create a separate inline function in audio.h for that. git-svn-id: https://svn.musicpd.org/mpd/trunk@7277 09075e82-0dd4-0310-85a5-a0d7c8717e4f