- 28 Aug, 2008 15 commits
-
-
Max Kellermann authored
Exit the function when an error occurs, and move the rest of the following code one indent level left.
-
Max Kellermann authored
Split the large function client_write_output() into two parts; this is the first code moving patch.
-
Max Kellermann authored
All of the client's resources are freed in client_close(). It is enough to set the "expired" flag, no need to duplicate lots of destruction code again and again.
-
Max Kellermann authored
Due to the large buffers in the client struct, the static client array eats several megabytes of RAM with a maximum of only 10 clients. Stop this waste and allocate each client struct from the heap.
-
Max Kellermann authored
The code becomes less complex and more readable when we move this linear search into a separate mini function.
-
Max Kellermann authored
This saves one level of indent.
-
Max Kellermann authored
Functions which operate on the whole client list are prefixed with "client_manager_", and functions which handle just one client just get "client_".
-
Max Kellermann authored
Rename all static functions, variables and macros which have "interface" in their name to something nicer prefixed with "client_".
-
Max Kellermann authored
Second patch: rename the internal struct name. We will eventually export this type as an opaque forward-declared struct later, so we can pass a struct pointer instead of a file descriptor, which would save us an expensive linear lookup.
-
Max Kellermann authored
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.
-
Max Kellermann authored
linux/list.h is a nice doubly linked list library - it is lightweight and powerful at the same time. It will be useful later, when we begin to allocate client structures dynamically. Import it, and strip out all the stuff which we are not going to use.
-
Max Kellermann authored
The usual bunch of pointer arguments which should be const.
-
Max Kellermann authored
Use "unsigned int" whenever negative values are not meaningful. Use size_t whenever we are going to describe buffer sizes.
-
Max Kellermann authored
Only include headers which are really needed.
-
Max Kellermann authored
-
- 26 Aug, 2008 25 commits
-
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
Give player.c a better name, meaning that the code is used to control the player thread.
-
Max Kellermann authored
We should avoid having protocol specific code in player.c. Just return success or failure, and let the caller send the error code to the MPD client.
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
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.
-
Max Kellermann authored
This is the last of the three variables. Now we don't need playerData.h anymore in most sources.
-
Max Kellermann authored
This releases several include file dependencies. As a side effect, "CHUNK_SIZE" isn't defined by decoder_api.h anymore, so we have to define it directly in the plugins which need it. It just isn't worth it to add it to the decoder plugin API.
-
Max Kellermann authored
The decoder plugins need this type, so export it in the public API. This allows is to remove "decode.h" from "decoder_api.h", uncluttering the API namespace some more.
-
Max Kellermann authored
Now that "dc" is available here, we don't have to pass it to decoder_is_idle() and decoder_is_starting() anymore.
-
Max Kellermann authored
decode() is a trivial wrapper for decodeParent(). Merge both and rename them to do_play().
-
Max Kellermann authored
Unfortunately, we have to pass the DecoderControl pointer to these inline functions, because the global variable "dc" may not be available here. This will be fixed later.
-
Max Kellermann authored
When dc->error!=NOERROR, we do not need to check state!=START. Simplify the checks by moving the error check to the top.
-
Max Kellermann authored
The decoder thread is responsible for resetting dc->command after a command was executed. As a consequence, we can assume that dc->command is already NONE after decoder_stop().
-
Max Kellermann authored
The source "decoder_control.c" provides an API for controlling the decoder. This replaces various direct accesses to the DecoderControl struct.
-
Max Kellermann authored
There is only one caller which passes "true", so we can move the queueNextSongInPlaylist() invocation there.
-
Max Kellermann authored
There is no unlocked caller of clearPlayerQueue(), and the functions lockPlaylistInteraction() and unlockPlaylistInteraction() are trivial - merge them.
-
Max Kellermann authored
-
Max Kellermann authored
Since playerPlay() already calls playerStop(), we can remove its invocation of playerStop() from playPlaylistOrderNumber(). We can also make playerStop a static function.
-
Max Kellermann authored
There are no nested queue locks in mpd, thus replace the locked checks in playerQueueLock(), playerQueueUnlock() with assertions.
-
Max Kellermann authored
There is no caller of these two functions which locks the player queue; replace the playerQueueUnlock() call with an assertion.
-
Max Kellermann authored
All (indirect) callers of queueSong() ensure that the queue state is BLANK, so there is no need to check it in queueSong() again. As a side effect, queueSong() cannot fail anymore, and can return void. Also, playlist_queueError and all its error handling can go away.
-
Max Kellermann authored
-