2 * Copyright (c) 2006-2011 Ed Schouten <ed@80386.nl>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * @brief Playlist handling.
34 * @brief Initialize the playlist locking.
36 void playq_init(int autoplay
, int xmms
, int load_dumpfile
);
38 * @brief Spawn the playback thread.
40 void playq_spawn(void);
42 * @brief Shutdown the playback thread.
44 void playq_shutdown(void);
47 * @brief Seek the current played song.
49 void playq_cursong_seek(int len
, int rel
);
51 * @brief Continue to the next song.
53 void playq_cursong_next(void);
55 * @brief Go back to the previous song.
57 void playq_cursong_prev(void);
59 * @brief Stop playback.
61 void playq_cursong_stop(void);
63 * @brief Pause or unpause the current song, depending on its current
66 void playq_cursong_pause(void);
68 * @brief Toggle whether repeat is turned on or off.
70 void playq_repeat_toggle(void);
73 * @brief Lock queue and add a file or directory to the head of the
76 void playq_song_add_head(struct vfsref
*vr
);
78 * @brief Lock queue and add a file or directory to the tail of the
81 void playq_song_add_tail(struct vfsref
*vr
);
83 * @brief Remove all songs from the playlist.
85 void playq_song_remove_all(void);
87 * @brief Randomize the playlist.
89 void playq_song_randomize(void);
92 * @brief The mutex that locks down the playlist.
94 extern GMutex
*playq_mtx
;
97 * @brief Acquire the lock on the playlist.
102 g_mutex_lock(playq_mtx
);
106 * @brief Release the lock on the playlist.
111 g_mutex_unlock(playq_mtx
);
115 * All functions and variables below need proper locking. Always use
116 * playq_lock() and playq_unlock() when using them.
120 * @brief The actual playlist containing all songs scheduled for playback.
122 extern struct vfslist playq_list
;
125 * @brief Remove the song with its corresponding index.
127 void playq_song_fast_remove(struct vfsref
*vr
, unsigned int index
);
129 * @brief Add a song before the specified song.
131 void playq_song_fast_add_before(struct vfsref
*nvr
, struct vfsref
*lvr
,
134 * @brief Add a song after the specified song.
136 void playq_song_fast_add_after(struct vfsref
*nvr
, struct vfsref
*lvr
,
139 * @brief Move the specified song one position up.
141 void playq_song_fast_move_up(struct vfsref
*vr
, unsigned int index
);
143 * @brief Move the specified song one position down.
145 void playq_song_fast_move_down(struct vfsref
*vr
, unsigned int index
);
147 * @brief Move the specified song to the top.
149 void playq_song_fast_move_head(struct vfsref
*vr
, unsigned int index
);
151 * @brief Move the specified song to the bottom.
153 void playq_song_fast_move_tail(struct vfsref
*vr
, unsigned int index
);
155 * @brief Switch playback to a specific song.
157 void playq_song_fast_select(struct vfsref
*vr
);