Mercurial > audlegacy
annotate src/audacious/playlist.h @ 2978:f4971c7d6384 trunk
Remove inlined urldecoding functions and use g_filename_from_uri() instead where appropriate.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Tue, 03 Jul 2007 21:20:01 -0500 |
parents | a49d86ca147b |
children | 3b6d316f8b09 |
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 | |
12 * the Free Software Foundation; under version 2 of the License. | |
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 | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
22 */ | |
23 #ifndef PLAYLIST_H | |
24 #define PLAYLIST_H | |
25 | |
2634 | 26 /* XXX: Allow pre-0.2 libmowgli to build audacious. */ |
27 #ifdef TRUE | |
28 # undef TRUE | |
29 #endif | |
30 | |
31 #ifdef FALSE | |
32 # undef FALSE | |
33 #endif | |
34 | |
2633
c079e507869a
[svn] - use a managed heap for playlist entry node allocation.
nenolod
parents:
2548
diff
changeset
|
35 #include <mowgli.h> |
2313 | 36 #include <glib.h> |
37 #include "audacious/titlestring.h" | |
38 #include "input.h" | |
39 | |
40 G_BEGIN_DECLS | |
41 | |
42 typedef enum { | |
43 PLAYLIST_SORT_PATH, | |
44 PLAYLIST_SORT_FILENAME, | |
45 PLAYLIST_SORT_TITLE, | |
46 PLAYLIST_SORT_ARTIST, | |
47 PLAYLIST_SORT_DATE, | |
48 PLAYLIST_SORT_TRACK, | |
49 PLAYLIST_SORT_PLAYLIST | |
50 } PlaylistSortType; | |
51 | |
52 typedef enum { | |
53 PLAYLIST_DUPS_PATH, | |
54 PLAYLIST_DUPS_FILENAME, | |
55 PLAYLIST_DUPS_TITLE | |
56 } PlaylistDupsType; | |
57 | |
58 typedef enum { | |
59 PLAYLIST_FORMAT_UNKNOWN = -1, | |
60 PLAYLIST_FORMAT_M3U, | |
61 PLAYLIST_FORMAT_PLS, | |
62 PLAYLIST_FORMAT_COUNT | |
63 } PlaylistFormat; | |
64 | |
65 #define PLAYLIST_ENTRY(x) ((PlaylistEntry*)(x)) | |
66 typedef struct _PlaylistEntry { | |
67 gchar *filename; | |
68 gchar *title; | |
69 gint length; | |
70 gboolean selected; | |
71 InputPlugin *decoder; | |
72 TitleInput *tuple; /* cached entry tuple, if available */ | |
73 } PlaylistEntry; | |
74 | |
75 #define PLAYLIST(x) ((Playlist *)(x)) | |
2636 | 76 |
77 typedef enum { | |
78 PLAYLIST_PLAIN = 0, | |
79 PLAYLIST_STATIC = 1, | |
2641 | 80 PLAYLIST_USE_RELATIVE = 1 << 1, |
2636 | 81 } PlaylistAttribute; |
82 | |
2313 | 83 typedef struct _Playlist { |
84 gchar *title; | |
85 gchar *filename; | |
86 gint length; | |
87 GList *entries; | |
88 GList *queue; | |
89 GList *shuffle; | |
90 PlaylistEntry *position; /* bleah */ | |
91 gulong pl_total_time; | |
92 gulong pl_selection_time; | |
93 gboolean pl_total_more; | |
94 gboolean pl_selection_more; | |
95 gboolean loading_playlist; | |
96 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
|
97 GList *tail; /* marker for the last element in playlist->entries */ |
2636 | 98 gint attribute; /* PlaylistAttribute */ |
2313 | 99 } Playlist; |
100 | |
101 typedef enum { | |
102 PLAYLIST_ASSOC_LINEAR, | |
103 PLAYLIST_ASSOC_QUEUE, | |
104 PLAYLIST_ASSOC_SHUFFLE | |
105 } PlaylistAssociation; | |
106 | |
107 PlaylistEntry *playlist_entry_new(const gchar * filename, | |
108 const gchar * title, const gint len, | |
109 InputPlugin * dec); | |
110 void playlist_entry_free(PlaylistEntry * entry); | |
111 | |
112 void playlist_entry_associate(Playlist * playlist, PlaylistEntry * entry, | |
113 PlaylistAssociation assoc); | |
114 | |
115 void playlist_entry_associate_pos(Playlist * playlist, PlaylistEntry * entry, | |
116 PlaylistAssociation assoc, gint pos); | |
117 | |
118 void playlist_init(void); | |
119 void playlist_add_playlist(Playlist *); | |
120 void playlist_remove_playlist(Playlist *); | |
121 void playlist_select_playlist(Playlist *); | |
122 void playlist_select_next(void); | |
123 void playlist_select_prev(void); | |
124 GList * playlist_get_playlists(void); | |
125 | |
126 void playlist_clear(Playlist *playlist); | |
127 void playlist_delete(Playlist *playlist, gboolean crop); | |
128 | |
129 gboolean playlist_add(Playlist *playlist, const gchar * filename); | |
130 gboolean playlist_ins(Playlist *playlist, const gchar * filename, gint pos); | |
131 guint playlist_add_dir(Playlist *playlist, const gchar * dir); | |
132 guint playlist_ins_dir(Playlist *playlist, const gchar * dir, gint pos, gboolean background); | |
133 guint playlist_add_url(Playlist *playlist, const gchar * url); | |
134 guint playlist_ins_url(Playlist *playlist, const gchar * string, gint pos); | |
135 | |
136 void playlist_set_info(Playlist *playlist, const gchar * title, gint length, gint rate, | |
137 gint freq, gint nch); | |
138 void playlist_set_info_old_abi(const gchar * title, gint length, gint rate, | |
139 gint freq, gint nch); | |
140 void playlist_check_pos_current(Playlist *playlist); | |
141 void playlist_next(Playlist *playlist); | |
142 void playlist_prev(Playlist *playlist); | |
143 void playlist_queue(Playlist *playlist); | |
144 void playlist_queue_position(Playlist *playlist, guint pos); | |
145 void playlist_queue_remove(Playlist *playlist, guint pos); | |
146 gint playlist_queue_get_length(Playlist *playlist); | |
147 gboolean playlist_is_position_queued(Playlist *playlist, guint pos); | |
148 void playlist_clear_queue(Playlist *playlist); | |
149 gint playlist_get_queue_position(Playlist *playlist, PlaylistEntry * entry); | |
150 gint playlist_get_queue_position_number(Playlist *playlist, guint pos); | |
151 gint playlist_get_queue_qposition_number(Playlist *playlist, guint pos); | |
152 void playlist_eof_reached(Playlist *playlist); | |
153 void playlist_set_position(Playlist *playlist, guint pos); | |
154 gint playlist_get_length(Playlist *playlist); | |
155 gint playlist_get_position(Playlist *playlist); | |
156 gint playlist_get_position_nolock(Playlist *playlist); | |
157 gchar *playlist_get_info_text(Playlist *playlist); | |
158 gint playlist_get_current_length(Playlist *playlist); | |
159 | |
160 gboolean playlist_save(Playlist *playlist, const gchar * filename); | |
161 gboolean playlist_load(Playlist *playlist, const gchar * filename); | |
162 | |
163 void playlist_start_get_info_thread(void); | |
164 void playlist_stop_get_info_thread(); | |
165 void playlist_start_get_info_scan(void); | |
166 | |
167 void playlist_sort(Playlist *playlist, PlaylistSortType type); | |
168 void playlist_sort_selected(Playlist *playlist, PlaylistSortType type); | |
169 | |
170 void playlist_reverse(Playlist *playlist); | |
171 void playlist_random(Playlist *playlist); | |
172 void playlist_remove_duplicates(Playlist *playlist, PlaylistDupsType); | |
173 void playlist_remove_dead_files(Playlist *playlist); | |
174 | |
175 void playlist_fileinfo_current(Playlist *playlist); | |
176 void playlist_fileinfo(Playlist *playlist, guint pos); | |
177 | |
178 void playlist_delete_index(Playlist *playlist, guint pos); | |
179 void playlist_delete_filenames(Playlist *playlist, GList * filenames); | |
180 | |
181 PlaylistEntry *playlist_get_entry_to_play(Playlist *playlist); | |
182 | |
183 /* XXX this is for reverse compatibility --nenolod */ | |
184 const gchar *playlist_get_filename_to_play(Playlist *playlist); | |
185 | |
186 gchar *playlist_get_filename(Playlist *playlist, guint pos); | |
187 gchar *playlist_get_songtitle(Playlist *playlist, guint pos); | |
188 TitleInput *playlist_get_tuple(Playlist *playlist, guint pos); | |
189 gint playlist_get_songtime(Playlist *playlist, guint pos); | |
190 | |
191 GList *playlist_get_selected(Playlist *playlist); | |
192 GList *playlist_get_selected_list(Playlist *playlist); | |
193 int playlist_get_num_selected(Playlist *playlist); | |
194 | |
195 void playlist_get_total_time(Playlist *playlist, gulong * total_time, gulong * selection_time, | |
196 gboolean * total_more, | |
197 gboolean * selection_more); | |
198 | |
199 gint playlist_select_search(Playlist *playlist, TitleInput *tuple, gint action); | |
200 void playlist_select_all(Playlist *playlist, gboolean set); | |
201 void playlist_select_range(Playlist *playlist, gint min, gint max, gboolean sel); | |
202 void playlist_select_invert_all(Playlist *playlist); | |
203 gboolean playlist_select_invert(Playlist *playlist, guint pos); | |
204 | |
205 gboolean playlist_read_info_selection(Playlist *playlist); | |
206 void playlist_read_info(Playlist *playlist, guint pos); | |
207 | |
208 void playlist_set_shuffle(gboolean shuffle); | |
209 | |
210 void playlist_clear_selected(Playlist *playlist); | |
211 | |
212 GList *get_playlist_nth(Playlist *playlist, guint); | |
213 gboolean playlist_set_current_name(Playlist *playlist, const gchar * filename); | |
214 const gchar *playlist_get_current_name(Playlist *playlist); | |
215 Playlist *playlist_new(void); | |
216 void playlist_free(Playlist *playlist); | |
217 Playlist *playlist_new_from_selected(void); | |
218 | |
219 PlaylistFormat playlist_format_get_from_name(const gchar * filename); | |
220 gboolean is_playlist_name(const gchar * filename); | |
221 | |
2680 | 222 #define PLAYLIST_LOCK(m) g_mutex_lock(m) |
223 #define PLAYLIST_UNLOCK(m) g_mutex_unlock(m) | |
2313 | 224 |
225 G_LOCK_EXTERN(playlists); | |
226 | |
227 extern void playlist_load_ins_file(Playlist *playlist, const gchar * filename, | |
228 const gchar * playlist_name, gint pos, | |
229 const gchar * title, gint len); | |
230 | |
231 extern void playlist_load_ins_file_tuple(Playlist *playlist, const gchar * filename_p, | |
232 const gchar * playlist_name, gint pos, | |
233 TitleInput *tuple); | |
234 | |
235 Playlist *playlist_get_active(void); | |
236 | |
237 G_END_DECLS | |
238 | |
239 #endif |