Mercurial > audlegacy
annotate src/audacious/playlist.h @ 3623:3625e0085d7f
Change PLLIST_COL_PLPOINTER to PLLIST_PLPOINTER for consistency
author | Kieran Clancy <clancy.kieran+audacious@gmail.com> |
---|---|
date | Tue, 25 Sep 2007 20:39:26 +0930 |
parents | 26910525cec8 |
children | 9c4633afc0a8 |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 William Pitcock, Tony Vroon, George Averill, | |
3 * Giacomo Lozito, Derek Pomery and Yoshiki Yazawa. | |
4 * | |
5 * XMMS - Cross-platform multimedia player | |
6 * Copyright (C) 1998-2003 Peter Alm, Mikael Alm, Olle Hallnas, | |
7 * Thomas Nilsson and 4Front Technologies | |
8 * Copyright (C) 1999-2003 Haavard Kvaalen | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2680
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
2313 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2680
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
2313 | 24 */ |
25 #ifndef PLAYLIST_H | |
26 #define PLAYLIST_H | |
27 | |
2634 | 28 /* XXX: Allow pre-0.2 libmowgli to build audacious. */ |
29 #ifdef TRUE | |
30 # undef TRUE | |
31 #endif | |
32 | |
33 #ifdef FALSE | |
34 # undef FALSE | |
35 #endif | |
36 | |
2633
c079e507869a
[svn] - use a managed heap for playlist entry node allocation.
nenolod
parents:
2548
diff
changeset
|
37 #include <mowgli.h> |
2313 | 38 #include <glib.h> |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
39 #include "audacious/tuple.h" |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
40 #include "audacious/tuple_formatter.h" |
2313 | 41 #include "input.h" |
42 | |
43 G_BEGIN_DECLS | |
44 | |
45 typedef enum { | |
46 PLAYLIST_SORT_PATH, | |
47 PLAYLIST_SORT_FILENAME, | |
48 PLAYLIST_SORT_TITLE, | |
49 PLAYLIST_SORT_ARTIST, | |
50 PLAYLIST_SORT_DATE, | |
51 PLAYLIST_SORT_TRACK, | |
52 PLAYLIST_SORT_PLAYLIST | |
53 } PlaylistSortType; | |
54 | |
55 typedef enum { | |
56 PLAYLIST_DUPS_PATH, | |
57 PLAYLIST_DUPS_FILENAME, | |
58 PLAYLIST_DUPS_TITLE | |
59 } PlaylistDupsType; | |
60 | |
61 typedef enum { | |
62 PLAYLIST_FORMAT_UNKNOWN = -1, | |
63 PLAYLIST_FORMAT_M3U, | |
64 PLAYLIST_FORMAT_PLS, | |
65 PLAYLIST_FORMAT_COUNT | |
66 } PlaylistFormat; | |
67 | |
68 #define PLAYLIST_ENTRY(x) ((PlaylistEntry*)(x)) | |
69 typedef struct _PlaylistEntry { | |
70 gchar *filename; | |
71 gchar *title; | |
72 gint length; | |
73 gboolean selected; | |
74 InputPlugin *decoder; | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
75 Tuple *tuple; /* cached entry tuple, if available */ |
2313 | 76 } PlaylistEntry; |
77 | |
78 #define PLAYLIST(x) ((Playlist *)(x)) | |
2636 | 79 |
80 typedef enum { | |
81 PLAYLIST_PLAIN = 0, | |
82 PLAYLIST_STATIC = 1, | |
2641 | 83 PLAYLIST_USE_RELATIVE = 1 << 1, |
2636 | 84 } PlaylistAttribute; |
85 | |
2313 | 86 typedef struct _Playlist { |
87 gchar *title; | |
88 gchar *filename; | |
89 gint length; | |
90 GList *entries; | |
91 GList *queue; | |
92 GList *shuffle; | |
93 PlaylistEntry *position; /* bleah */ | |
94 gulong pl_total_time; | |
95 gulong pl_selection_time; | |
96 gboolean pl_total_more; | |
97 gboolean pl_selection_more; | |
98 gboolean loading_playlist; | |
99 GMutex *mutex; /* this is required for multiple playlist */ | |
2548
68d1e9761cc5
[svn] - highly experimental code to speed up loading huge playlist. let me know if it breaks something.
yaz
parents:
2313
diff
changeset
|
100 GList *tail; /* marker for the last element in playlist->entries */ |
2636 | 101 gint attribute; /* PlaylistAttribute */ |
2313 | 102 } Playlist; |
103 | |
104 typedef enum { | |
105 PLAYLIST_ASSOC_LINEAR, | |
106 PLAYLIST_ASSOC_QUEUE, | |
107 PLAYLIST_ASSOC_SHUFFLE | |
108 } PlaylistAssociation; | |
109 | |
110 PlaylistEntry *playlist_entry_new(const gchar * filename, | |
111 const gchar * title, const gint len, | |
112 InputPlugin * dec); | |
113 void playlist_entry_free(PlaylistEntry * entry); | |
114 | |
115 void playlist_entry_associate(Playlist * playlist, PlaylistEntry * entry, | |
116 PlaylistAssociation assoc); | |
117 | |
118 void playlist_entry_associate_pos(Playlist * playlist, PlaylistEntry * entry, | |
119 PlaylistAssociation assoc, gint pos); | |
120 | |
121 void playlist_init(void); | |
122 void playlist_add_playlist(Playlist *); | |
123 void playlist_remove_playlist(Playlist *); | |
124 void playlist_select_playlist(Playlist *); | |
125 void playlist_select_next(void); | |
126 void playlist_select_prev(void); | |
127 GList * playlist_get_playlists(void); | |
128 | |
3460
0fcff78c0c2c
Make the shutdown procedure more sane and improve playlist clearing
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
129 void playlist_clear_only(Playlist *playlist); |
2313 | 130 void playlist_clear(Playlist *playlist); |
131 void playlist_delete(Playlist *playlist, gboolean crop); | |
132 | |
133 gboolean playlist_add(Playlist *playlist, const gchar * filename); | |
134 gboolean playlist_ins(Playlist *playlist, const gchar * filename, gint pos); | |
135 guint playlist_add_dir(Playlist *playlist, const gchar * dir); | |
136 guint playlist_ins_dir(Playlist *playlist, const gchar * dir, gint pos, gboolean background); | |
137 guint playlist_add_url(Playlist *playlist, const gchar * url); | |
138 guint playlist_ins_url(Playlist *playlist, const gchar * string, gint pos); | |
139 | |
140 void playlist_set_info(Playlist *playlist, const gchar * title, gint length, gint rate, | |
141 gint freq, gint nch); | |
142 void playlist_set_info_old_abi(const gchar * title, gint length, gint rate, | |
143 gint freq, gint nch); | |
144 void playlist_check_pos_current(Playlist *playlist); | |
145 void playlist_next(Playlist *playlist); | |
146 void playlist_prev(Playlist *playlist); | |
147 void playlist_queue(Playlist *playlist); | |
148 void playlist_queue_position(Playlist *playlist, guint pos); | |
149 void playlist_queue_remove(Playlist *playlist, guint pos); | |
150 gint playlist_queue_get_length(Playlist *playlist); | |
151 gboolean playlist_is_position_queued(Playlist *playlist, guint pos); | |
152 void playlist_clear_queue(Playlist *playlist); | |
153 gint playlist_get_queue_position(Playlist *playlist, PlaylistEntry * entry); | |
154 gint playlist_get_queue_position_number(Playlist *playlist, guint pos); | |
155 gint playlist_get_queue_qposition_number(Playlist *playlist, guint pos); | |
156 void playlist_eof_reached(Playlist *playlist); | |
157 void playlist_set_position(Playlist *playlist, guint pos); | |
158 gint playlist_get_length(Playlist *playlist); | |
159 gint playlist_get_position(Playlist *playlist); | |
160 gint playlist_get_position_nolock(Playlist *playlist); | |
161 gchar *playlist_get_info_text(Playlist *playlist); | |
162 gint playlist_get_current_length(Playlist *playlist); | |
163 | |
164 gboolean playlist_save(Playlist *playlist, const gchar * filename); | |
165 gboolean playlist_load(Playlist *playlist, const gchar * filename); | |
166 | |
167 void playlist_start_get_info_thread(void); | |
168 void playlist_stop_get_info_thread(); | |
169 void playlist_start_get_info_scan(void); | |
170 | |
171 void playlist_sort(Playlist *playlist, PlaylistSortType type); | |
172 void playlist_sort_selected(Playlist *playlist, PlaylistSortType type); | |
173 | |
174 void playlist_reverse(Playlist *playlist); | |
175 void playlist_random(Playlist *playlist); | |
176 void playlist_remove_duplicates(Playlist *playlist, PlaylistDupsType); | |
177 void playlist_remove_dead_files(Playlist *playlist); | |
178 | |
179 void playlist_fileinfo_current(Playlist *playlist); | |
180 void playlist_fileinfo(Playlist *playlist, guint pos); | |
181 | |
182 void playlist_delete_index(Playlist *playlist, guint pos); | |
183 void playlist_delete_filenames(Playlist *playlist, GList * filenames); | |
184 | |
185 PlaylistEntry *playlist_get_entry_to_play(Playlist *playlist); | |
186 | |
187 /* XXX this is for reverse compatibility --nenolod */ | |
188 const gchar *playlist_get_filename_to_play(Playlist *playlist); | |
189 | |
190 gchar *playlist_get_filename(Playlist *playlist, guint pos); | |
191 gchar *playlist_get_songtitle(Playlist *playlist, guint pos); | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
192 Tuple *playlist_get_tuple(Playlist *playlist, guint pos); |
2313 | 193 gint playlist_get_songtime(Playlist *playlist, guint pos); |
194 | |
195 GList *playlist_get_selected(Playlist *playlist); | |
196 GList *playlist_get_selected_list(Playlist *playlist); | |
197 int playlist_get_num_selected(Playlist *playlist); | |
198 | |
199 void playlist_get_total_time(Playlist *playlist, gulong * total_time, gulong * selection_time, | |
200 gboolean * total_more, | |
201 gboolean * selection_more); | |
202 | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
203 gint playlist_select_search(Playlist *playlist, Tuple *tuple, gint action); |
2313 | 204 void playlist_select_all(Playlist *playlist, gboolean set); |
205 void playlist_select_range(Playlist *playlist, gint min, gint max, gboolean sel); | |
206 void playlist_select_invert_all(Playlist *playlist); | |
207 gboolean playlist_select_invert(Playlist *playlist, guint pos); | |
208 | |
209 gboolean playlist_read_info_selection(Playlist *playlist); | |
210 void playlist_read_info(Playlist *playlist, guint pos); | |
211 | |
212 void playlist_set_shuffle(gboolean shuffle); | |
213 | |
214 void playlist_clear_selected(Playlist *playlist); | |
215 | |
216 GList *get_playlist_nth(Playlist *playlist, guint); | |
3477
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3474
diff
changeset
|
217 |
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3474
diff
changeset
|
218 gboolean playlist_set_current_name(Playlist *playlist, const gchar * title); |
2313 | 219 const gchar *playlist_get_current_name(Playlist *playlist); |
3477
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3474
diff
changeset
|
220 |
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3474
diff
changeset
|
221 gboolean playlist_filename_set(Playlist *playlist, const gchar * filename); |
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3474
diff
changeset
|
222 gchar *playlist_filename_get(Playlist *playlist); |
57f4971b7086
New functions for associating a filename with a playlist. Made title/filename setting more consistent.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3474
diff
changeset
|
223 |
2313 | 224 Playlist *playlist_new(void); |
225 void playlist_free(Playlist *playlist); | |
226 Playlist *playlist_new_from_selected(void); | |
227 | |
228 PlaylistFormat playlist_format_get_from_name(const gchar * filename); | |
229 gboolean is_playlist_name(const gchar * filename); | |
230 | |
3468
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3460
diff
changeset
|
231 #define PLAYLIST_LOCK(pl) g_mutex_lock(pl->mutex) |
440877c9360e
Changed PLAYLIST_{UN}LOCK() macros to use playlist itself as argument, not
Matti Hamalainen <ccr@tnsp.org>
parents:
3460
diff
changeset
|
232 #define PLAYLIST_UNLOCK(pl) g_mutex_unlock(pl->mutex) |
2313 | 233 |
234 G_LOCK_EXTERN(playlists); | |
235 | |
236 extern void playlist_load_ins_file(Playlist *playlist, const gchar * filename, | |
237 const gchar * playlist_name, gint pos, | |
238 const gchar * title, gint len); | |
239 | |
240 extern void playlist_load_ins_file_tuple(Playlist *playlist, const gchar * filename_p, | |
241 const gchar * playlist_name, gint pos, | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
242 Tuple *tuple); |
2313 | 243 |
244 Playlist *playlist_get_active(void); | |
245 | |
3474
adc785ee517b
Add playlist_playlists_equal for comparing entire playlists
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3298
diff
changeset
|
246 gboolean playlist_playlists_equal(Playlist *p1, Playlist *p2); |
adc785ee517b
Add playlist_playlists_equal for comparing entire playlists
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3298
diff
changeset
|
247 |
2313 | 248 G_END_DECLS |
249 | |
250 #endif |