annotate audacious/input.c @ 2261:bdb2983612f0 trunk

[svn] - given some decent namespacing to playlist menus (part 1); removed last references to obsolete mainwin_accel
author giacomo
date Thu, 04 Jan 2007 05:29:13 -0800
parents 4bc65cec8f7a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2252
4bc65cec8f7a [svn] Update copyright notices
kiyoshi
parents: 2237
diff changeset
1 /* Audacious - Cross-platform multimedia player
4bc65cec8f7a [svn] Update copyright notices
kiyoshi
parents: 2237
diff changeset
2 * Copyright (C) 2005-2006 Audacious development team
1951
c2a63f41d8c6 [svn] - NewVFS input probing layer. VFS-Aware plugins can automatically take
nenolod
parents: 1765
diff changeset
3 *
2252
4bc65cec8f7a [svn] Update copyright notices
kiyoshi
parents: 2237
diff changeset
4 * Based on BMP:
4bc65cec8f7a [svn] Update copyright notices
kiyoshi
parents: 2237
diff changeset
5 * Copyright (C) 2003-2004 BMP development team
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * Based on XMMS:
2252
4bc65cec8f7a [svn] Update copyright notices
kiyoshi
parents: 2237
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
2105
f18a5b617c34 [svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents: 2062
diff changeset
12 * the Free Software Foundation; under version 2 of the License.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 #include <glib/gi18n.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 #include <gtk/gtk.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 #include "fft.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #include "input.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 #include "main.h"
2237
d507d2c1f75c [svn] - rename mainwin.c to ui_main.c and such
nenolod
parents: 2228
diff changeset
36 #include "ui_main.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 #include "output.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 #include "util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 #include "visualization.h"
538
e4e897d20791 [svn] remove libaudcore, we never did anything with it
nenolod
parents: 355
diff changeset
40 #include "playback.h"
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
41 #include "widgets/widgetcore.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 #include "pluginenum.h"
1755
3434eb44b304 [svn] - version bump to 1.2.0-rc2
nenolod
parents: 1672
diff changeset
43 #include "titlestring.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 #include "libaudacious/util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 G_LOCK_DEFINE_STATIC(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 struct _VisNode {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 gint time;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 gint nch;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 gint length; /* number of samples per channel */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 gint16 data[2][512];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 typedef struct _VisNode VisNode;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 InputPluginData ip_data = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 NULL,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 NULL,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 FALSE,
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 538
diff changeset
63 FALSE,
890
ed26947bbf57 [svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents: 625
diff changeset
64 FALSE,
1273
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
65 FALSE,
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 538
diff changeset
66 NULL
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 static GList *vis_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 gchar *input_info_text = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 InputPlugin *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 get_current_input_plugin(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 return ip_data.current_input_plugin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 set_current_input_plugin(InputPlugin * ip)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 ip_data.current_input_plugin = ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 GList *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 get_input_list(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 return ip_data.input_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 input_is_enabled(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 gchar *basename = g_path_get_basename(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 gint enabled;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 enabled = GPOINTER_TO_INT(g_hash_table_lookup(plugin_matrix, basename));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 g_free(basename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 return enabled;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 disabled_iplugins_foreach_func(const gchar * name,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 gboolean enabled,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 GString * list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 g_return_if_fail(list != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 if (enabled)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 if (list->len > 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 g_string_append(list, ":");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 g_string_append(list, name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 gchar *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 input_stringify_disabled_list(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 GString *disabled_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 disabled_list = g_string_new("");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 g_hash_table_foreach(plugin_matrix,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 (GHFunc) disabled_iplugins_foreach_func,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 disabled_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 return g_string_free(disabled_list, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 free_vis_data(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 G_LOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 g_list_foreach(vis_list, (GFunc) g_free, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 g_list_free(vis_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 vis_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 G_UNLOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 convert_to_s16_ne(AFormat fmt, gpointer ptr, gint16 * left,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 gint16 * right, gint nch, gint max)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 gint16 *ptr16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 guint16 *ptru16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 guint8 *ptru8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 switch (fmt) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 case FMT_U8:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 ptru8 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 if (nch == 1)
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 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 left[i] = ((*ptru8++) ^ 128) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 right[i] = ((*ptru8++) ^ 128) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 case FMT_S8:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 ptru8 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 if (nch == 1)
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 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 left[i] = (*ptru8++) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 right[i] = (*ptru8++) << 8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 case FMT_U16_LE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 ptru16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 for (i = 0; i < max; i++, ptru16++)
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 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 left[i] = GUINT16_FROM_LE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 ptru16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 right[i] = GUINT16_FROM_LE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 ptru16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 case FMT_U16_BE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 ptru16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 for (i = 0; i < max; i++, ptru16++)
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 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 left[i] = GUINT16_FROM_BE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 ptru16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 right[i] = GUINT16_FROM_BE(*ptru16) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 ptru16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 case FMT_U16_NE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 ptru16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 if (nch == 1)
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 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 left[i] = (*ptru16++) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 right[i] = (*ptru16++) ^ 32768;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 case FMT_S16_LE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 ptr16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 for (i = 0; i < max; i++, ptr16++)
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 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 left[i] = GINT16_FROM_LE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 ptr16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 right[i] = GINT16_FROM_LE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 ptr16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 case FMT_S16_BE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 ptr16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 if (nch == 1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 for (i = 0; i < max; i++, ptr16++)
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 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 left[i] = GINT16_FROM_BE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 ptr16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 right[i] = GINT16_FROM_BE(*ptr16);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 ptr16++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 case FMT_S16_NE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 ptr16 = ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 if (nch == 1)
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 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 for (i = 0; i < max; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 left[i] = (*ptr16++);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 right[i] = (*ptr16++);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 InputVisType
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 input_get_vis_type()
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 return INPUT_VIS_OFF;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 input_add_vis(gint time, guchar * s, InputVisType type)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 g_warning("plugin uses obsoleted input_add_vis()");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 VisNode *vis_node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 gint max;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 max = length / nch;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 if (fmt == FMT_U16_LE || fmt == FMT_U16_BE || fmt == FMT_U16_NE ||
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
272 fmt == FMT_S16_LE || fmt == FMT_S16_BE || fmt == FMT_S16_NE)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273 max /= 2;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 max = CLAMP(max, 0, 512);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
275
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 vis_node = g_new0(VisNode, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
277 vis_node->time = time;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
278 vis_node->nch = nch;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279 vis_node->length = max;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
280 convert_to_s16_ne(fmt, ptr, vis_node->data[0], vis_node->data[1], nch,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
281 max);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283 G_LOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
284 vis_list = g_list_append(vis_list, vis_node);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 G_UNLOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
289 input_dont_show_warning(GtkObject * object, gpointer user_data)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291 *((gboolean *) user_data) =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297 input_show_unplayable_files(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299 static GtkWidget *dialog = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
300 static GtkListStore *store = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
301
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
302 const gchar *markup =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303 N_("<b><big>Unable to play files.</big></b>\n\n"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304 "The following files could not be played. Please check that:\n"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305 "1. they are accessible.\n"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306 "2. you have enabled the media plugins required.");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
307
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308 GtkTreeIter iter;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
309
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
310 gchar *filename_utf8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
311
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312 if (!dialog) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313 GtkWidget *vbox, *check;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
314 GtkWidget *expander;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
315 GtkWidget *scrolled, *treeview;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
316 GtkCellRenderer *renderer;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
317
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318 dialog =
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
319 gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin),
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320 GTK_DIALOG_DESTROY_WITH_PARENT,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321 GTK_MESSAGE_ERROR,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
322 GTK_BUTTONS_OK,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
323 _(markup));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
324
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
325 vbox = gtk_vbox_new(FALSE, 6);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
327 check = gtk_check_button_new_with_label
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
328 (_("Don't show this warning anymore"));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
329
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
330 expander = gtk_expander_new_with_mnemonic(_("Show more _details"));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
331
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
332 scrolled = gtk_scrolled_window_new(NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
333 gtk_container_add(GTK_CONTAINER(expander), scrolled);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
334
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 store = gtk_list_store_new(1, G_TYPE_STRING);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340 treeview);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342 renderer = gtk_cell_renderer_text_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344 -1, _("Filename"),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345 renderer,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
346 "text", 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
347 NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
348
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
349 vbox = GTK_DIALOG(dialog)->vbox;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
350 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351 gtk_box_pack_start(GTK_BOX(vbox), expander, TRUE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353 g_signal_connect(dialog, "response",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
354 G_CALLBACK(gtk_widget_destroy),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
355 dialog);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 g_signal_connect(dialog, "destroy",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357 G_CALLBACK(gtk_widget_destroyed),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358 &dialog);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359 g_signal_connect(check, "clicked",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 G_CALLBACK(input_dont_show_warning),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 &cfg.warn_about_unplayables);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363 gtk_widget_show_all(dialog);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366 gtk_window_present(GTK_WINDOW(dialog));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 filename_utf8 = filename_to_utf8(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 gtk_list_store_append(store, &iter);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370 gtk_list_store_set(store, &iter, 0, filename_utf8, -1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371 g_free(filename_utf8);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376 input_file_not_playable(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378 if (cfg.warn_about_unplayables)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
379 input_show_unplayable_files(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
380 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
381
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
382 /*
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
383 * input_check_file()
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
384 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
385 * Inputs:
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
386 * 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
387 * 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
388 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
389 * Outputs:
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
390 * 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
391 * otherwise, NULL
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 * (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
394 * 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
395 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
396 * Side Effects:
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
397 * 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
398 * -- 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
399 *
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
400 * --nenolod, Dec 31 2005
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
401 *
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
402 * Rewritten to use NewVFS probing, semantics are still basically the same.
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
403 *
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
404 * --nenolod, Dec 5 2006
2108
02f39b64f36b [svn] - add support for new extension probing system
nenolod
parents: 2105
diff changeset
405 *
02f39b64f36b [svn] - add support for new extension probing system
nenolod
parents: 2105
diff changeset
406 * Adapted to use the NewVFS extension probing system if enabled.
02f39b64f36b [svn] - add support for new extension probing system
nenolod
parents: 2105
diff changeset
407 *
02f39b64f36b [svn] - add support for new extension probing system
nenolod
parents: 2105
diff changeset
408 * --nenolod, Dec 12 2006
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
409 */
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
410 InputPlugin *
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
411 input_check_file(const gchar * filename, gboolean show_warning)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
412 {
1951
c2a63f41d8c6 [svn] - NewVFS input probing layer. VFS-Aware plugins can automatically take
nenolod
parents: 1765
diff changeset
413 VFSFile *fd;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
414 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
415 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
416 gchar *filename_proxy;
1486
c32478314967 [svn] - do virtual playlists properly in 1.2
nenolod
parents: 1459
diff changeset
417 gint ret = 1;
2112
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
418 gchar *ext;
2114
180e466f96bc [svn] - at present, only use extension filtering in the file:// namespace.
nenolod
parents: 2113
diff changeset
419 gboolean use_ext_filter;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
420
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
421 filename_proxy = g_strdup(filename);
1951
c2a63f41d8c6 [svn] - NewVFS input probing layer. VFS-Aware plugins can automatically take
nenolod
parents: 1765
diff changeset
422 fd = vfs_fopen(filename, "rb");
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
423
2113
d1e4f54fb9f5 [svn] - warning fix
nenolod
parents: 2112
diff changeset
424 ext = strrchr(filename_proxy, '.') + 1;
2112
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
425
2115
13da6ea5e4da [svn] - make sure fd is not NULL before checking it's URI namespace
nenolod
parents: 2114
diff changeset
426 use_ext_filter = (fd != NULL &&
2114
180e466f96bc [svn] - at present, only use extension filtering in the file:// namespace.
nenolod
parents: 2113
diff changeset
427 (!g_strcasecmp(fd->base->uri_id, "/") ||
2115
13da6ea5e4da [svn] - make sure fd is not NULL before checking it's URI namespace
nenolod
parents: 2114
diff changeset
428 !g_strcasecmp(fd->base->uri_id, "file"))) ? TRUE : FALSE;
2114
180e466f96bc [svn] - at present, only use extension filtering in the file:// namespace.
nenolod
parents: 2113
diff changeset
429
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
430 for (node = get_input_list(); node != NULL; node = g_list_next(node))
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
431 {
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
432 ip = INPUT_PLUGIN(node->data);
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
433
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
434 if (!ip || !input_is_enabled(ip->filename))
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
435 continue;
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
436
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
437 vfs_fseek(fd, 0, SEEK_SET);
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
438
2112
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
439 if (cfg.use_extension_probing == TRUE && ip->vfs_extensions != NULL
2114
180e466f96bc [svn] - at present, only use extension filtering in the file:// namespace.
nenolod
parents: 2113
diff changeset
440 && ext != NULL && ext != (gpointer) 0x1 && use_ext_filter == TRUE)
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
441 {
2108
02f39b64f36b [svn] - add support for new extension probing system
nenolod
parents: 2105
diff changeset
442 gint i;
2112
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
443 gboolean is_our_ext = FALSE;
2108
02f39b64f36b [svn] - add support for new extension probing system
nenolod
parents: 2105
diff changeset
444
02f39b64f36b [svn] - add support for new extension probing system
nenolod
parents: 2105
diff changeset
445 for (i = 0; ip->vfs_extensions[i] != NULL; i++)
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
446 {
2117
5dc1bfb0ac99 [svn] - use str_has_prefix_nocase instead of a literal compare on extension
nenolod
parents: 2115
diff changeset
447 if (str_has_prefix_nocase(ext, ip->vfs_extensions[i]))
2112
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
448 {
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
449 is_our_ext = TRUE;
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
450 break;
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
451 }
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
452 }
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
453
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
454 /* not a plugin that supports this extension */
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
455 if (is_our_ext == FALSE)
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
456 continue;
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
457 }
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
458
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
459 if (ip->is_our_file_from_vfs != NULL)
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
460 {
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
461 ret = ip->is_our_file_from_vfs(filename_proxy, fd);
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
462
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
463 if (ret > 0)
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
464 {
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
465 g_free(filename_proxy);
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
466 vfs_fclose(fd);
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
467 return ip;
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
468 }
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
469 }
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
470 else if (ip->is_our_file != NULL)
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
471 {
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
472 ret = ip->is_our_file(filename_proxy);
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
473
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
474 if (ret > 0)
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
475 {
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
476 g_free(filename_proxy);
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
477 vfs_fclose(fd);
81c744358bab [svn] - improved logic for extension assist
nenolod
parents: 2108
diff changeset
478 return ip;
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
479 }
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
480 }
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
481
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
482 if (ret <= -1)
1765
c186ee9524ed [svn] - enforce the ret = -1 == silent failure rule
nenolod
parents: 1755
diff changeset
483 break;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
484 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
485
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
486 g_free(filename_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
487
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
488 if (show_warning && ret != -1)
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
489 input_file_not_playable(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
490
1951
c2a63f41d8c6 [svn] - NewVFS input probing layer. VFS-Aware plugins can automatically take
nenolod
parents: 1765
diff changeset
491 vfs_fclose(fd);
c2a63f41d8c6 [svn] - NewVFS input probing layer. VFS-Aware plugins can automatically take
nenolod
parents: 1765
diff changeset
492
355
1c701dfe5098 [svn] Cache the decoder used for each PlaylistEntry. This reduces the amount
nenolod
parents: 284
diff changeset
493 return NULL;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
494 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
495
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
496
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
497 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
498 input_set_eq(gint on, gfloat preamp, gfloat * bands)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
499 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
500 if (!ip_data.playing)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
501 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
502
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
503 if (!get_current_input_plugin())
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
504 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
505
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
506 if (get_current_input_plugin()->set_eq)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
507 get_current_input_plugin()->set_eq(on, preamp, bands);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
508 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
509
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
510 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
511 input_get_song_info(const gchar * filename, gchar ** title, gint * length)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
512 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
513 InputPlugin *ip = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
514 BmpTitleInput *input;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
515 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
516 gchar *tmp = NULL, *ext;
1993
b9d5d917ae2a [svn] - filename_proxy need not and should not be freed here.
yaz
parents: 1989
diff changeset
517 gchar *filename_proxy;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
518
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
519 g_return_if_fail(filename != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
520 g_return_if_fail(title != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
521 g_return_if_fail(length != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
522
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
523 filename_proxy = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
524
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
525 ip = input_check_file(filename_proxy, FALSE);
1982
cf33371e7ac3 [svn] - enhancements to the NewVFS probing layer.
nenolod
parents: 1973
diff changeset
526
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
527 if (ip && node && ip->get_song_info) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
528 ip->get_song_info(filename_proxy, &tmp, length);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
529 *title = str_to_utf8(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
530 g_free(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
531 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
532 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
533 input = bmp_title_input_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
534
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
535 tmp = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
536 if ((ext = strrchr(tmp, '.')))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
537 *ext = '\0';
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
538
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
539 input->file_name = g_path_get_basename(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
540 input->file_ext = ext ? ext + 1 : NULL;
2206
ab4c7ad1857c [svn] - file_path should be dirname.
yaz
parents: 2117
diff changeset
541 input->file_path = g_path_get_dirname(tmp);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
542
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
543 if ((tmp = xmms_get_titlestring(xmms_get_gentitle_format(), input))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
544 (*title) = str_to_utf8(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
545 g_free(tmp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
546 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
547 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
548 (*title) = filename_to_utf8(input->file_name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
549 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
550
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
551 (*length) = -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
552
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
553 bmp_title_input_free(input);
1588
15d92c51bde6 [svn] - modified time (mtime) has been introduced into tuple
yaz
parents: 1547
diff changeset
554 input = NULL;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
555 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
556
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
557 g_free(filename_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
558 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
559
1231
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
560 TitleInput *
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
561 input_get_song_tuple(const gchar * filename)
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
562 {
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
563 InputPlugin *ip = NULL;
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
564 TitleInput *input;
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
565 GList *node;
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
566 gchar *tmp = NULL, *ext;
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
567 gchar *filename_proxy;
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
568
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
569 if (filename == NULL)
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
570 return NULL;
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
571
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
572 filename_proxy = g_strdup(filename);
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
573
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
574 ip = input_check_file(filename_proxy, FALSE);
1982
cf33371e7ac3 [svn] - enhancements to the NewVFS probing layer.
nenolod
parents: 1973
diff changeset
575
1231
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
576 if (ip && node && ip->get_song_tuple)
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
577 input = ip->get_song_tuple(filename_proxy);
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
578 else {
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
579 input = bmp_title_input_new();
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
580
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
581 tmp = g_strdup(filename);
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
582 if ((ext = strrchr(tmp, '.')))
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
583 *ext = '\0';
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
584
1235
7918849bad3e [svn] - more sanity for input_get_song_tuple()
nenolod
parents: 1231
diff changeset
585 input->track_name = NULL;
7918849bad3e [svn] - more sanity for input_get_song_tuple()
nenolod
parents: 1231
diff changeset
586 input->length = -1;
7918849bad3e [svn] - more sanity for input_get_song_tuple()
nenolod
parents: 1231
diff changeset
587 input_get_song_info(filename, &input->track_name, &input->length);
1231
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
588 input->file_name = g_path_get_basename(tmp);
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
589 input->file_ext = ext ? ext + 1 : NULL;
2206
ab4c7ad1857c [svn] - file_path should be dirname.
yaz
parents: 2117
diff changeset
590 input->file_path = g_path_get_dirname(tmp);
1231
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
591 }
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
592
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
593 return input;
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
594 }
502b369314c1 [svn] - InputPlugin class:
nenolod
parents: 890
diff changeset
595
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
596 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
597 input_general_file_info_box(const gchar * filename, InputPlugin * ip)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
598 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
599 GtkWidget *window, *vbox;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
600 GtkWidget *label, *filename_hbox, *filename_entry;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
601 GtkWidget *bbox, *cancel;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
602
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
603 gchar *title, *fileinfo, *basename, *iplugin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
604 gchar *filename_utf8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
605
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
606 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
607 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
608 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
609
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
610 basename = g_path_get_basename(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
611 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
612 title = g_strdup_printf(_("audacious: %s"), fileinfo);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
613
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
614 gtk_window_set_title(GTK_WINDOW(window), title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
615
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
616 g_free(title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
617 g_free(fileinfo);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
618 g_free(basename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
619
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
620 gtk_container_set_border_width(GTK_CONTAINER(window), 10);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
621
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
622 vbox = gtk_vbox_new(FALSE, 10);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
623 gtk_container_add(GTK_CONTAINER(window), vbox);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
624
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
625 filename_hbox = gtk_hbox_new(FALSE, 5);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
626 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
627
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
628 label = gtk_label_new(_("Filename:"));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
629 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
630
2035
bf9198617dae [svn] - remove only reference in source to xmms_entry_new() and prepare xentry.c's last rites.
nenolod
parents: 1993
diff changeset
631 filename_entry = gtk_entry_new();
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
632 filename_utf8 = filename_to_utf8(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
633
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
634 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
635 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
636 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
637
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
638 g_free(filename_utf8);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
639
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
640 if (ip)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
641 if (ip->description)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
642 iplugin = ip->description;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
643 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
644 iplugin = ip->filename;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
645 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
646 iplugin = _("No input plugin recognized this file");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
647
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
648 title = g_strdup_printf(_("Input plugin: %s"), iplugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
649
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
650 label = gtk_label_new(title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
651 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
652 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
653 g_free(title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
654 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
655
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
656 bbox = gtk_hbutton_box_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
657 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
658 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
659
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
660 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
661 g_signal_connect_swapped(G_OBJECT(cancel), "clicked",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
662 GTK_SIGNAL_FUNC(gtk_widget_destroy),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
663 GTK_OBJECT(window));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
664 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
665 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
666
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
667 gtk_widget_show_all(window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
668 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
669
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
670 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
671 input_file_info_box(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
672 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
673 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
674 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
675 gchar *filename_proxy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
676
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
677 filename_proxy = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
678
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
679 ip = input_check_file(filename_proxy, FALSE);
1982
cf33371e7ac3 [svn] - enhancements to the NewVFS probing layer.
nenolod
parents: 1973
diff changeset
680
2062
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
681 if (ip->file_info_box)
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
682 ip->file_info_box(filename_proxy);
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
683 else
409df027cc31 [svn] - rewrite input_check_file()
nenolod
parents: 2039
diff changeset
684 input_general_file_info_box(filename, ip);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
685
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
686 input_general_file_info_box(filename, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
687 g_free(filename_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
688 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
689
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
690 GList *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
691 input_scan_dir(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
692 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
693 GList *node, *result = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
694 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
695 gchar *path_proxy;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
696
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
697 g_return_val_if_fail(path != NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
698
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
699 if (*path == '/')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
700 while (path[1] == '/')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
701 path++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
702
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
703 path_proxy = g_strdup(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
704
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
705 for (node = get_input_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
706 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
707
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
708 if (!ip)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
709 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
710
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
711 if (!ip->scan_dir)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
712 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
713
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
714 if (!input_is_enabled(ip->filename))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
715 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
716
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
717 if ((result = ip->scan_dir(path_proxy)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
718 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
719 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
720
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
721 g_free(path_proxy);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
722
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
723 return result;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
724 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
725
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
726 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
727 input_get_volume(gint * l, gint * r)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
728 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
729 *l = -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
730 *r = -1;
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2206
diff changeset
731 if (playback_get_playing()) {
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
732 if (get_current_input_plugin() &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
733 get_current_input_plugin()->get_volume) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
734 get_current_input_plugin()->get_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
735 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
736 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
737 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
738 output_get_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
739 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
740
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
741 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
742 input_set_volume(gint l, gint r)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
743 {
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2206
diff changeset
744 if (playback_get_playing()) {
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
745 if (get_current_input_plugin() &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
746 get_current_input_plugin()->set_volume) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
747 get_current_input_plugin()->set_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
748 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
749 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
750 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
751 output_set_volume(l, r);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
752 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
753
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
754 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
755 input_update_vis(gint time)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
756 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
757 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
758 VisNode *vis = NULL, *visnext = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
759 gboolean found = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
760
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
761 G_LOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
762 node = vis_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
763 while (g_list_next(node) && !found) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
764 visnext = g_list_next(node)->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
765 vis = node->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
766
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
767 if (vis->time >= time)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
768 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
769
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
770 vis_list = g_list_delete_link(vis_list, node);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
771
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
772 if (visnext->time >= time) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
773 found = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
774 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
775 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
776 g_free(vis);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
777 node = vis_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
778 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
779 G_UNLOCK(vis_mutex);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
780
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
781 if (found) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
782 vis_send_data(vis->data, vis->nch, vis->length);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
783 g_free(vis);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
784 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
785 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
786 vis_send_data(NULL, 0, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
787 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
788
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
789
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
790 gchar *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
791 input_get_info_text(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
792 {
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
793 return g_strdup(input_info_text);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
794 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
795
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
796 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
797 input_set_info_text(const gchar * text)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
798 {
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
799 g_free(input_info_text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
800 input_info_text = g_strdup(text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
801 mainwin_set_info_text();
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
802 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
803
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
804 void
1273
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
805 input_set_status_buffering(gboolean status)
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
806 {
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2206
diff changeset
807 if (!playback_get_playing())
1273
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
808 return;
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
809
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
810 if (!get_current_input_plugin())
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
811 return;
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
812
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
813 ip_data.buffering = status;
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
814
1672
600efc52c645 [svn] - be careful about referencing a NULL widget (e.g. headless/serveronly mode crashes on streams, bug #562)
nenolod
parents: 1653
diff changeset
815 g_return_if_fail(mainwin_playstatus != NULL);
600efc52c645 [svn] - be careful about referencing a NULL widget (e.g. headless/serveronly mode crashes on streams, bug #562)
nenolod
parents: 1653
diff changeset
816
600efc52c645 [svn] - be careful about referencing a NULL widget (e.g. headless/serveronly mode crashes on streams, bug #562)
nenolod
parents: 1653
diff changeset
817 if (ip_data.buffering == TRUE && mainwin_playstatus != NULL && mainwin_playstatus->ps_status == STATUS_STOP)
1273
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
818 mainwin_playstatus->ps_status = STATUS_PLAY;
1672
600efc52c645 [svn] - be careful about referencing a NULL widget (e.g. headless/serveronly mode crashes on streams, bug #562)
nenolod
parents: 1653
diff changeset
819
1273
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
820 playstatus_set_status_buffering(mainwin_playstatus, ip_data.buffering);
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
821 }
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
822
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 1235
diff changeset
823 void
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
824 input_about(gint index)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
825 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
826 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
827
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
828 ip = g_list_nth(ip_data.input_list, index)->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
829 if (ip && ip->about)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
830 ip->about();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
831 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
832
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
833 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
834 input_configure(gint index)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
835 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
836 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
837
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
838 ip = g_list_nth(ip_data.input_list, index)->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
839 if (ip && ip->configure)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
840 ip->configure();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
841 }