1 /* libmpd (high level libmpdclient library)
2  * Copyright (C) 2004-2009 Qball Cow <qball@sarine.nl>
3  * Project homepage: http://gmpcwiki.sarine.nl/
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 /**
21  * @defgroup Player Player
22  * These functions allow the client to control the player part of mpd.
23  * To use the read functions you need "read" permission on mpd.
24  * To use the control functions you need "control" and "read" permission on mpd.
25  */
26 /* @{*/
27 #ifndef __MPD_LIB_PLAYER__
28 #define __MPD_LIB_PLAYER__
29 
30 /**
31  * Enum representing the possible states of the player
32  */
33 
34 typedef enum {
35 	/** The player is paused */
36 	MPD_PLAYER_PAUSE = MPD_STATUS_STATE_PAUSE,
37 	/** The player is playing */
38 	MPD_PLAYER_PLAY =  MPD_STATUS_STATE_PLAY,
39 	/** The player is stopped */
40 	MPD_PLAYER_STOP =  MPD_STATUS_STATE_STOP,
41 	/** The player is in an unknown state */
42 	MPD_PLAYER_UNKNOWN = MPD_STATUS_STATE_UNKNOWN
43 } MpdState;
44 
45 /**
46  * \param mi a #MpdObj
47  *
48  * Sends mpd the play command.
49  *
50  * This equals:
51  * @code
52  * mpd_player_play_id(mi, -1);
53  * @endcode
54  *
55  * @returns a #MpdError
56  */
57 int mpd_player_play(MpdObj * mi);
58 
59 
60 /**
61  *
62  * \param mi a #MpdObj
63  * \param id a songid.
64  *
65  * Plays the song with id
66  *
67  * @returns a #MpdError
68  */
69 int mpd_player_play_id(MpdObj * mi, int id);
70 
71 
72 /**
73  * \param mi a #MpdObj
74  *
75  * Sends mpd the stop command.
76  *
77  * @returns a #MpdError
78  */
79 int mpd_player_stop(MpdObj * mi);
80 
81 
82 /**
83  * \param mi a #MpdObj
84  *
85  * Sends mpd the next command.
86  *
87  * @returns a #MpdError
88  */
89 int mpd_player_next(MpdObj * mi);
90 
91 
92 /**
93  * \param mi a #MpdObj
94  *
95  * Sends mpd the prev command.
96  *
97  * @returns a #MpdError
98  */
99 int mpd_player_prev(MpdObj * mi);
100 
101 
102 /**
103  * \param mi a #MpdObj
104  *
105  * Sends mpd the pause command.
106  *
107  * @returns a #MpdError
108  */
109 int mpd_player_pause(MpdObj * mi);
110 
111 
112 /**
113  * \param mi a #MpdObj
114  *
115  * Returns the mpd play state (play/paused/stop)
116  *
117  * @returns a #MpdState
118  */
119 int mpd_player_get_state(MpdObj * mi);
120 
121 /**
122  * \param mi a #MpdObj
123  *
124  * Returns the id of the currently playing song
125  *
126  * @returns the songid of the playing song
127  */
128 int mpd_player_get_current_song_id(MpdObj * mi);
129 
130 
131 /**
132  * \param mi a #MpdObj
133  *
134  * Returns the position of the currently playing song in the playlist
135  *
136  * @returns the position of the playing song
137  */
138 int mpd_player_get_current_song_pos(MpdObj * mi);
139 
140 
141 /**
142  * \param mi a #MpdObj
143  *
144  * Get the state of repeat: 1 if enabled, 0 when disabled.
145  *
146  * @returns the state of repeat
147  */
148 int mpd_player_get_repeat(MpdObj * mi);
149 
150 /**
151  * \param mi a #MpdObj
152  *
153  * Get the state of consume mode: 1 if enabled, 0 when disabled.
154  *
155  * @returns the state of consume
156  */
157 int mpd_player_get_consume(MpdObj * mi);
158 
159 /**
160  * \param mi a #MpdObj
161  *
162  * Get the state of single mode: 1 if enabled, 0 when disabled.
163  *
164  * @returns the state of single
165  */
166 int mpd_player_get_single(MpdObj * mi);
167 
168 /**
169  * \param mi a #MpdObj
170  * \param repeat New state of repeat (1 is enabled, 0 is disabled)
171  *
172  * Enable/disabled repeat
173  *
174  * @returns 0 when successful
175  */
176 int mpd_player_set_repeat(MpdObj * mi, int repeat);
177 /**
178  * \param mi a #MpdObj
179  *
180  * Get the state of random: 1 if enabled, 0 when disabled.
181  *
182  * @returns the state of random
183  */
184 
185 int mpd_player_get_random(MpdObj * mi);
186 /**
187  * @param mi a #MpdObj
188  * @param random New state of random (1 is enabled, 0 is disabled)
189  *
190  * Enable/disable random
191  *
192  * @returns 0 when successful
193  */
194 int mpd_player_set_random(MpdObj * mi, int random);
195 
196 
197 /**
198  * @param mi a #MpdObj
199  * @param sec Position to seek to. (in seconds)
200  *
201  * Seek through the current song.
202  * @returns a #MpdError
203  */
204 int mpd_player_seek(MpdObj * mi, int sec);
205 
206 
207 
208 int mpd_player_get_next_song_pos(MpdObj *mi);
209 int mpd_player_get_next_song_id(MpdObj *mi);
210 /**
211  * @param mi a #MpdObj
212  * @param single the state of single mode
213  *
214  * Enable/disable single mode. (single = 1 is enabled, single = 0 disabled)
215  * @return  a #MpdError
216  */
217 int mpd_player_set_single(MpdObj * mi, int single);
218 
219 /**
220  * @param mi a #MpdObj
221  * @param consume the state of consume mode
222  *
223  * Enable/disable consume mode. (consume = 1 is enabled, consume = 0 disabled)
224  */
225 int mpd_player_set_consume(MpdObj * mi, int consume);
226 
227 #endif
228 
229 
230 /*@}*/
231