61
|
1
|
|
2 #include "mpg123.h"
|
|
3
|
|
4 #include <glib.h>
|
|
5 #include <glib/gi18n.h>
|
|
6 #include <gtk/gtk.h>
|
|
7 #include <stdlib.h>
|
|
8 #include <string.h>
|
|
9 #include <math.h>
|
|
10
|
|
11 #include <libaudacious/configdb.h>
|
|
12 #include <libaudacious/dirbrowser.h>
|
|
13 #include <libaudacious/titlestring.h>
|
|
14
|
|
15
|
|
16 static GtkWidget *mpg123_configurewin = NULL;
|
|
17 static GtkWidget *vbox, *notebook;
|
|
18 static GtkWidget *decode_vbox, *decode_hbox1;
|
|
19 static GtkWidget *decode_res_frame, *decode_res_vbox, *decode_res_16,
|
|
20 *decode_res_8;
|
|
21 static GtkWidget *decode_ch_frame, *decode_ch_vbox, *decode_ch_stereo,
|
|
22 *decode_ch_mono;
|
|
23 static GtkWidget *decode_freq_frame, *decode_freq_vbox, *decode_freq_1to1,
|
|
24 *decode_freq_1to2, *decode_freq_1to4;
|
|
25
|
|
26 static GtkObject *streaming_size_adj, *streaming_pre_adj;
|
|
27 static GtkWidget *streaming_proxy_use, *streaming_proxy_host_entry;
|
|
28 static GtkWidget *streaming_proxy_port_entry, *streaming_save_use,
|
|
29 *streaming_save_entry;
|
|
30 static GtkWidget *streaming_proxy_auth_use;
|
|
31 static GtkWidget *streaming_proxy_auth_pass_entry,
|
|
32 *streaming_proxy_auth_user_entry;
|
|
33 static GtkWidget *streaming_proxy_auth_user_label,
|
|
34 *streaming_proxy_auth_pass_label;
|
|
35 static GtkWidget *streaming_cast_title, *streaming_udp_title;
|
|
36 static GtkWidget *streaming_proxy_hbox, *streaming_proxy_auth_hbox,
|
|
37 *streaming_save_dirbrowser;
|
|
38 static GtkWidget *streaming_save_hbox, *title_id3_box, *title_tag_desc;
|
|
39 static GtkWidget *title_override, *title_id3_entry, *title_id3v2_disable;
|
|
40
|
|
41 /* Encoding patch */
|
|
42 static GtkWidget *title_encoding_hbox, *title_encoding_enabled, *title_encoding, *title_encoding_label;
|
|
43 /* Encoding patch */
|
|
44
|
|
45 MPG123Config mpg123_cfg;
|
|
46
|
|
47 static void
|
|
48 mpg123_configurewin_ok(GtkWidget * widget, gpointer data)
|
|
49 {
|
|
50 ConfigDb *db;
|
|
51
|
|
52 if (GTK_TOGGLE_BUTTON(decode_res_16)->active)
|
|
53 mpg123_cfg.resolution = 16;
|
|
54 else if (GTK_TOGGLE_BUTTON(decode_res_8)->active)
|
|
55 mpg123_cfg.resolution = 8;
|
|
56
|
|
57 if (GTK_TOGGLE_BUTTON(decode_ch_stereo)->active)
|
|
58 mpg123_cfg.channels = 2;
|
|
59 else if (GTK_TOGGLE_BUTTON(decode_ch_mono)->active)
|
|
60 mpg123_cfg.channels = 1;
|
|
61
|
|
62 if (GTK_TOGGLE_BUTTON(decode_freq_1to1)->active)
|
|
63 mpg123_cfg.downsample = 0;
|
|
64 else if (GTK_TOGGLE_BUTTON(decode_freq_1to2)->active)
|
|
65 mpg123_cfg.downsample = 1;
|
|
66 if (GTK_TOGGLE_BUTTON(decode_freq_1to4)->active)
|
|
67 mpg123_cfg.downsample = 2;
|
|
68
|
558
|
69 mpg123_cfg.detect_by = DETECT_CONTENT;
|
61
|
70
|
|
71 mpg123_cfg.http_buffer_size =
|
|
72 (gint) GTK_ADJUSTMENT(streaming_size_adj)->value;
|
|
73 mpg123_cfg.http_prebuffer =
|
|
74 (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value;
|
|
75
|
|
76 mpg123_cfg.use_proxy =
|
|
77 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
|
|
78 g_free(mpg123_cfg.proxy_host);
|
|
79 mpg123_cfg.proxy_host =
|
|
80 g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry)));
|
|
81 mpg123_cfg.proxy_port =
|
|
82 atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry)));
|
|
83
|
|
84 mpg123_cfg.proxy_use_auth =
|
|
85 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
|
|
86 (streaming_proxy_auth_use));
|
|
87
|
|
88 if (mpg123_cfg.proxy_user)
|
|
89 g_free(mpg123_cfg.proxy_user);
|
|
90 mpg123_cfg.proxy_user = NULL;
|
|
91 if (strlen
|
|
92 (gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0)
|
|
93 mpg123_cfg.proxy_user =
|
|
94 g_strdup(gtk_entry_get_text
|
|
95 (GTK_ENTRY(streaming_proxy_auth_user_entry)));
|
|
96
|
|
97 if (mpg123_cfg.proxy_pass)
|
|
98 g_free(mpg123_cfg.proxy_pass);
|
|
99 mpg123_cfg.proxy_pass = NULL;
|
|
100 if (strlen
|
|
101 (gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0)
|
|
102 mpg123_cfg.proxy_pass =
|
|
103 g_strdup(gtk_entry_get_text
|
|
104 (GTK_ENTRY(streaming_proxy_auth_pass_entry)));
|
|
105
|
|
106
|
|
107 mpg123_cfg.save_http_stream =
|
|
108 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
|
|
109 if (mpg123_cfg.save_http_path)
|
|
110 g_free(mpg123_cfg.save_http_path);
|
|
111 mpg123_cfg.save_http_path =
|
|
112 g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry)));
|
|
113
|
|
114 mpg123_cfg.use_udp_channel =
|
|
115 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title));
|
|
116
|
|
117 mpg123_cfg.title_override =
|
|
118 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override));
|
|
119 mpg123_cfg.disable_id3v2 =
|
|
120 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_id3v2_disable));
|
|
121 g_free(mpg123_cfg.id3_format);
|
|
122 mpg123_cfg.id3_format =
|
|
123 g_strdup(gtk_entry_get_text(GTK_ENTRY(title_id3_entry)));
|
|
124
|
|
125 mpg123_cfg.title_encoding_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_encoding_enabled));
|
|
126 mpg123_cfg.title_encoding = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_encoding)));
|
|
127 if (mpg123_cfg.title_encoding_enabled)
|
|
128 mpg123_id3_encoding_list = g_strsplit_set(mpg123_cfg.title_encoding, ENCODING_SEPARATOR, 0);
|
|
129 db = bmp_cfg_db_open();
|
|
130 bmp_cfg_db_set_int(db, "MPG123", "resolution", mpg123_cfg.resolution);
|
|
131 bmp_cfg_db_set_int(db, "MPG123", "channels", mpg123_cfg.channels);
|
|
132 bmp_cfg_db_set_int(db, "MPG123", "downsample", mpg123_cfg.downsample);
|
|
133 bmp_cfg_db_set_int(db, "MPG123", "http_buffer_size",
|
|
134 mpg123_cfg.http_buffer_size);
|
|
135 bmp_cfg_db_set_int(db, "MPG123", "http_prebuffer",
|
|
136 mpg123_cfg.http_prebuffer);
|
|
137 bmp_cfg_db_set_bool(db, "MPG123", "use_proxy", mpg123_cfg.use_proxy);
|
|
138 bmp_cfg_db_set_string(db, "MPG123", "proxy_host", mpg123_cfg.proxy_host);
|
|
139 bmp_cfg_db_set_int(db, "MPG123", "proxy_port", mpg123_cfg.proxy_port);
|
|
140 bmp_cfg_db_set_bool(db, "MPG123", "proxy_use_auth",
|
|
141 mpg123_cfg.proxy_use_auth);
|
|
142 if (mpg123_cfg.proxy_user)
|
|
143 bmp_cfg_db_set_string(db, "MPG123", "proxy_user",
|
|
144 mpg123_cfg.proxy_user);
|
|
145 else
|
|
146 bmp_cfg_db_unset_key(db, "MPG123", "proxy_user");
|
|
147 if (mpg123_cfg.proxy_pass)
|
|
148 bmp_cfg_db_set_string(db, "MPG123", "proxy_pass",
|
|
149 mpg123_cfg.proxy_pass);
|
|
150 else
|
|
151 bmp_cfg_db_unset_key(db, "MPG123", "proxy_pass");
|
|
152 bmp_cfg_db_set_bool(db, "MPG123", "save_http_stream",
|
|
153 mpg123_cfg.save_http_stream);
|
|
154 bmp_cfg_db_set_string(db, "MPG123", "save_http_path",
|
|
155 mpg123_cfg.save_http_path);
|
|
156 bmp_cfg_db_set_bool(db, "MPG123", "use_udp_channel",
|
|
157 mpg123_cfg.use_udp_channel);
|
|
158 bmp_cfg_db_set_bool(db, "MPG123", "title_override",
|
|
159 mpg123_cfg.title_override);
|
|
160 bmp_cfg_db_set_bool(db, "MPG123", "disable_id3v2",
|
|
161 mpg123_cfg.disable_id3v2);
|
|
162 bmp_cfg_db_set_string(db, "MPG123", "id3_format", mpg123_cfg.id3_format);
|
|
163 bmp_cfg_db_set_int(db, "MPG123", "detect_by", mpg123_cfg.detect_by);
|
|
164
|
|
165 /* Encoding patch */
|
|
166 bmp_cfg_db_set_bool(db, "MPG123", "title_encoding_enabled", mpg123_cfg.title_encoding_enabled);
|
|
167 bmp_cfg_db_set_string(db, "MPG123", "title_encoding", mpg123_cfg.title_encoding);
|
|
168 /* Encoding patch */
|
|
169
|
|
170 bmp_cfg_db_close(db);
|
|
171 gtk_widget_destroy(mpg123_configurewin);
|
|
172 }
|
|
173
|
|
174 static void
|
|
175 proxy_use_cb(GtkWidget * w, gpointer data)
|
|
176 {
|
|
177 gboolean use_proxy, use_proxy_auth;
|
|
178
|
|
179 use_proxy =
|
|
180 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
|
|
181 use_proxy_auth =
|
|
182 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
|
|
183 (streaming_proxy_auth_use));
|
|
184
|
|
185 gtk_widget_set_sensitive(streaming_proxy_hbox, use_proxy);
|
|
186 gtk_widget_set_sensitive(streaming_proxy_auth_use, use_proxy);
|
|
187 gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy
|
|
188 && use_proxy_auth);
|
|
189 }
|
|
190
|
|
191 static void
|
|
192 proxy_auth_use_cb(GtkWidget * w, gpointer data)
|
|
193 {
|
|
194 gboolean use_proxy, use_proxy_auth;
|
|
195
|
|
196 use_proxy =
|
|
197 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
|
|
198 use_proxy_auth =
|
|
199 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
|
|
200 (streaming_proxy_auth_use));
|
|
201
|
|
202 gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy
|
|
203 && use_proxy_auth);
|
|
204 }
|
|
205
|
|
206 static void
|
|
207 streaming_save_dirbrowser_cb(gchar * dir)
|
|
208 {
|
|
209 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), dir);
|
|
210 }
|
|
211
|
|
212 static void
|
|
213 streaming_save_browse_cb(GtkWidget * w, gpointer data)
|
|
214 {
|
|
215 if (!streaming_save_dirbrowser) {
|
|
216 streaming_save_dirbrowser =
|
|
217 xmms_create_dir_browser(_
|
|
218 ("Select the directory where you want to store the MPEG streams:"),
|
|
219 mpg123_cfg.save_http_path,
|
|
220 GTK_SELECTION_SINGLE,
|
|
221 streaming_save_dirbrowser_cb);
|
|
222 g_signal_connect(G_OBJECT(streaming_save_dirbrowser), "destroy",
|
|
223 G_CALLBACK(gtk_widget_destroyed),
|
|
224 &streaming_save_dirbrowser);
|
|
225 gtk_window_set_transient_for(GTK_WINDOW(streaming_save_dirbrowser),
|
|
226 GTK_WINDOW(mpg123_configurewin));
|
|
227 gtk_widget_show(streaming_save_dirbrowser);
|
|
228 }
|
|
229 }
|
|
230
|
|
231 static void
|
|
232 streaming_save_use_cb(GtkWidget * w, gpointer data)
|
|
233 {
|
|
234 gboolean save_stream;
|
|
235
|
|
236 save_stream =
|
|
237 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
|
|
238
|
|
239 gtk_widget_set_sensitive(streaming_save_hbox, save_stream);
|
|
240 }
|
|
241
|
|
242 static void
|
|
243 title_override_cb(GtkWidget * w, gpointer data)
|
|
244 {
|
|
245 gboolean override;
|
|
246 override =
|
|
247 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override));
|
|
248 gtk_widget_set_sensitive(title_id3_box, override);
|
|
249 gtk_widget_set_sensitive(title_tag_desc, override);
|
|
250 }
|
|
251
|
|
252 /* Encoding patch */
|
|
253 static void
|
|
254 title_encoding_enabled_cb(GtkWidget * w, gpointer data)
|
|
255 {
|
|
256 gboolean encoding_enabled;
|
|
257 encoding_enabled =
|
|
258 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_encoding_enabled));
|
|
259 gtk_widget_set_sensitive(title_encoding_hbox, encoding_enabled);
|
|
260 }
|
|
261 /* Encoding patch */
|
|
262
|
|
263 static void
|
|
264 configure_destroy(GtkWidget * w, gpointer data)
|
|
265 {
|
|
266 if (streaming_save_dirbrowser)
|
|
267 gtk_widget_destroy(streaming_save_dirbrowser);
|
|
268 }
|
|
269
|
|
270 void
|
|
271 mpg123_configure(void)
|
|
272 {
|
|
273 GtkWidget *streaming_vbox;
|
|
274 GtkWidget *streaming_buf_frame, *streaming_buf_hbox;
|
|
275 GtkWidget *streaming_size_box, *streaming_size_label,
|
|
276 *streaming_size_spin;
|
|
277 GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin;
|
|
278 GtkWidget *streaming_proxy_frame, *streaming_proxy_vbox;
|
|
279 GtkWidget *streaming_proxy_port_label, *streaming_proxy_host_label;
|
|
280 GtkWidget *streaming_save_frame, *streaming_save_vbox;
|
|
281 GtkWidget *streaming_save_label, *streaming_save_browse;
|
|
282 GtkWidget *streaming_cast_frame, *streaming_cast_vbox;
|
|
283 GtkWidget *title_frame, *title_id3_vbox, *title_id3_label;
|
|
284 GtkWidget *bbox, *ok, *cancel;
|
|
285
|
|
286 char *temp;
|
|
287
|
|
288 if (mpg123_configurewin != NULL) {
|
|
289 gtk_window_present(GTK_WINDOW(mpg123_configurewin));
|
|
290 return;
|
|
291 }
|
|
292 mpg123_configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
293 gtk_window_set_type_hint(GTK_WINDOW(mpg123_configurewin),
|
|
294 GDK_WINDOW_TYPE_HINT_DIALOG);
|
|
295 gtk_window_set_position(GTK_WINDOW(mpg123_configurewin),
|
|
296 GTK_WIN_POS_CENTER);
|
|
297 g_signal_connect(G_OBJECT(mpg123_configurewin), "destroy",
|
|
298 G_CALLBACK(gtk_widget_destroyed), &mpg123_configurewin);
|
|
299 g_signal_connect(G_OBJECT(mpg123_configurewin), "destroy",
|
|
300 G_CALLBACK(configure_destroy), &mpg123_configurewin);
|
|
301 gtk_window_set_title(GTK_WINDOW(mpg123_configurewin),
|
|
302 _("MPEG Audio Plugin Configuration"));
|
|
303 gtk_window_set_resizable(GTK_WINDOW(mpg123_configurewin), FALSE);
|
|
304 /* gtk_window_set_position(GTK_WINDOW(mpg123_configurewin), GTK_WIN_POS_MOUSE); */
|
|
305 gtk_container_border_width(GTK_CONTAINER(mpg123_configurewin), 10);
|
|
306
|
|
307 vbox = gtk_vbox_new(FALSE, 10);
|
|
308 gtk_container_add(GTK_CONTAINER(mpg123_configurewin), vbox);
|
|
309
|
|
310 notebook = gtk_notebook_new();
|
|
311 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
|
|
312
|
|
313 decode_vbox = gtk_vbox_new(FALSE, 5);
|
|
314 gtk_container_set_border_width(GTK_CONTAINER(decode_vbox), 5);
|
|
315
|
|
316 decode_hbox1 = gtk_hbox_new(TRUE, 5);
|
|
317 gtk_box_pack_start(GTK_BOX(decode_vbox), decode_hbox1, FALSE, FALSE, 0);
|
|
318
|
|
319 decode_res_frame = gtk_frame_new(_("Resolution:"));
|
|
320 gtk_box_pack_start(GTK_BOX(decode_hbox1), decode_res_frame, TRUE, TRUE,
|
|
321 0);
|
|
322
|
|
323 decode_res_vbox = gtk_vbox_new(FALSE, 5);
|
|
324 gtk_container_set_border_width(GTK_CONTAINER(decode_res_vbox), 5);
|
|
325 gtk_container_add(GTK_CONTAINER(decode_res_frame), decode_res_vbox);
|
|
326
|
|
327 decode_res_16 = gtk_radio_button_new_with_label(NULL, _("16 bit"));
|
|
328 if (mpg123_cfg.resolution == 16)
|
|
329 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_res_16), TRUE);
|
|
330 gtk_box_pack_start(GTK_BOX(decode_res_vbox), decode_res_16, FALSE,
|
|
331 FALSE, 0);
|
|
332
|
|
333 decode_res_8 =
|
|
334 gtk_radio_button_new_with_label(gtk_radio_button_group
|
|
335 (GTK_RADIO_BUTTON(decode_res_16)),
|
|
336 _("8 bit"));
|
|
337 if (mpg123_cfg.resolution == 8)
|
|
338 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_res_8), TRUE);
|
|
339
|
|
340 gtk_box_pack_start(GTK_BOX(decode_res_vbox), decode_res_8, FALSE,
|
|
341 FALSE, 0);
|
|
342
|
|
343 decode_ch_frame = gtk_frame_new(_("Channels:"));
|
|
344 gtk_box_pack_start(GTK_BOX(decode_hbox1), decode_ch_frame, TRUE, TRUE, 0);
|
|
345
|
|
346 decode_ch_vbox = gtk_vbox_new(FALSE, 5);
|
|
347 gtk_container_set_border_width(GTK_CONTAINER(decode_ch_vbox), 5);
|
|
348 gtk_container_add(GTK_CONTAINER(decode_ch_frame), decode_ch_vbox);
|
|
349
|
|
350 decode_ch_stereo =
|
|
351 gtk_radio_button_new_with_label(NULL, _("Stereo (if available)"));
|
|
352 if (mpg123_cfg.channels == 2)
|
|
353 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_ch_stereo),
|
|
354 TRUE);
|
|
355
|
|
356 gtk_box_pack_start(GTK_BOX(decode_ch_vbox), decode_ch_stereo, FALSE,
|
|
357 FALSE, 0);
|
|
358
|
|
359 decode_ch_mono =
|
|
360 gtk_radio_button_new_with_label(gtk_radio_button_group
|
|
361 (GTK_RADIO_BUTTON
|
|
362 (decode_ch_stereo)), _("Mono"));
|
|
363 if (mpg123_cfg.channels == 1)
|
|
364 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_ch_mono), TRUE);
|
|
365
|
|
366 gtk_box_pack_start(GTK_BOX(decode_ch_vbox), decode_ch_mono, FALSE,
|
|
367 FALSE, 0);
|
|
368
|
|
369 decode_freq_frame = gtk_frame_new(_("Down sample:"));
|
|
370 gtk_box_pack_start(GTK_BOX(decode_vbox), decode_freq_frame, FALSE,
|
|
371 FALSE, 0);
|
|
372
|
|
373 decode_freq_vbox = gtk_vbox_new(FALSE, 5);
|
|
374 gtk_container_set_border_width(GTK_CONTAINER(decode_freq_vbox), 5);
|
|
375 gtk_container_add(GTK_CONTAINER(decode_freq_frame), decode_freq_vbox);
|
|
376
|
|
377 decode_freq_1to1 =
|
|
378 gtk_radio_button_new_with_label(NULL, _("1:1 (44 kHz)"));
|
|
379 if (mpg123_cfg.downsample == 0)
|
|
380 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to1),
|
|
381 TRUE);
|
|
382 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to1, FALSE,
|
|
383 FALSE, 0);
|
|
384
|
|
385 decode_freq_1to2 =
|
|
386 gtk_radio_button_new_with_label(gtk_radio_button_group
|
|
387 (GTK_RADIO_BUTTON
|
|
388 (decode_freq_1to1)),
|
|
389 _("1:2 (22 kHz)"));
|
|
390 if (mpg123_cfg.downsample == 1)
|
|
391 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to2),
|
|
392 TRUE);
|
|
393 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to2, FALSE,
|
|
394 FALSE, 0);
|
|
395
|
|
396 decode_freq_1to4 =
|
|
397 gtk_radio_button_new_with_label(gtk_radio_button_group
|
|
398 (GTK_RADIO_BUTTON
|
|
399 (decode_freq_1to1)),
|
|
400 _("1:4 (11 kHz)"));
|
|
401 if (mpg123_cfg.downsample == 2)
|
|
402 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to4),
|
|
403 TRUE);
|
|
404
|
|
405 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to4, FALSE,
|
|
406 FALSE, 0);
|
|
407
|
|
408 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), decode_vbox,
|
|
409 gtk_label_new(_("Decoder")));
|
|
410
|
|
411 streaming_vbox = gtk_vbox_new(FALSE, 0);
|
|
412
|
|
413 streaming_buf_frame = gtk_frame_new(_("Buffering:"));
|
|
414 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5);
|
|
415 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE,
|
|
416 FALSE, 0);
|
|
417
|
|
418 streaming_buf_hbox = gtk_hbox_new(TRUE, 5);
|
|
419 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5);
|
|
420 gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox);
|
|
421
|
|
422 streaming_size_box = gtk_hbox_new(FALSE, 5);
|
|
423 /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_size_box,0,1,0,1); */
|
|
424 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box,
|
|
425 TRUE, TRUE, 0);
|
|
426 streaming_size_label = gtk_label_new(_("Buffer size (kb):"));
|
|
427 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label,
|
|
428 FALSE, FALSE, 0);
|
|
429 streaming_size_adj =
|
|
430 gtk_adjustment_new(mpg123_cfg.http_buffer_size, 4, 4096, 4, 4, 4);
|
|
431 streaming_size_spin =
|
|
432 gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0);
|
|
433 gtk_widget_set_usize(streaming_size_spin, 60, -1);
|
|
434 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin,
|
|
435 FALSE, FALSE, 0);
|
|
436
|
|
437 streaming_pre_box = gtk_hbox_new(FALSE, 5);
|
|
438 /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_pre_box,1,2,0,1); */
|
|
439 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box,
|
|
440 TRUE, TRUE, 0);
|
|
441 streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):"));
|
|
442 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label,
|
|
443 FALSE, FALSE, 0);
|
|
444 streaming_pre_adj =
|
|
445 gtk_adjustment_new(mpg123_cfg.http_prebuffer, 0, 90, 1, 1, 1);
|
|
446 streaming_pre_spin =
|
|
447 gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0);
|
|
448 gtk_widget_set_usize(streaming_pre_spin, 60, -1);
|
|
449 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin,
|
|
450 FALSE, FALSE, 0);
|
|
451
|
|
452 /*
|
|
453 * Proxy config.
|
|
454 */
|
|
455 streaming_proxy_frame = gtk_frame_new(_("Proxy:"));
|
|
456 gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_frame), 5);
|
|
457 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_proxy_frame,
|
|
458 FALSE, FALSE, 0);
|
|
459
|
|
460 streaming_proxy_vbox = gtk_vbox_new(FALSE, 5);
|
|
461 gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_vbox), 5);
|
|
462 gtk_container_add(GTK_CONTAINER(streaming_proxy_frame),
|
|
463 streaming_proxy_vbox);
|
|
464
|
|
465 streaming_proxy_use = gtk_check_button_new_with_label(_("Use proxy"));
|
|
466 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_use),
|
|
467 mpg123_cfg.use_proxy);
|
|
468 g_signal_connect(G_OBJECT(streaming_proxy_use), "clicked",
|
|
469 G_CALLBACK(proxy_use_cb), NULL);
|
|
470 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_use,
|
|
471 FALSE, FALSE, 0);
|
|
472
|
|
473 streaming_proxy_hbox = gtk_hbox_new(FALSE, 5);
|
|
474 gtk_widget_set_sensitive(streaming_proxy_hbox, mpg123_cfg.use_proxy);
|
|
475 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_hbox,
|
|
476 FALSE, FALSE, 0);
|
|
477
|
|
478 streaming_proxy_host_label = gtk_label_new(_("Host:"));
|
|
479 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox),
|
|
480 streaming_proxy_host_label, FALSE, FALSE, 0);
|
|
481
|
|
482 streaming_proxy_host_entry = gtk_entry_new();
|
|
483 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry),
|
|
484 mpg123_cfg.proxy_host);
|
|
485 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox),
|
|
486 streaming_proxy_host_entry, TRUE, TRUE, 0);
|
|
487
|
|
488 streaming_proxy_port_label = gtk_label_new(_("Port:"));
|
|
489 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox),
|
|
490 streaming_proxy_port_label, FALSE, FALSE, 0);
|
|
491
|
|
492 streaming_proxy_port_entry = gtk_entry_new();
|
|
493 gtk_widget_set_usize(streaming_proxy_port_entry, 50, -1);
|
|
494 temp = g_strdup_printf("%d", mpg123_cfg.proxy_port);
|
|
495 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_port_entry), temp);
|
|
496 g_free(temp);
|
|
497 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox),
|
|
498 streaming_proxy_port_entry, FALSE, FALSE, 0);
|
|
499
|
|
500 streaming_proxy_auth_use =
|
|
501 gtk_check_button_new_with_label(_("Use authentication"));
|
|
502 gtk_widget_set_sensitive(streaming_proxy_auth_use, mpg123_cfg.use_proxy);
|
|
503 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
|
|
504 (streaming_proxy_auth_use),
|
|
505 mpg123_cfg.proxy_use_auth);
|
|
506 g_signal_connect(G_OBJECT(streaming_proxy_auth_use), "clicked",
|
|
507 G_CALLBACK(proxy_auth_use_cb), NULL);
|
|
508 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox),
|
|
509 streaming_proxy_auth_use, FALSE, FALSE, 0);
|
|
510
|
|
511 streaming_proxy_auth_hbox = gtk_hbox_new(FALSE, 5);
|
|
512 gtk_widget_set_sensitive(streaming_proxy_auth_hbox,
|
|
513 mpg123_cfg.use_proxy
|
|
514 && mpg123_cfg.proxy_use_auth);
|
|
515 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox),
|
|
516 streaming_proxy_auth_hbox, FALSE, FALSE, 0);
|
|
517
|
|
518 streaming_proxy_auth_user_label = gtk_label_new(_("Username:"));
|
|
519 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox),
|
|
520 streaming_proxy_auth_user_label, FALSE, FALSE, 0);
|
|
521
|
|
522 streaming_proxy_auth_user_entry = gtk_entry_new();
|
|
523 if (mpg123_cfg.proxy_user)
|
|
524 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_user_entry),
|
|
525 mpg123_cfg.proxy_user);
|
|
526 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox),
|
|
527 streaming_proxy_auth_user_entry, TRUE, TRUE, 0);
|
|
528
|
|
529 streaming_proxy_auth_pass_label = gtk_label_new(_("Password:"));
|
|
530 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox),
|
|
531 streaming_proxy_auth_pass_label, FALSE, FALSE, 0);
|
|
532
|
|
533 streaming_proxy_auth_pass_entry = gtk_entry_new();
|
|
534 if (mpg123_cfg.proxy_pass)
|
|
535 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_pass_entry),
|
|
536 mpg123_cfg.proxy_pass);
|
|
537 gtk_entry_set_visibility(GTK_ENTRY(streaming_proxy_auth_pass_entry),
|
|
538 FALSE);
|
|
539 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox),
|
|
540 streaming_proxy_auth_pass_entry, TRUE, TRUE, 0);
|
|
541
|
|
542
|
|
543 /*
|
|
544 * Save to disk config.
|
|
545 */
|
|
546 streaming_save_frame = gtk_frame_new(_("Save stream to disk:"));
|
|
547 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5);
|
|
548 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame,
|
|
549 FALSE, FALSE, 0);
|
|
550
|
|
551 streaming_save_vbox = gtk_vbox_new(FALSE, 5);
|
|
552 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5);
|
|
553 gtk_container_add(GTK_CONTAINER(streaming_save_frame),
|
|
554 streaming_save_vbox);
|
|
555
|
|
556 streaming_save_use =
|
|
557 gtk_check_button_new_with_label(_("Save stream to disk"));
|
|
558 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use),
|
|
559 mpg123_cfg.save_http_stream);
|
|
560 g_signal_connect(G_OBJECT(streaming_save_use), "clicked",
|
|
561 G_CALLBACK(streaming_save_use_cb), NULL);
|
|
562 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use,
|
|
563 FALSE, FALSE, 0);
|
|
564
|
|
565 streaming_save_hbox = gtk_hbox_new(FALSE, 5);
|
|
566 gtk_widget_set_sensitive(streaming_save_hbox,
|
|
567 mpg123_cfg.save_http_stream);
|
|
568 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox,
|
|
569 FALSE, FALSE, 0);
|
|
570
|
|
571 streaming_save_label = gtk_label_new(_("Path:"));
|
|
572 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label,
|
|
573 FALSE, FALSE, 0);
|
|
574
|
|
575 streaming_save_entry = gtk_entry_new();
|
|
576 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry),
|
|
577 mpg123_cfg.save_http_path);
|
|
578 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry,
|
|
579 TRUE, TRUE, 0);
|
|
580
|
|
581 streaming_save_browse = gtk_button_new_with_label(_("Browse"));
|
|
582 g_signal_connect(G_OBJECT(streaming_save_browse), "clicked",
|
|
583 G_CALLBACK(streaming_save_browse_cb), NULL);
|
|
584 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse,
|
|
585 FALSE, FALSE, 0);
|
|
586
|
|
587 streaming_cast_frame = gtk_frame_new(_("SHOUT/Icecast:"));
|
|
588 gtk_container_set_border_width(GTK_CONTAINER(streaming_cast_frame), 5);
|
|
589 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_cast_frame,
|
|
590 FALSE, FALSE, 0);
|
|
591
|
|
592 streaming_cast_vbox = gtk_vbox_new(5, FALSE);
|
|
593 gtk_container_add(GTK_CONTAINER(streaming_cast_frame),
|
|
594 streaming_cast_vbox);
|
|
595
|
|
596 gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_cast_title,
|
|
597 FALSE, FALSE, 0);
|
|
598
|
|
599 streaming_udp_title =
|
|
600 gtk_check_button_new_with_label(_
|
|
601 ("Enable Icecast Metadata UDP Channel"));
|
|
602 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title),
|
|
603 mpg123_cfg.use_udp_channel);
|
|
604 gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title,
|
|
605 FALSE, FALSE, 0);
|
|
606
|
|
607 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox,
|
|
608 gtk_label_new(_("Streaming")));
|
|
609
|
|
610 title_frame = gtk_frame_new(_("ID3 Tags:"));
|
|
611 gtk_container_border_width(GTK_CONTAINER(title_frame), 5);
|
|
612
|
|
613 title_id3_vbox = gtk_vbox_new(FALSE, 10);
|
|
614 gtk_container_border_width(GTK_CONTAINER(title_id3_vbox), 5);
|
|
615 gtk_container_add(GTK_CONTAINER(title_frame), title_id3_vbox);
|
|
616
|
|
617 title_id3v2_disable =
|
|
618 gtk_check_button_new_with_label(_("Disable ID3V2 tags"));
|
|
619 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_id3v2_disable),
|
|
620 mpg123_cfg.disable_id3v2);
|
|
621 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_id3v2_disable, FALSE,
|
|
622 FALSE, 0);
|
|
623
|
|
624
|
|
625 /* Encoding patch */
|
|
626 title_encoding_enabled =
|
|
627 gtk_check_button_new_with_label(_("Convert non-UTF8 ID3 tags to UTF8"));
|
|
628 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_encoding_enabled),
|
|
629 mpg123_cfg.title_encoding_enabled);
|
|
630 g_signal_connect(G_OBJECT(title_encoding_enabled), "clicked",
|
|
631 G_CALLBACK(title_encoding_enabled_cb), NULL);
|
|
632 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_encoding_enabled, FALSE,
|
|
633 FALSE, 0);
|
|
634
|
|
635 title_encoding_hbox = gtk_hbox_new(FALSE, 5);
|
|
636 gtk_widget_set_sensitive(title_encoding_hbox, mpg123_cfg.title_encoding_enabled);
|
|
637 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_encoding_hbox, FALSE,
|
|
638 FALSE, 0);
|
|
639
|
|
640 title_encoding_label = gtk_label_new(_("ID3 encoding:"));
|
|
641 gtk_box_pack_start(GTK_BOX(title_encoding_hbox), title_encoding_label, FALSE,
|
|
642 FALSE, 0);
|
|
643
|
|
644 title_encoding = gtk_entry_new();
|
|
645 gtk_entry_set_text(GTK_ENTRY(title_encoding), mpg123_cfg.title_encoding);
|
|
646 gtk_box_pack_start(GTK_BOX(title_encoding_hbox), title_encoding, TRUE, TRUE,
|
|
647 0);
|
|
648 /* Encoding patch */
|
|
649
|
|
650
|
|
651 title_override =
|
|
652 gtk_check_button_new_with_label(_("Override generic titles"));
|
|
653 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_override),
|
|
654 mpg123_cfg.title_override);
|
|
655 g_signal_connect(G_OBJECT(title_override), "clicked",
|
|
656 G_CALLBACK(title_override_cb), NULL);
|
|
657 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_override, FALSE,
|
|
658 FALSE, 0);
|
|
659
|
|
660 title_id3_box = gtk_hbox_new(FALSE, 5);
|
|
661 gtk_widget_set_sensitive(title_id3_box, mpg123_cfg.title_override);
|
|
662 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_id3_box, FALSE,
|
|
663 FALSE, 0);
|
|
664
|
|
665 title_id3_label = gtk_label_new(_("ID3 format:"));
|
|
666 gtk_box_pack_start(GTK_BOX(title_id3_box), title_id3_label, FALSE,
|
|
667 FALSE, 0);
|
|
668
|
|
669 title_id3_entry = gtk_entry_new();
|
|
670 gtk_entry_set_text(GTK_ENTRY(title_id3_entry), mpg123_cfg.id3_format);
|
|
671 gtk_box_pack_start(GTK_BOX(title_id3_box), title_id3_entry, TRUE, TRUE,
|
|
672 0);
|
|
673
|
|
674 title_tag_desc = xmms_titlestring_descriptions("pafFetnygc", 2);
|
|
675 gtk_widget_set_sensitive(title_tag_desc, mpg123_cfg.title_override);
|
|
676 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_tag_desc, FALSE,
|
|
677 FALSE, 0);
|
|
678 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame,
|
|
679 gtk_label_new(_("Title")));
|
|
680
|
|
681 bbox = gtk_hbutton_box_new();
|
|
682 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
|
683 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
|
|
684 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
|
|
685
|
|
686 cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
|
|
687 g_signal_connect_swapped(G_OBJECT(cancel), "clicked",
|
|
688 G_CALLBACK(gtk_widget_destroy),
|
|
689 GTK_OBJECT(mpg123_configurewin));
|
|
690 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
|
|
691 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
|
|
692
|
|
693
|
|
694 ok = gtk_button_new_from_stock(GTK_STOCK_OK);
|
|
695 g_signal_connect(G_OBJECT(ok), "clicked",
|
|
696 G_CALLBACK(mpg123_configurewin_ok), NULL);
|
|
697 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
|
|
698 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
|
|
699 gtk_widget_grab_default(ok);
|
|
700
|
|
701 gtk_widget_show_all(mpg123_configurewin);
|
|
702 }
|