| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
The usual bunch of pointer arguments which should be const.
|
|
|
|
|
| |
Use "unsigned int" whenever negative values are not meaningful. Use
size_t whenever we are going to describe buffer sizes.
|
|
|
|
| |
Only include headers which are really needed.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Give player.c a better name, meaning that the code is used to control
the player thread.
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This is the last of the three variables. Now we don't need
playerData.h anymore in most sources.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Now that "dc" is available here, we don't have to pass it to
decoder_is_idle() and decoder_is_starting() anymore.
|
|
|
|
|
| |
decode() is a trivial wrapper for decodeParent(). Merge both and
rename them to do_play().
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
When dc->error!=NOERROR, we do not need to check state!=START.
Simplify the checks by moving the error check to the top.
|
|
|
|
|
|
| |
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().
|
|
|
|
|
|
| |
The source "decoder_control.c" provides an API for controlling the
decoder. This replaces various direct accesses to the DecoderControl
struct.
|
|
|
|
|
| |
There is only one caller which passes "true", so we can move the
queueNextSongInPlaylist() invocation there.
|
|
|
|
|
|
| |
There is no unlocked caller of clearPlayerQueue(), and the functions
lockPlaylistInteraction() and unlockPlaylistInteraction() are trivial
- merge them.
|
| |
|
|
|
|
|
|
|
| |
Since playerPlay() already calls playerStop(), we can remove its
invocation of playerStop() from playPlaylistOrderNumber().
We can also make playerStop a static function.
|
|
|
|
|
| |
There are no nested queue locks in mpd, thus replace the locked checks
in playerQueueLock(), playerQueueUnlock() with assertions.
|
|
|
|
|
| |
There is no caller of these two functions which locks the player
queue; replace the playerQueueUnlock() call with an assertion.
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
playerKill() was marked as deprecated, but it seems like a good idea
to do proper cleanup in all threads (e.g. for usable valgrind
results). Introduce the command "EXIT" which makes the player thread
exit cleanly.
|
|
|
|
|
|
|
|
|
| |
playerWait() stops the player thread (twice!) and closes the output
device. It should be well enough to just send CLOSE_AUDIO, without
STOP.
This requires a tiny change to the player thread code: make it break
when CLOSE_AUDIO is sent.
|
|
|
|
|
| |
Again, remove file descriptor parameters, which are not actually
used. These functions can also be converted to return void.
|
|
|
|
|
| |
Most player*() functions do not actually use the file descriptor, and
always return 0 (success). Eliminate them to get a leaner interface.
|
|
|
|
|
|
|
| |
It was possible for the decoder thread to go into an endless loop
(flac and oggflac decoders): when a "STOP" command arrived, the Read()
callback would return 0, but the EOF() callback returned false. Fix:
when decoder_get_command()!=NONE, return EOF==true.
|
|
|
|
|
| |
sample_size is a variable which is computed at compile time. Declare
it "static const", so the compiler can optimize it away.
|
|
|
|
|
|
| |
Storing local configuration in global (static) variables is obviously
a bad idea. Move all those variables into the JackData struct,
including the locks.
|
| |
|
|
|
|
|
|
|
| |
There is only one caller of freeJackData() left: jack_finishDriver().
This function is called by the mpd core, and is called exactly once
for every successful jack_initDriver(). We do not need to clear
audioOutput->data, since this variable is invalidated anyway.
|
|
|
|
|
|
|
|
| |
Over the lifetime of the jack AudioOutput object, we want a single
valid JackData object, so we can persistently store data there
(configuration etc.). Allocate JackData in jack_initDriver(). After
that, we can safely remove all audioOutput->data==NULL checks (and
replace them with assertions).
|
|
|
|
|
|
|
| |
No need to destroy the JackData object when an error occurs, since
jack_finishDriver() already frees it. Only deinitialize the jack
library, introduce freeJackClient() for that, and move code from
freeJackData().
|
|
|
|
|
|
| |
Prepare the next patch: make the "!jd" check independent of the
jd->client initialization. This way we can change the "jd"
initialization semantics later.
|
|
|
|
|
|
|
| |
connect_jack() invokes freeJackData() in every error handler, although
its caller also invokes this function after a failure. We can save a
lot of lines in connect_jack() by removing these redundant
freeJackData() invocations.
|
|
|
|
|
|
|
| |
When we introduced decoder_read(), we added code which aborts the read
operation when a decoder command arrives. Several plugins however did
not expect that when they were converted to decoder_read(). Add
proper checks to the mp3 and flac decoder plugins.
|
|
|
|
|
|
| |
The code said "decoder_command==STOP" because that was a conversion
from the old "dc->stop" test. As we can now check for all commands in
one test, we can simply rewrite that to decoder_command!=NONE.
|
|
|
|
| |
Also introduce MUTEFRAME_NONE; previously, the code used "0".
|