annotate src/audacious/input.c @ 4270:a3d30a174720

Automated merge with ssh://hg.atheme.org//hg/audacious
author Eugene Zagidullin <e.asphyx@gmail.com>
date Sun, 10 Feb 2008 16:03:55 +0300
parents 2b7a74fce100
children 04ade98fafa3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
3 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
4 * Based on BMP:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
6 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
7 * Based on XMMS:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
9 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
13 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
17 * GNU General Public License for more details.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
18 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
24 */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
25
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
27 # include "config.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
28 #endif
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
29
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
30 #include <glib.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
31 #include <glib/gi18n.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
32 #include <gtk/gtk.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
33 #include <string.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
34
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3416
diff changeset
35 #include <mowgli.h>
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3416
diff changeset
36
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
37 #include "fft.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
38 #include "input.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
39 #include "main.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
40 #include "output.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
41 #include "playback.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
42 #include "pluginenum.h"
2420
b23f52fe132f [svn] Removed util.* from libaudacious
mf0102
parents: 2399
diff changeset
43 #include "strings.h"
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3251
diff changeset
44 #include "tuple.h"
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3251
diff changeset
45 #include "tuple_formatter.h"
2420
b23f52fe132f [svn] Removed util.* from libaudacious
mf0102
parents: 2399
diff changeset
46 #include "ui_main.h"
b23f52fe132f [svn] Removed util.* from libaudacious
mf0102
parents: 2399
diff changeset
47 #include "util.h"
b23f52fe132f [svn] Removed util.* from libaudacious
mf0102
parents: 2399
diff changeset
48 #include "visualization.h"
3072
84de3244aeaa replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents: 3013
diff changeset
49 #include "ui_skinned_playstatus.h"
2505
87c53f0e9e0d [svn] - added set volume hook
giacomo
parents: 2439
diff changeset
50 #include "hook.h"
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
58 G_LOCK_DEFINE_STATIC(vis_mutex);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
59
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
60 struct _VisNode {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
61 gint time;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
62 gint nch;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
63 gint length; /* number of samples per channel */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
64 gint16 data[2][512];
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
65 };
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
66
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
67 typedef struct _VisNode VisNode;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
68
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
69
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
70 InputPluginData ip_data = {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
71 NULL,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
72 NULL,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
73 FALSE,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
74 FALSE,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
75 FALSE,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
76 FALSE,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
77 NULL
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
78 };
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
79
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
80 static GList *vis_list = NULL;
3977
81b4e186765f Multiple changes.
Jonathan Schleifer <js@webkeks.org>
parents: 3963
diff changeset
81 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
82 static SAD_dither_t *sad_state = NULL;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
83 static gint sad_nch = -1;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
84
2436
f346d30bf5ab [svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents: 2430
diff changeset
85 InputPlayback *
f346d30bf5ab [svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents: 2430
diff changeset
86 get_current_input_playback(void)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
87 {
2436
f346d30bf5ab [svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents: 2430
diff changeset
88 return ip_data.current_input_playback;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
89 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
90
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
91 void
2436
f346d30bf5ab [svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents: 2430
diff changeset
92 set_current_input_playback(InputPlayback * ip)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
93 {
2436
f346d30bf5ab [svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents: 2430
diff changeset
94 ip_data.current_input_playback = ip;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
95 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
96
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
97 GList *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
98 get_input_list(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
99 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
100 return ip_data.input_list;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
101 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
102
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
103 /*
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 * 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
105 * 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
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 * -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
108 */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
109 gchar *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
110 input_stringify_disabled_list(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
111 {
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
112 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
113 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
114
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 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
116 {
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 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
118 gchar *filename;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
119
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
120 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
121 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
122
4098
fe0f7a72facd Fix memory leak in input_stringify_disabled_list() (Bugzilla #25)
Jussi Judin <jjudin+audacious@iki.fi>
parents: 4094
diff changeset
123 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
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 (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
126 g_string_append(list, ":");
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
127
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
128 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
129 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
130 }
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
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
132 return g_string_free(list, FALSE);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
133 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
134
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
135 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
136 free_vis_data(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
137 {
3516
0970c745a497 Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents: 3502
diff changeset
138 GList *iter;
0970c745a497 Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents: 3502
diff changeset
139
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
140 G_LOCK(vis_mutex);
3516
0970c745a497 Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents: 3502
diff changeset
141
0970c745a497 Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents: 3502
diff changeset
142 MOWGLI_ITER_FOREACH(iter, vis_list)
0970c745a497 Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents: 3502
diff changeset
143 g_slice_free(VisNode, iter->data);
0970c745a497 Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents: 3502
diff changeset
144
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
145 g_list_free(vis_list);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
146 vis_list = NULL;
3516
0970c745a497 Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents: 3502
diff changeset
147
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
148 G_UNLOCK(vis_mutex);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
149 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
150
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
151 InputVisType
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
152 input_get_vis_type()
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
153 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
154 return INPUT_VIS_OFF;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
155 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
156
4259
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
157 static SAD_dither_t*
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
158 init_sad(gint nch)
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
159 {
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
160 gint ret;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
161
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
162 SAD_buffer_format in, out;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
163 in.sample_format = SAD_SAMPLE_FLOAT;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
164 in.fracbits = 0;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
165 in.channels = nch;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
166 in.channels_order = SAD_CHORDER_INTERLEAVED;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
167 in.samplerate = 0;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
168
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
169 out.sample_format = SAD_SAMPLE_S16;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
170 out.fracbits = 0;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
171 out.channels = nch;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
172 out.channels_order = SAD_CHORDER_SEPARATED; /* sic! --asphyx */
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
173 out.samplerate = 0;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
174
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
175 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
176 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
177 return state;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
178 }
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
179
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
180 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
181 input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
182 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
183 VisNode *vis_node;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
184 gint max;
4259
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
185
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
186 if (fmt != FMT_FLOAT || nch > 2) return;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
187
4259
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
188 if (sad_state == NULL || nch != sad_nch) {
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
189 if(sad_state != NULL) SAD_dither_free(sad_state);
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
190 sad_state = init_sad(nch);
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
191 if(sad_state == NULL) return;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
192 sad_nch = nch;
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
193 }
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
194
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
195 max = length / nch / sizeof(float);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
196 max = CLAMP(max, 0, 512);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
197
3516
0970c745a497 Use GSlice for VisNode structs.
William Pitcock <nenolod@atheme.org>
parents: 3502
diff changeset
198 vis_node = g_slice_new0(VisNode);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
199 vis_node->time = time;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
200 vis_node->nch = nch;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
201 vis_node->length = max;
4259
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
202
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
203 gint16 *tmp[2];
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
204
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
205 tmp[0] = vis_node->data[0];
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
206 tmp[1] = vis_node->data[1];
92642f860860 - added template for src_flow
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
207 SAD_dither_process_buffer(sad_state, ptr, tmp, max);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
208
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
209 G_LOCK(vis_mutex);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
210 vis_list = g_list_append(vis_list, vis_node);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
211 G_UNLOCK(vis_mutex);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
212 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
213
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
214 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
215 input_dont_show_warning(GtkObject * object, gpointer user_data)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
216 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
217 *((gboolean *) user_data) =
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
218 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
219 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
220
3133
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
221 static time_t
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
222 input_get_mtime(const gchar *filename)
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 struct stat buf;
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
225 gint rv;
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
226 gchar *realfn = NULL;
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
227
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
228 /* stat() does not accept file:// --yaz */
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
229 realfn = g_filename_from_uri(filename, NULL, NULL);
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
230 rv = stat(realfn ? realfn : filename, &buf);
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
231 g_free(realfn); realfn = NULL;
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
232
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
233 if (rv == 0) {
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
234 return buf.st_mtime;
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
235 } else {
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
236 return 0; //error
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
237 }
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
238 }
25f92bfd50c4 Initialize tuple.mtime.
William Pitcock <nenolod@atheme-project.org>
parents: 3131
diff changeset
239
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
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 /* 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
242 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
243 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
244 {
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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 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
246 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
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 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
249
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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 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
251
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
252 /* 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
253 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
254 (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
255 (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
256
4266
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
257 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
258 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
259
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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 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
261 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
262 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
263 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
264 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
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 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
267 }
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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 }
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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 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
271 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
272 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
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 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
275 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
276 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
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 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
279 }
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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 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
283 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
284 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
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 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
287 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
288 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
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 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
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
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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 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
295 }
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
298 /*
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
299 * input_check_file()
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
300 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
301 * Inputs:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
302 * filename to check recursively against input plugins
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
303 * whether or not to show an error
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
304 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
305 * Outputs:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
306 * pointer to input plugin which can handle this file
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
307 * otherwise, NULL
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
308 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
309 * (the previous code returned a boolean of whether or not we can
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
310 * play the file... even WORSE for performance)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
311 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
312 * Side Effects:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
313 * various input plugins open the file and probe it
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
314 * -- this can have very ugly effects performance wise on streams
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
315 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
316 * --nenolod, Dec 31 2005
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
317 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
318 * Rewritten to use NewVFS probing, semantics are still basically the same.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
319 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
320 * --nenolod, Dec 5 2006
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
321 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
322 * Adapted to use the NewVFS extension probing system if enabled.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
323 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
324 * --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
325 *
a5f606b01038 Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents: 2707
diff changeset
326 * 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
327 *
a5f606b01038 Use mimetype system to accelerate detection of network streams.
William Pitcock <nenolod@atheme-project.org>
parents: 2707
diff changeset
328 * --nenolod, Jul 9 2007
3127
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
329 *
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
330 * Adapted to return ProbeResult structure.
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
331 *
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
332 * --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
333 *
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3517
diff changeset
334 * 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
335 *
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3517
diff changeset
336 * --yaz, Nov 16 2007
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
337 */
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
338
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3517
diff changeset
339 /* 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
340 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
341 input_check_file(const gchar *filename, gboolean loading)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
342 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
343 VFSFile *fd;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
344 GList *node;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
345 InputPlugin *ip;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
346 gchar *filename_proxy;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
347 gint ret = 1;
2430
4e2fc64d95ef [svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents: 2427
diff changeset
348 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
349 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
350 gchar *mimetype;
3127
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
351 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
352 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
353 extern GHashTable *ext_hash;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
354
2430
4e2fc64d95ef [svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents: 2427
diff changeset
355 /* 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
356 tmp_uri = g_strdup(filename);
4e2fc64d95ef [svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents: 2427
diff changeset
357 tmp = strrchr(tmp_uri, '?');
4e2fc64d95ef [svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents: 2427
diff changeset
358
3979
67f01143e613 improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3977
diff changeset
359 if (tmp && g_ascii_isdigit(*(tmp + 1)))
2430
4e2fc64d95ef [svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents: 2427
diff changeset
360 *tmp = '\0';
4e2fc64d95ef [svn] - make vfs_buffered_file_new_from_uri declaration const
nenolod
parents: 2427
diff changeset
361
3979
67f01143e613 improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3977
diff changeset
362 filename_proxy = g_strdup(tmp_uri);
67f01143e613 improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3977
diff changeset
363 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
364
3341
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
365 /* 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
366 /* cue:// cdda:// tone:// tact:// */
3979
67f01143e613 improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3977
diff changeset
367 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
368 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
369 {
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
370 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
371 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
372 }
3341
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
373 else
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
374 ret = 0;
3979
67f01143e613 improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3977
diff changeset
375 if (ret > 0) {
3341
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
376 g_free(filename_proxy);
3517
b747ad540903 proberesult = use g_new0() for now still
William Pitcock <nenolod@atheme.org>
parents: 3516
diff changeset
377 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
378 pr->ip = ip;
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
379 return pr;
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
380 }
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
381 g_free(filename_proxy);
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
382 return NULL;
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
383 }
3da640de0e99 Check for registered URI://s defined by uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents: 3334
diff changeset
384
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
385
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3517
diff changeset
386 // open the file with vfs sub-system
3979
67f01143e613 improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3977
diff changeset
387 fd = vfs_buffered_file_new_from_uri(filename_proxy);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
ed6c6aa50c7c Fixing typo
Christian Birchinger <joker@netswarm.net>
parents: 3123
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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");
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
398 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
399 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
400 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
401 continue;
3198
7628b2b7a688 Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents: 3171
diff changeset
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 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
404
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3517
diff changeset
405 if(pr) {
3198
7628b2b7a688 Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents: 3171
diff changeset
406 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
407 vfs_fclose(fd);
7628b2b7a688 Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents: 3171
diff changeset
408 return pr;
7628b2b7a688 Don't explicitly trust the mimetype, still do a probe.
William Pitcock <nenolod@atheme-project.org>
parents: 3171
diff changeset
409 }
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 =
3979
67f01143e613 improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3977
diff changeset
417 (fd && (!g_strncasecmp(filename_proxy, "/", 1) ||
67f01143e613 improve on-demand probing:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3977
diff changeset
418 !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
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, '.');
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
463 ip = INPUT_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
466 continue;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
474 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
475 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
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
a575c29cee05 - revive on-demand metadata retrieving. in the combination with "Detect file 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
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
479 g_free(filename_proxy);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
480 vfs_fclose(fd);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
481 return NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
482 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
483
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
484
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
485 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
486 input_set_eq(gint on, gfloat preamp, gfloat * bands)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
487 {
3170
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
488 InputPlayback *playback;
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
489
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
490 if (!ip_data.playing)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
491 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
492
3170
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
493 if ((playback = get_current_input_playback()) == NULL)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
494 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
495
3170
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
496 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
497 {
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
498 plugin_set_current((Plugin *)(playback->plugin));
3170
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
499 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
500 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
501 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
502
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
503
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3251
diff changeset
504 Tuple *
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
505 input_get_song_tuple(const gchar * filename)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
506 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
507 InputPlugin *ip = NULL;
4153
a35b9970d55d - fix a compilation warning
mf0102 <0102@gmx.at>
parents: 4098
diff changeset
508 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
509 gchar *ext = NULL;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
510 gchar *filename_proxy;
3127
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
511 ProbeResult *pr;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
512
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
513 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
514 return NULL;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
515
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
516 filename_proxy = g_strdup(filename);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
517
3127
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
518 pr = input_check_file(filename_proxy, FALSE);
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
519
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
520 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
521 g_free(filename_proxy);
3128
343504d43afc Fix warnings.
William Pitcock <nenolod@atheme-project.org>
parents: 3127
diff changeset
522 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
523 }
3127
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
524
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
525 ip = pr->ip;
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
526
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
527 g_free(pr);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
528
2331
d7ccaa59630f [svn] Wiped out some error messages
mf0102
parents: 2313
diff changeset
529 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
530 {
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
531 plugin_set_current((Plugin *)ip);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
532 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
533 }
2331
d7ccaa59630f [svn] Wiped out some error messages
mf0102
parents: 2313
diff changeset
534 else
d7ccaa59630f [svn] Wiped out some error messages
mf0102
parents: 2313
diff changeset
535 {
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
536 gchar *scratch;
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3251
diff changeset
537
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
538 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
539 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
540 g_free(scratch);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
541
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
542 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
543 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
544 g_free(scratch);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
545
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
546 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
547 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
548 ++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
549 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
550 }
3298
f985357757e0 audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents: 3251
diff changeset
551
3490
602ec8c40d0d Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 3343
diff changeset
552 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
553
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
554 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
555
2569
b3ca1bfcae6c [svn] - Spring clean (removed one function)
mf0102
parents: 2557
diff changeset
556 g_free(filename_proxy);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
557 return input;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
558 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
559
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
560 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
561 input_general_file_info_box(const gchar * filename, InputPlugin * ip)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
562 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
563 GtkWidget *window, *vbox;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
564 GtkWidget *label, *filename_hbox, *filename_entry;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
565 GtkWidget *bbox, *cancel;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
566
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
567 gchar *title, *fileinfo, *basename, *iplugin;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
568 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
569 gchar *realfn = NULL;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
570
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
571 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
572 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
573 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
574
3081
ba2143c1c6f5 unescape url encoded filename where real filename is needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3072
diff changeset
575 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
576 basename = g_path_get_basename(realfn ? realfn : filename);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
577 fileinfo = filename_to_utf8(basename);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
578 title = g_strdup_printf(_("audacious: %s"), fileinfo);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
579
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
580 gtk_window_set_title(GTK_WINDOW(window), title);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
581
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
582 g_free(title);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
583 g_free(fileinfo);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
584 g_free(basename);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
585
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
586 gtk_container_set_border_width(GTK_CONTAINER(window), 10);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
587
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
588 vbox = gtk_vbox_new(FALSE, 10);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
589 gtk_container_add(GTK_CONTAINER(window), vbox);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
590
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
591 filename_hbox = gtk_hbox_new(FALSE, 5);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
592 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
593
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
594 label = gtk_label_new(_("Filename:"));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
595 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
596
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
597 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
598 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
599 g_free(realfn); realfn = NULL;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
600
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
601 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
602 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
603 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
604
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
605 g_free(filename_utf8);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
606
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
607 if (ip)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
608 if (ip->description)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
609 iplugin = ip->description;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
610 else
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
611 iplugin = ip->filename;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
612 else
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
613 iplugin = _("No input plugin recognized this file");
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
614
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
615 title = g_strdup_printf(_("Input plugin: %s"), iplugin);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
616
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
617 label = gtk_label_new(title);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
618 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
619 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
620 g_free(title);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
621 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
622
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
623 bbox = gtk_hbutton_box_new();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
624 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
625 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
626
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
627 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
628 g_signal_connect_swapped(G_OBJECT(cancel), "clicked",
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
629 GTK_SIGNAL_FUNC(gtk_widget_destroy),
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
630 GTK_OBJECT(window));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
631 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
632 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
633
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
634 gtk_widget_show_all(window);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
635 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
636
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
637 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
638 input_file_info_box(const gchar * filename)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
639 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
640 InputPlugin *ip;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
641 gchar *filename_proxy;
3127
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
642 ProbeResult *pr;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
643
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
644 filename_proxy = g_strdup(filename);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
645
3127
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
646 pr = input_check_file(filename_proxy, FALSE);
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
647
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
648 if (!pr)
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
649 return;
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
650
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
651 ip = pr->ip;
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
652
c92070f10148 Use ProbeResult (try 1)
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
653 g_free(pr);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
654
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
655 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
656 {
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
657 plugin_set_current((Plugin *)ip);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
658 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
659 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
660 else
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
661 input_general_file_info_box(filename, ip);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
662
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
663 input_general_file_info_box(filename, NULL);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
664 g_free(filename_proxy);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
665 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
666
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
667 GList *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
668 input_scan_dir(const gchar * path)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
669 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
670 GList *node, *result = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
671 InputPlugin *ip;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
672 gchar *path_proxy;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
673
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
674 g_return_val_if_fail(path != NULL, NULL);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
675
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
676 if (*path == '/')
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
677 while (path[1] == '/')
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
678 path++;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
679
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
680 path_proxy = g_strdup(path);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
681
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
682 for (node = get_input_list(); node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
683 ip = INPUT_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
684
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
685 if (!ip)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
686 continue;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
687
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
688 if (!ip->scan_dir)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
689 continue;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
690
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
691 if (!ip->enabled)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
692 continue;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
693
4266
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
694 plugin_set_current((Plugin *)ip);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
695 if ((result = ip->scan_dir(path_proxy)))
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
696 break;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
697 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
698
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
699 g_free(path_proxy);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
700
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
701 return result;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
702 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
703
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
704 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
705 input_get_volume(gint * l, gint * r)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
706 {
3977
81b4e186765f Multiple changes.
Jonathan Schleifer <js@webkeks.org>
parents: 3963
diff changeset
707 if (volume_l == -1 || volume_r == -1)
81b4e186765f Multiple changes.
Jonathan Schleifer <js@webkeks.org>
parents: 3963
diff changeset
708 output_get_volume(&volume_l, &volume_r);
3170
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
709
3977
81b4e186765f Multiple changes.
Jonathan Schleifer <js@webkeks.org>
parents: 3963
diff changeset
710 *l = volume_l;
81b4e186765f Multiple changes.
Jonathan Schleifer <js@webkeks.org>
parents: 3963
diff changeset
711 *r = volume_r;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
712 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
713
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
714 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
715 input_set_volume(gint l, gint r)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
716 {
3170
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
717 InputPlayback *playback;
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
718
2505
87c53f0e9e0d [svn] - added set volume hook
giacomo
parents: 2439
diff changeset
719 gint h_vol[2];
3170
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
720
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
721 h_vol[0] = l;
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
722 h_vol[1] = r;
603577228518 get_current_input_playback() cleanups.
William Pitcock <nenolod@atheme-project.org>
parents: 3166
diff changeset
723 hook_call("volume set", h_vol);
2505
87c53f0e9e0d [svn] - added set volume hook
giacomo
parents: 2439
diff changeset
724
4266
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
725 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
726 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
727 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
728 {
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
729 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
730 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
731 return;
2b7a74fce100 Implemented support for multiple subplugins inside a plugin (see bug #148) and PluginHeader finalization
stefano@zanga
parents: 4259
diff changeset
732 }
2569
b3ca1bfcae6c [svn] - Spring clean (removed one function)
mf0102
parents: 2557
diff changeset
733
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
734 output_set_volume(l, r);
3977
81b4e186765f Multiple changes.
Jonathan Schleifer <js@webkeks.org>
parents: 3963
diff changeset
735
81b4e186765f Multiple changes.
Jonathan Schleifer <js@webkeks.org>
parents: 3963
diff changeset
736 volume_l = l;
81b4e186765f Multiple changes.
Jonathan Schleifer <js@webkeks.org>
parents: 3963
diff changeset
737 volume_r = r;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
738 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
739
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
740 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
741 input_update_vis(gint time)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
742 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
743 GList *node;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
744 VisNode *vis = NULL, *visnext = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
745 gboolean found = FALSE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
746
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
747 G_LOCK(vis_mutex);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
748 node = vis_list;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
749 while (g_list_next(node) && !found) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
750 visnext = g_list_next(node)->data;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
751 vis = node->data;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
752
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
753 if (vis->time >= time)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
754 break;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
755
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
756 vis_list = g_list_delete_link(vis_list, node);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
757
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
758 if (visnext->time >= time) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
759 found = TRUE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
760 break;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
761 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
762 g_free(vis);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
763 node = vis_list;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
764 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
765 G_UNLOCK(vis_mutex);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
766
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
767 if (found) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
768 vis_send_data(vis->data, vis->nch, vis->length);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
769 g_free(vis);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
770 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
771 else
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
772 vis_send_data(NULL, 0, 0);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
773 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
774
3165
8775dfc57ead Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents: 3145
diff changeset
775 /* 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
776 void
8775dfc57ead Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents: 3145
diff changeset
777 input_set_info_text(gchar *text)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
778 {
3165
8775dfc57ead Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents: 3145
diff changeset
779 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
780 event_queue("title change", title);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
781 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
782
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
783 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
784 input_set_status_buffering(gboolean status)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
785 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
786 if (!playback_get_playing())
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
787 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
788
2436
f346d30bf5ab [svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents: 2430
diff changeset
789 if (!get_current_input_playback())
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
790 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
791
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
792 ip_data.buffering = status;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
793
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
794 g_return_if_fail(mainwin_playstatus != NULL);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
795
3072
84de3244aeaa replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents: 3013
diff changeset
796 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
797 UI_SKINNED_PLAYSTATUS(mainwin_playstatus)->status = STATUS_PLAY;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
798
3072
84de3244aeaa replace Playstatus with UiSkinnedPlaystatus
Tomasz Mon <desowin@gmail.com>
parents: 3013
diff changeset
799 ui_skinned_playstatus_set_buffering(mainwin_playstatus, ip_data.buffering);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
800 }