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