MPD
Main Page
Data Structures
Files
File List
Globals
src
player_control.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2003-2010 The Music Player Daemon Project
3
* http://www.musicpd.org
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
*/
19
20
#ifndef MPD_PLAYER_H
21
#define MPD_PLAYER_H
22
23
#include "
notify.h
"
24
#include "
audio_format.h
"
25
26
#include <stdint.h>
27
28
struct
decoder_control
;
29
30
enum
player_state
{
31
PLAYER_STATE_STOP
= 0,
32
PLAYER_STATE_PAUSE
,
33
PLAYER_STATE_PLAY
34
};
35
36
enum
player_command
{
37
PLAYER_COMMAND_NONE
= 0,
38
PLAYER_COMMAND_EXIT
,
39
PLAYER_COMMAND_STOP
,
40
PLAYER_COMMAND_PAUSE
,
41
PLAYER_COMMAND_SEEK
,
42
PLAYER_COMMAND_CLOSE_AUDIO
,
43
48
PLAYER_COMMAND_UPDATE_AUDIO
,
49
51
PLAYER_COMMAND_QUEUE
,
52
58
PLAYER_COMMAND_CANCEL
,
59
64
PLAYER_COMMAND_REFRESH
,
65
};
66
67
enum
player_error
{
68
PLAYER_ERROR_NOERROR
= 0,
69
PLAYER_ERROR_FILE
,
70
PLAYER_ERROR_AUDIO
,
71
PLAYER_ERROR_SYSTEM
,
72
PLAYER_ERROR_UNKTYPE
,
73
PLAYER_ERROR_FILENOTFOUND
,
74
};
75
76
struct
player_status
{
77
enum
player_state
state
;
78
uint16_t
bit_rate
;
79
struct
audio_format
audio_format
;
80
float
total_time
;
81
float
elapsed_time
;
82
};
83
84
struct
player_control
{
85
unsigned
buffer_chunks
;
86
87
unsigned
int
buffered_before_play
;
88
91
GThread *
thread
;
92
96
GMutex *
mutex
;
97
101
GCond *
cond
;
102
103
enum
player_command
command
;
104
enum
player_state
state
;
105
enum
player_error
error
;
106
uint16_t
bit_rate
;
107
struct
audio_format
audio_format
;
108
float
total_time
;
109
float
elapsed_time
;
110
struct
song
*
next_song
;
111
const
struct
song
*
errored_song
;
112
double
seek_where
;
113
float
cross_fade_seconds
;
114
float
mixramp_db
;
115
float
mixramp_delay_seconds
;
116
double
total_play_time
;
117
};
118
119
extern
struct
player_control
pc
;
120
121
void
pc_init
(
unsigned
buffer_chunks
,
unsigned
buffered_before_play
);
122
123
void
pc_deinit
(
void
);
124
128
static
inline
void
129
player_lock
(
void
)
130
{
131
g_mutex_lock(
pc
.
mutex
);
132
}
133
137
static
inline
void
138
player_unlock
(
void
)
139
{
140
g_mutex_unlock(
pc
.
mutex
);
141
}
142
148
static
inline
void
149
player_wait
(
void
)
150
{
151
g_cond_wait(
pc
.
cond
,
pc
.
mutex
);
152
}
153
161
void
162
player_wait_decoder
(
struct
decoder_control
*dc);
163
168
static
inline
void
169
player_signal
(
void
)
170
{
171
g_cond_signal(
pc
.
cond
);
172
}
173
178
static
inline
void
179
player_lock_signal
(
void
)
180
{
181
player_lock
();
182
player_signal
();
183
player_unlock
();
184
}
185
191
void
192
pc_song_deleted
(
const
struct
song
*
song
);
193
194
void
195
pc_play
(
struct
song
*
song
);
196
200
void
pc_cancel
(
void
);
201
202
void
203
pc_set_pause
(
bool
pause_flag);
204
205
void
206
pc_pause
(
void
);
207
208
void
209
pc_kill
(
void
);
210
211
void
212
pc_get_status
(
struct
player_status
*status);
213
214
enum
player_state
215
pc_get_state
(
void
);
216
217
void
218
pc_clear_error
(
void
);
219
225
char
*
226
pc_get_error_message
(
void
);
227
228
enum
player_error
229
pc_get_error
(
void
);
230
231
void
232
pc_stop
(
void
);
233
234
void
235
pc_update_audio
(
void
);
236
237
void
238
pc_enqueue_song
(
struct
song
*
song
);
239
246
bool
247
pc_seek
(
struct
song
*
song
,
float
seek_time);
248
249
void
250
pc_set_cross_fade
(
float
cross_fade_seconds
);
251
252
float
253
pc_get_cross_fade
(
void
);
254
255
void
256
pc_set_mixramp_db
(
float
mixramp_db
);
257
258
float
259
pc_get_mixramp_db
(
void
);
260
261
void
262
pc_set_mixramp_delay
(
float
mixramp_delay_seconds
);
263
264
float
265
pc_get_mixramp_delay
(
void
);
266
267
double
268
pc_get_total_play_time
(
void
);
269
270
#endif
Generated on Sun Aug 12 2012 21:58:00 for MPD by
1.8.2