Mercurial > audlegacy
annotate src/audacious/input.c @ 3977:81b4e186765f
Multiple changes.
- Introduce a new variable that stores the volume.
- Set volume on playback start.
| author | Jonathan Schleifer <js@webkeks.org> |
|---|---|
| date | Mon, 19 Nov 2007 21:35:25 +0100 |
| parents | 572258c68dfb |
| children | 67f01143e613 |
| 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 | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
35 #include <mowgli.h> |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
36 |
| 2313 | 37 #include "fft.h" |
| 38 #include "input.h" | |
| 39 #include "main.h" | |
| 40 #include "output.h" | |
| 41 #include "playback.h" | |
| 42 #include "pluginenum.h" | |
| 2420 | 43 #include "strings.h" |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
44 #include "tuple.h" |
|
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
45 #include "tuple_formatter.h" |
| 2420 | 46 #include "ui_main.h" |
| 47 #include "util.h" | |
| 48 #include "visualization.h" | |
|
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
49 #include "ui_skinned_playstatus.h" |
| 2505 | 50 #include "hook.h" |
| 2313 | 51 |
|
2347
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
52 #include "vfs.h" |
|
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
53 #include "vfs_buffer.h" |
|
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
54 #include "vfs_buffered_file.h" |
|
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
55 |
| 2313 | 56 G_LOCK_DEFINE_STATIC(vis_mutex); |
| 57 | |
| 58 struct _VisNode { | |
| 59 gint time; | |
| 60 gint nch; | |
| 61 gint length; /* number of samples per channel */ | |
| 62 gint16 data[2][512]; | |
| 63 }; | |
| 64 | |
| 65 typedef struct _VisNode VisNode; | |
| 66 | |
| 67 | |
| 68 InputPluginData ip_data = { | |
| 69 NULL, | |
| 70 NULL, | |
| 71 FALSE, | |
| 72 FALSE, | |
| 73 FALSE, | |
| 74 FALSE, | |
| 75 NULL | |
| 76 }; | |
| 77 | |
| 78 static GList *vis_list = NULL; | |
| 3977 | 79 static int volume_l = -1, volume_r = -1; |
| 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 InputPlayback * |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
82 get_current_input_playback(void) |
| 2313 | 83 { |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
84 return ip_data.current_input_playback; |
| 2313 | 85 } |
| 86 | |
| 87 void | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
88 set_current_input_playback(InputPlayback * ip) |
| 2313 | 89 { |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
90 ip_data.current_input_playback = ip; |
| 2313 | 91 } |
| 92 | |
| 93 GList * | |
| 94 get_input_list(void) | |
| 95 { | |
| 96 return ip_data.input_list; | |
| 97 } | |
| 98 | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
99 /* |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
100 * TODO: move this to utility as something like |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
101 * plugin_generate_list(GList *plugin_list, gboolean enabled_state) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
102 * |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
103 * -nenolod |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
104 */ |
| 2313 | 105 gchar * |
| 106 input_stringify_disabled_list(void) | |
| 107 { | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
108 GList *node; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
109 GString *list = g_string_new(""); |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
110 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
111 MOWGLI_ITER_FOREACH(node, ip_data.input_list) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
112 { |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
113 Plugin *plugin = (Plugin *) node->data; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
114 gchar *filename = g_path_get_basename(plugin->filename); |
| 2313 | 115 |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
116 if (plugin->enabled) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
117 continue; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
118 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
119 if (list->len > 0) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
120 g_string_append(list, ":"); |
| 2313 | 121 |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
122 g_string_append(list, filename); |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
123 g_free(filename); |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
124 } |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
125 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
126 return g_string_free(list, FALSE); |
| 2313 | 127 } |
| 128 | |
| 129 void | |
| 130 free_vis_data(void) | |
| 131 { | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
132 GList *iter; |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
133 |
| 2313 | 134 G_LOCK(vis_mutex); |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
135 |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
136 MOWGLI_ITER_FOREACH(iter, vis_list) |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
137 g_slice_free(VisNode, iter->data); |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
138 |
| 2313 | 139 g_list_free(vis_list); |
| 140 vis_list = NULL; | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
141 |
| 2313 | 142 G_UNLOCK(vis_mutex); |
| 143 } | |
| 144 | |
| 145 static void | |
| 146 convert_to_s16_ne(AFormat fmt, gpointer ptr, gint16 * left, | |
| 147 gint16 * right, gint nch, gint max) | |
| 148 { | |
| 149 gint16 *ptr16; | |
| 150 guint16 *ptru16; | |
| 151 guint8 *ptru8; | |
| 152 gint i; | |
| 153 | |
| 154 switch (fmt) { | |
| 155 case FMT_U8: | |
| 156 ptru8 = ptr; | |
| 157 if (nch == 1) | |
| 158 for (i = 0; i < max; i++) | |
| 159 left[i] = ((*ptru8++) ^ 128) << 8; | |
| 160 else | |
| 161 for (i = 0; i < max; i++) { | |
| 162 left[i] = ((*ptru8++) ^ 128) << 8; | |
| 163 right[i] = ((*ptru8++) ^ 128) << 8; | |
| 164 } | |
| 165 break; | |
| 166 case FMT_S8: | |
| 167 ptru8 = ptr; | |
| 168 if (nch == 1) | |
| 169 for (i = 0; i < max; i++) | |
| 170 left[i] = (*ptru8++) << 8; | |
| 171 else | |
| 172 for (i = 0; i < max; i++) { | |
| 173 left[i] = (*ptru8++) << 8; | |
| 174 right[i] = (*ptru8++) << 8; | |
| 175 } | |
| 176 break; | |
| 177 case FMT_U16_LE: | |
| 178 ptru16 = ptr; | |
| 179 if (nch == 1) | |
| 180 for (i = 0; i < max; i++, ptru16++) | |
| 181 left[i] = GUINT16_FROM_LE(*ptru16) ^ 32768; | |
| 182 else | |
| 183 for (i = 0; i < max; i++) { | |
| 184 left[i] = GUINT16_FROM_LE(*ptru16) ^ 32768; | |
| 185 ptru16++; | |
| 186 right[i] = GUINT16_FROM_LE(*ptru16) ^ 32768; | |
| 187 ptru16++; | |
| 188 } | |
| 189 break; | |
| 190 case FMT_U16_BE: | |
| 191 ptru16 = ptr; | |
| 192 if (nch == 1) | |
| 193 for (i = 0; i < max; i++, ptru16++) | |
| 194 left[i] = GUINT16_FROM_BE(*ptru16) ^ 32768; | |
| 195 else | |
| 196 for (i = 0; i < max; i++) { | |
| 197 left[i] = GUINT16_FROM_BE(*ptru16) ^ 32768; | |
| 198 ptru16++; | |
| 199 right[i] = GUINT16_FROM_BE(*ptru16) ^ 32768; | |
| 200 ptru16++; | |
| 201 } | |
| 202 break; | |
| 203 case FMT_U16_NE: | |
| 204 ptru16 = ptr; | |
| 205 if (nch == 1) | |
| 206 for (i = 0; i < max; i++) | |
| 207 left[i] = (*ptru16++) ^ 32768; | |
| 208 else | |
| 209 for (i = 0; i < max; i++) { | |
| 210 left[i] = (*ptru16++) ^ 32768; | |
| 211 right[i] = (*ptru16++) ^ 32768; | |
| 212 } | |
| 213 break; | |
| 214 case FMT_S16_LE: | |
| 215 ptr16 = ptr; | |
| 216 if (nch == 1) | |
| 217 for (i = 0; i < max; i++, ptr16++) | |
| 218 left[i] = GINT16_FROM_LE(*ptr16); | |
| 219 else | |
| 220 for (i = 0; i < max; i++) { | |
| 221 left[i] = GINT16_FROM_LE(*ptr16); | |
| 222 ptr16++; | |
| 223 right[i] = GINT16_FROM_LE(*ptr16); | |
| 224 ptr16++; | |
| 225 } | |
| 226 break; | |
| 227 case FMT_S16_BE: | |
| 228 ptr16 = ptr; | |
| 229 if (nch == 1) | |
| 230 for (i = 0; i < max; i++, ptr16++) | |
| 231 left[i] = GINT16_FROM_BE(*ptr16); | |
| 232 else | |
| 233 for (i = 0; i < max; i++) { | |
| 234 left[i] = GINT16_FROM_BE(*ptr16); | |
| 235 ptr16++; | |
| 236 right[i] = GINT16_FROM_BE(*ptr16); | |
| 237 ptr16++; | |
| 238 } | |
| 239 break; | |
| 240 case FMT_S16_NE: | |
| 241 ptr16 = ptr; | |
| 242 if (nch == 1) | |
| 243 for (i = 0; i < max; i++) | |
| 244 left[i] = (*ptr16++); | |
| 245 else | |
| 246 for (i = 0; i < max; i++) { | |
| 247 left[i] = (*ptr16++); | |
| 248 right[i] = (*ptr16++); | |
| 249 } | |
| 250 break; | |
| 251 } | |
| 252 } | |
| 253 | |
| 254 InputVisType | |
| 255 input_get_vis_type() | |
| 256 { | |
| 257 return INPUT_VIS_OFF; | |
| 258 } | |
| 259 | |
| 260 void | |
| 261 input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr) | |
| 262 { | |
| 263 VisNode *vis_node; | |
| 264 gint max; | |
| 265 | |
| 266 max = length / nch; | |
| 267 if (fmt == FMT_U16_LE || fmt == FMT_U16_BE || fmt == FMT_U16_NE || | |
| 268 fmt == FMT_S16_LE || fmt == FMT_S16_BE || fmt == FMT_S16_NE) | |
| 269 max /= 2; | |
| 270 max = CLAMP(max, 0, 512); | |
| 271 | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
272 vis_node = g_slice_new0(VisNode); |
| 2313 | 273 vis_node->time = time; |
| 274 vis_node->nch = nch; | |
| 275 vis_node->length = max; | |
| 276 convert_to_s16_ne(fmt, ptr, vis_node->data[0], vis_node->data[1], nch, | |
| 277 max); | |
| 278 | |
| 279 G_LOCK(vis_mutex); | |
| 280 vis_list = g_list_append(vis_list, vis_node); | |
| 281 G_UNLOCK(vis_mutex); | |
| 282 } | |
| 283 | |
| 284 void | |
| 285 input_dont_show_warning(GtkObject * object, gpointer user_data) | |
| 286 { | |
| 287 *((gboolean *) user_data) = | |
| 288 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)); | |
| 289 } | |
| 290 | |
|
3133
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
291 static time_t |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
292 input_get_mtime(const gchar *filename) |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
293 { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
294 struct stat buf; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
295 gint rv; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
296 gchar *realfn = NULL; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
297 |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
298 /* stat() does not accept file:// --yaz */ |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
299 realfn = g_filename_from_uri(filename, NULL, NULL); |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
300 rv = stat(realfn ? realfn : filename, &buf); |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
301 g_free(realfn); realfn = NULL; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
302 |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
303 if (rv == 0) { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
304 return buf.st_mtime; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
305 } else { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
306 return 0; //error |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
307 } |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
308 } |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
309 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
310 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
311 /* do actual probing. this function is called from input_check_file() */ |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
312 static ProbeResult * |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
313 input_do_check_file(InputPlugin *ip, VFSFile *fd, gchar *filename_proxy, gboolean loading) |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
314 { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
315 ProbeResult *pr = NULL; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
316 gint result = 0; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
317 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
318 g_return_val_if_fail(fd != NULL, NULL); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
319 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
320 vfs_rewind(fd); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
321 |
|
3963
572258c68dfb
- for input plugins which provide probe_for_tuple only, now input_do_check_file() calls probe_for_tuple regardless of cfg.use_pl_metadata.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3959
diff
changeset
|
322 /* some input plugins provide probe_for_tuple() only. */ |
|
572258c68dfb
- for input plugins which provide probe_for_tuple only, now input_do_check_file() calls probe_for_tuple regardless of cfg.use_pl_metadata.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3959
diff
changeset
|
323 if ( (ip->probe_for_tuple && !ip->is_our_file_from_vfs && !ip->is_our_file) || |
|
572258c68dfb
- for input plugins which provide probe_for_tuple only, now input_do_check_file() calls probe_for_tuple regardless of cfg.use_pl_metadata.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3959
diff
changeset
|
324 (ip->probe_for_tuple && (cfg.use_pl_metadata && (!loading || (loading && cfg.get_info_on_load)))) ) { |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
325 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
326 Tuple *tuple = ip->probe_for_tuple(filename_proxy, fd); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
327 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
328 if (tuple != NULL) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
329 pr = g_new0(ProbeResult, 1); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
330 pr->ip = ip; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
331 pr->tuple = tuple; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
332 tuple_associate_int(pr->tuple, FIELD_MTIME, NULL, input_get_mtime(filename_proxy)); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
333 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
334 return pr; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
335 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
336 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
337 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
338 else if (ip->is_our_file_from_vfs != NULL) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
339 result = ip->is_our_file_from_vfs(filename_proxy, fd); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
340 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
341 if (result > 0) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
342 pr = g_new0(ProbeResult, 1); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
343 pr->ip = ip; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
344 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
345 return pr; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
346 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
347 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
348 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
349 else if (ip->is_our_file != NULL) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
350 result = ip->is_our_file(filename_proxy); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
351 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
352 if (result > 0) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
353 pr = g_new0(ProbeResult, 1); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
354 pr->ip = ip; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
355 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
356 return pr; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
357 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
358 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
359 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
360 return NULL; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
361 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
362 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
363 |
| 2313 | 364 /* |
| 365 * input_check_file() | |
| 366 * | |
| 367 * Inputs: | |
| 368 * filename to check recursively against input plugins | |
| 369 * whether or not to show an error | |
| 370 * | |
| 371 * Outputs: | |
| 372 * pointer to input plugin which can handle this file | |
| 373 * otherwise, NULL | |
| 374 * | |
| 375 * (the previous code returned a boolean of whether or not we can | |
| 376 * play the file... even WORSE for performance) | |
| 377 * | |
| 378 * Side Effects: | |
| 379 * various input plugins open the file and probe it | |
| 380 * -- this can have very ugly effects performance wise on streams | |
| 381 * | |
| 382 * --nenolod, Dec 31 2005 | |
| 383 * | |
| 384 * Rewritten to use NewVFS probing, semantics are still basically the same. | |
| 385 * | |
| 386 * --nenolod, Dec 5 2006 | |
| 387 * | |
| 388 * Adapted to use the NewVFS extension probing system if enabled. | |
| 389 * | |
| 390 * --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
|
391 * |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
392 * 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
|
393 * |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
394 * --nenolod, Jul 9 2007 |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
395 * |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
396 * Adapted to return ProbeResult structure. |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
397 * |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
398 * --nenolod, Jul 20 2007 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
399 * |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
400 * Make use of ext_hash to avoid full scan in input list. |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
401 * |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
402 * --yaz, Nov 16 2007 |
| 2313 | 403 */ |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
404 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
405 /* if loading is TRUE, tuple probing can be skipped as regards configuration. */ |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
406 ProbeResult * |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
407 input_check_file(const gchar *filename, gboolean loading) |
| 2313 | 408 { |
| 409 VFSFile *fd; | |
| 410 GList *node; | |
| 411 InputPlugin *ip; | |
| 412 gchar *filename_proxy; | |
| 413 gint ret = 1; | |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
414 gchar *ext, *tmp, *tmp_uri; |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
415 gboolean use_ext_filter = FALSE; |
|
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
416 gchar *mimetype; |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
417 ProbeResult *pr = NULL; |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
418 GList **list_hdr = NULL; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
419 extern GHashTable *ext_hash; |
| 2313 | 420 |
| 421 filename_proxy = g_strdup(filename); | |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
422 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
423 |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
424 /* 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
|
425 tmp_uri = g_strdup(filename); |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
426 tmp = strrchr(tmp_uri, '?'); |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
427 |
|
3144
2812140dba3f
Backed out changeset 4673533d7cc3
Cristi Magherusan <majeru@atheme-project.org>
parents:
3143
diff
changeset
|
428 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
|
429 *tmp = '\0'; |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
430 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
431 |
|
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
432 /* 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
|
433 /* cue:// cdda:// tone:// tact:// */ |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
434 if ((ip = uri_get_plugin(filename)) != NULL && ip->enabled) |
|
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
435 { |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
436 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
|
437 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
|
438 else |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
439 ret = 0; |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
440 if (ret > 0) |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
441 { |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
442 g_free(filename_proxy); |
|
3517
b747ad540903
proberesult = use g_new0() for now still
William Pitcock <nenolod@atheme.org>
parents:
3516
diff
changeset
|
443 pr = g_new0(ProbeResult, 1); |
|
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
444 pr->ip = ip; |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
445 return pr; |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
446 } |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
447 g_free(filename_proxy); |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
448 return NULL; |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
449 } |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
450 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
451 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
452 // open the file with vfs sub-system |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
453 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
|
454 g_free(tmp_uri); |
| 2313 | 455 |
|
3110
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
456 if (!fd) { |
| 3125 | 457 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
|
458 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
|
459 return NULL; |
|
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
460 } |
|
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
461 |
| 2313 | 462 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
463 // apply mimetype check. note that stdio does not support mimetype check. |
|
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
464 mimetype = vfs_get_metadata(fd, "content-type"); |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
465 if ((ip = mime_get_plugin(mimetype)) != NULL && ip->enabled) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
466 while(1) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
467 if (!ip || !ip->enabled) |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
468 continue; |
|
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
469 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
470 pr = input_do_check_file(ip, fd, filename_proxy, loading); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
471 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
472 if(pr) { |
|
3198
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 return pr; |
|
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
476 } |
|
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
477 } |
|
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
478 } |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
479 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
480 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
481 // apply ext_hash check |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
482 if(cfg.use_extension_probing) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
483 use_ext_filter = |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
484 (fd != NULL && (!g_strncasecmp(filename, "/", 1) || |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
485 !g_strncasecmp(filename, "file://", 7))) ? TRUE : FALSE; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
486 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
487 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
488 if(use_ext_filter) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
489 gchar *base, *lext; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
490 gchar *tmp2 = g_filename_from_uri(filename_proxy, NULL, NULL); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
491 gchar *realfn = g_strdup(tmp2 ? tmp2 : filename_proxy); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
492 g_free(tmp2); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
493 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
494 base = g_path_get_basename(realfn); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
495 g_free(realfn); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
496 ext = strrchr(base, '.'); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
497 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
498 if(ext) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
499 lext = g_ascii_strdown(ext+1, -1); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
500 list_hdr = g_hash_table_lookup(ext_hash, lext); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
501 g_free(lext); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
502 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
503 g_free(base); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
504 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
505 if(list_hdr) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
506 for(node = *list_hdr; node != NULL; node = g_list_next(node)) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
507 ip = INPUT_PLUGIN(node->data); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
508 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
509 if (!ip || !ip->enabled) |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
510 continue; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
511 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
512 pr = input_do_check_file(ip, fd, filename_proxy, loading); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
513 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
514 if(pr) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
515 g_free(filename_proxy); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
516 vfs_fclose(fd); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
517 return pr; |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
518 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
519 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
520 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
521 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
522 return NULL; // no plugin found. |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
523 } |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
524 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
525 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
526 // do full scan when extension match isn't specified. |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
527 for (node = get_input_list(); node != NULL; node = g_list_next(node)) { |
| 2313 | 528 ip = INPUT_PLUGIN(node->data); |
| 529 | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
530 if (!ip || !ip->enabled) |
| 2313 | 531 continue; |
| 532 | |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
533 pr = input_do_check_file(ip, fd, filename_proxy, loading); |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
534 |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
535 if(pr) { |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
536 g_free(filename_proxy); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
537 vfs_fclose(fd); |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
538 return pr; |
| 2313 | 539 } |
| 540 } | |
| 541 | |
|
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
542 |
|
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3517
diff
changeset
|
543 // all probing failed. return NULL |
| 2313 | 544 g_free(filename_proxy); |
| 545 vfs_fclose(fd); | |
| 546 return NULL; | |
| 547 } | |
| 548 | |
| 549 | |
| 550 void | |
| 551 input_set_eq(gint on, gfloat preamp, gfloat * bands) | |
| 552 { | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
553 InputPlayback *playback; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
554 |
| 2313 | 555 if (!ip_data.playing) |
| 556 return; | |
| 557 | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
558 if ((playback = get_current_input_playback()) == NULL) |
| 2313 | 559 return; |
| 560 | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
561 if (playback->plugin->set_eq) |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
562 playback->plugin->set_eq(on, preamp, bands); |
| 2313 | 563 } |
| 564 | |
| 565 | |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
566 Tuple * |
| 2313 | 567 input_get_song_tuple(const gchar * filename) |
| 568 { | |
| 569 InputPlugin *ip = NULL; | |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
570 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
|
571 gchar *ext = NULL; |
| 2313 | 572 gchar *filename_proxy; |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
573 ProbeResult *pr; |
| 2313 | 574 |
| 575 if (filename == NULL) | |
| 2331 | 576 return NULL; |
| 2313 | 577 |
| 578 filename_proxy = g_strdup(filename); | |
| 579 | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
580 pr = input_check_file(filename_proxy, FALSE); |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
581 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
582 if (!pr) |
|
3128
343504d43afc
Fix warnings.
William Pitcock <nenolod@atheme-project.org>
parents:
3127
diff
changeset
|
583 return NULL; |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
584 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
585 ip = pr->ip; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
586 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
587 g_free(pr); |
| 2313 | 588 |
| 2331 | 589 if (ip && ip->get_song_tuple) |
| 2313 | 590 input = ip->get_song_tuple(filename_proxy); |
| 2331 | 591 else |
| 592 { | |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
593 gchar *tmp; |
|
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
594 |
|
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
595 input = tuple_new(); |
| 2313 | 596 |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
597 tmp = g_strdup(filename); |
|
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
598 if ((ext = strrchr(tmp, '.'))) |
|
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
599 *ext = '\0'; |
| 2313 | 600 |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3343
diff
changeset
|
601 tuple_associate_string(input, FIELD_FILE_NAME, NULL, g_path_get_basename(tmp)); |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
602 |
|
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
603 if (ext) |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3343
diff
changeset
|
604 tuple_associate_string(input, FIELD_FILE_EXT, NULL, ext + 1); |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
605 |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3343
diff
changeset
|
606 tuple_associate_string(input, FIELD_FILE_PATH, NULL, g_path_get_dirname(tmp)); |
|
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3343
diff
changeset
|
607 tuple_associate_int(input, FIELD_LENGTH, NULL, -1); |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
608 |
|
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
609 g_free(tmp); |
| 2313 | 610 } |
| 611 | |
| 2569 | 612 g_free(filename_proxy); |
| 2313 | 613 return input; |
| 614 } | |
| 615 | |
| 616 static void | |
| 617 input_general_file_info_box(const gchar * filename, InputPlugin * ip) | |
| 618 { | |
| 619 GtkWidget *window, *vbox; | |
| 620 GtkWidget *label, *filename_hbox, *filename_entry; | |
| 621 GtkWidget *bbox, *cancel; | |
| 622 | |
| 623 gchar *title, *fileinfo, *basename, *iplugin; | |
| 624 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
|
625 gchar *realfn = NULL; |
| 2313 | 626 |
| 627 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 628 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
| 629 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); | |
| 630 | |
|
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3072
diff
changeset
|
631 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
|
632 basename = g_path_get_basename(realfn ? realfn : filename); |
| 2313 | 633 fileinfo = filename_to_utf8(basename); |
| 634 title = g_strdup_printf(_("audacious: %s"), fileinfo); | |
| 635 | |
| 636 gtk_window_set_title(GTK_WINDOW(window), title); | |
| 637 | |
| 638 g_free(title); | |
| 639 g_free(fileinfo); | |
| 640 g_free(basename); | |
| 641 | |
| 642 gtk_container_set_border_width(GTK_CONTAINER(window), 10); | |
| 643 | |
| 644 vbox = gtk_vbox_new(FALSE, 10); | |
| 645 gtk_container_add(GTK_CONTAINER(window), vbox); | |
| 646 | |
| 647 filename_hbox = gtk_hbox_new(FALSE, 5); | |
| 648 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); | |
| 649 | |
| 650 label = gtk_label_new(_("Filename:")); | |
| 651 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); | |
| 652 | |
| 653 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
|
654 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
|
655 g_free(realfn); realfn = NULL; |
| 2313 | 656 |
| 657 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8); | |
| 658 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); | |
| 659 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0); | |
| 660 | |
| 661 g_free(filename_utf8); | |
| 662 | |
| 663 if (ip) | |
| 664 if (ip->description) | |
| 665 iplugin = ip->description; | |
| 666 else | |
| 667 iplugin = ip->filename; | |
| 668 else | |
| 669 iplugin = _("No input plugin recognized this file"); | |
| 670 | |
| 671 title = g_strdup_printf(_("Input plugin: %s"), iplugin); | |
| 672 | |
| 673 label = gtk_label_new(title); | |
| 674 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 675 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | |
| 676 g_free(title); | |
| 677 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0); | |
| 678 | |
| 679 bbox = gtk_hbutton_box_new(); | |
| 680 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
| 681 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
| 682 | |
| 683 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
| 684 g_signal_connect_swapped(G_OBJECT(cancel), "clicked", | |
| 685 GTK_SIGNAL_FUNC(gtk_widget_destroy), | |
| 686 GTK_OBJECT(window)); | |
| 687 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
| 688 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
| 689 | |
| 690 gtk_widget_show_all(window); | |
| 691 } | |
| 692 | |
| 693 void | |
| 694 input_file_info_box(const gchar * filename) | |
| 695 { | |
| 696 InputPlugin *ip; | |
| 697 gchar *filename_proxy; | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
698 ProbeResult *pr; |
| 2313 | 699 |
| 700 filename_proxy = g_strdup(filename); | |
| 701 | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
702 pr = input_check_file(filename_proxy, FALSE); |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
703 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
704 if (!pr) |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
705 return; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
706 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
707 ip = pr->ip; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
708 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
709 g_free(pr); |
| 2313 | 710 |
| 711 if (ip->file_info_box) | |
| 712 ip->file_info_box(filename_proxy); | |
| 713 else | |
| 714 input_general_file_info_box(filename, ip); | |
| 715 | |
| 716 input_general_file_info_box(filename, NULL); | |
| 717 g_free(filename_proxy); | |
| 718 } | |
| 719 | |
| 720 GList * | |
| 721 input_scan_dir(const gchar * path) | |
| 722 { | |
| 723 GList *node, *result = NULL; | |
| 724 InputPlugin *ip; | |
| 725 gchar *path_proxy; | |
| 726 | |
| 727 g_return_val_if_fail(path != NULL, NULL); | |
| 728 | |
| 729 if (*path == '/') | |
| 730 while (path[1] == '/') | |
| 731 path++; | |
| 732 | |
| 733 path_proxy = g_strdup(path); | |
| 734 | |
| 735 for (node = get_input_list(); node; node = g_list_next(node)) { | |
| 736 ip = INPUT_PLUGIN(node->data); | |
| 737 | |
| 738 if (!ip) | |
| 739 continue; | |
| 740 | |
| 741 if (!ip->scan_dir) | |
| 742 continue; | |
| 743 | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3416
diff
changeset
|
744 if (!ip->enabled) |
| 2313 | 745 continue; |
| 746 | |
| 747 if ((result = ip->scan_dir(path_proxy))) | |
| 748 break; | |
| 749 } | |
| 750 | |
| 751 g_free(path_proxy); | |
| 752 | |
| 753 return result; | |
| 754 } | |
| 755 | |
| 756 void | |
| 757 input_get_volume(gint * l, gint * r) | |
| 758 { | |
| 3977 | 759 if (volume_l == -1 || volume_r == -1) |
| 760 output_get_volume(&volume_l, &volume_r); | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
761 |
| 3977 | 762 *l = volume_l; |
| 763 *r = volume_r; | |
| 2313 | 764 } |
| 765 | |
| 766 void | |
| 767 input_set_volume(gint l, gint r) | |
| 768 { | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
769 InputPlayback *playback; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
770 |
| 2505 | 771 gint h_vol[2]; |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
772 |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
773 h_vol[0] = l; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
774 h_vol[1] = r; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
775 hook_call("volume set", h_vol); |
| 2505 | 776 |
| 2569 | 777 if (playback_get_playing() && |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
778 (playback = get_current_input_playback()) != NULL && |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
779 playback->plugin->set_volume && |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
780 playback->plugin->set_volume(l, r)) |
| 2569 | 781 return; |
| 782 | |
| 2313 | 783 output_set_volume(l, r); |
| 3977 | 784 |
| 785 volume_l = l; | |
| 786 volume_r = r; | |
| 2313 | 787 } |
| 788 | |
| 789 void | |
| 790 input_update_vis(gint time) | |
| 791 { | |
| 792 GList *node; | |
| 793 VisNode *vis = NULL, *visnext = NULL; | |
| 794 gboolean found = FALSE; | |
| 795 | |
| 796 G_LOCK(vis_mutex); | |
| 797 node = vis_list; | |
| 798 while (g_list_next(node) && !found) { | |
| 799 visnext = g_list_next(node)->data; | |
| 800 vis = node->data; | |
| 801 | |
| 802 if (vis->time >= time) | |
| 803 break; | |
| 804 | |
| 805 vis_list = g_list_delete_link(vis_list, node); | |
| 806 | |
| 807 if (visnext->time >= time) { | |
| 808 found = TRUE; | |
| 809 break; | |
| 810 } | |
| 811 g_free(vis); | |
| 812 node = vis_list; | |
| 813 } | |
| 814 G_UNLOCK(vis_mutex); | |
| 815 | |
| 816 if (found) { | |
| 817 vis_send_data(vis->data, vis->nch, vis->length); | |
| 818 g_free(vis); | |
| 819 } | |
| 820 else | |
| 821 vis_send_data(NULL, 0, 0); | |
| 822 } | |
| 823 | |
|
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
824 /* 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
|
825 void |
|
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
826 input_set_info_text(gchar *text) |
| 2313 | 827 { |
|
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
828 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
|
829 event_queue("title change", title); |
| 2313 | 830 } |
| 831 | |
| 832 void | |
| 833 input_set_status_buffering(gboolean status) | |
| 834 { | |
| 835 if (!playback_get_playing()) | |
| 836 return; | |
| 837 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
838 if (!get_current_input_playback()) |
| 2313 | 839 return; |
| 840 | |
| 841 ip_data.buffering = status; | |
| 842 | |
| 843 g_return_if_fail(mainwin_playstatus != NULL); | |
| 844 | |
|
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
845 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
|
846 UI_SKINNED_PLAYSTATUS(mainwin_playstatus)->status = STATUS_PLAY; |
| 2313 | 847 |
|
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
848 ui_skinned_playstatus_set_buffering(mainwin_playstatus, ip_data.buffering); |
| 2313 | 849 } |
