annotate src/audacious/input.c @ 3304:00286cde2485 trunk

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