annotate audacious/playlist.h @ 1252:ece68ef26b94 trunk

[svn] - we don't really have to unwire track 0 this way, as 0 will be selected by default if no subsong URI is given
author nenolod
date Thu, 15 Jun 2006 05:17:49 -0700
parents 5f09d64c61e2
children 01dcb223833a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1230
a5d5f404b933 [svn] - attach a TitleInput tuple to the PlaylistEntry class.
nenolod
parents: 984
diff changeset
1 /* Audacious - Cross-platform multimedia player
a5d5f404b933 [svn] - attach a TitleInput tuple to the PlaylistEntry class.
nenolod
parents: 984
diff changeset
2 * Copyright (C) 2005-2006 William Pitcock, Tony Vroon, George Averill,
a5d5f404b933 [svn] - attach a TitleInput tuple to the PlaylistEntry class.
nenolod
parents: 984
diff changeset
3 * Giacomo Lozito, Derek Pomery and Yoshiki Yazawa.
a5d5f404b933 [svn] - attach a TitleInput tuple to the PlaylistEntry class.
nenolod
parents: 984
diff changeset
4 *
a5d5f404b933 [svn] - attach a TitleInput tuple to the PlaylistEntry class.
nenolod
parents: 984
diff changeset
5 * XMMS - Cross-platform multimedia player
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 * Copyright (C) 1998-2003 Peter Alm, Mikael Alm, Olle Hallnas,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * Thomas Nilsson and 4Front Technologies
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * Copyright (C) 1999-2003 Haavard Kvaalen
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #ifndef PLAYLIST_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 #define PLAYLIST_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 #include <glib.h>
1230
a5d5f404b933 [svn] - attach a TitleInput tuple to the PlaylistEntry class.
nenolod
parents: 984
diff changeset
28 #include "libaudacious/titlestring.h"
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 0
diff changeset
29 #include "input.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 typedef enum {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 PLAYLIST_SORT_PATH,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 PLAYLIST_SORT_FILENAME,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 PLAYLIST_SORT_TITLE,
1251
5f09d64c61e2 [svn] - sort by Artist
nenolod
parents: 1235
diff changeset
35 PLAYLIST_SORT_ARTIST,
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 PLAYLIST_SORT_DATE
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 } PlaylistSortType;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 typedef enum {
852
bcff46a2558d [svn] added multiple 'remove duplicates' (by title, by filename, by path+filename)
giacomo
parents: 840
diff changeset
40 PLAYLIST_DUPS_PATH,
bcff46a2558d [svn] added multiple 'remove duplicates' (by title, by filename, by path+filename)
giacomo
parents: 840
diff changeset
41 PLAYLIST_DUPS_FILENAME,
bcff46a2558d [svn] added multiple 'remove duplicates' (by title, by filename, by path+filename)
giacomo
parents: 840
diff changeset
42 PLAYLIST_DUPS_TITLE
bcff46a2558d [svn] added multiple 'remove duplicates' (by title, by filename, by path+filename)
giacomo
parents: 840
diff changeset
43 } PlaylistDupsType;
bcff46a2558d [svn] added multiple 'remove duplicates' (by title, by filename, by path+filename)
giacomo
parents: 840
diff changeset
44
bcff46a2558d [svn] added multiple 'remove duplicates' (by title, by filename, by path+filename)
giacomo
parents: 840
diff changeset
45 typedef enum {
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 PLAYLIST_FORMAT_UNKNOWN = -1,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 PLAYLIST_FORMAT_M3U,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 PLAYLIST_FORMAT_PLS,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 PLAYLIST_FORMAT_COUNT
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 } PlaylistFormat;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 #define PLAYLIST_ENTRY(x) ((PlaylistEntry*)(x))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 struct _PlaylistEntry {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 gchar *filename;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 gchar *title;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 gint length;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 gboolean selected;
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 0
diff changeset
58 InputPlugin *decoder;
1230
a5d5f404b933 [svn] - attach a TitleInput tuple to the PlaylistEntry class.
nenolod
parents: 984
diff changeset
59 TitleInput *tuple; /* cached entry tuple, if available */
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 typedef struct _PlaylistEntry PlaylistEntry;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 PlaylistEntry *playlist_entry_new(const gchar * filename,
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 0
diff changeset
65 const gchar * title, const gint len,
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 0
diff changeset
66 InputPlugin * dec);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 void playlist_entry_free(PlaylistEntry * entry);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 void playlist_init(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 void playlist_clear(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 void playlist_delete(gboolean crop);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 gboolean playlist_add(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 gboolean playlist_ins(const gchar * filename, gint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 guint playlist_add_dir(const gchar * dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 guint playlist_ins_dir(const gchar * dir, gint pos, gboolean background);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 guint playlist_add_url(const gchar * url);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 guint playlist_ins_url(const gchar * string, gint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 void playlist_play(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 void playlist_set_info(const gchar * title, gint length, gint rate,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 gint freq, gint nch);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 void playlist_check_pos_current(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 void playlist_next(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 void playlist_prev(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 void playlist_queue(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 void playlist_queue_position(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 void playlist_queue_remove(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 gint playlist_queue_get_length(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 gboolean playlist_is_position_queued(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 void playlist_clear_queue(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 gint playlist_get_queue_position(PlaylistEntry * entry);
984
bcd1ebd0a7c1 [svn] - jumptofile and queue support fun
nhjm449
parents: 852
diff changeset
93 gint playlist_get_queue_position_number(guint pos);
bcd1ebd0a7c1 [svn] - jumptofile and queue support fun
nhjm449
parents: 852
diff changeset
94 gint playlist_get_queue_qposition_number(guint pos);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 void playlist_eof_reached(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 void playlist_set_position(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 gint playlist_get_length(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 gint playlist_get_length_nolock(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 gint playlist_get_position(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 gint playlist_get_position_nolock(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 gchar *playlist_get_info_text(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 gint playlist_get_current_length(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 gboolean playlist_save(const gchar * filename, PlaylistFormat format);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 gboolean playlist_load(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 GList *playlist_get(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 void playlist_start_get_info_thread(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 void playlist_stop_get_info_thread();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 void playlist_start_get_info_scan(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 void playlist_sort(PlaylistSortType type);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 void playlist_sort_selected(PlaylistSortType type);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 void playlist_reverse(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 void playlist_random(void);
852
bcff46a2558d [svn] added multiple 'remove duplicates' (by title, by filename, by path+filename)
giacomo
parents: 840
diff changeset
118 void playlist_remove_duplicates(PlaylistDupsType);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 void playlist_remove_dead_files(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 void playlist_fileinfo_current(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 void playlist_fileinfo(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 void playlist_delete_index(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 void playlist_delete_filenames(GList * filenames);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126
398
f908bcd87c3d [svn] Generate cache content on demand if it was not previously there.
nenolod
parents: 356
diff changeset
127 PlaylistEntry *playlist_get_entry_to_play();
356
99928e1275a1 [svn] This commit reduces the amount of times we probe a source down to ONE
nenolod
parents: 355
diff changeset
128
99928e1275a1 [svn] This commit reduces the amount of times we probe a source down to ONE
nenolod
parents: 355
diff changeset
129 /* XXX this is for reverse compatibility --nenolod */
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 const gchar *playlist_get_filename_to_play();
356
99928e1275a1 [svn] This commit reduces the amount of times we probe a source down to ONE
nenolod
parents: 355
diff changeset
131
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 gchar *playlist_get_filename(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 gchar *playlist_get_songtitle(guint pos);
1235
7918849bad3e [svn] - more sanity for input_get_song_tuple()
nenolod
parents: 1230
diff changeset
134 TitleInput *playlist_get_tuple(guint pos);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 gint playlist_get_songtime(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 GList *playlist_get_selected(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 GList *playlist_get_selected_list(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 int playlist_get_num_selected(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 void playlist_get_total_time(gulong * total_time, gulong * selection_time,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 gboolean * total_more,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 gboolean * selection_more);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 void playlist_select_all(gboolean set);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 void playlist_select_range(gint min, gint max, gboolean sel);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 void playlist_select_invert_all(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 gboolean playlist_select_invert(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 gboolean playlist_read_info_selection(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 void playlist_read_info(guint pos);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 void playlist_set_shuffle(gboolean shuffle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 void playlist_clear_selected(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 GList *get_playlist_nth(guint);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 gboolean playlist_set_current_name(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 const gchar *playlist_get_current_name(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 void playlist_new(void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 PlaylistFormat playlist_format_get_from_name(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 gboolean is_playlist_name(const gchar * filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 #define PLAYLIST_LOCK() G_LOCK(playlist)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 #define PLAYLIST_UNLOCK() G_UNLOCK(playlist)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 G_LOCK_EXTERN(playlist);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169
356
99928e1275a1 [svn] This commit reduces the amount of times we probe a source down to ONE
nenolod
parents: 355
diff changeset
170 extern PlaylistEntry *playlist_position;
99928e1275a1 [svn] This commit reduces the amount of times we probe a source down to ONE
nenolod
parents: 355
diff changeset
171
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 #endif