MPD
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 
34 };
35 
43 
49 
52 
59 
65 };
66 
74 };
75 
76 struct player_status {
78  uint16_t bit_rate;
80  float total_time;
81  float elapsed_time;
82 };
83 
85  unsigned buffer_chunks;
86 
87  unsigned int buffered_before_play;
88 
91  GThread *thread;
92 
96  GMutex *mutex;
97 
101  GCond *cond;
102 
106  uint16_t bit_rate;
108  float total_time;
110  struct song *next_song;
111  const struct song *errored_song;
112  double seek_where;
114  float mixramp_db;
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
130 {
131  g_mutex_lock(pc.mutex);
132 }
133 
137 static inline void
139 {
140  g_mutex_unlock(pc.mutex);
141 }
142 
148 static inline void
150 {
151  g_cond_wait(pc.cond, pc.mutex);
152 }
153 
161 void
163 
168 static inline void
170 {
171  g_cond_signal(pc.cond);
172 }
173 
178 static inline 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 *
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
251 
252 float
253 pc_get_cross_fade(void);
254 
255 void
257 
258 float
259 pc_get_mixramp_db(void);
260 
261 void
263 
264 float
266 
267 double
269 
270 #endif