summaryrefslogtreecommitdiffstats
path: root/src/player.h
blob: 44bff99b30eb4eaf0f3dc434e5576482e164c274 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once

#include "track.h"
#include "list.h"
#include "util.h"

#include "mpd/client.h"

#include <signal.h>

enum {
	PLAYER_OK,
	PLAYER_ERR
};

enum {
	PLAYER_MSG_NONE,
	PLAYER_MSG_INFO,
	PLAYER_MSG_ERR
};

enum {
	PLAYER_STATE_NONE,
	PLAYER_STATE_PAUSED,
	PLAYER_STATE_PLAYING,
	PLAYER_STATE_STOPPED
};

enum {
	PLAYER_ACTION_NONE,
	PLAYER_ACTION_PLAY_PREV,
	PLAYER_ACTION_PLAY_NEXT
};

struct player {
	struct mpd_connection *conn;

	struct link queue;
	struct link history;
	struct track *track;
	int state;

	int action;
	int seek_delay;

	int loaded;
	int volume;
	unsigned int time_pos, time_end;

	char *msg;
	int msglvl;
};

void player_init(void);
void player_free(void);
void player_update(void);

void player_queue_clear(void);
void player_queue_append(struct track *track);
void player_queue_insert(struct track *track, size_t pos);

int player_play_track(struct track *track);

int player_toggle_pause(void);
int player_pause(void);
int player_resume(void);
int player_prev(void);
int player_next(void);
int player_seek(int sec);
int player_play(void);
int player_stop(void);

int player_set_volume(unsigned int vol);

void player_clear_msg(void);

extern struct player *player;