Mercurial > audlegacy
annotate Plugins/Input/mpg123/configure.c @ 1472:04cdccf13105 trunk
[svn] - reset real_ip<InputPlugin *> when we are done with it
author | nenolod |
---|---|
date | Wed, 02 Aug 2006 22:28:10 -0700 |
parents | c7b3996a123f |
children |
rev | line source |
---|---|
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 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
16 static GtkWidget *mpgdec_configurewin = NULL; |
61 | 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; | |
1071
592ef16386aa
[svn] - use global proxy configuration instead of individual configurations (chainsaw)
nenolod
parents:
651
diff
changeset
|
27 static GtkWidget *streaming_save_use, *streaming_save_entry; |
1260
bf0664762d4a
[svn] - remove unused code (causes a crash on some GTKs, eww!)
nenolod
parents:
1098
diff
changeset
|
28 static GtkWidget *streaming_udp_title; |
1071
592ef16386aa
[svn] - use global proxy configuration instead of individual configurations (chainsaw)
nenolod
parents:
651
diff
changeset
|
29 static GtkWidget *streaming_save_dirbrowser; |
61 | 30 static GtkWidget *streaming_save_hbox, *title_id3_box, *title_tag_desc; |
31 static GtkWidget *title_override, *title_id3_entry, *title_id3v2_disable; | |
32 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
33 MPG123Config mpgdec_cfg; |
61 | 34 |
35 static void | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
36 mpgdec_configurewin_ok(GtkWidget * widget, gpointer data) |
61 | 37 { |
38 ConfigDb *db; | |
39 | |
40 if (GTK_TOGGLE_BUTTON(decode_res_16)->active) | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
41 mpgdec_cfg.resolution = 16; |
61 | 42 else if (GTK_TOGGLE_BUTTON(decode_res_8)->active) |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
43 mpgdec_cfg.resolution = 8; |
61 | 44 |
45 if (GTK_TOGGLE_BUTTON(decode_ch_stereo)->active) | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
46 mpgdec_cfg.channels = 2; |
61 | 47 else if (GTK_TOGGLE_BUTTON(decode_ch_mono)->active) |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
48 mpgdec_cfg.channels = 1; |
61 | 49 |
50 if (GTK_TOGGLE_BUTTON(decode_freq_1to1)->active) | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
51 mpgdec_cfg.downsample = 0; |
61 | 52 else if (GTK_TOGGLE_BUTTON(decode_freq_1to2)->active) |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
53 mpgdec_cfg.downsample = 1; |
61 | 54 if (GTK_TOGGLE_BUTTON(decode_freq_1to4)->active) |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
55 mpgdec_cfg.downsample = 2; |
61 | 56 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
57 mpgdec_cfg.http_buffer_size = |
61 | 58 (gint) GTK_ADJUSTMENT(streaming_size_adj)->value; |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
59 mpgdec_cfg.http_prebuffer = |
61 | 60 (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value; |
61 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
62 mpgdec_cfg.save_http_stream = |
61 | 63 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
64 if (mpgdec_cfg.save_http_path) |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
65 g_free(mpgdec_cfg.save_http_path); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
66 mpgdec_cfg.save_http_path = |
61 | 67 g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry))); |
68 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
69 mpgdec_cfg.use_udp_channel = |
61 | 70 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title)); |
71 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
72 mpgdec_cfg.title_override = |
61 | 73 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override)); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
74 mpgdec_cfg.disable_id3v2 = |
61 | 75 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_id3v2_disable)); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
76 g_free(mpgdec_cfg.id3_format); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
77 mpgdec_cfg.id3_format = |
61 | 78 g_strdup(gtk_entry_get_text(GTK_ENTRY(title_id3_entry))); |
79 | |
80 db = bmp_cfg_db_open(); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
81 bmp_cfg_db_set_int(db, "MPG123", "resolution", mpgdec_cfg.resolution); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
82 bmp_cfg_db_set_int(db, "MPG123", "channels", mpgdec_cfg.channels); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
83 bmp_cfg_db_set_int(db, "MPG123", "downsample", mpgdec_cfg.downsample); |
61 | 84 bmp_cfg_db_set_int(db, "MPG123", "http_buffer_size", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
85 mpgdec_cfg.http_buffer_size); |
61 | 86 bmp_cfg_db_set_int(db, "MPG123", "http_prebuffer", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
87 mpgdec_cfg.http_prebuffer); |
61 | 88 bmp_cfg_db_set_bool(db, "MPG123", "save_http_stream", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
89 mpgdec_cfg.save_http_stream); |
61 | 90 bmp_cfg_db_set_string(db, "MPG123", "save_http_path", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
91 mpgdec_cfg.save_http_path); |
61 | 92 bmp_cfg_db_set_bool(db, "MPG123", "use_udp_channel", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
93 mpgdec_cfg.use_udp_channel); |
61 | 94 bmp_cfg_db_set_bool(db, "MPG123", "title_override", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
95 mpgdec_cfg.title_override); |
61 | 96 bmp_cfg_db_set_bool(db, "MPG123", "disable_id3v2", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
97 mpgdec_cfg.disable_id3v2); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
98 bmp_cfg_db_set_string(db, "MPG123", "id3_format", mpgdec_cfg.id3_format); |
61 | 99 |
100 bmp_cfg_db_close(db); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
101 gtk_widget_destroy(mpgdec_configurewin); |
61 | 102 } |
103 | |
104 static void | |
105 streaming_save_dirbrowser_cb(gchar * dir) | |
106 { | |
107 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), dir); | |
108 } | |
109 | |
110 static void | |
111 streaming_save_browse_cb(GtkWidget * w, gpointer data) | |
112 { | |
113 if (!streaming_save_dirbrowser) { | |
114 streaming_save_dirbrowser = | |
115 xmms_create_dir_browser(_ | |
116 ("Select the directory where you want to store the MPEG streams:"), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
117 mpgdec_cfg.save_http_path, |
61 | 118 GTK_SELECTION_SINGLE, |
119 streaming_save_dirbrowser_cb); | |
120 g_signal_connect(G_OBJECT(streaming_save_dirbrowser), "destroy", | |
121 G_CALLBACK(gtk_widget_destroyed), | |
122 &streaming_save_dirbrowser); | |
123 gtk_window_set_transient_for(GTK_WINDOW(streaming_save_dirbrowser), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
124 GTK_WINDOW(mpgdec_configurewin)); |
61 | 125 gtk_widget_show(streaming_save_dirbrowser); |
126 } | |
127 } | |
128 | |
129 static void | |
130 streaming_save_use_cb(GtkWidget * w, gpointer data) | |
131 { | |
132 gboolean save_stream; | |
133 | |
134 save_stream = | |
135 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); | |
136 | |
137 gtk_widget_set_sensitive(streaming_save_hbox, save_stream); | |
138 } | |
139 | |
140 static void | |
141 title_override_cb(GtkWidget * w, gpointer data) | |
142 { | |
143 gboolean override; | |
144 override = | |
145 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override)); | |
146 gtk_widget_set_sensitive(title_id3_box, override); | |
147 gtk_widget_set_sensitive(title_tag_desc, override); | |
148 } | |
149 | |
150 static void | |
151 configure_destroy(GtkWidget * w, gpointer data) | |
152 { | |
153 if (streaming_save_dirbrowser) | |
154 gtk_widget_destroy(streaming_save_dirbrowser); | |
155 } | |
156 | |
157 void | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
158 mpgdec_configure(void) |
61 | 159 { |
160 GtkWidget *streaming_vbox; | |
161 GtkWidget *streaming_buf_frame, *streaming_buf_hbox; | |
162 GtkWidget *streaming_size_box, *streaming_size_label, | |
163 *streaming_size_spin; | |
164 GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin; | |
165 GtkWidget *streaming_save_frame, *streaming_save_vbox; | |
166 GtkWidget *streaming_save_label, *streaming_save_browse; | |
167 GtkWidget *streaming_cast_frame, *streaming_cast_vbox; | |
168 GtkWidget *title_frame, *title_id3_vbox, *title_id3_label; | |
169 GtkWidget *bbox, *ok, *cancel; | |
170 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
171 if (mpgdec_configurewin != NULL) { |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
172 gtk_window_present(GTK_WINDOW(mpgdec_configurewin)); |
61 | 173 return; |
174 } | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
175 mpgdec_configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
176 gtk_window_set_type_hint(GTK_WINDOW(mpgdec_configurewin), |
61 | 177 GDK_WINDOW_TYPE_HINT_DIALOG); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
178 gtk_window_set_position(GTK_WINDOW(mpgdec_configurewin), |
61 | 179 GTK_WIN_POS_CENTER); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
180 g_signal_connect(G_OBJECT(mpgdec_configurewin), "destroy", |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
181 G_CALLBACK(gtk_widget_destroyed), &mpgdec_configurewin); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
182 g_signal_connect(G_OBJECT(mpgdec_configurewin), "destroy", |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
183 G_CALLBACK(configure_destroy), &mpgdec_configurewin); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
184 gtk_window_set_title(GTK_WINDOW(mpgdec_configurewin), |
61 | 185 _("MPEG Audio Plugin Configuration")); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
186 gtk_window_set_resizable(GTK_WINDOW(mpgdec_configurewin), FALSE); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
187 /* gtk_window_set_position(GTK_WINDOW(mpgdec_configurewin), GTK_WIN_POS_MOUSE); */ |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
188 gtk_container_border_width(GTK_CONTAINER(mpgdec_configurewin), 10); |
61 | 189 |
190 vbox = gtk_vbox_new(FALSE, 10); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
191 gtk_container_add(GTK_CONTAINER(mpgdec_configurewin), vbox); |
61 | 192 |
193 notebook = gtk_notebook_new(); | |
194 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
195 | |
196 decode_vbox = gtk_vbox_new(FALSE, 5); | |
197 gtk_container_set_border_width(GTK_CONTAINER(decode_vbox), 5); | |
198 | |
199 decode_hbox1 = gtk_hbox_new(TRUE, 5); | |
200 gtk_box_pack_start(GTK_BOX(decode_vbox), decode_hbox1, FALSE, FALSE, 0); | |
201 | |
202 decode_res_frame = gtk_frame_new(_("Resolution:")); | |
203 gtk_box_pack_start(GTK_BOX(decode_hbox1), decode_res_frame, TRUE, TRUE, | |
204 0); | |
205 | |
206 decode_res_vbox = gtk_vbox_new(FALSE, 5); | |
207 gtk_container_set_border_width(GTK_CONTAINER(decode_res_vbox), 5); | |
208 gtk_container_add(GTK_CONTAINER(decode_res_frame), decode_res_vbox); | |
209 | |
210 decode_res_16 = gtk_radio_button_new_with_label(NULL, _("16 bit")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
211 if (mpgdec_cfg.resolution == 16) |
61 | 212 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_res_16), TRUE); |
213 gtk_box_pack_start(GTK_BOX(decode_res_vbox), decode_res_16, FALSE, | |
214 FALSE, 0); | |
215 | |
216 decode_res_8 = | |
217 gtk_radio_button_new_with_label(gtk_radio_button_group | |
218 (GTK_RADIO_BUTTON(decode_res_16)), | |
219 _("8 bit")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
220 if (mpgdec_cfg.resolution == 8) |
61 | 221 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_res_8), TRUE); |
222 | |
223 gtk_box_pack_start(GTK_BOX(decode_res_vbox), decode_res_8, FALSE, | |
224 FALSE, 0); | |
225 | |
226 decode_ch_frame = gtk_frame_new(_("Channels:")); | |
227 gtk_box_pack_start(GTK_BOX(decode_hbox1), decode_ch_frame, TRUE, TRUE, 0); | |
228 | |
229 decode_ch_vbox = gtk_vbox_new(FALSE, 5); | |
230 gtk_container_set_border_width(GTK_CONTAINER(decode_ch_vbox), 5); | |
231 gtk_container_add(GTK_CONTAINER(decode_ch_frame), decode_ch_vbox); | |
232 | |
233 decode_ch_stereo = | |
234 gtk_radio_button_new_with_label(NULL, _("Stereo (if available)")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
235 if (mpgdec_cfg.channels == 2) |
61 | 236 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_ch_stereo), |
237 TRUE); | |
238 | |
239 gtk_box_pack_start(GTK_BOX(decode_ch_vbox), decode_ch_stereo, FALSE, | |
240 FALSE, 0); | |
241 | |
242 decode_ch_mono = | |
243 gtk_radio_button_new_with_label(gtk_radio_button_group | |
244 (GTK_RADIO_BUTTON | |
245 (decode_ch_stereo)), _("Mono")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
246 if (mpgdec_cfg.channels == 1) |
61 | 247 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_ch_mono), TRUE); |
248 | |
249 gtk_box_pack_start(GTK_BOX(decode_ch_vbox), decode_ch_mono, FALSE, | |
250 FALSE, 0); | |
251 | |
252 decode_freq_frame = gtk_frame_new(_("Down sample:")); | |
253 gtk_box_pack_start(GTK_BOX(decode_vbox), decode_freq_frame, FALSE, | |
254 FALSE, 0); | |
255 | |
256 decode_freq_vbox = gtk_vbox_new(FALSE, 5); | |
257 gtk_container_set_border_width(GTK_CONTAINER(decode_freq_vbox), 5); | |
258 gtk_container_add(GTK_CONTAINER(decode_freq_frame), decode_freq_vbox); | |
259 | |
260 decode_freq_1to1 = | |
261 gtk_radio_button_new_with_label(NULL, _("1:1 (44 kHz)")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
262 if (mpgdec_cfg.downsample == 0) |
61 | 263 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to1), |
264 TRUE); | |
265 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to1, FALSE, | |
266 FALSE, 0); | |
267 | |
268 decode_freq_1to2 = | |
269 gtk_radio_button_new_with_label(gtk_radio_button_group | |
270 (GTK_RADIO_BUTTON | |
271 (decode_freq_1to1)), | |
272 _("1:2 (22 kHz)")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
273 if (mpgdec_cfg.downsample == 1) |
61 | 274 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to2), |
275 TRUE); | |
276 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to2, FALSE, | |
277 FALSE, 0); | |
278 | |
279 decode_freq_1to4 = | |
280 gtk_radio_button_new_with_label(gtk_radio_button_group | |
281 (GTK_RADIO_BUTTON | |
282 (decode_freq_1to1)), | |
283 _("1:4 (11 kHz)")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
284 if (mpgdec_cfg.downsample == 2) |
61 | 285 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to4), |
286 TRUE); | |
287 | |
288 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to4, FALSE, | |
289 FALSE, 0); | |
290 | |
291 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), decode_vbox, | |
292 gtk_label_new(_("Decoder"))); | |
293 | |
294 streaming_vbox = gtk_vbox_new(FALSE, 0); | |
295 | |
296 streaming_buf_frame = gtk_frame_new(_("Buffering:")); | |
297 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5); | |
298 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE, | |
299 FALSE, 0); | |
300 | |
301 streaming_buf_hbox = gtk_hbox_new(TRUE, 5); | |
302 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5); | |
303 gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox); | |
304 | |
305 streaming_size_box = gtk_hbox_new(FALSE, 5); | |
306 /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_size_box,0,1,0,1); */ | |
307 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box, | |
308 TRUE, TRUE, 0); | |
309 streaming_size_label = gtk_label_new(_("Buffer size (kb):")); | |
310 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label, | |
311 FALSE, FALSE, 0); | |
312 streaming_size_adj = | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
313 gtk_adjustment_new(mpgdec_cfg.http_buffer_size, 4, 4096, 4, 4, 4); |
61 | 314 streaming_size_spin = |
315 gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0); | |
316 gtk_widget_set_usize(streaming_size_spin, 60, -1); | |
317 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin, | |
318 FALSE, FALSE, 0); | |
319 | |
320 streaming_pre_box = gtk_hbox_new(FALSE, 5); | |
321 /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_pre_box,1,2,0,1); */ | |
322 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box, | |
323 TRUE, TRUE, 0); | |
324 streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):")); | |
325 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label, | |
326 FALSE, FALSE, 0); | |
327 streaming_pre_adj = | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
328 gtk_adjustment_new(mpgdec_cfg.http_prebuffer, 0, 90, 1, 1, 1); |
61 | 329 streaming_pre_spin = |
330 gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0); | |
331 gtk_widget_set_usize(streaming_pre_spin, 60, -1); | |
332 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin, | |
333 FALSE, FALSE, 0); | |
334 | |
335 /* | |
336 * Save to disk config. | |
337 */ | |
338 streaming_save_frame = gtk_frame_new(_("Save stream to disk:")); | |
339 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5); | |
340 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame, | |
341 FALSE, FALSE, 0); | |
342 | |
343 streaming_save_vbox = gtk_vbox_new(FALSE, 5); | |
344 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5); | |
345 gtk_container_add(GTK_CONTAINER(streaming_save_frame), | |
346 streaming_save_vbox); | |
347 | |
348 streaming_save_use = | |
349 gtk_check_button_new_with_label(_("Save stream to disk")); | |
350 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
351 mpgdec_cfg.save_http_stream); |
61 | 352 g_signal_connect(G_OBJECT(streaming_save_use), "clicked", |
353 G_CALLBACK(streaming_save_use_cb), NULL); | |
354 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use, | |
355 FALSE, FALSE, 0); | |
356 | |
357 streaming_save_hbox = gtk_hbox_new(FALSE, 5); | |
358 gtk_widget_set_sensitive(streaming_save_hbox, | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
359 mpgdec_cfg.save_http_stream); |
61 | 360 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox, |
361 FALSE, FALSE, 0); | |
362 | |
363 streaming_save_label = gtk_label_new(_("Path:")); | |
364 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label, | |
365 FALSE, FALSE, 0); | |
366 | |
367 streaming_save_entry = gtk_entry_new(); | |
368 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
369 mpgdec_cfg.save_http_path); |
61 | 370 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, |
371 TRUE, TRUE, 0); | |
372 | |
373 streaming_save_browse = gtk_button_new_with_label(_("Browse")); | |
374 g_signal_connect(G_OBJECT(streaming_save_browse), "clicked", | |
375 G_CALLBACK(streaming_save_browse_cb), NULL); | |
376 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse, | |
377 FALSE, FALSE, 0); | |
378 | |
379 streaming_cast_frame = gtk_frame_new(_("SHOUT/Icecast:")); | |
380 gtk_container_set_border_width(GTK_CONTAINER(streaming_cast_frame), 5); | |
381 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_cast_frame, | |
382 FALSE, FALSE, 0); | |
383 | |
384 streaming_cast_vbox = gtk_vbox_new(5, FALSE); | |
385 gtk_container_add(GTK_CONTAINER(streaming_cast_frame), | |
386 streaming_cast_vbox); | |
387 | |
388 streaming_udp_title = | |
389 gtk_check_button_new_with_label(_ | |
390 ("Enable Icecast Metadata UDP Channel")); | |
391 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
392 mpgdec_cfg.use_udp_channel); |
61 | 393 gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title, |
394 FALSE, FALSE, 0); | |
395 | |
396 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox, | |
397 gtk_label_new(_("Streaming"))); | |
398 | |
399 title_frame = gtk_frame_new(_("ID3 Tags:")); | |
400 gtk_container_border_width(GTK_CONTAINER(title_frame), 5); | |
401 | |
402 title_id3_vbox = gtk_vbox_new(FALSE, 10); | |
403 gtk_container_border_width(GTK_CONTAINER(title_id3_vbox), 5); | |
404 gtk_container_add(GTK_CONTAINER(title_frame), title_id3_vbox); | |
405 | |
406 title_id3v2_disable = | |
407 gtk_check_button_new_with_label(_("Disable ID3V2 tags")); | |
408 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_id3v2_disable), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
409 mpgdec_cfg.disable_id3v2); |
61 | 410 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_id3v2_disable, FALSE, |
411 FALSE, 0); | |
412 | |
413 title_override = | |
414 gtk_check_button_new_with_label(_("Override generic titles")); | |
415 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_override), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
416 mpgdec_cfg.title_override); |
61 | 417 g_signal_connect(G_OBJECT(title_override), "clicked", |
418 G_CALLBACK(title_override_cb), NULL); | |
419 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_override, FALSE, | |
420 FALSE, 0); | |
421 | |
422 title_id3_box = gtk_hbox_new(FALSE, 5); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
423 gtk_widget_set_sensitive(title_id3_box, mpgdec_cfg.title_override); |
61 | 424 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_id3_box, FALSE, |
425 FALSE, 0); | |
426 | |
427 title_id3_label = gtk_label_new(_("ID3 format:")); | |
428 gtk_box_pack_start(GTK_BOX(title_id3_box), title_id3_label, FALSE, | |
429 FALSE, 0); | |
430 | |
431 title_id3_entry = gtk_entry_new(); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
432 gtk_entry_set_text(GTK_ENTRY(title_id3_entry), mpgdec_cfg.id3_format); |
61 | 433 gtk_box_pack_start(GTK_BOX(title_id3_box), title_id3_entry, TRUE, TRUE, |
434 0); | |
435 | |
436 title_tag_desc = xmms_titlestring_descriptions("pafFetnygc", 2); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
437 gtk_widget_set_sensitive(title_tag_desc, mpgdec_cfg.title_override); |
61 | 438 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_tag_desc, FALSE, |
439 FALSE, 0); | |
440 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, | |
441 gtk_label_new(_("Title"))); | |
442 | |
443 bbox = gtk_hbutton_box_new(); | |
444 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
445 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
446 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
447 | |
448 cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
449 g_signal_connect_swapped(G_OBJECT(cancel), "clicked", | |
450 G_CALLBACK(gtk_widget_destroy), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
451 GTK_OBJECT(mpgdec_configurewin)); |
61 | 452 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); |
453 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
454 | |
455 | |
456 ok = gtk_button_new_from_stock(GTK_STOCK_OK); | |
457 g_signal_connect(G_OBJECT(ok), "clicked", | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
458 G_CALLBACK(mpgdec_configurewin_ok), NULL); |
61 | 459 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT); |
460 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0); | |
461 gtk_widget_grab_default(ok); | |
462 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
463 gtk_widget_show_all(mpgdec_configurewin); |
61 | 464 } |