added enum player_queue_state
This commit is contained in:
parent
ae00330285
commit
55377fbd9f
@ -176,12 +176,12 @@ int queueSong(Song * song)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getPlayerQueueState(void)
|
enum player_queue_state getPlayerQueueState(void)
|
||||||
{
|
{
|
||||||
return pc.queueState;
|
return pc.queueState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setQueueState(int queueState)
|
void setQueueState(enum player_queue_state queueState)
|
||||||
{
|
{
|
||||||
pc.queueState = queueState;
|
pc.queueState = queueState;
|
||||||
notify_signal(&pc.notify);
|
notify_signal(&pc.notify);
|
||||||
|
20
src/player.h
20
src/player.h
@ -52,12 +52,14 @@ enum player_command {
|
|||||||
/* 0->1->2->3->5 regular playback
|
/* 0->1->2->3->5 regular playback
|
||||||
* ->4->0 don't play queued song
|
* ->4->0 don't play queued song
|
||||||
*/
|
*/
|
||||||
#define PLAYER_QUEUE_BLANK 0
|
enum player_queue_state {
|
||||||
#define PLAYER_QUEUE_FULL 1
|
PLAYER_QUEUE_BLANK = 0,
|
||||||
#define PLAYER_QUEUE_DECODE 2
|
PLAYER_QUEUE_FULL = 1,
|
||||||
#define PLAYER_QUEUE_PLAY 3
|
PLAYER_QUEUE_DECODE = 2,
|
||||||
#define PLAYER_QUEUE_STOP 4
|
PLAYER_QUEUE_PLAY = 3,
|
||||||
#define PLAYER_QUEUE_EMPTY 5
|
PLAYER_QUEUE_STOP = 4,
|
||||||
|
PLAYER_QUEUE_EMPTY = 5
|
||||||
|
};
|
||||||
|
|
||||||
#define PLAYER_QUEUE_UNLOCKED 0
|
#define PLAYER_QUEUE_UNLOCKED 0
|
||||||
#define PLAYER_QUEUE_LOCKED 1
|
#define PLAYER_QUEUE_LOCKED 1
|
||||||
@ -76,7 +78,7 @@ typedef struct _PlayerControl {
|
|||||||
volatile float fileTime;
|
volatile float fileTime;
|
||||||
Song *volatile next_song;
|
Song *volatile next_song;
|
||||||
Song *errored_song;
|
Song *errored_song;
|
||||||
volatile mpd_sint8 queueState;
|
volatile enum player_queue_state queueState;
|
||||||
volatile mpd_sint8 queueLockState;
|
volatile mpd_sint8 queueLockState;
|
||||||
volatile double seekWhere;
|
volatile double seekWhere;
|
||||||
volatile float crossFade;
|
volatile float crossFade;
|
||||||
@ -114,9 +116,9 @@ void playerWait(void);
|
|||||||
|
|
||||||
int queueSong(Song * song);
|
int queueSong(Song * song);
|
||||||
|
|
||||||
int getPlayerQueueState(void);
|
enum player_queue_state getPlayerQueueState(void);
|
||||||
|
|
||||||
void setQueueState(int queueState);
|
void setQueueState(enum player_queue_state queueState);
|
||||||
|
|
||||||
void playerQueueLock(void);
|
void playerQueueLock(void);
|
||||||
|
|
||||||
|
@ -553,6 +553,12 @@ static void clearPlayerQueue(void)
|
|||||||
{
|
{
|
||||||
playlist.queued = -1;
|
playlist.queued = -1;
|
||||||
switch (getPlayerQueueState()) {
|
switch (getPlayerQueueState()) {
|
||||||
|
case PLAYER_QUEUE_BLANK:
|
||||||
|
case PLAYER_QUEUE_DECODE:
|
||||||
|
case PLAYER_QUEUE_STOP:
|
||||||
|
case PLAYER_QUEUE_EMPTY:
|
||||||
|
break;
|
||||||
|
|
||||||
case PLAYER_QUEUE_FULL:
|
case PLAYER_QUEUE_FULL:
|
||||||
DEBUG("playlist: dequeue song\n");
|
DEBUG("playlist: dequeue song\n");
|
||||||
setQueueState(PLAYER_QUEUE_BLANK);
|
setQueueState(PLAYER_QUEUE_BLANK);
|
||||||
|
Loading…
Reference in New Issue
Block a user