Mercurial > audlegacy
annotate src/audacious/input.c @ 4797:9b9bcf252a10
- provide a way to query current interface.
- revive visualization when legacy interface is chosen.
| author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
|---|---|
| date | Sat, 11 Oct 2008 07:43:44 +0900 |
| parents | 792338a0f6ce |
| children |
| 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 "util.h" |
| 49 #include "visualization.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 |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
56 #include "libSAD.h" |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
57 |
| 2313 | 58 G_LOCK_DEFINE_STATIC(vis_mutex); |
| 59 | |
| 60 InputPluginData ip_data = { | |
| 61 NULL, | |
| 62 NULL, | |
| 63 FALSE, | |
| 64 FALSE, | |
| 65 FALSE, | |
| 66 NULL | |
| 67 }; | |
| 68 | |
| 69 static GList *vis_list = NULL; | |
| 3977 | 70 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
|
71 static SAD_dither_t *sad_state = NULL; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
72 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
|
73 static AFormat sad_fmt = -1; |
| 2313 | 74 |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
75 InputPlayback * |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
76 get_current_input_playback(void) |
| 2313 | 77 { |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
78 return ip_data.current_input_playback; |
| 2313 | 79 } |
| 80 | |
| 81 void | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2430
diff
changeset
|
82 set_current_input_playback(InputPlayback * ip) |
| 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 ip_data.current_input_playback = ip; |
| 2313 | 85 } |
| 86 | |
| 87 GList * | |
| 88 get_input_list(void) | |
| 89 { | |
| 90 return ip_data.input_list; | |
| 91 } | |
| 92 | |
|
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
|
93 /* |
|
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
|
94 * 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
|
95 * 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
|
96 * |
|
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
|
97 * -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
|
98 */ |
| 2313 | 99 gchar * |
| 100 input_stringify_disabled_list(void) | |
| 101 { | |
|
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
|
102 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
|
103 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
|
104 |
|
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
|
105 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
|
106 { |
|
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
|
107 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
|
108 gchar *filename; |
| 2313 | 109 |
|
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
|
110 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
|
111 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
|
112 |
|
4098
fe0f7a72facd
Fix memory leak in input_stringify_disabled_list() (Bugzilla #25)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4094
diff
changeset
|
113 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
|
114 |
|
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
|
115 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
|
116 g_string_append(list, ":"); |
| 2313 | 117 |
|
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
|
118 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
|
119 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
|
120 } |
|
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 return g_string_free(list, FALSE); |
| 2313 | 123 } |
| 124 | |
| 125 void | |
| 126 free_vis_data(void) | |
| 127 { | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
128 GList *iter; |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
129 |
| 2313 | 130 G_LOCK(vis_mutex); |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
131 |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
132 MOWGLI_ITER_FOREACH(iter, vis_list) |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
133 g_slice_free(VisNode, iter->data); |
|
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
134 |
| 2313 | 135 g_list_free(vis_list); |
| 136 vis_list = NULL; | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
137 |
| 2313 | 138 G_UNLOCK(vis_mutex); |
| 139 } | |
| 140 | |
| 141 InputVisType | |
| 142 input_get_vis_type() | |
| 143 { | |
| 144 return INPUT_VIS_OFF; | |
| 145 } | |
| 146 | |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
147 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
|
148 init_sad(AFormat fmt, gint nch) |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
149 { |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
150 gint ret; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
151 |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
152 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
|
153 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
|
154 in.fracbits = FMT_FRACBITS(fmt); |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
155 in.channels = nch; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
156 in.channels_order = SAD_CHORDER_INTERLEAVED; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
157 in.samplerate = 0; |
|
4797
9b9bcf252a10
- provide a way to query current interface.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4782
diff
changeset
|
158 |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
159 out.sample_format = SAD_SAMPLE_S16; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
160 out.fracbits = 0; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
161 out.channels = nch; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
162 out.channels_order = SAD_CHORDER_SEPARATED; /* sic! --asphyx */ |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
163 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
|
164 |
|
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
165 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
|
166 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
|
167 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
|
168 return state; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
169 } |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
170 |
| 2313 | 171 void |
| 172 input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr) | |
| 173 { | |
| 174 VisNode *vis_node; | |
| 175 gint max; | |
|
4797
9b9bcf252a10
- provide a way to query current interface.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4782
diff
changeset
|
176 const Interface *current = interface_get_current(); |
|
9b9bcf252a10
- provide a way to query current interface.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4782
diff
changeset
|
177 |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
178 if (nch > 2) return; |
| 2313 | 179 |
|
4797
9b9bcf252a10
- provide a way to query current interface.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4782
diff
changeset
|
180 if (current && !strstr(current->desc, "Legacy Interface")) |
|
9b9bcf252a10
- provide a way to query current interface.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4782
diff
changeset
|
181 return; |
|
9b9bcf252a10
- provide a way to query current interface.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4782
diff
changeset
|
182 |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
183 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
|
184 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
|
185 sad_state = init_sad(fmt, nch); |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
186 if(sad_state == NULL) return; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
187 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
|
188 sad_fmt = fmt; |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
189 } |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
190 |
|
4323
04ade98fafa3
vis moved to separate flow. works in passthrough mode too
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4266
diff
changeset
|
191 max = length / nch / FMT_SIZEOF(fmt); |
| 2313 | 192 max = CLAMP(max, 0, 512); |
| 193 | |
|
3516
0970c745a497
Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents:
3502
diff
changeset
|
194 vis_node = g_slice_new0(VisNode); |
| 2313 | 195 vis_node->time = time; |
| 196 vis_node->nch = nch; | |
| 197 vis_node->length = max; | |
|
4259
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
198 |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
199 gint16 *tmp[2]; |
|
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 tmp[0] = vis_node->data[0]; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
202 tmp[1] = vis_node->data[1]; |
|
92642f860860
- added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4232
diff
changeset
|
203 SAD_dither_process_buffer(sad_state, ptr, tmp, max); |
| 2313 | 204 |
| 205 G_LOCK(vis_mutex); | |
| 206 vis_list = g_list_append(vis_list, vis_node); | |
| 207 G_UNLOCK(vis_mutex); | |
| 208 } | |
| 209 | |
| 210 void | |
| 211 input_dont_show_warning(GtkObject * object, gpointer user_data) | |
| 212 { | |
| 213 *((gboolean *) user_data) = | |
| 214 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)); | |
| 215 } | |
| 216 | |
|
3133
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
217 static time_t |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
218 input_get_mtime(const gchar *filename) |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
219 { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
220 struct stat buf; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
221 gint rv; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
222 gchar *realfn = NULL; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
223 |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
224 /* stat() does not accept file:// --yaz */ |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
225 realfn = g_filename_from_uri(filename, NULL, NULL); |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
226 rv = stat(realfn ? realfn : filename, &buf); |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
227 g_free(realfn); realfn = NULL; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
228 |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
229 if (rv == 0) { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
230 return buf.st_mtime; |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
231 } else { |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
232 return 0; //error |
|
25f92bfd50c4
Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents:
3131
diff
changeset
|
233 } |
|
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 |
|
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
|
236 |
|
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
|
237 /* 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
|
238 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
|
239 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
|
240 { |
|
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
|
241 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
|
242 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
|
243 |
|
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
|
244 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
|
245 |
|
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
|
246 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
|
247 |
|
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
|
248 /* 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
|
249 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
|
250 (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
|
251 (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
|
252 |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
253 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
|
254 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
|
255 |
|
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 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
|
257 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
|
258 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
|
259 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
|
260 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
|
261 |
|
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
|
262 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
|
263 } |
|
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
|
264 } |
|
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 |
|
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 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
|
267 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
|
268 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
|
269 |
|
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 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
|
271 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
|
272 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
|
273 |
|
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 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
|
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 |
|
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
|
278 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
|
279 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
|
280 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
|
281 |
|
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 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
|
283 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
|
284 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
|
285 |
|
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 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
|
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 |
|
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
|
290 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
|
291 } |
|
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 |
| 2313 | 294 /* |
| 295 * input_check_file() | |
| 296 * | |
| 297 * Inputs: | |
| 298 * filename to check recursively against input plugins | |
| 299 * whether or not to show an error | |
| 300 * | |
| 301 * Outputs: | |
| 302 * pointer to input plugin which can handle this file | |
| 303 * otherwise, NULL | |
| 304 * | |
| 305 * (the previous code returned a boolean of whether or not we can | |
| 306 * play the file... even WORSE for performance) | |
| 307 * | |
| 308 * Side Effects: | |
| 309 * various input plugins open the file and probe it | |
| 310 * -- this can have very ugly effects performance wise on streams | |
| 311 * | |
| 312 * --nenolod, Dec 31 2005 | |
| 313 * | |
| 314 * Rewritten to use NewVFS probing, semantics are still basically the same. | |
| 315 * | |
| 316 * --nenolod, Dec 5 2006 | |
| 317 * | |
| 318 * Adapted to use the NewVFS extension probing system if enabled. | |
| 319 * | |
| 320 * --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
|
321 * |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
322 * 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
|
323 * |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
324 * --nenolod, Jul 9 2007 |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
325 * |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
326 * Adapted to return ProbeResult structure. |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
327 * |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
328 * --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
|
329 * |
|
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 * 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
|
331 * |
|
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 * --yaz, Nov 16 2007 |
| 2313 | 333 */ |
|
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
|
334 |
|
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 /* 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
|
336 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
|
337 input_check_file(const gchar *filename, gboolean loading) |
| 2313 | 338 { |
| 339 VFSFile *fd; | |
| 340 GList *node; | |
| 341 InputPlugin *ip; | |
| 342 gchar *filename_proxy; | |
| 343 gint ret = 1; | |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
344 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
|
345 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
|
346 gchar *mimetype; |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
347 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
|
348 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
|
349 extern GHashTable *ext_hash; |
| 2313 | 350 |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
351 /* 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
|
352 tmp_uri = g_strdup(filename); |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
353 tmp = strrchr(tmp_uri, '?'); |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
354 |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
355 if (tmp && g_ascii_isdigit(*(tmp + 1))) |
|
2430
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
356 *tmp = '\0'; |
|
4e2fc64d95ef
[svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents:
2427
diff
changeset
|
357 |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
358 filename_proxy = g_strdup(tmp_uri); |
|
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
359 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
|
360 |
|
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
361 /* 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
|
362 /* cue:// cdda:// tone:// tact:// */ |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
363 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
|
364 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
|
365 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
366 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
|
367 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
|
368 } |
|
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
369 else |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
370 ret = 0; |
|
3979
67f01143e613
improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3977
diff
changeset
|
371 if (ret > 0) { |
|
3341
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
372 g_free(filename_proxy); |
|
3517
b747ad540903
proberesult = use g_new0() for now still
William Pitcock <nenolod@atheme.org>
parents:
3516
diff
changeset
|
373 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
|
374 pr->ip = ip; |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
375 return pr; |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
376 } |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
377 g_free(filename_proxy); |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
378 return NULL; |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
379 } |
|
3da640de0e99
Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
3334
diff
changeset
|
380 |
|
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
|
381 |
|
4777
1f03f17e263e
Buffered VFS file routies do not handle mixed seeks and reads/writes
Matti Hamalainen <ccr@tnsp.org>
parents:
4762
diff
changeset
|
382 /* open the file with vfs sub-system |
|
1f03f17e263e
Buffered VFS file routies do not handle mixed seeks and reads/writes
Matti Hamalainen <ccr@tnsp.org>
parents:
4762
diff
changeset
|
383 * FIXME! XXX! buffered VFS file does not handle mixed seeks and reads/writes |
|
1f03f17e263e
Buffered VFS file routies do not handle mixed seeks and reads/writes
Matti Hamalainen <ccr@tnsp.org>
parents:
4762
diff
changeset
|
384 * correctly! As a temporary workaround, switching to unbuffered ... -ccr |
|
1f03f17e263e
Buffered VFS file routies do not handle mixed seeks and reads/writes
Matti Hamalainen <ccr@tnsp.org>
parents:
4762
diff
changeset
|
385 */ |
|
1f03f17e263e
Buffered VFS file routies do not handle mixed seeks and reads/writes
Matti Hamalainen <ccr@tnsp.org>
parents:
4762
diff
changeset
|
386 //fd = vfs_buffered_file_new_from_uri(filename_proxy); |
|
1f03f17e263e
Buffered VFS file routies do not handle mixed seeks and reads/writes
Matti Hamalainen <ccr@tnsp.org>
parents:
4762
diff
changeset
|
387 fd = vfs_fopen(filename_proxy, "rb"); |
| 2313 | 388 |
|
3110
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
389 if (!fd) { |
| 3125 | 390 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
|
391 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
|
392 return NULL; |
|
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
393 } |
|
35e560fa183f
Added a fd NULL check to avoid probing on none-existing fds
Christian Birchinger <joker@netswarm.net>
parents:
3081
diff
changeset
|
394 |
| 2313 | 395 |
|
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
|
396 // 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
|
397 mimetype = vfs_get_metadata(fd, "content-type"); |
|
4539
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
398 if (mimetype) { |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
399 ip = mime_get_plugin(mimetype); |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
400 g_free(mimetype); |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
401 } else |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
402 ip = NULL; |
|
4797
9b9bcf252a10
- provide a way to query current interface.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4782
diff
changeset
|
403 |
|
4539
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
404 if (ip && ip->enabled) { |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
405 pr = input_do_check_file(ip, fd, filename_proxy, loading); |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
406 if (pr) { |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
407 g_free(filename_proxy); |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
408 vfs_fclose(fd); |
|
8c2a166168dd
Fix a theoretical infinite loop: if plugin matches a mime-type, but probe
Matti Hamalainen <ccr@tnsp.org>
parents:
4345
diff
changeset
|
409 return pr; |
|
3198
7628b2b7a688
Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents:
3171
diff
changeset
|
410 } |
|
3013
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
411 } |
|
a5f606b01038
Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents:
2707
diff
changeset
|
412 |
|
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
|
413 |
|
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
|
414 // 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
|
415 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
|
416 use_ext_filter = |
|
4782
792338a0f6ce
Replace g_strncasecmp with g_ascii_strncasecmp.
Tony Vroon <chainsaw@gentoo.org>
parents:
4777
diff
changeset
|
417 (fd && (!g_ascii_strncasecmp(filename_proxy, "/", 1) || |
|
792338a0f6ce
Replace g_strncasecmp with g_ascii_strncasecmp.
Tony Vroon <chainsaw@gentoo.org>
parents:
4777
diff
changeset
|
418 !g_ascii_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
|
419 } |
|
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 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
|
422 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
|
423 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
|
424 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
|
425 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
|
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 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
|
428 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
|
429 ext = strrchr(base, '.'); |
|
4797
9b9bcf252a10
- provide a way to query current interface.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4782
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 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
|
432 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
|
433 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
|
434 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
|
435 } |
|
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 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
|
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(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
|
439 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
|
440 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
|
441 |
|
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 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
|
443 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
|
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 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
|
446 |
|
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 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
|
448 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
|
449 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
|
450 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
|
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 } |
|
4208
e8c79a8b9d9b
Backed out changeset d0b2d8d4e955
William Pitcock <nenolod@atheme.org>
parents:
4156
diff
changeset
|
453 } |
|
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
|
454 |
|
4208
e8c79a8b9d9b
Backed out changeset d0b2d8d4e955
William Pitcock <nenolod@atheme.org>
parents:
4156
diff
changeset
|
455 g_free(filename_proxy); |
|
e8c79a8b9d9b
Backed out changeset d0b2d8d4e955
William Pitcock <nenolod@atheme.org>
parents:
4156
diff
changeset
|
456 vfs_fclose(fd); |
|
e8c79a8b9d9b
Backed out changeset d0b2d8d4e955
William Pitcock <nenolod@atheme.org>
parents:
4156
diff
changeset
|
457 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
|
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 |
|
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
|
460 |
|
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
|
461 // 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
|
462 for (node = get_input_list(); node != NULL; node = g_list_next(node)) { |
| 2313 | 463 ip = INPUT_PLUGIN(node->data); |
| 464 | |
|
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
|
465 if (!ip || !ip->enabled) |
| 2313 | 466 continue; |
| 467 | |
|
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
|
468 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
|
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 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
|
471 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
|
472 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
|
473 return pr; |
| 2313 | 474 } |
| 475 } | |
| 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 |
|
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 // all probing failed. return NULL |
| 2313 | 479 g_free(filename_proxy); |
| 480 vfs_fclose(fd); | |
| 481 return NULL; | |
| 482 } | |
| 483 | |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
484 Tuple * |
| 2313 | 485 input_get_song_tuple(const gchar * filename) |
| 486 { | |
| 487 InputPlugin *ip = NULL; | |
| 4153 | 488 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
|
489 gchar *ext = NULL; |
| 2313 | 490 gchar *filename_proxy; |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
491 ProbeResult *pr; |
| 2313 | 492 |
| 493 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
|
494 return NULL; |
| 2313 | 495 |
| 496 filename_proxy = g_strdup(filename); | |
| 497 | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
498 pr = input_check_file(filename_proxy, FALSE); |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
499 |
|
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
|
500 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
|
501 g_free(filename_proxy); |
|
3128
343504d43afc
Fix warnings.
William Pitcock <nenolod@atheme-project.org>
parents:
3127
diff
changeset
|
502 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
|
503 } |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
504 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
505 ip = pr->ip; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
506 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
507 g_free(pr); |
| 2313 | 508 |
| 2331 | 509 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
|
510 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
511 plugin_set_current((Plugin *)ip); |
| 2313 | 512 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
|
513 } |
| 2331 | 514 else |
| 515 { | |
|
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
|
516 gchar *scratch; |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
517 |
|
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
|
518 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
|
519 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
|
520 g_free(scratch); |
| 2313 | 521 |
|
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
|
522 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
|
523 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
|
524 g_free(scratch); |
| 2313 | 525 |
|
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
|
526 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
|
527 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
|
528 ++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
|
529 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
|
530 } |
|
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
531 |
|
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3343
diff
changeset
|
532 tuple_associate_int(input, FIELD_LENGTH, NULL, -1); |
| 2313 | 533 } |
| 534 | |
| 2569 | 535 g_free(filename_proxy); |
| 2313 | 536 return input; |
| 537 } | |
| 538 | |
| 539 static void | |
| 540 input_general_file_info_box(const gchar * filename, InputPlugin * ip) | |
| 541 { | |
| 542 GtkWidget *window, *vbox; | |
| 543 GtkWidget *label, *filename_hbox, *filename_entry; | |
| 544 GtkWidget *bbox, *cancel; | |
| 545 | |
| 546 gchar *title, *fileinfo, *basename, *iplugin; | |
| 547 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
|
548 gchar *realfn = NULL; |
| 2313 | 549 |
| 550 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 551 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
| 552 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); | |
| 553 | |
|
3081
ba2143c1c6f5
unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3072
diff
changeset
|
554 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
|
555 basename = g_path_get_basename(realfn ? realfn : filename); |
| 2313 | 556 fileinfo = filename_to_utf8(basename); |
| 557 title = g_strdup_printf(_("audacious: %s"), fileinfo); | |
| 558 | |
| 559 gtk_window_set_title(GTK_WINDOW(window), title); | |
| 560 | |
| 561 g_free(title); | |
| 562 g_free(fileinfo); | |
| 563 g_free(basename); | |
| 564 | |
| 565 gtk_container_set_border_width(GTK_CONTAINER(window), 10); | |
| 566 | |
| 567 vbox = gtk_vbox_new(FALSE, 10); | |
| 568 gtk_container_add(GTK_CONTAINER(window), vbox); | |
| 569 | |
| 570 filename_hbox = gtk_hbox_new(FALSE, 5); | |
| 571 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); | |
| 572 | |
| 573 label = gtk_label_new(_("Filename:")); | |
| 574 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); | |
| 575 | |
| 576 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
|
577 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
|
578 g_free(realfn); realfn = NULL; |
| 2313 | 579 |
| 580 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8); | |
| 581 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); | |
| 582 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0); | |
| 583 | |
| 584 g_free(filename_utf8); | |
| 585 | |
| 586 if (ip) | |
| 587 if (ip->description) | |
| 588 iplugin = ip->description; | |
| 589 else | |
| 590 iplugin = ip->filename; | |
| 591 else | |
| 592 iplugin = _("No input plugin recognized this file"); | |
| 593 | |
| 594 title = g_strdup_printf(_("Input plugin: %s"), iplugin); | |
| 595 | |
| 596 label = gtk_label_new(title); | |
| 597 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 598 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | |
| 599 g_free(title); | |
| 600 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0); | |
| 601 | |
| 602 bbox = gtk_hbutton_box_new(); | |
| 603 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
| 604 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
| 605 | |
| 606 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
| 607 g_signal_connect_swapped(G_OBJECT(cancel), "clicked", | |
| 608 GTK_SIGNAL_FUNC(gtk_widget_destroy), | |
| 609 GTK_OBJECT(window)); | |
| 610 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
| 611 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
| 612 | |
| 613 gtk_widget_show_all(window); | |
| 614 } | |
| 615 | |
| 616 void | |
| 617 input_file_info_box(const gchar * filename) | |
| 618 { | |
| 619 InputPlugin *ip; | |
| 620 gchar *filename_proxy; | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
621 ProbeResult *pr; |
| 2313 | 622 |
| 623 filename_proxy = g_strdup(filename); | |
| 624 | |
|
3127
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
625 pr = input_check_file(filename_proxy, FALSE); |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
626 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
627 if (!pr) |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
628 return; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
629 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
630 ip = pr->ip; |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
631 |
|
c92070f10148
Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
632 g_free(pr); |
| 2313 | 633 |
| 634 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
|
635 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
636 plugin_set_current((Plugin *)ip); |
| 2313 | 637 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
|
638 } |
| 2313 | 639 else |
| 640 input_general_file_info_box(filename, ip); | |
| 641 | |
| 642 input_general_file_info_box(filename, NULL); | |
| 643 g_free(filename_proxy); | |
| 644 } | |
| 645 | |
| 646 GList * | |
| 647 input_scan_dir(const gchar * path) | |
| 648 { | |
| 649 GList *node, *result = NULL; | |
| 650 InputPlugin *ip; | |
| 651 gchar *path_proxy; | |
| 652 | |
| 653 g_return_val_if_fail(path != NULL, NULL); | |
| 654 | |
| 655 if (*path == '/') | |
| 656 while (path[1] == '/') | |
| 657 path++; | |
| 658 | |
| 659 path_proxy = g_strdup(path); | |
| 660 | |
| 661 for (node = get_input_list(); node; node = g_list_next(node)) { | |
| 662 ip = INPUT_PLUGIN(node->data); | |
| 663 | |
| 664 if (!ip) | |
| 665 continue; | |
| 666 | |
| 667 if (!ip->scan_dir) | |
| 668 continue; | |
| 669 | |
|
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
|
670 if (!ip->enabled) |
| 2313 | 671 continue; |
| 672 | |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
673 plugin_set_current((Plugin *)ip); |
| 2313 | 674 if ((result = ip->scan_dir(path_proxy))) |
| 675 break; | |
| 676 } | |
| 677 | |
| 678 g_free(path_proxy); | |
| 679 | |
| 680 return result; | |
| 681 } | |
| 682 | |
| 683 void | |
| 684 input_get_volume(gint * l, gint * r) | |
| 685 { | |
| 3977 | 686 if (volume_l == -1 || volume_r == -1) |
| 687 output_get_volume(&volume_l, &volume_r); | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
688 |
| 3977 | 689 *l = volume_l; |
| 690 *r = volume_r; | |
| 2313 | 691 } |
| 692 | |
| 693 void | |
| 694 input_set_volume(gint l, gint r) | |
| 695 { | |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
696 InputPlayback *playback; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
697 |
| 2505 | 698 gint h_vol[2]; |
|
3170
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
699 |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
700 h_vol[0] = l; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
701 h_vol[1] = r; |
|
603577228518
get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents:
3166
diff
changeset
|
702 hook_call("volume set", h_vol); |
|
4587
ab8bc8a89a52
remove ui_main_set_initial_volume, call volume set hook instead
Tomasz Mon <desowin@gmail.com>
parents:
4581
diff
changeset
|
703 |
|
4266
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
704 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
|
705 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
|
706 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
|
707 { |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
708 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
|
709 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
|
710 return; |
|
2b7a74fce100
Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents:
4259
diff
changeset
|
711 } |
| 2569 | 712 |
| 2313 | 713 output_set_volume(l, r); |
| 3977 | 714 |
| 715 volume_l = l; | |
| 716 volume_r = r; | |
| 2313 | 717 } |
| 718 | |
| 719 void | |
| 720 input_update_vis(gint time) | |
| 721 { | |
| 722 GList *node; | |
| 723 VisNode *vis = NULL, *visnext = NULL; | |
| 724 gboolean found = FALSE; | |
| 725 | |
| 726 G_LOCK(vis_mutex); | |
| 727 node = vis_list; | |
| 728 while (g_list_next(node) && !found) { | |
| 729 visnext = g_list_next(node)->data; | |
| 730 vis = node->data; | |
| 731 | |
| 732 if (vis->time >= time) | |
| 733 break; | |
| 734 | |
| 735 vis_list = g_list_delete_link(vis_list, node); | |
| 736 | |
| 737 if (visnext->time >= time) { | |
| 738 found = TRUE; | |
| 739 break; | |
| 740 } | |
| 741 g_free(vis); | |
| 742 node = vis_list; | |
| 743 } | |
| 744 G_UNLOCK(vis_mutex); | |
| 745 | |
| 746 if (found) { | |
| 747 vis_send_data(vis->data, vis->nch, vis->length); | |
|
4596
a77d02342ee1
change visualization timeout; export calc_stereo_pcm, calc_mono_pcm and calc_mono_freq to PAPI
Tomasz Mon <desowin@gmail.com>
parents:
4587
diff
changeset
|
748 hook_call("visualization timeout", vis); |
| 2313 | 749 g_free(vis); |
| 750 } | |
| 751 else | |
|
4596
a77d02342ee1
change visualization timeout; export calc_stereo_pcm, calc_mono_pcm and calc_mono_freq to PAPI
Tomasz Mon <desowin@gmail.com>
parents:
4587
diff
changeset
|
752 hook_call("visualization timeout", NULL); |
| 2313 | 753 } |
| 754 | |
|
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
755 /* 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
|
756 void |
|
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
757 input_set_info_text(gchar *text) |
| 2313 | 758 { |
|
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3145
diff
changeset
|
759 gchar *title = g_strdup(text); |
|
4581
cf6711eeb12f
implement event_queue_with_data_free()
Tomasz Mon <desowin@gmail.com>
parents:
4539
diff
changeset
|
760 event_queue_with_data_free("title change", title); |
| 2313 | 761 } |
