Commit Graph

116 Commits

Author SHA1 Message Date
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