Mercurial > audlegacy
annotate src/audacious/input.c @ 3342:5d50b9604ddc trunk
Remove hardcoded test because uri_get_plugin should take care of it now
author | Christian Birchinger <joker@netswarm.net> |
---|---|
date | Sun, 12 Aug 2007 21:38:04 +0200 |
parents | 3da640de0e99 |
children | f5a413804217 |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
2 * Copyright (C) 2005-2007 Audacious development team |
2313 | 3 * |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team | |
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:
3110
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:
3110
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 | |
26 #ifdef HAVE_CONFIG_H | |
27 # include "config.h" | |
28 #endif | |
29 | |
30 #include <glib.h> | |
31 #include <glib/gi18n.h> | |
32 #include <gtk/gtk.h> | |
33 #include <string.h> | |
34 | |
35 #include "fft.h" | |
36 #include "input.h" | |
37 #include "main.h" | |
38 #include "output.h" | |
39 #include "playback.h" | |
40 #include "pluginenum.h" | |
2420 | 41 #include "strings.h" |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
42 #include "tuple.h" |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
43 #include "tuple_formatter.h" |
2420 | 44 #include "ui_main.h" |
45 #include "util.h" | |
46 #include "visualization.h" | |
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
47 #include "ui_skinned_playstatus.h" |
2505 | 48 #include "hook.h" |
2313 | 49 |
2347
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
50 #include "vfs.h" |
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
51 #include "vfs_buffer.h" |
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
52 #include "vfs_buffered_file.h" |
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
53 |
2313 | 54 G_LOCK_DEFINE_STATIC(vis_mutex); |
55 | |
56 struct _VisNode { | |
57 gint time; | |
58 gint nch; | |
59 gint length; /* number of samples per channel */ | |
60 gint16 data[2][512]; | |
61 }; | |
62 | |
63 typedef struct _VisNode VisNode; | |
64 | |
65 | |
66 InputPluginData ip_data = { | |
67 NULL, | |
68 NULL, | |
69 FALSE, | |
70 FALSE, | |
71 FALSE, | |
72 FALSE, | |
73 NULL | |
74 }; | |
75 | |
76 static GList *vis_list = NULL; | |
77 | |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
78 InputPlayback * |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
79 get_current_input_playback(void) |
2313 | 80 { |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
81 return ip_data.current_input_playback; |
2313 | 82 } |
83 | |
84 void | |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
85 set_current_input_playback(InputPlayback * ip) |
2313 | 86 { |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
87 ip_data.current_input_playback = ip; |
2313 | 88 } |
89 | |
90 GList * | |
91 get_input_list(void) | |
92 { | |
93 return ip_data.input_list; | |
94 } | |
95 | |
96 | |
97 gboolean | |
98 input_is_enabled(const gchar * filename) | |
99 { | |
100 gchar *basename = g_path_get_basename(filename); | |
101 gint enabled; | |
102 | |
103 enabled = GPOINTER_TO_INT(g_hash_table_lookup(plugin_matrix, basename)); | |
104 g_free(basename); | |
105 | |
106 return enabled; | |
107 } | |
108 | |
109 static void | |
110 disabled_iplugins_foreach_func(const gchar * name, | |
111 gboolean enabled, | |
112 GString * list) | |
113 { | |
114 g_return_if_fail(list != NULL); | |
115 | |
116 if (enabled) | |
117 return; | |
118 | |
119 if (list->len > 0) | |
120 g_string_append(list, ":"); | |
121 | |
122 g_string_append(list, name); | |
123 } | |
124 | |
125 gchar * | |
126 input_stringify_disabled_list(void) | |
127 { | |
128 GString *disabled_list; | |
129 | |
130 disabled_list = g_string_new(""); | |
131 g_hash_table_foreach(plugin_matrix, | |
132 (GHFunc) disabled_iplugins_foreach_func, | |
133 disabled_list); | |
134 | |
135 return g_string_free(disabled_list, FALSE); | |
136 } | |
137 | |
138 void | |
139 free_vis_data(void) | |
140 { | |
141 G_LOCK(vis_mutex); | |
142 g_list_foreach(vis_list, (GFunc) g_free, NULL); | |
143 g_list_free(vis_list); | |
144 vis_list = NULL; | |
145 G_UNLOCK(vis_mutex); | |
146 } | |
147 | |
148 static void | |
149 convert_to_s16_ne(AFormat fmt, gpointer ptr, gint16 * left, | |
150 gint16 * right, gint nch, gint max) | |
151 { | |
152 gint16 *ptr16; | |
153 guint16 *ptru16; | |
154 guint8 *ptru8; | |
155 gint i; | |
156 | |
157 switch (fmt) { | |
158 case FMT_U8: | |
159 ptru8 = ptr; | |
160 if (nch == 1) | |
161 for (i = 0; i < max; i++) | |
162 left[i] = ((*ptru8++) ^ 128) << 8; | |
163 else | |
164 for (i = 0; i < max; i++) { | |
165 left[i] = ((*ptru8++) ^ 128) << 8; | |
166 right[i] = ((*ptru8++) ^ 128) << 8; | |
167 } | |
168 break; | |
169 case FMT_S8: | |
170 ptru8 = ptr; | |
171 if (nch == 1) | |
172 for (i = 0; i < max; i++) | |
173 left[i] = (*ptru8++) << 8; | |
174 else | |
175 for (i = 0; i < max; i++) { | |
176 left[i] = (*ptru8++) << 8; | |
177 right[i] = (*ptru8++) << 8; | |
178 } | |
179 break; | |
180 case FMT_U16_LE: | |
181 ptru16 = ptr; | |
182 if (nch == 1) | |
183 for (i = 0; i < max; i++, ptru16++) | |
184 left[i] = GUINT16_FROM_LE(*ptru16) ^ 32768; | |
185 else | |
186 for (i = 0; i < max; i++) { | |
187 left[i] = GUINT16_FROM_LE(*ptru16) ^ 32768; | |
188 ptru16++; | |
189 right[i] = GUINT16_FROM_LE(*ptru16) ^ 32768; | |
190 ptru16++; | |
191 } | |
192 break; | |
193 case FMT_U16_BE: | |
194 ptru16 = ptr; | |
195 if (nch == 1) | |
196 for (i = 0; i < max; i++, ptru16++) | |
197 left[i] = GUINT16_FROM_BE(*ptru16) ^ 32768; | |
198 else | |
199 for (i = 0; i < max; i++) { | |
200 left[i] = GUINT16_FROM_BE(*ptru16) ^ 32768; | |
201 ptru16++; | |
202 right[i] = GUINT16_FROM_BE(*ptru16) ^ 32768; | |
203 ptru16++; | |
204 } | |
205 break; | |
206 case FMT_U16_NE: | |
207 ptru16 = ptr; | |
208 if (nch == 1) | |
209 for (i = 0; i < max; i++) | |
210 left[i] = (*ptru16++) ^ 32768; | |
211 else | |
212 for (i = 0; i < max; i++) { | |
213 left[i] = (*ptru16++) ^ 32768; | |
214 right[i] = (*ptru16++) ^ 32768; | |
215 } | |
216 break; | |
217 case FMT_S16_LE: | |
218 ptr16 = ptr; | |
219 if (nch == 1) | |
220 for (i = 0; i < max; i++, ptr16++) | |
221 left[i] = GINT16_FROM_LE(*ptr16); | |
222 else | |
223 for (i = 0; i < max; i++) { | |
224 left[i] = GINT16_FROM_LE(*ptr16); | |
225 ptr16++; | |
226 right[i] = GINT16_FROM_LE(*ptr16); | |
227 ptr16++; | |
228 } | |
229 break; | |
230 case FMT_S16_BE: | |
231 ptr16 = ptr; | |
232 if (nch == 1) | |
233 for (i = 0; i < max; i++, ptr16++) | |
234 left[i] = GINT16_FROM_BE(*ptr16); | |
235 else | |
236 for (i = 0; i < max; i++) { | |
237 left[i] = GINT16_FROM_BE(*ptr16); | |
238 ptr16++; | |
239 right[i] = GINT16_FROM_BE(*ptr16); | |
240 ptr16++; | |
241 } | |
242 break; | |
243 case FMT_S16_NE: | |
244 ptr16 = ptr; | |
245 if (nch == 1) | |
246 for (i = 0; i < max; i++) | |
247 left[i] = (*ptr16++); | |
248 else | |
249 for (i = 0; i < max; i++) { | |
250 left[i] = (*ptr16++); | |
251 right[i] = (*ptr16++); | |
252 } | |
253 break; | |
254 } | |
255 } | |
256 | |
257 InputVisType | |
258 input_get_vis_type() | |
259 { | |
260 return INPUT_VIS_OFF; | |
261 } | |
262 | |
263 void | |
264 input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr) | |
265 { | |
266 VisNode *vis_node; | |
267 gint max; | |
268 | |
269 max = length / nch; | |
270 if (fmt == FMT_U16_LE || fmt == FMT_U16_BE || fmt == FMT_U16_NE || | |
271 fmt == FMT_S16_LE || fmt == FMT_S16_BE || fmt == FMT_S16_NE) | |
272 max /= 2; | |
273 max = CLAMP(max, 0, 512); | |
274 | |
275 vis_node = g_new0(VisNode, 1); | |
276 vis_node->time = time; | |
277 vis_node->nch = nch; | |
278 vis_node->length = max; | |
279 convert_to_s16_ne(fmt, ptr, vis_node->data[0], vis_node->data[1], nch, | |
280 max); | |
281 | |
282 G_LOCK(vis_mutex); | |
283 vis_list = g_list_append(vis_list, vis_node); | |
284 G_UNLOCK(vis_mutex); | |
285 } | |
286 | |
287 void | |
288 input_dont_show_warning(GtkObject * object, gpointer user_data) | |
289 { | |
290 *((gboolean *) user_data) = | |
291 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)); | |
292 } | |
293 | |
3133
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
294 static time_t |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
295 input_get_mtime(const gchar *filename) |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
296 { |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
297 struct stat buf; |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
298 gint rv; |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
299 gchar *realfn = NULL; |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
300 |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
301 /* stat() does not accept file:// --yaz */ |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
302 realfn = g_filename_from_uri(filename, NULL, NULL); |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
303 rv = stat(realfn ? realfn : filename, &buf); |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
304 g_free(realfn); realfn = NULL; |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
305 |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
306 if (rv == 0) { |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
307 return buf.st_mtime; |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
308 } else { |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
309 return 0; //error |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
310 } |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
311 } |
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
312 |
2313 | 313 /* |
314 * input_check_file() | |
315 * | |
316 * Inputs: | |
317 * filename to check recursively against input plugins | |
318 * whether or not to show an error | |
319 * | |
320 * Outputs: | |
321 * pointer to input plugin which can handle this file | |
322 * otherwise, NULL | |
323 * | |
324 * (the previous code returned a boolean of whether or not we can | |
325 * play the file... even WORSE for performance) | |
326 * | |
327 * Side Effects: | |
328 * various input plugins open the file and probe it | |
329 * -- this can have very ugly effects performance wise on streams | |
330 * | |
331 * --nenolod, Dec 31 2005 | |
332 * | |
333 * Rewritten to use NewVFS probing, semantics are still basically the same. | |
334 * | |
335 * --nenolod, Dec 5 2006 | |
336 * | |
337 * Adapted to use the NewVFS extension probing system if enabled. | |
338 * | |
339 * --nenolod, Dec 12 2006 | |
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
340 * |
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
341 * Adapted to use the mimetype system. |
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
342 * |
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
343 * --nenolod, Jul 9 2007 |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
344 * |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
345 * Adapted to return ProbeResult structure. |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
346 * |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
347 * --nenolod, Jul 20 2007 |
2313 | 348 */ |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
349 ProbeResult * |
2313 | 350 input_check_file(const gchar * filename, gboolean show_warning) |
351 { | |
352 VFSFile *fd; | |
353 GList *node; | |
354 InputPlugin *ip; | |
355 gchar *filename_proxy; | |
356 gint ret = 1; | |
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
357 gchar *ext, *tmp, *tmp_uri; |
2313 | 358 gboolean use_ext_filter; |
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
359 gchar *mimetype; |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
360 ProbeResult *pr = NULL; |
2313 | 361 |
362 filename_proxy = g_strdup(filename); | |
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
363 |
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
364 /* Some URIs will end in ?<subsong> to determine the subsong requested. */ |
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
365 tmp_uri = g_strdup(filename); |
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
366 |
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
367 tmp = strrchr(tmp_uri, '?'); |
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
368 |
3144
2812140dba3f
Backed out changeset 4673533d7cc3
Cristi Magherusan <majeru@atheme-project.org>
parents:
3143
diff
changeset
|
369 if (tmp != NULL && g_ascii_isdigit(*(tmp + 1))) |
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
370 *tmp = '\0'; |
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
371 |
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
372 /* Check for plugins with custom URI:// strings */ |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
373 /* cue:// cdda:// tone:// tact:// */ |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
374 if ((ip = uri_get_plugin(filename)) != NULL && |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
375 input_is_enabled(ip->filename) == TRUE) |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
376 { |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
377 if (ip->is_our_file != NULL) |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
378 ret = ip->is_our_file(filename_proxy); |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
379 else |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
380 ret = 0; |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
381 if (ret > 0) |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
382 { |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
383 g_free(filename_proxy); |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
384 pr = g_new0(ProbeResult, 1); |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
385 pr->ip = ip; |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
386 return pr; |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
387 } |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
388 g_free(filename_proxy); |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
389 return NULL; |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
390 } |
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
391 |
3145
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
392 /* CD-Audio uses cdda:// dummy paths, no filedescriptor handling for it */ |
3162
5161ced1bce2
exclude cue:// from regular scheme check. it is temporal too.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3145
diff
changeset
|
393 /* also cuesheet uses cue:// */ |
3342
5d50b9604ddc
Remove hardcoded test because uri_get_plugin should take care of it now
Christian Birchinger <joker@netswarm.net>
parents:
3341
diff
changeset
|
394 if (!g_strncasecmp(filename, "cue://", 6)) { |
3145
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
395 for (node = get_input_list(); node != NULL; node = g_list_next(node)) |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
396 { |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
397 ip = INPUT_PLUGIN(node->data); |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
398 if (!ip || !input_is_enabled(ip->filename)) |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
399 continue; |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
400 if (ip->is_our_file != NULL) |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
401 ret = ip->is_our_file(filename_proxy); |
3169
b1964057a1a0
Hardcoded a dummy path to use with cdaudio-ng plugin
Calin Crisan ccrisan@gmail.com
parents:
3166
diff
changeset
|
402 else |
b1964057a1a0
Hardcoded a dummy path to use with cdaudio-ng plugin
Calin Crisan ccrisan@gmail.com
parents:
3166
diff
changeset
|
403 ret = 0; |
3145
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
404 if (ret > 0) |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
405 { |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
406 g_free(filename_proxy); |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
407 pr = g_new0(ProbeResult, 1); |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
408 pr->ip = ip; |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
409 return pr; |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
410 } |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
411 } |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
412 g_free(filename_proxy); |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
413 return NULL; |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
414 } |
0aaad77951c7
Treating cdda:// as a regular file is bad, hmmkay? This is just a hack and nenolod will improve on it later.
Tony Vroon <chainsaw@gentoo.org>
parents:
3144
diff
changeset
|
415 |
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
416 fd = vfs_buffered_file_new_from_uri(tmp_uri); |
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
417 g_free(tmp_uri); |
2313 | 418 |
3110
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
419 if (!fd) { |
3125 | 420 printf("Unable to read from %s, giving up.\n", filename_proxy); |
3110
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
421 g_free(filename_proxy); |
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
422 return NULL; |
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
423 } |
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
424 |
2313 | 425 ext = strrchr(filename_proxy, '.') + 1; |
426 | |
2569 | 427 use_ext_filter = |
428 (fd != NULL && (!g_strncasecmp(filename, "/", 1) || | |
429 !g_strncasecmp(filename, "file://", 7))) ? TRUE : FALSE; | |
2313 | 430 |
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
431 mimetype = vfs_get_metadata(fd, "content-type"); |
3200
95cfda3878da
oops, using a C0X extension (break-from-if) probably isn't cool here.
William Pitcock <nenolod@atheme-project.org>
parents:
3198
diff
changeset
|
432 if ((ip = mime_get_plugin(mimetype)) != NULL && |
95cfda3878da
oops, using a C0X extension (break-from-if) probably isn't cool here.
William Pitcock <nenolod@atheme-project.org>
parents:
3198
diff
changeset
|
433 input_is_enabled(ip->filename) == TRUE) |
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
434 { |
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
435 if (ip->probe_for_tuple != NULL) |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
436 { |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
437 Tuple *tuple = ip->probe_for_tuple(filename_proxy, fd); |
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
438 |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
439 if (tuple != NULL) |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
440 { |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
441 g_free(filename_proxy); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
442 vfs_fclose(fd); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
443 |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
444 pr = g_new0(ProbeResult, 1); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
445 pr->ip = ip; |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
446 pr->tuple = tuple; |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
447 tuple_associate_int(pr->tuple, "mtime", input_get_mtime(filename_proxy)); |
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
448 |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
449 return pr; |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
450 } |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
451 } |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
452 else if (fd && ip->is_our_file_from_vfs != NULL) |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
453 { |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
454 ret = ip->is_our_file_from_vfs(filename_proxy, fd); |
3128
343504d43afc
Fix warnings.
William Pitcock <nenolod@atheme-project.org>
parents:
3127
diff
changeset
|
455 |
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
456 if (ret > 0) |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
457 { |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
458 g_free(filename_proxy); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
459 vfs_fclose(fd); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
460 |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
461 pr = g_new0(ProbeResult, 1); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
462 pr->ip = ip; |
3128
343504d43afc
Fix warnings.
William Pitcock <nenolod@atheme-project.org>
parents:
3127
diff
changeset
|
463 |
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
464 return pr; |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
465 } |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
466 } |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
467 else if (ip->is_our_file != NULL) |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
468 { |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
469 ret = ip->is_our_file(filename_proxy); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
470 |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
471 if (ret > 0) |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
472 { |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
473 g_free(filename_proxy); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
474 vfs_fclose(fd); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
475 |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
476 pr = g_new0(ProbeResult, 1); |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
477 pr->ip = ip; |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
478 |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
479 return pr; |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
480 } |
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
481 } |
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
482 } |
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
483 |
2313 | 484 for (node = get_input_list(); node != NULL; node = g_list_next(node)) |
485 { | |
486 ip = INPUT_PLUGIN(node->data); | |
487 | |
488 if (!ip || !input_is_enabled(ip->filename)) | |
489 continue; | |
490 | |
2342
f140d0a27093
[svn] - use vfs_rewind() instead of vfs_fseek(fd, 0, seek_set) which was wrong
nenolod
parents:
2331
diff
changeset
|
491 vfs_rewind(fd); |
2313 | 492 |
2569 | 493 if (cfg.use_extension_probing == TRUE && ip->vfs_extensions != NULL && |
494 ext != NULL && ext != (gpointer) 0x1 && use_ext_filter == TRUE) | |
2313 | 495 { |
496 gint i; | |
497 gboolean is_our_ext = FALSE; | |
498 | |
499 for (i = 0; ip->vfs_extensions[i] != NULL; i++) | |
500 { | |
501 if (str_has_prefix_nocase(ext, ip->vfs_extensions[i])) | |
2331 | 502 { |
503 is_our_ext = TRUE; | |
504 break; | |
505 } | |
2313 | 506 } |
507 | |
508 /* not a plugin that supports this extension */ | |
509 if (is_our_ext == FALSE) | |
510 continue; | |
511 } | |
512 | |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
513 if (fd && ip->probe_for_tuple != NULL) |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
514 { |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
515 Tuple *tuple = ip->probe_for_tuple(filename_proxy, fd); |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
516 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
517 if (tuple != NULL) |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
518 { |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
519 g_free(filename_proxy); |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
520 vfs_fclose(fd); |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
521 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
522 pr = g_new0(ProbeResult, 1); |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
523 pr->ip = ip; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
524 pr->tuple = tuple; |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
525 tuple_associate_int(pr->tuple, "mtime", input_get_mtime(filename_proxy)); |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
526 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
527 return pr; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
528 } |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
529 } |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
530 else if (fd && ip->is_our_file_from_vfs != NULL) |
2313 | 531 { |
532 ret = ip->is_our_file_from_vfs(filename_proxy, fd); | |
533 | |
534 if (ret > 0) | |
535 { | |
536 g_free(filename_proxy); | |
537 vfs_fclose(fd); | |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
538 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
539 pr = g_new0(ProbeResult, 1); |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
540 pr->ip = ip; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
541 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
542 return pr; |
2313 | 543 } |
544 } | |
545 else if (ip->is_our_file != NULL) | |
546 { | |
547 ret = ip->is_our_file(filename_proxy); | |
548 | |
549 if (ret > 0) | |
550 { | |
551 g_free(filename_proxy); | |
552 vfs_fclose(fd); | |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
553 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
554 pr = g_new0(ProbeResult, 1); |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
555 pr->ip = ip; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
556 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
557 return pr; |
2313 | 558 } |
559 } | |
560 | |
2331 | 561 if (ret <= -1) |
562 break; | |
2313 | 563 } |
564 | |
565 g_free(filename_proxy); | |
566 | |
567 vfs_fclose(fd); | |
568 | |
569 return NULL; | |
570 } | |
571 | |
572 | |
573 void | |
574 input_set_eq(gint on, gfloat preamp, gfloat * bands) | |
575 { | |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
576 InputPlayback *playback; |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
577 |
2313 | 578 if (!ip_data.playing) |
579 return; | |
580 | |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
581 if ((playback = get_current_input_playback()) == NULL) |
2313 | 582 return; |
583 | |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
584 if (playback->plugin->set_eq) |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
585 playback->plugin->set_eq(on, preamp, bands); |
2313 | 586 } |
587 | |
588 void | |
589 input_get_song_info(const gchar * filename, gchar ** title, gint * length) | |
590 { | |
591 InputPlugin *ip = NULL; | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
592 Tuple *tuple; |
2313 | 593 gchar *tmp = NULL, *ext; |
594 gchar *filename_proxy; | |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
595 ProbeResult *pr; |
2313 | 596 |
597 g_return_if_fail(filename != NULL); | |
598 g_return_if_fail(title != NULL); | |
599 g_return_if_fail(length != NULL); | |
600 | |
601 filename_proxy = g_strdup(filename); | |
602 | |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
603 pr = input_check_file(filename_proxy, FALSE); |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
604 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
605 if (!pr) |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
606 return; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
607 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
608 ip = pr->ip; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
609 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
610 g_free(pr); |
2313 | 611 |
2331 | 612 if (ip && ip->get_song_info) { |
2313 | 613 ip->get_song_info(filename_proxy, &tmp, length); |
614 *title = str_to_utf8(tmp); | |
615 g_free(tmp); | |
616 } | |
617 else { | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
618 tuple = tuple_new(); |
2313 | 619 |
620 tmp = g_strdup(filename); | |
621 if ((ext = strrchr(tmp, '.'))) | |
622 *ext = '\0'; | |
623 | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
624 tuple_associate_string(tuple, "file-name", g_path_get_basename(tmp)); |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
625 |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
626 if (ext) |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
627 tuple_associate_string(tuple, "file-ext", ext + 1); |
2313 | 628 |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
629 tuple_associate_string(tuple, "file-path", g_path_get_dirname(tmp)); |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
630 |
3334
ea806daf3ef0
rename xmms_get_gentitle_format() to get_gentitle_format().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3298
diff
changeset
|
631 tmp = tuple_formatter_process_string(tuple, get_gentitle_format()); |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
632 if (tmp != NULL && *tmp != '\0') { |
2313 | 633 (*title) = str_to_utf8(tmp); |
634 g_free(tmp); | |
635 } | |
636 else { | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
637 (*title) = filename_to_utf8(tuple_get_string(tuple, "file-name")); |
2313 | 638 } |
639 | |
640 (*length) = -1; | |
641 | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
642 mowgli_object_unref(tuple); |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
643 tuple = NULL; |
2313 | 644 } |
645 | |
646 g_free(filename_proxy); | |
647 } | |
648 | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
649 Tuple * |
2313 | 650 input_get_song_tuple(const gchar * filename) |
651 { | |
652 InputPlugin *ip = NULL; | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
653 Tuple *input; |
2394
e2aaa7dca389
[svn] - tuple->file_name coming from input plugins have a string with filename + extension, but tuple->file_name coming from input plugins without a get_song_tuple have a string with filename without extension; fix this incongruency, always pass tuple->filename with a string containing filename + extension
giacomo
parents:
2373
diff
changeset
|
654 gchar *ext = NULL; |
2313 | 655 gchar *filename_proxy; |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
656 ProbeResult *pr; |
2313 | 657 |
658 if (filename == NULL) | |
2331 | 659 return NULL; |
2313 | 660 |
661 filename_proxy = g_strdup(filename); | |
662 | |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
663 pr = input_check_file(filename_proxy, FALSE); |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
664 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
665 if (!pr) |
3128
343504d43afc
Fix warnings.
William Pitcock <nenolod@atheme-project.org>
parents:
3127
diff
changeset
|
666 return NULL; |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
667 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
668 ip = pr->ip; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
669 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
670 g_free(pr); |
2313 | 671 |
2331 | 672 if (ip && ip->get_song_tuple) |
2313 | 673 input = ip->get_song_tuple(filename_proxy); |
2331 | 674 else |
675 { | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
676 gchar *tmp; |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
677 |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
678 input = tuple_new(); |
2313 | 679 |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
680 tmp = g_strdup(filename); |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
681 if ((ext = strrchr(tmp, '.'))) |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
682 *ext = '\0'; |
2313 | 683 |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
684 tuple_associate_string(input, "file-name", g_path_get_basename(tmp)); |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
685 |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
686 if (ext) |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
687 tuple_associate_string(input, "file-ext", ext + 1); |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
688 |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
689 tuple_associate_string(input, "file-path", g_path_get_dirname(tmp)); |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
690 tuple_associate_int(input, "length", -1); |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
691 |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
692 g_free(tmp); |
2313 | 693 } |
694 | |
2569 | 695 g_free(filename_proxy); |
2313 | 696 return input; |
697 } | |
698 | |
699 static void | |
700 input_general_file_info_box(const gchar * filename, InputPlugin * ip) | |
701 { | |
702 GtkWidget *window, *vbox; | |
703 GtkWidget *label, *filename_hbox, *filename_entry; | |
704 GtkWidget *bbox, *cancel; | |
705 | |
706 gchar *title, *fileinfo, *basename, *iplugin; | |
707 gchar *filename_utf8; | |
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3072
diff
changeset
|
708 gchar *realfn = NULL; |
2313 | 709 |
710 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
711 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
712 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); | |
713 | |
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3072
diff
changeset
|
714 realfn = g_filename_from_uri(filename, NULL, NULL); |
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3072
diff
changeset
|
715 basename = g_path_get_basename(realfn ? realfn : filename); |
2313 | 716 fileinfo = filename_to_utf8(basename); |
717 title = g_strdup_printf(_("audacious: %s"), fileinfo); | |
718 | |
719 gtk_window_set_title(GTK_WINDOW(window), title); | |
720 | |
721 g_free(title); | |
722 g_free(fileinfo); | |
723 g_free(basename); | |
724 | |
725 gtk_container_set_border_width(GTK_CONTAINER(window), 10); | |
726 | |
727 vbox = gtk_vbox_new(FALSE, 10); | |
728 gtk_container_add(GTK_CONTAINER(window), vbox); | |
729 | |
730 filename_hbox = gtk_hbox_new(FALSE, 5); | |
731 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); | |
732 | |
733 label = gtk_label_new(_("Filename:")); | |
734 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); | |
735 | |
736 filename_entry = gtk_entry_new(); | |
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3072
diff
changeset
|
737 filename_utf8 = filename_to_utf8(realfn ? realfn : filename); |
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3072
diff
changeset
|
738 g_free(realfn); realfn = NULL; |
2313 | 739 |
740 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8); | |
741 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); | |
742 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0); | |
743 | |
744 g_free(filename_utf8); | |
745 | |
746 if (ip) | |
747 if (ip->description) | |
748 iplugin = ip->description; | |
749 else | |
750 iplugin = ip->filename; | |
751 else | |
752 iplugin = _("No input plugin recognized this file"); | |
753 | |
754 title = g_strdup_printf(_("Input plugin: %s"), iplugin); | |
755 | |
756 label = gtk_label_new(title); | |
757 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
758 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | |
759 g_free(title); | |
760 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0); | |
761 | |
762 bbox = gtk_hbutton_box_new(); | |
763 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
764 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
765 | |
766 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
767 g_signal_connect_swapped(G_OBJECT(cancel), "clicked", | |
768 GTK_SIGNAL_FUNC(gtk_widget_destroy), | |
769 GTK_OBJECT(window)); | |
770 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
771 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
772 | |
773 gtk_widget_show_all(window); | |
774 } | |
775 | |
776 void | |
777 input_file_info_box(const gchar * filename) | |
778 { | |
779 InputPlugin *ip; | |
780 gchar *filename_proxy; | |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
781 ProbeResult *pr; |
2313 | 782 |
783 filename_proxy = g_strdup(filename); | |
784 | |
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
785 pr = input_check_file(filename_proxy, FALSE); |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
786 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
787 if (!pr) |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
788 return; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
789 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
790 ip = pr->ip; |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
791 |
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
792 g_free(pr); |
2313 | 793 |
794 if (ip->file_info_box) | |
795 ip->file_info_box(filename_proxy); | |
796 else | |
797 input_general_file_info_box(filename, ip); | |
798 | |
799 input_general_file_info_box(filename, NULL); | |
800 g_free(filename_proxy); | |
801 } | |
802 | |
803 GList * | |
804 input_scan_dir(const gchar * path) | |
805 { | |
806 GList *node, *result = NULL; | |
807 InputPlugin *ip; | |
808 gchar *path_proxy; | |
809 | |
810 g_return_val_if_fail(path != NULL, NULL); | |
811 | |
812 if (*path == '/') | |
813 while (path[1] == '/') | |
814 path++; | |
815 | |
816 path_proxy = g_strdup(path); | |
817 | |
818 for (node = get_input_list(); node; node = g_list_next(node)) { | |
819 ip = INPUT_PLUGIN(node->data); | |
820 | |
821 if (!ip) | |
822 continue; | |
823 | |
824 if (!ip->scan_dir) | |
825 continue; | |
826 | |
827 if (!input_is_enabled(ip->filename)) | |
828 continue; | |
829 | |
830 if ((result = ip->scan_dir(path_proxy))) | |
831 break; | |
832 } | |
833 | |
834 g_free(path_proxy); | |
835 | |
836 return result; | |
837 } | |
838 | |
839 void | |
840 input_get_volume(gint * l, gint * r) | |
841 { | |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
842 InputPlayback *playback; |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
843 |
2313 | 844 *l = -1; |
845 *r = -1; | |
846 if (playback_get_playing()) { | |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
847 if ((playback = get_current_input_playback()) != NULL && |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
848 playback->plugin->get_volume && |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
849 playback->plugin->get_volume(l, r)) |
2313 | 850 return; |
851 } | |
852 output_get_volume(l, r); | |
853 } | |
854 | |
855 void | |
856 input_set_volume(gint l, gint r) | |
857 { | |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
858 InputPlayback *playback; |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
859 |
2505 | 860 gint h_vol[2]; |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
861 |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
862 h_vol[0] = l; |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
863 h_vol[1] = r; |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
864 hook_call("volume set", h_vol); |
2505 | 865 |
2569 | 866 if (playback_get_playing() && |
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
867 (playback = get_current_input_playback()) != NULL && |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
868 playback->plugin->set_volume && |
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
869 playback->plugin->set_volume(l, r)) |
2569 | 870 return; |
871 | |
2313 | 872 output_set_volume(l, r); |
873 } | |
874 | |
875 void | |
876 input_update_vis(gint time) | |
877 { | |
878 GList *node; | |
879 VisNode *vis = NULL, *visnext = NULL; | |
880 gboolean found = FALSE; | |
881 | |
882 G_LOCK(vis_mutex); | |
883 node = vis_list; | |
884 while (g_list_next(node) && !found) { | |
885 visnext = g_list_next(node)->data; | |
886 vis = node->data; | |
887 | |
888 if (vis->time >= time) | |
889 break; | |
890 | |
891 vis_list = g_list_delete_link(vis_list, node); | |
892 | |
893 if (visnext->time >= time) { | |
894 found = TRUE; | |
895 break; | |
896 } | |
897 g_free(vis); | |
898 node = vis_list; | |
899 } | |
900 G_UNLOCK(vis_mutex); | |
901 | |
902 if (found) { | |
903 vis_send_data(vis->data, vis->nch, vis->length); | |
904 g_free(vis); | |
905 } | |
906 else | |
907 vis_send_data(NULL, 0, 0); | |
908 } | |
909 | |
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
910 /* FIXME: move this somewhere else */ |
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
911 void |
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
912 input_set_info_text(gchar *text) |
2313 | 913 { |
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
914 gchar *title = g_strdup(text); |
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
915 event_queue("title change", title); |
2313 | 916 } |
917 | |
918 void | |
919 input_set_status_buffering(gboolean status) | |
920 { | |
921 if (!playback_get_playing()) | |
922 return; | |
923 | |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
924 if (!get_current_input_playback()) |
2313 | 925 return; |
926 | |
927 ip_data.buffering = status; | |
928 | |
929 g_return_if_fail(mainwin_playstatus != NULL); | |
930 | |
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
931 if (ip_data.buffering == TRUE && mainwin_playstatus != NULL && UI_SKINNED_PLAYSTATUS(mainwin_playstatus)->status == STATUS_STOP) |
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
932 UI_SKINNED_PLAYSTATUS(mainwin_playstatus)->status = STATUS_PLAY; |
2313 | 933 |
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
934 ui_skinned_playstatus_set_buffering(mainwin_playstatus, ip_data.buffering); |
2313 | 935 } |
936 | |
937 void | |
938 input_about(gint index) | |
939 { | |
940 InputPlugin *ip; | |
941 | |
942 ip = g_list_nth(ip_data.input_list, index)->data; | |
943 if (ip && ip->about) | |
944 ip->about(); | |
945 } | |
946 | |
947 void | |
948 input_configure(gint index) | |
949 { | |
950 InputPlugin *ip; | |
951 | |
952 ip = g_list_nth(ip_data.input_list, index)->data; | |
953 if (ip && ip->configure) | |
954 ip->configure(); | |
955 } |