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