Mercurial > audlegacy
annotate src/audacious/input.c @ 4323:04ade98fafa3
vis moved to separate flow. works in passthrough mode too
| author | Eugene Zagidullin <e.asphyx@gmail.com> |
|---|---|
| date | Thu, 13 Mar 2008 01:42:59 +0300 |
| parents | 2b7a74fce100 |
| children | 51b7809c2d87 |
| rev | line source |
|---|---|
| 2313 | 1 /* Audacious - Cross-platform multimedia player |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
2 * Copyright (C) 2005-2008 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 | |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
26 /* #define AUD_DEBUG */ |
|
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
27 |
| 2313 | 28 #ifdef HAVE_CONFIG_H |
| 29 # include "config.h" | |
| 30 #endif | |
| 31 | |
| 32 #include <glib.h> | |
| 33 #include <glib/gi18n.h> | |
| 34 #include <gtk/gtk.h> | |
| 35 #include <string.h> | |
| 36 | |
|
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
|
37 #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
|
38 |
| 2313 | 39 #include "fft.h" |
| 40 #include "input.h" | |
| 41 #include "main.h" | |
| 42 #include "output.h" | |
| 43 #include "playback.h" | |
| 44 #include "pluginenum.h" | |
| 2420 | 45 #include "strings.h" |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
46 #include "tuple.h" |
|
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
47 #include "tuple_formatter.h" |
| 2420 | 48 #include "ui_main.h" |
| 49 #include "util.h" | |
| 50 #include "visualization.h" | |
|
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
51 #include "ui_skinned_playstatus.h" |
| 2505 | 52 #include "hook.h" |
| 2313 | 53 |
|
2347
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
54 #include "vfs.h" |
|
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
55 #include "vfs_buffer.h" |
|
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
56 #include "vfs_buffered_file.h" |
|
74bbc3e18cba
[svn] - fix W:input.c(422) [input_check_file]:Implicit declaration
nenolod
parents:
2344
diff
changeset
|
57 |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
58 #include "libSAD.h" |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
59 |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
60 #define FMT_FRACBITS(a) ( (a) == FMT_FIXED32 ? __AUDACIOUS_ASSUMED_MAD_F_FRACBITS__ : 0 ) |
|
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
61 |
| 2313 | 62 G_LOCK_DEFINE_STATIC(vis_mutex); |
| 63 | |
| 64 struct _VisNode { | |
| 65 gint time; | |
| 66 gint nch; | |
| 67 gint length; /* number of samples per channel */ | |
| 68 gint16 data[2][512]; | |
| 69 }; | |
| 70 | |
| 71 typedef struct _VisNode VisNode; | |
| 72 | |
| 73 | |
| 74 InputPluginData ip_data = { | |
| 75 NULL, | |
| 76 NULL, | |
| 77 FALSE, | |
| 78 FALSE, | |
| 79 FALSE, | |
| 80 FALSE, | |
| 81 NULL | |
| 82 }; | |
| 83 | |
| 84 static GList *vis_list = NULL; | |
| 3977 | 85 static int volume_l = -1, volume_r = -1; |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
86 static SAD_dither_t *sad_state = NULL; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
87 static gint sad_nch = -1; |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
88 static AFormat sad_fmt = -1; |
| 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 InputPlayback * |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
91 get_current_input_playback(void) |
| 2313 | 92 { |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
93 return ip_data.current_input_playback; |
| 2313 | 94 } |
| 95 | |
| 96 void | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
97 set_current_input_playback(InputPlayback * ip) |
| 2313 | 98 { |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
99 ip_data.current_input_playback = ip; |
| 2313 | 100 } |
| 101 | |
| 102 GList * | |
| 103 get_input_list(void) | |
| 104 { | |
| 105 return ip_data.input_list; | |
| 106 } | |
| 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 /* |
|
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 * 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
|
110 * 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
|
111 * |
|
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 * -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
|
113 */ |
| 2313 | 114 gchar * |
| 115 input_stringify_disabled_list(void) | |
| 116 { | |
|
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
|
117 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
|
118 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
|
119 |
|
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 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
|
121 { |
|
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 Plugin *plugin = (Plugin *) node->data; |
|
4098
fe0f7a72facd
Fix memory leak in input_stringify_disabled_list() (Bugzilla #25)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4094
diff
changeset
|
123 gchar *filename; |
| 2313 | 124 |
|
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
|
125 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
|
126 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
|
127 |
|
4098
fe0f7a72facd
Fix memory leak in input_stringify_disabled_list() (Bugzilla #25)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4094
diff
changeset
|
128 filename = g_path_get_basename(plugin->filename); |
|
fe0f7a72facd
Fix memory leak in input_stringify_disabled_list() (Bugzilla #25)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4094
diff
changeset
|
129 |
|
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
|
130 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
|
131 g_string_append(list, ":"); |
| 2313 | 132 |
|
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
|
133 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
|
134 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
|
135 } |
|
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
|
136 |
|
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
|
137 return g_string_free(list, FALSE); |
| 2313 | 138 } |
| 139 | |
| 140 void | |
| 141 free_vis_data(void) | |
| 142 { | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
143 GList *iter; |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
144 |
| 2313 | 145 G_LOCK(vis_mutex); |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
146 |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
147 MOWGLI_ITER_FOREACH(iter, vis_list) |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
148 g_slice_free(VisNode, iter->data); |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
149 |
| 2313 | 150 g_list_free(vis_list); |
| 151 vis_list = NULL; | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
152 |
| 2313 | 153 G_UNLOCK(vis_mutex); |
| 154 } | |
| 155 | |
| 156 InputVisType | |
| 157 input_get_vis_type() | |
| 158 { | |
| 159 return INPUT_VIS_OFF; | |
| 160 } | |
| 161 | |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
162 static SAD_dither_t* |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
163 init_sad(AFormat fmt, gint nch) |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
164 { |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
165 gint ret; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
166 |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
167 SAD_buffer_format in, out; |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
168 in.sample_format = sadfmt_from_afmt(fmt); |
|
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
169 in.fracbits = FMT_FRACBITS(fmt); |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
170 in.channels = nch; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
171 in.channels_order = SAD_CHORDER_INTERLEAVED; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
172 in.samplerate = 0; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
173 |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
174 out.sample_format = SAD_SAMPLE_S16; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
175 out.fracbits = 0; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
176 out.channels = nch; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
177 out.channels_order = SAD_CHORDER_SEPARATED; /* sic! --asphyx */ |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
178 out.samplerate = 0; |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
179 |
|
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
180 AUDDBG("fmt=%d, nch=%d\n", fmt, nch); |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
181 SAD_dither_t *state = SAD_dither_init(&in, &out, &ret); |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
182 if (state != NULL) SAD_dither_set_dither(state, FALSE); |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
183 return state; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
184 } |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
185 |
| 2313 | 186 void |
| 187 input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr) | |
| 188 { | |
| 189 VisNode *vis_node; | |
| 190 gint max; | |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
191 |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
192 if (nch > 2) return; |
| 2313 | 193 |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
194 if (sad_state == NULL || nch != sad_nch || fmt != sad_fmt) { |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
195 if(sad_state != NULL) SAD_dither_free(sad_state); |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
196 sad_state = init_sad(fmt, nch); |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
197 if(sad_state == NULL) return; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
198 sad_nch = nch; |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
199 sad_fmt = fmt; |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
200 } |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
201 |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
202 max = length / nch / FMT_SIZEOF(fmt); |
| 2313 | 203 max = CLAMP(max, 0, 512); |
| 204 | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
205 vis_node = g_slice_new0(VisNode); |
| 2313 | 206 vis_node->time = time; |
| 207 vis_node->nch = nch; | |
| 208 vis_node->length = max; | |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
209 |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
210 gint16 *tmp[2]; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
211 |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
212 tmp[0] = vis_node->data[0]; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
213 tmp[1] = vis_node->data[1]; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
214 SAD_dither_process_buffer(sad_state, ptr, tmp, max); |
| 2313 | 215 |
| 216 G_LOCK(vis_mutex); | |
| 217 vis_list = g_list_append(vis_list, vis_node); | |
| 218 G_UNLOCK(vis_mutex); | |
| 219 } | |
| 220 | |
| 221 void | |
| 222 input_dont_show_warning(GtkObject * object, gpointer user_data) | |
| 223 { | |
| 224 *((gboolean *) user_data) = | |
| 225 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)); | |
| 226 } | |
| 227 | |
|
3133
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
228 static time_t |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
229 input_get_mtime(const gchar *filename) |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
230 { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
231 struct stat buf; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
232 gint rv; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
233 gchar *realfn = NULL; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
234 |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
235 /* stat() does not accept file:// --yaz */ |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
236 realfn = g_filename_from_uri(filename, NULL, NULL); |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
237 rv = stat(realfn ? realfn : filename, &buf); |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
238 g_free(realfn); realfn = NULL; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
239 |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
240 if (rv == 0) { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
241 return buf.st_mtime; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
242 } else { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
243 return 0; //error |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
244 } |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
245 } |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
246 |
|
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
|
247 |
|
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
|
248 /* 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
|
249 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
|
250 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
|
251 { |
|
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
|
252 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
|
253 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
|
254 |
|
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
|
255 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
|
256 |
|
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
|
257 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
|
258 |
|
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
|
259 /* 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
|
260 if ( (ip->probe_for_tuple && !ip->is_our_file_from_vfs && !ip->is_our_file) || |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
261 (ip->probe_for_tuple && ip->have_subtune == TRUE) || |
|
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
|
262 (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
|
263 |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
264 plugin_set_current((Plugin *)ip); |
|
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
|
265 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
|
266 |
|
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
|
267 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
|
268 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
|
269 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
|
270 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
|
271 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
|
272 |
|
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
|
273 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
|
274 } |
|
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
|
275 } |
|
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
|
276 |
|
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
|
277 else if (ip->is_our_file_from_vfs != NULL) { |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
278 plugin_set_current((Plugin *)ip); |
|
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
|
279 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
|
280 |
|
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
|
281 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
|
282 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
|
283 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
|
284 |
|
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
|
285 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
|
286 } |
|
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
|
287 } |
|
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
|
288 |
|
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
|
289 else if (ip->is_our_file != NULL) { |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
290 plugin_set_current((Plugin *)ip); |
|
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
|
291 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
|
292 |
|
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
|
293 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
|
294 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
|
295 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
|
296 |
|
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
|
297 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
|
298 } |
|
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
|
299 } |
|
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
|
300 |
|
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
|
301 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
|
302 } |
|
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
|
303 |
|
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
|
304 |
| 2313 | 305 /* |
| 306 * input_check_file() | |
| 307 * | |
| 308 * Inputs: | |
| 309 * filename to check recursively against input plugins | |
| 310 * whether or not to show an error | |
| 311 * | |
| 312 * Outputs: | |
| 313 * pointer to input plugin which can handle this file | |
| 314 * otherwise, NULL | |
| 315 * | |
| 316 * (the previous code returned a boolean of whether or not we can | |
| 317 * play the file... even WORSE for performance) | |
| 318 * | |
| 319 * Side Effects: | |
| 320 * various input plugins open the file and probe it | |
| 321 * -- this can have very ugly effects performance wise on streams | |
| 322 * | |
| 323 * --nenolod, Dec 31 2005 | |
| 324 * | |
| 325 * Rewritten to use NewVFS probing, semantics are still basically the same. | |
| 326 * | |
| 327 * --nenolod, Dec 5 2006 | |
| 328 * | |
| 329 * Adapted to use the NewVFS extension probing system if enabled. | |
| 330 * | |
| 331 * --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
|
332 * |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
333 * 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
|
334 * |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
335 * --nenolod, Jul 9 2007 |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
336 * |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
337 * Adapted to return ProbeResult structure. |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
338 * |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
339 * --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
|
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 * 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
|
342 * |
|
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 * --yaz, Nov 16 2007 |
| 2313 | 344 */ |
|
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
|
345 |
|
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 /* 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
|
347 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
|
348 input_check_file(const gchar *filename, gboolean loading) |
| 2313 | 349 { |
| 350 VFSFile *fd; | |
| 351 GList *node; | |
| 352 InputPlugin *ip; | |
| 353 gchar *filename_proxy; | |
| 354 gint ret = 1; | |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
355 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
|
356 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
|
357 gchar *mimetype; |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
358 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
|
359 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
|
360 extern GHashTable *ext_hash; |
| 2313 | 361 |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
362 /* 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
|
363 tmp_uri = g_strdup(filename); |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
364 tmp = strrchr(tmp_uri, '?'); |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
365 |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
366 if (tmp && g_ascii_isdigit(*(tmp + 1))) |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
367 *tmp = '\0'; |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
368 |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
369 filename_proxy = g_strdup(tmp_uri); |
|
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
370 g_free(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
|
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:// */ |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
374 if ((ip = uri_get_plugin(filename_proxy)) != NULL && ip->enabled) { |
|
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
375 if (ip->is_our_file != NULL) |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
376 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
377 plugin_set_current((Plugin *)ip); |
|
3341
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); |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
379 } |
|
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
380 else |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
381 ret = 0; |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
382 if (ret > 0) { |
|
3341
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); |
|
3517
b747ad540903
proberesult = use g_new0() for now still
William Pitcock <nenolod@atheme.org>
parents:
3516
diff
changeset
|
384 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
|
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 |
|
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
|
392 |
|
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
|
393 // open the file with vfs sub-system |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
394 fd = vfs_buffered_file_new_from_uri(filename_proxy); |
| 2313 | 395 |
|
3110
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
396 if (!fd) { |
| 3125 | 397 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
|
398 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
|
399 return NULL; |
|
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
400 } |
|
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
401 |
| 2313 | 402 |
|
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
|
403 // 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
|
404 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
|
405 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
|
406 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
|
407 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
|
408 continue; |
|
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
409 |
|
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
|
410 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
|
411 |
|
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
|
412 if(pr) { |
|
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
413 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
|
414 vfs_fclose(fd); |
|
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
415 return pr; |
|
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
416 } |
|
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
417 } |
|
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
418 } |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
419 |
|
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
|
420 |
|
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
|
421 // 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
|
422 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
|
423 use_ext_filter = |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
424 (fd && (!g_strncasecmp(filename_proxy, "/", 1) || |
|
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
425 !g_strncasecmp(filename_proxy, "file://", 7))) ? TRUE : FALSE; |
|
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
|
426 } |
|
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
|
427 |
|
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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 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
|
433 |
|
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
|
434 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
|
435 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
|
436 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
|
437 |
|
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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 } |
|
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
|
443 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
|
444 |
|
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
|
445 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
|
446 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
|
447 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
|
448 |
|
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
|
449 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
|
450 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
|
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 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
|
453 |
|
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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 } |
|
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
|
459 } |
|
4208
e8c79a8b9d9b
Backed out changeset d0b2d8d4e955
William Pitcock <nenolod@atheme.org>
parents:
4156
diff
changeset
|
460 } |
|
4156
a2da130cdafa
If no plugins claim that they can support a file extension, try them all just to be sure. (Bugzilla #80)
Jack Kelly <weldingmaskman@hotmail.com>
parents:
4153
diff
changeset
|
461 |
|
4208
e8c79a8b9d9b
Backed out changeset d0b2d8d4e955
William Pitcock <nenolod@atheme.org>
parents:
4156
diff
changeset
|
462 g_free(filename_proxy); |
|
e8c79a8b9d9b
Backed out changeset d0b2d8d4e955
William Pitcock <nenolod@atheme.org>
parents:
4156
diff
changeset
|
463 vfs_fclose(fd); |
|
e8c79a8b9d9b
Backed out changeset d0b2d8d4e955
William Pitcock <nenolod@atheme.org>
parents:
4156
diff
changeset
|
464 return NULL; // no plugin found. |
|
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 } |
|
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 |
|
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 |
|
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 // 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
|
469 for (node = get_input_list(); node != NULL; node = g_list_next(node)) { |
| 2313 | 470 ip = INPUT_PLUGIN(node->data); |
| 471 | |
|
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
|
472 if (!ip || !ip->enabled) |
| 2313 | 473 continue; |
| 474 | |
|
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
|
475 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
|
476 |
|
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
|
477 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
|
478 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
|
479 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
|
480 return pr; |
| 2313 | 481 } |
| 482 } | |
| 483 | |
|
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
|
484 |
|
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 // all probing failed. return NULL |
| 2313 | 486 g_free(filename_proxy); |
| 487 vfs_fclose(fd); | |
| 488 return NULL; | |
| 489 } | |
| 490 | |
| 491 | |
| 492 void | |
| 493 input_set_eq(gint on, gfloat preamp, gfloat * bands) | |
| 494 { | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
495 InputPlayback *playback; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
496 |
| 2313 | 497 if (!ip_data.playing) |
| 498 return; | |
| 499 | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
500 if ((playback = get_current_input_playback()) == NULL) |
| 2313 | 501 return; |
| 502 | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
503 if (playback->plugin->set_eq) |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
504 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
505 plugin_set_current((Plugin *)(playback->plugin)); |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
506 playback->plugin->set_eq(on, preamp, bands); |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
507 } |
| 2313 | 508 } |
| 509 | |
| 510 | |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
511 Tuple * |
| 2313 | 512 input_get_song_tuple(const gchar * filename) |
| 513 { | |
| 514 InputPlugin *ip = NULL; | |
| 4153 | 515 Tuple *input = NULL; |
|
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
|
516 gchar *ext = NULL; |
| 2313 | 517 gchar *filename_proxy; |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
518 ProbeResult *pr; |
| 2313 | 519 |
| 520 if (filename == NULL) | |
|
4089
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
521 return NULL; |
| 2313 | 522 |
| 523 filename_proxy = g_strdup(filename); | |
| 524 | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
525 pr = input_check_file(filename_proxy, FALSE); |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
526 |
|
4089
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
527 if (!pr) { |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
528 g_free(filename_proxy); |
|
3128
343504d43afc
Fix warnings.
William Pitcock <nenolod@atheme-project.org>
parents:
3127
diff
changeset
|
529 return NULL; |
|
4089
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
530 } |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
531 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
532 ip = pr->ip; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
533 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
534 g_free(pr); |
| 2313 | 535 |
| 2331 | 536 if (ip && ip->get_song_tuple) |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
537 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
538 plugin_set_current((Plugin *)ip); |
| 2313 | 539 input = ip->get_song_tuple(filename_proxy); |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
540 } |
| 2331 | 541 else |
| 542 { | |
|
4089
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
543 gchar *scratch; |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
544 |
|
4089
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
545 scratch = uri_to_display_basename(filename); |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
546 tuple_associate_string(input, FIELD_FILE_NAME, NULL, scratch); |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
547 g_free(scratch); |
| 2313 | 548 |
|
4089
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
549 scratch = uri_to_display_dirname(filename); |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
550 tuple_associate_string(input, FIELD_FILE_PATH, NULL, scratch); |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
551 g_free(scratch); |
| 2313 | 552 |
|
4089
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
553 ext = strrchr(filename, '.'); |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
554 if (ext != NULL) { |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
555 ++ext; |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
556 tuple_associate_string(input, FIELD_FILE_EXT, NULL, ext); |
|
9e24c8746d99
- introduce new API functions uri_to_display_basename() and uri_to_display_dirname(). each function derives utf8 encoded basename or dirname from given uri respectively.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4029
diff
changeset
|
557 } |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
558 |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3343
diff
changeset
|
559 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
|
560 |
| 2313 | 561 } |
| 562 | |
| 2569 | 563 g_free(filename_proxy); |
| 2313 | 564 return input; |
| 565 } | |
| 566 | |
| 567 static void | |
| 568 input_general_file_info_box(const gchar * filename, InputPlugin * ip) | |
| 569 { | |
| 570 GtkWidget *window, *vbox; | |
| 571 GtkWidget *label, *filename_hbox, *filename_entry; | |
| 572 GtkWidget *bbox, *cancel; | |
| 573 | |
| 574 gchar *title, *fileinfo, *basename, *iplugin; | |
| 575 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
|
576 gchar *realfn = NULL; |
| 2313 | 577 |
| 578 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 579 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
| 580 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); | |
| 581 | |
|
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3072
diff
changeset
|
582 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
|
583 basename = g_path_get_basename(realfn ? realfn : filename); |
| 2313 | 584 fileinfo = filename_to_utf8(basename); |
| 585 title = g_strdup_printf(_("audacious: %s"), fileinfo); | |
| 586 | |
| 587 gtk_window_set_title(GTK_WINDOW(window), title); | |
| 588 | |
| 589 g_free(title); | |
| 590 g_free(fileinfo); | |
| 591 g_free(basename); | |
| 592 | |
| 593 gtk_container_set_border_width(GTK_CONTAINER(window), 10); | |
| 594 | |
| 595 vbox = gtk_vbox_new(FALSE, 10); | |
| 596 gtk_container_add(GTK_CONTAINER(window), vbox); | |
| 597 | |
| 598 filename_hbox = gtk_hbox_new(FALSE, 5); | |
| 599 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); | |
| 600 | |
| 601 label = gtk_label_new(_("Filename:")); | |
| 602 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); | |
| 603 | |
| 604 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
|
605 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
|
606 g_free(realfn); realfn = NULL; |
| 2313 | 607 |
| 608 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8); | |
| 609 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); | |
| 610 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0); | |
| 611 | |
| 612 g_free(filename_utf8); | |
| 613 | |
| 614 if (ip) | |
| 615 if (ip->description) | |
| 616 iplugin = ip->description; | |
| 617 else | |
| 618 iplugin = ip->filename; | |
| 619 else | |
| 620 iplugin = _("No input plugin recognized this file"); | |
| 621 | |
| 622 title = g_strdup_printf(_("Input plugin: %s"), iplugin); | |
| 623 | |
| 624 label = gtk_label_new(title); | |
| 625 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 626 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | |
| 627 g_free(title); | |
| 628 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0); | |
| 629 | |
| 630 bbox = gtk_hbutton_box_new(); | |
| 631 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
| 632 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
| 633 | |
| 634 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
| 635 g_signal_connect_swapped(G_OBJECT(cancel), "clicked", | |
| 636 GTK_SIGNAL_FUNC(gtk_widget_destroy), | |
| 637 GTK_OBJECT(window)); | |
| 638 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
| 639 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
| 640 | |
| 641 gtk_widget_show_all(window); | |
| 642 } | |
| 643 | |
| 644 void | |
| 645 input_file_info_box(const gchar * filename) | |
| 646 { | |
| 647 InputPlugin *ip; | |
| 648 gchar *filename_proxy; | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
649 ProbeResult *pr; |
| 2313 | 650 |
| 651 filename_proxy = g_strdup(filename); | |
| 652 | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
653 pr = input_check_file(filename_proxy, FALSE); |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
654 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
655 if (!pr) |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
656 return; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
657 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
658 ip = pr->ip; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
659 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
660 g_free(pr); |
| 2313 | 661 |
| 662 if (ip->file_info_box) | |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
663 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
664 plugin_set_current((Plugin *)ip); |
| 2313 | 665 ip->file_info_box(filename_proxy); |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
666 } |
| 2313 | 667 else |
| 668 input_general_file_info_box(filename, ip); | |
| 669 | |
| 670 input_general_file_info_box(filename, NULL); | |
| 671 g_free(filename_proxy); | |
| 672 } | |
| 673 | |
| 674 GList * | |
| 675 input_scan_dir(const gchar * path) | |
| 676 { | |
| 677 GList *node, *result = NULL; | |
| 678 InputPlugin *ip; | |
| 679 gchar *path_proxy; | |
| 680 | |
| 681 g_return_val_if_fail(path != NULL, NULL); | |
| 682 | |
| 683 if (*path == '/') | |
| 684 while (path[1] == '/') | |
| 685 path++; | |
| 686 | |
| 687 path_proxy = g_strdup(path); | |
| 688 | |
| 689 for (node = get_input_list(); node; node = g_list_next(node)) { | |
| 690 ip = INPUT_PLUGIN(node->data); | |
| 691 | |
| 692 if (!ip) | |
| 693 continue; | |
| 694 | |
| 695 if (!ip->scan_dir) | |
| 696 continue; | |
| 697 | |
|
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
|
698 if (!ip->enabled) |
| 2313 | 699 continue; |
| 700 | |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
701 plugin_set_current((Plugin *)ip); |
| 2313 | 702 if ((result = ip->scan_dir(path_proxy))) |
| 703 break; | |
| 704 } | |
| 705 | |
| 706 g_free(path_proxy); | |
| 707 | |
| 708 return result; | |
| 709 } | |
| 710 | |
| 711 void | |
| 712 input_get_volume(gint * l, gint * r) | |
| 713 { | |
| 3977 | 714 if (volume_l == -1 || volume_r == -1) |
| 715 output_get_volume(&volume_l, &volume_r); | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
716 |
| 3977 | 717 *l = volume_l; |
| 718 *r = volume_r; | |
| 2313 | 719 } |
| 720 | |
| 721 void | |
| 722 input_set_volume(gint l, gint r) | |
| 723 { | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
724 InputPlayback *playback; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
725 |
| 2505 | 726 gint h_vol[2]; |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
727 |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
728 h_vol[0] = l; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
729 h_vol[1] = r; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
730 hook_call("volume set", h_vol); |
| 2505 | 731 |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
732 if (playback_get_playing()) |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
733 if ((playback = get_current_input_playback()) != NULL) |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
734 if (playback->plugin->set_volume != NULL) |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
735 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
736 plugin_set_current((Plugin *)(playback->plugin)); |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
737 if (playback->plugin->set_volume(l, r)) |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
738 return; |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
739 } |
| 2569 | 740 |
| 2313 | 741 output_set_volume(l, r); |
| 3977 | 742 |
| 743 volume_l = l; | |
| 744 volume_r = r; | |
| 2313 | 745 } |
| 746 | |
| 747 void | |
| 748 input_update_vis(gint time) | |
| 749 { | |
| 750 GList *node; | |
| 751 VisNode *vis = NULL, *visnext = NULL; | |
| 752 gboolean found = FALSE; | |
| 753 | |
| 754 G_LOCK(vis_mutex); | |
| 755 node = vis_list; | |
| 756 while (g_list_next(node) && !found) { | |
| 757 visnext = g_list_next(node)->data; | |
| 758 vis = node->data; | |
| 759 | |
| 760 if (vis->time >= time) | |
| 761 break; | |
| 762 | |
| 763 vis_list = g_list_delete_link(vis_list, node); | |
| 764 | |
| 765 if (visnext->time >= time) { | |
| 766 found = TRUE; | |
| 767 break; | |
| 768 } | |
| 769 g_free(vis); | |
| 770 node = vis_list; | |
| 771 } | |
| 772 G_UNLOCK(vis_mutex); | |
| 773 | |
| 774 if (found) { | |
| 775 vis_send_data(vis->data, vis->nch, vis->length); | |
| 776 g_free(vis); | |
| 777 } | |
| 778 else | |
| 779 vis_send_data(NULL, 0, 0); | |
| 780 } | |
| 781 | |
|
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
782 /* 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
|
783 void |
|
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
784 input_set_info_text(gchar *text) |
| 2313 | 785 { |
|
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
786 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
|
787 event_queue("title change", title); |
| 2313 | 788 } |
| 789 | |
| 790 void | |
| 791 input_set_status_buffering(gboolean status) | |
| 792 { | |
| 793 if (!playback_get_playing()) | |
| 794 return; | |
| 795 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
796 if (!get_current_input_playback()) |
| 2313 | 797 return; |
| 798 | |
| 799 ip_data.buffering = status; | |
| 800 | |
| 801 g_return_if_fail(mainwin_playstatus != NULL); | |
| 802 | |
|
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
803 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
|
804 UI_SKINNED_PLAYSTATUS(mainwin_playstatus)->status = STATUS_PLAY; |
| 2313 | 805 |
|
3072
84de3244aeaa
replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents:
3013
diff
changeset
|
806 ui_skinned_playstatus_set_buffering(mainwin_playstatus, ip_data.buffering); |
| 2313 | 807 } |
