1 /* libmpd (high level libmpdclient library)
2 * Copyright (C) 2004-2009 Qball Cow <qball@sarine.nl>
3 * Project homepage: http://gmpcwiki.sarine.nl/
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.
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.
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.
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.
27 #ifndef __MPD_LIB_PLAYER__
28 #define __MPD_LIB_PLAYER__
31 * Enum representing the possible states of the player
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
48 * Sends mpd the play command.
52 * mpd_player_play_id(mi, -1);
55 * @returns a #MpdError
57 int mpd_player_play(MpdObj
* mi
);
65 * Plays the song with id
67 * @returns a #MpdError
69 int mpd_player_play_id(MpdObj
* mi
, int id
);
75 * Sends mpd the stop command.
77 * @returns a #MpdError
79 int mpd_player_stop(MpdObj
* mi
);
85 * Sends mpd the next command.
87 * @returns a #MpdError
89 int mpd_player_next(MpdObj
* mi
);
95 * Sends mpd the prev command.
97 * @returns a #MpdError
99 int mpd_player_prev(MpdObj
* mi
);
103 * \param mi a #MpdObj
105 * Sends mpd the pause command.
107 * @returns a #MpdError
109 int mpd_player_pause(MpdObj
* mi
);
113 * \param mi a #MpdObj
115 * Returns the mpd play state (play/paused/stop)
117 * @returns a #MpdState
119 int mpd_player_get_state(MpdObj
* mi
);
122 * \param mi a #MpdObj
124 * Returns the id of the currently playing song
126 * @returns the songid of the playing song
128 int mpd_player_get_current_song_id(MpdObj
* mi
);
132 * \param mi a #MpdObj
134 * Returns the position of the currently playing song in the playlist
136 * @returns the position of the playing song
138 int mpd_player_get_current_song_pos(MpdObj
* mi
);
142 * \param mi a #MpdObj
144 * Get the state of repeat: 1 if enabled, 0 when disabled.
146 * @returns the state of repeat
148 int mpd_player_get_repeat(MpdObj
* mi
);
151 * \param mi a #MpdObj
153 * Get the state of consume mode: 1 if enabled, 0 when disabled.
155 * @returns the state of consume
157 int mpd_player_get_consume(MpdObj
* mi
);
160 * \param mi a #MpdObj
162 * Get the state of single mode: 1 if enabled, 0 when disabled.
164 * @returns the state of single
166 int mpd_player_get_single(MpdObj
* mi
);
169 * \param mi a #MpdObj
170 * \param repeat New state of repeat (1 is enabled, 0 is disabled)
172 * Enable/disabled repeat
174 * @returns 0 when successful
176 int mpd_player_set_repeat(MpdObj
* mi
, int repeat
);
178 * \param mi a #MpdObj
180 * Get the state of random: 1 if enabled, 0 when disabled.
182 * @returns the state of random
185 int mpd_player_get_random(MpdObj
* mi
);
187 * @param mi a #MpdObj
188 * @param random New state of random (1 is enabled, 0 is disabled)
190 * Enable/disable random
192 * @returns 0 when successful
194 int mpd_player_set_random(MpdObj
* mi
, int random
);
198 * @param mi a #MpdObj
199 * @param sec Position to seek to. (in seconds)
201 * Seek through the current song.
202 * @returns a #MpdError
204 int mpd_player_seek(MpdObj
* mi
, int sec
);
208 int mpd_player_get_next_song_pos(MpdObj
*mi
);
209 int mpd_player_get_next_song_id(MpdObj
*mi
);
211 * @param mi a #MpdObj
212 * @param single the state of single mode
214 * Enable/disable single mode. (single = 1 is enabled, single = 0 disabled)
215 * @return a #MpdError
217 int mpd_player_set_single(MpdObj
* mi
, int single
);
220 * @param mi a #MpdObj
221 * @param consume the state of consume mode
223 * Enable/disable consume mode. (consume = 1 is enabled, consume = 0 disabled)
225 int mpd_player_set_consume(MpdObj
* mi
, int consume
);