|
MPD
|
00001 /* 00002 * Copyright (C) 2003-2010 The Music Player Daemon Project 00003 * http://www.musicpd.org 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 #ifndef MPD_PLAYLIST_H 00021 #define MPD_PLAYLIST_H 00022 00023 #include "queue.h" 00024 00025 #include <stdbool.h> 00026 00027 #define PLAYLIST_COMMENT '#' 00028 00029 enum playlist_result { 00030 PLAYLIST_RESULT_SUCCESS, 00031 PLAYLIST_RESULT_ERRNO, 00032 PLAYLIST_RESULT_DENIED, 00033 PLAYLIST_RESULT_NO_SUCH_SONG, 00034 PLAYLIST_RESULT_NO_SUCH_LIST, 00035 PLAYLIST_RESULT_LIST_EXISTS, 00036 PLAYLIST_RESULT_BAD_NAME, 00037 PLAYLIST_RESULT_BAD_RANGE, 00038 PLAYLIST_RESULT_NOT_PLAYING, 00039 PLAYLIST_RESULT_TOO_LARGE, 00040 PLAYLIST_RESULT_DISABLED, 00041 }; 00042 00043 struct playlist { 00047 struct queue queue; 00048 00053 bool playing; 00054 00060 bool stop_on_error; 00061 00067 unsigned error_count; 00068 00074 int current; 00075 00083 int queued; 00084 }; 00085 00087 extern struct playlist g_playlist; 00088 00089 void 00090 playlist_global_init(void); 00091 00092 void 00093 playlist_global_finish(void); 00094 00095 void 00096 playlist_init(struct playlist *playlist); 00097 00098 void 00099 playlist_finish(struct playlist *playlist); 00100 00101 void 00102 playlist_tag_changed(struct playlist *playlist); 00103 00107 static inline const struct queue * 00108 playlist_get_queue(const struct playlist *playlist) 00109 { 00110 return &playlist->queue; 00111 } 00112 00113 void 00114 playlist_clear(struct playlist *playlist); 00115 00116 #ifndef WIN32 00117 00121 enum playlist_result 00122 playlist_append_file(struct playlist *playlist, const char *path, int uid, 00123 unsigned *added_id); 00124 #endif 00125 00126 enum playlist_result 00127 playlist_append_uri(struct playlist *playlist, const char *file, 00128 unsigned *added_id); 00129 00130 enum playlist_result 00131 playlist_append_song(struct playlist *playlist, 00132 struct song *song, unsigned *added_id); 00133 00134 enum playlist_result 00135 playlist_delete(struct playlist *playlist, unsigned song); 00136 00143 enum playlist_result 00144 playlist_delete_range(struct playlist *playlist, unsigned start, unsigned end); 00145 00146 enum playlist_result 00147 playlist_delete_id(struct playlist *playlist, unsigned song); 00148 00149 void 00150 playlist_stop(struct playlist *playlist); 00151 00152 enum playlist_result 00153 playlist_play(struct playlist *playlist, int song); 00154 00155 enum playlist_result 00156 playlist_play_id(struct playlist *playlist, int song); 00157 00158 void 00159 playlist_next(struct playlist *playlist); 00160 00161 void 00162 playlist_sync(struct playlist *playlist); 00163 00164 void 00165 playlist_previous(struct playlist *playlist); 00166 00167 void 00168 playlist_shuffle(struct playlist *playlist, unsigned start, unsigned end); 00169 00170 void 00171 playlist_delete_song(struct playlist *playlist, const struct song *song); 00172 00173 enum playlist_result 00174 playlist_move_range(struct playlist *playlist, unsigned start, unsigned end, int to); 00175 00176 enum playlist_result 00177 playlist_move_id(struct playlist *playlist, unsigned id, int to); 00178 00179 enum playlist_result 00180 playlist_swap_songs(struct playlist *playlist, unsigned song1, unsigned song2); 00181 00182 enum playlist_result 00183 playlist_swap_songs_id(struct playlist *playlist, unsigned id1, unsigned id2); 00184 00185 bool 00186 playlist_get_repeat(const struct playlist *playlist); 00187 00188 void 00189 playlist_set_repeat(struct playlist *playlist, bool status); 00190 00191 bool 00192 playlist_get_random(const struct playlist *playlist); 00193 00194 void 00195 playlist_set_random(struct playlist *playlist, bool status); 00196 00197 bool 00198 playlist_get_single(const struct playlist *playlist); 00199 00200 void 00201 playlist_set_single(struct playlist *playlist, bool status); 00202 00203 bool 00204 playlist_get_consume(const struct playlist *playlist); 00205 00206 void 00207 playlist_set_consume(struct playlist *playlist, bool status); 00208 00209 int 00210 playlist_get_current_song(const struct playlist *playlist); 00211 00212 int 00213 playlist_get_next_song(const struct playlist *playlist); 00214 00215 unsigned 00216 playlist_get_song_id(const struct playlist *playlist, unsigned song); 00217 00218 int 00219 playlist_get_length(const struct playlist *playlist); 00220 00221 unsigned long 00222 playlist_get_version(const struct playlist *playlist); 00223 00224 enum playlist_result 00225 playlist_seek_song(struct playlist *playlist, unsigned song, float seek_time); 00226 00227 enum playlist_result 00228 playlist_seek_song_id(struct playlist *playlist, 00229 unsigned id, float seek_time); 00230 00231 void 00232 playlist_increment_version_all(struct playlist *playlist); 00233 00234 #endif
1.7.3