Commit Graph

22 Commits

Author SHA1 Message Date
Max Kellermann b084bc28ed use the "bool" data type instead of "int"
"bool" should be used in C99 programs for boolean values.
2008-10-08 11:03:39 +02:00
Max Kellermann d562ba5fbb song: converted typedef Song to struct song
Again, a data type which can be forward-declared.
2008-10-08 10:49:11 +02:00
Max Kellermann 6e21e24cae audio_output: added method pause()
pause() puts the audio output into pause mode: if supported, it may
perform a special action, which keeps the device open, but does not
play anything.  Output plugins like "shout" might want to play silence
during pause, so their clients won't be disconnected.  Plugins which
do not support pausing will simply be closed, and have to be reopened
when unpaused.

This pach includes an implementation for the shout plugin, which
sends silence chunks.
2008-09-29 16:43:55 +02:00
Max Kellermann 58554e14f9 notify: protect notify->pending with the mutex
There was a known deadlocking bug in the notify library: when the
other thread set notify->pending after the according check in
notify_wait(), the latter thread was deadlocked.  Resolve this by
synchronizing all accesses to notify->pending with the notify object's
mutex.  Since notify_signal_sync() was never used, we can remove it.
As a consequence, we don't need notify_enter() and notify_leave()
anymore; eliminate them, too.
2008-09-26 09:57:11 +02:00
Max Kellermann f1dd9c209c audio_format: converted typedef AudioFormat to struct audio_format
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
2008-09-07 19:19:55 +02:00
Max Kellermann f34f694ec3 moved player_command_finished() to player_thread.c 2008-08-26 08:45:15 +02:00
Max Kellermann e2c8b960de moved code to pc_init(), dc_init() 2008-08-26 08:45:14 +02:00
Max Kellermann 5e51fa020d renamed player.c to player_control.c
Give player.c a better name, meaning that the code is used to control
the player thread.
2008-08-26 08:44:38 +02:00
Max Kellermann 56cdce6946 renamed decode.h to decoder_control.h 2008-08-26 08:44:19 +02:00
Max Kellermann 4255bba0f7 moved global variable "pc" to player.h
This is the last of the three variables.  Now we don't need
playerData.h anymore in most sources.
2008-08-26 08:41:05 +02:00
Max Kellermann 1c03c721ea moved variable "dc" to decode.h
Now that "dc" is available here, we don't have to pass it to
decoder_is_idle() and decoder_is_starting() anymore.
2008-08-26 08:40:47 +02:00
Max Kellermann 9521c92f66 player_thread: removed decode(), renamed decodeParent()
decode() is a trivial wrapper for decodeParent().  Merge both and
rename them to do_play().
2008-08-26 08:29:37 +02:00
Max Kellermann 70904adf18 hide DecoderControl accesses in inline functions
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.
2008-08-26 08:29:35 +02:00
Max Kellermann a1ce999978 check for decoder error before state!=START
When dc->error!=NOERROR, we do not need to check state!=START.
Simplify the checks by moving the error check to the top.
2008-08-26 08:27:18 +02:00
Max Kellermann c6035ea332 don't reset dc->command in quitDecode()
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().
2008-08-26 08:27:18 +02:00
Max Kellermann 8a4970f863 added decoder_control.c
The source "decoder_control.c" provides an API for controlling the
decoder.  This replaces various direct accesses to the DecoderControl
struct.
2008-08-26 08:27:18 +02:00
Max Kellermann b94af79134 fix a comment regarding the player queue 2008-08-26 08:27:17 +02:00
Max Kellermann ae00330285 rewrote playerKill()
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.
2008-08-26 08:27:16 +02:00
Max Kellermann 92d9797b8c player: don't call STOP before CLOSE_AUDIO
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.
2008-08-26 08:27:16 +02:00
Max Kellermann df251a9960 assert song->url != NULL 2008-08-26 08:27:11 +02:00
Max Kellermann a68ef497f5 don't call quitDecode() in waitOnDecode()
To make the code more consistent, call quitDecode() only at the end of
decodeParent().
2008-08-26 08:27:09 +02:00
Max Kellermann e8bd9ddc9f moved code to player_thread.c
Move code which runs in the player thread to player_thread.c.  Having
a lot of player thread code in decode.c isn't easy to understand.
2008-08-26 08:27:09 +02:00