annotate audacious/input.c @ 710:500f6d54bc46 trunk

[svn] Remove references to inetctl from the build system.
author chainsaw
date Sun, 26 Feb 2006 16:17:12 -0800
parents 0a73d1faeb4e
children ed26947bbf57
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * Based on XMMS:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 #include <glib/gi18n.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #include <gtk/gtk.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 #include "fft.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 #include "input.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 #include "main.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #include "mainwin.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 #include "output.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 #include "util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 #include "visualization.h"
538
e4e897d20791 [svn] remove libaudcore, we never did anything with it
nenolod
parents: 355
diff changeset
38 #include "playback.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 #include "playstatus.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 #include "pluginenum.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 #include "libaudacious/titlestring.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 #include "libaudacious/util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 #include "libaudacious/xentry.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 G_LOCK_DEFINE_STATIC(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 struct _VisNode {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 gint time;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 gint nch;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 gint length; /* number of samples per channel */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 gint16 data[2][512];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 typedef struct _VisNode VisNode;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 InputPluginData ip_data = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 NULL,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 NULL,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 FALSE,
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 538
diff changeset
62 FALSE,
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 538
diff changeset
63 NULL
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 static GList *vis_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 gchar *input_info_text = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 InputPlugin *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 get_current_input_plugin(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 return ip_data.current_input_plugin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 set_current_input_plugin(InputPlugin * ip)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 ip_data.current_input_plugin = ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 GList *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 get_input_list(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 return ip_data.input_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 input_is_enabled(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 gchar *basename = g_path_get_basename(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 gint enabled;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 enabled = GPOINTER_TO_INT(g_hash_table_lookup(plugin_matrix, basename));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 g_free(basename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 return enabled;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 disabled_iplugins_foreach_func(const gchar * name,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 gboolean enabled,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 GString * list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 g_return_if_fail(list != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 if (enabled)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 if (list->len > 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 g_string_append(list, ":");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 g_string_append(list, name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 gchar *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 input_stringify_disabled_list(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 GString *disabled_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 disabled_list = g_string_new("");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 g_hash_table_foreach(plugin_matrix,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 (GHFunc) disabled_iplugins_foreach_func,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 disabled_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 return g_string_free(disabled_list, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 free_vis_data(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 G_LOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 g_list_foreach(vis_list, (GFunc) g_free, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 g_list_free(vis_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 vis_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 G_UNLOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 convert_to_s16_ne(AFormat fmt, gpointer ptr, gint16 * left,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 gint16 * right, gint nch, gint max)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 gint16 *ptr16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 guint16 *ptru16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 guint8 *ptru8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 switch (fmt) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 case FMT_U8:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 ptru8 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 for (i = 0; i < max; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 left[i] = ((*ptru8++) ^ 128) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 left[i] = ((*ptru8++) ^ 128) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 right[i] = ((*ptru8++) ^ 128) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 case FMT_S8:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 ptru8 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 for (i = 0; i < max; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 left[i] = (*ptru8++) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 left[i] = (*ptru8++) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 right[i] = (*ptru8++) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 case FMT_U16_LE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 ptru16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 for (i = 0; i < max; i++, ptru16++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 left[i] = GUINT16_FROM_LE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 left[i] = GUINT16_FROM_LE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 ptru16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 right[i] = GUINT16_FROM_LE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 ptru16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 case FMT_U16_BE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 ptru16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 for (i = 0; i < max; i++, ptru16++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 left[i] = GUINT16_FROM_BE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 left[i] = GUINT16_FROM_BE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 ptru16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 right[i] = GUINT16_FROM_BE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 ptru16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 case FMT_U16_NE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 ptru16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 for (i = 0; i < max; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 left[i] = (*ptru16++) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 left[i] = (*ptru16++) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 right[i] = (*ptru16++) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 case FMT_S16_LE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 ptr16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 for (i = 0; i < max; i++, ptr16++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 left[i] = GINT16_FROM_LE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 left[i] = GINT16_FROM_LE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 ptr16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 right[i] = GINT16_FROM_LE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 ptr16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 case FMT_S16_BE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 ptr16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 for (i = 0; i < max; i++, ptr16++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 left[i] = GINT16_FROM_BE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 left[i] = GINT16_FROM_BE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 ptr16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 right[i] = GINT16_FROM_BE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 ptr16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 case FMT_S16_NE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 ptr16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 for (i = 0; i < max; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 left[i] = (*ptr16++);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 left[i] = (*ptr16++);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 right[i] = (*ptr16++);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 InputVisType
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 input_get_vis_type()
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 return INPUT_VIS_OFF;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 input_add_vis(gint time, guchar * s, InputVisType type)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258 g_warning("plugin uses obsoleted input_add_vis()");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 VisNode *vis_node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 gint max;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 max = length / nch;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 if (fmt == FMT_U16_LE || fmt == FMT_U16_BE || fmt == FMT_U16_NE ||
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269 fmt == FMT_S16_LE || fmt == FMT_S16_BE || fmt == FMT_S16_NE)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 max /= 2;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 max = CLAMP(max, 0, 512);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
272
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273 vis_node = g_new0(VisNode, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 vis_node->time = time;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
275 vis_node->nch = nch;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 vis_node->length = max;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
277 convert_to_s16_ne(fmt, ptr, vis_node->data[0], vis_node->data[1], nch,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
278 max);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
280 G_LOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
281 vis_list = g_list_append(vis_list, vis_node);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282 G_UNLOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
284
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286 input_dont_show_warning(GtkObject * object, gpointer user_data)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288 *((gboolean *) user_data) =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
289 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294 input_show_unplayable_files(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296 static GtkWidget *dialog = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297 static GtkListStore *store = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299 const gchar *markup =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
300 N_("<b><big>Unable to play files.</big></b>\n\n"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
301 "The following files could not be played. Please check that:\n"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
302 "1. they are accessible.\n"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303 "2. you have enabled the media plugins required.");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305 GtkTreeIter iter;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
307 gchar *filename_utf8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
309 if (!dialog) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
310 GtkWidget *vbox, *check;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
311 GtkWidget *expander;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312 GtkWidget *scrolled, *treeview;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313 GtkCellRenderer *renderer;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
314
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
315 dialog =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
316 gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
317 GTK_DIALOG_DESTROY_WITH_PARENT,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318 GTK_MESSAGE_ERROR,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
319 GTK_BUTTONS_OK,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320 _(markup));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
322 vbox = gtk_vbox_new(FALSE, 6);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
323
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
324 check = gtk_check_button_new_with_label
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
325 (_("Don't show this warning anymore"));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
327 expander = gtk_expander_new_with_mnemonic(_("Show more _details"));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
328
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
329 scrolled = gtk_scrolled_window_new(NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
330 gtk_container_add(GTK_CONTAINER(expander), scrolled);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
331
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
332 store = gtk_list_store_new(1, G_TYPE_STRING);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
333
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
334 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337 treeview);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 renderer = gtk_cell_renderer_text_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341 -1, _("Filename"),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342 renderer,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 "text", 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344 NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
346 vbox = GTK_DIALOG(dialog)->vbox;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
347 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
348 gtk_box_pack_start(GTK_BOX(vbox), expander, TRUE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
349
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
350 g_signal_connect(dialog, "response",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351 G_CALLBACK(gtk_widget_destroy),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352 dialog);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353 g_signal_connect(dialog, "destroy",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
354 G_CALLBACK(gtk_widget_destroyed),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
355 &dialog);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 g_signal_connect(check, "clicked",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357 G_CALLBACK(input_dont_show_warning),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358 &cfg.warn_about_unplayables);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 gtk_widget_show_all(dialog);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363 gtk_window_present(GTK_WINDOW(dialog));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365 filename_utf8 = filename_to_utf8(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366 gtk_list_store_append(store, &iter);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367 gtk_list_store_set(store, &iter, 0, filename_utf8, -1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 g_free(filename_utf8);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373 input_file_not_playable(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375 if (cfg.warn_about_unplayables)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376 input_show_unplayable_files(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
379 /*
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
380 * input_check_file()
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
381 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
382 * Inputs:
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
383 * filename to check recursively against input plugins
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
384 * whether or not to show an error
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
385 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
386 * Outputs:
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
387 * pointer to input plugin which can handle this file
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
388 * otherwise, NULL
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
389 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
390 * (the previous code returned a boolean of whether or not we can
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
391 * play the file... even WORSE for performance)
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
392 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
393 * Side Effects:
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
394 * various input plugins open the file and probe it
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
395 * -- this can have very ugly effects performance wise on streams
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
396 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
397 * --nenolod, Dec 31 2005
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
398 */
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
399 InputPlugin *
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
400 input_check_file(const gchar * filename, gboolean show_warning)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
401 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
403 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
404 gchar *filename_proxy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
405
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
406 filename_proxy = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
407
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
408 for (node = get_input_list(); node != NULL; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
409 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
410 if (ip && input_is_enabled(ip->filename) &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
411 ip->is_our_file(filename_proxy)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
412 g_free(filename_proxy);
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
413 return ip;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
414 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
415 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
416
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
417 g_free(filename_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
418
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
419 if (show_warning) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
420 input_file_not_playable(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
421 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
422
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
423 return NULL;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
424 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
425
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
426
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
427 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
428 input_set_eq(gint on, gfloat preamp, gfloat * bands)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
429 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
430 if (!ip_data.playing)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
431 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
432
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
433 if (!get_current_input_plugin())
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
434 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
435
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
436 if (get_current_input_plugin()->set_eq)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
437 get_current_input_plugin()->set_eq(on, preamp, bands);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
438 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
439
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
440 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
441 input_get_song_info(const gchar * filename, gchar ** title, gint * length)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
442 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
443 InputPlugin *ip = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
444 BmpTitleInput *input;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
445 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
446 gchar *tmp = NULL, *ext;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
447 gchar *filename_proxy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
448
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
449 g_return_if_fail(filename != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
450 g_return_if_fail(title != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
451 g_return_if_fail(length != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
452
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
453 filename_proxy = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
454
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
455 for (node = get_input_list(); node != NULL; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
456 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
457 if (input_is_enabled(ip->filename) && ip->is_our_file(filename_proxy))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
458 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
459 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
460
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
461 if (ip && node && ip->get_song_info) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
462 ip->get_song_info(filename_proxy, &tmp, length);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
463 *title = str_to_utf8(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
464 g_free(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
465 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
466 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
467 input = bmp_title_input_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
468
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
469 tmp = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
470 if ((ext = strrchr(tmp, '.')))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
471 *ext = '\0';
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
472
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
473 input->file_name = g_path_get_basename(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
474 input->file_ext = ext ? ext + 1 : NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
475 input->file_path = tmp;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
476
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
477 if ((tmp = xmms_get_titlestring(xmms_get_gentitle_format(), input))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
478 (*title) = str_to_utf8(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
479 g_free(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
480 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
481 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
482 (*title) = filename_to_utf8(input->file_name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
483 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
484
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
485 (*length) = -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
486
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
487 bmp_title_input_free(input);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
488 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
489
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
490 g_free(filename_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
491 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
492
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
493 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
494 input_general_file_info_box(const gchar * filename, InputPlugin * ip)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
495 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
496 GtkWidget *window, *vbox;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
497 GtkWidget *label, *filename_hbox, *filename_entry;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
498 GtkWidget *bbox, *cancel;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
499
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
500 gchar *title, *fileinfo, *basename, *iplugin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
501 gchar *filename_utf8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
502
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
503 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
504 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
505 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
506
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
507 basename = g_path_get_basename(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
508 fileinfo = filename_to_utf8(basename);
257
256b3acc87d4 [svn] Properly report Audacious instead of XMMS or BMP in all places. Patch by laci; closes bug #379.
chainsaw
parents: 0
diff changeset
509 title = g_strdup_printf(_("audacious: %s"), fileinfo);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
510
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
511 gtk_window_set_title(GTK_WINDOW(window), title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
512
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
513 g_free(title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
514 g_free(fileinfo);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
515 g_free(basename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
516
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
517 gtk_container_set_border_width(GTK_CONTAINER(window), 10);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
518
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
519 vbox = gtk_vbox_new(FALSE, 10);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
520 gtk_container_add(GTK_CONTAINER(window), vbox);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
521
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
522 filename_hbox = gtk_hbox_new(FALSE, 5);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
523 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
524
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
525 label = gtk_label_new(_("Filename:"));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
526 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
527
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
528 filename_entry = xmms_entry_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
529 filename_utf8 = filename_to_utf8(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
530
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
531 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
532 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
533 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
534
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
535 g_free(filename_utf8);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
536
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
537 if (ip)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
538 if (ip->description)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
539 iplugin = ip->description;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
540 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
541 iplugin = ip->filename;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
542 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
543 iplugin = _("No input plugin recognized this file");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
544
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
545 title = g_strdup_printf(_("Input plugin: %s"), iplugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
546
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
547 label = gtk_label_new(title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
548 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
549 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
550 g_free(title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
551 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
552
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
553 bbox = gtk_hbutton_box_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
554 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
555 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
556
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
557 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
558 g_signal_connect_swapped(G_OBJECT(cancel), "clicked",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
559 GTK_SIGNAL_FUNC(gtk_widget_destroy),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
560 GTK_OBJECT(window));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
561 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
562 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
563
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
564 gtk_widget_show_all(window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
565 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
566
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
567 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
568 input_file_info_box(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
569 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
570 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
571 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
572 gchar *filename_proxy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
573
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
574 filename_proxy = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
575
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
576 for (node = get_input_list(); node != NULL; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
577 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
578 if (input_is_enabled(ip->filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
579 && ip->is_our_file(filename_proxy)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
580 if (ip->file_info_box)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
581 ip->file_info_box(filename_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
582 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
583 input_general_file_info_box(filename, ip);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
584
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
585 g_free(filename_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
586 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
587 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
588 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
589
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
590 input_general_file_info_box(filename, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
591 g_free(filename_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
592 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
593
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
594 GList *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
595 input_scan_dir(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
596 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
597 GList *node, *result = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
598 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
599 gchar *path_proxy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
600
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
601 g_return_val_if_fail(path != NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
602
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
603 if (*path == '/')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
604 while (path[1] == '/')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
605 path++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
606
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
607 path_proxy = g_strdup(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
608
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
609 for (node = get_input_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
610 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
611
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
612 if (!ip)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
613 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
614
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
615 if (!ip->scan_dir)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
616 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
617
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
618 if (!input_is_enabled(ip->filename))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
619 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
620
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
621 if ((result = ip->scan_dir(path_proxy)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
622 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
623 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
624
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
625 g_free(path_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
626
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
627 return result;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
628 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
629
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
630 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
631 input_get_volume(gint * l, gint * r)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
632 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
633 *l = -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
634 *r = -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
635 if (bmp_playback_get_playing()) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
636 if (get_current_input_plugin() &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
637 get_current_input_plugin()->get_volume) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
638 get_current_input_plugin()->get_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
639 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
640 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
641 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
642 output_get_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
643 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
644
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
645 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
646 input_set_volume(gint l, gint r)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
647 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
648 if (bmp_playback_get_playing()) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
649 if (get_current_input_plugin() &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
650 get_current_input_plugin()->set_volume) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
651 get_current_input_plugin()->set_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
652 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
653 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
654 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
655 output_set_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
656 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
657
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
658 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
659 input_update_vis(gint time)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
660 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
661 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
662 VisNode *vis = NULL, *visnext = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
663 gboolean found = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
664
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
665 G_LOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
666 node = vis_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
667 while (g_list_next(node) && !found) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
668 visnext = g_list_next(node)->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
669 vis = node->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
670
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
671 if (vis->time >= time)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
672 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
673
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
674 vis_list = g_list_delete_link(vis_list, node);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
675
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
676 if (visnext->time >= time) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
677 found = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
678 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
679 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
680 g_free(vis);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
681 node = vis_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
682 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
683 G_UNLOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
684
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
685 if (found) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
686 vis_send_data(vis->data, vis->nch, vis->length);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
687 g_free(vis);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
688 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
689 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
690 vis_send_data(NULL, 0, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
691 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
692
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
693
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
694 gchar *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
695 input_get_info_text(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
696 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
697 return g_strdup(input_info_text);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
698 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
699
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
700 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
701 input_set_info_text(const gchar * text)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
702 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
703 g_free(input_info_text);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
704 input_info_text = g_strdup(text);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
705 mainwin_set_info_text();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
706 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
707
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
708 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
709 input_about(gint index)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
710 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
711 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
712
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
713 ip = g_list_nth(ip_data.input_list, index)->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
714 if (ip && ip->about)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
715 ip->about();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
716 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
717
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
718 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
719 input_configure(gint index)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
720 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
721 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
722
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
723 ip = g_list_nth(ip_data.input_list, index)->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
724 if (ip && ip->configure)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
725 ip->configure();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
726 }