Fix whitespace inconsistencies.
[herrie-working.git] / herrie / src / playq.h
blob6e935ba15bb8e3d21469efdb43669732d8c7a3d4
1 /*
2 * Copyright (c) 2006-2011 Ed Schouten <ed@80386.nl>
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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
24 * SUCH DAMAGE.
26 /**
27 * @file playq.h
28 * @brief Playlist handling.
31 struct vfsref;
33 /**
34 * @brief Initialize the playlist locking.
36 void playq_init(int autoplay, int xmms, int load_dumpfile);
37 /**
38 * @brief Spawn the playback thread.
40 void playq_spawn(void);
41 /**
42 * @brief Shutdown the playback thread.
44 void playq_shutdown(void);
46 /**
47 * @brief Seek the current played song.
49 void playq_cursong_seek(int len, int rel);
50 /**
51 * @brief Continue to the next song.
53 void playq_cursong_next(void);
54 /**
55 * @brief Go back to the previous song.
57 void playq_cursong_prev(void);
58 /**
59 * @brief Stop playback.
61 void playq_cursong_stop(void);
62 /**
63 * @brief Pause or unpause the current song, depending on its current
64 * state.
66 void playq_cursong_pause(void);
67 /**
68 * @brief Toggle whether repeat is turned on or off.
70 void playq_repeat_toggle(void);
72 /**
73 * @brief Lock queue and add a file or directory to the head of the
74 * playlist.
76 void playq_song_add_head(struct vfsref *vr);
77 /**
78 * @brief Lock queue and add a file or directory to the tail of the
79 * playlist.
81 void playq_song_add_tail(struct vfsref *vr);
82 /**
83 * @brief Remove all songs from the playlist.
85 void playq_song_remove_all(void);
86 /**
87 * @brief Randomize the playlist.
89 void playq_song_randomize(void);
91 /**
92 * @brief The mutex that locks down the playlist.
94 extern GMutex *playq_mtx;
96 /**
97 * @brief Acquire the lock on the playlist.
99 static inline void
100 playq_lock(void)
102 g_mutex_lock(playq_mtx);
106 * @brief Release the lock on the playlist.
108 static inline void
109 playq_unlock(void)
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,
132 unsigned int index);
134 * @brief Add a song after the specified song.
136 void playq_song_fast_add_after(struct vfsref *nvr, struct vfsref *lvr,
137 unsigned int index);
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);