annotate src/flac-1.2.1/src/plugin_xmms/configure.c @ 109:9d5448da9449

Added tag sv_v2.1 for changeset 619f715526df
author Chris Cannam <cannam@all-day-breakfast.com>
date Thu, 16 May 2013 16:47:33 +0100
parents 98c1576536ae
children
rev   line source
cannam@86 1 /* libxmms-flac - XMMS FLAC input plugin
cannam@86 2 * Copyright (C) 2002,2003,2004,2005,2006 Daisuke Shimamura
cannam@86 3 *
cannam@86 4 * Based on mpg123 plugin
cannam@86 5 * and prefs.c - 2000/05/06
cannam@86 6 * EasyTAG - Tag editor for MP3 and OGG files
cannam@86 7 * Copyright (C) 2000-2002 Jerome Couderc <j.couderc@ifrance.com>
cannam@86 8 *
cannam@86 9 * This program is free software; you can redistribute it and/or
cannam@86 10 * modify it under the terms of the GNU General Public License
cannam@86 11 * as published by the Free Software Foundation; either version 2
cannam@86 12 * of the License, or (at your option) any later version.
cannam@86 13 *
cannam@86 14 * This program is distributed in the hope that it will be useful,
cannam@86 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@86 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cannam@86 17 * GNU General Public License for more details.
cannam@86 18 *
cannam@86 19 * You should have received a copy of the GNU General Public License
cannam@86 20 * along with this program; if not, write to the Free Software
cannam@86 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cannam@86 22 */
cannam@86 23
cannam@86 24 #if HAVE_CONFIG_H
cannam@86 25 # include <config.h>
cannam@86 26 #endif
cannam@86 27
cannam@86 28 #include <stdlib.h>
cannam@86 29 #include <string.h>
cannam@86 30 #include <glib.h>
cannam@86 31 #include <gtk/gtk.h>
cannam@86 32 #include <pthread.h>
cannam@86 33 #include <math.h>
cannam@86 34
cannam@86 35 #include <xmms/configfile.h>
cannam@86 36 #include <xmms/dirbrowser.h>
cannam@86 37 #include <xmms/titlestring.h>
cannam@86 38 #include <xmms/util.h>
cannam@86 39 #include <xmms/plugin.h>
cannam@86 40
cannam@86 41 #include "share/replaygain_synthesis.h" /* for NOISE_SHAPING_LOW */
cannam@86 42 #include "charset.h"
cannam@86 43 #include "configure.h"
cannam@86 44 #include "locale_hack.h"
cannam@86 45
cannam@86 46 /*
cannam@86 47 * Initialize Global Valueable
cannam@86 48 */
cannam@86 49 flac_config_t flac_cfg = {
cannam@86 50 /* title */
cannam@86 51 {
cannam@86 52 FALSE, /* tag_override */
cannam@86 53 NULL, /* tag_format */
cannam@86 54 FALSE, /* convert_char_set */
cannam@86 55 NULL /* user_char_set */
cannam@86 56 },
cannam@86 57 /* stream */
cannam@86 58 {
cannam@86 59 100 /* KB */, /* http_buffer_size */
cannam@86 60 50, /* http_prebuffer */
cannam@86 61 FALSE, /* use_proxy */
cannam@86 62 NULL, /* proxy_host */
cannam@86 63 0, /* proxy_port */
cannam@86 64 FALSE, /* proxy_use_auth */
cannam@86 65 NULL, /* proxy_user */
cannam@86 66 NULL, /* proxy_pass */
cannam@86 67 FALSE, /* save_http_stream */
cannam@86 68 NULL, /* save_http_path */
cannam@86 69 FALSE, /* cast_title_streaming */
cannam@86 70 FALSE /* use_udp_channel */
cannam@86 71 },
cannam@86 72 /* output */
cannam@86 73 {
cannam@86 74 /* replaygain */
cannam@86 75 {
cannam@86 76 FALSE, /* enable */
cannam@86 77 TRUE, /* album_mode */
cannam@86 78 0, /* preamp */
cannam@86 79 FALSE /* hard_limit */
cannam@86 80 },
cannam@86 81 /* resolution */
cannam@86 82 {
cannam@86 83 /* normal */
cannam@86 84 {
cannam@86 85 TRUE /* dither_24_to_16 */
cannam@86 86 },
cannam@86 87 /* replaygain */
cannam@86 88 {
cannam@86 89 TRUE, /* dither */
cannam@86 90 NOISE_SHAPING_LOW, /* noise_shaping */
cannam@86 91 16 /* bps_out */
cannam@86 92 }
cannam@86 93 }
cannam@86 94 }
cannam@86 95 };
cannam@86 96
cannam@86 97
cannam@86 98 static GtkWidget *flac_configurewin = NULL;
cannam@86 99 static GtkWidget *vbox, *notebook;
cannam@86 100
cannam@86 101 static GtkWidget *title_tag_override, *title_tag_box, *title_tag_entry, *title_desc;
cannam@86 102 static GtkWidget *convert_char_set, *fileCharacterSetEntry, *userCharacterSetEntry;
cannam@86 103 static GtkWidget *replaygain_enable, *replaygain_album_mode;
cannam@86 104 static GtkWidget *replaygain_preamp_hscale, *replaygain_preamp_label, *replaygain_hard_limit;
cannam@86 105 static GtkObject *replaygain_preamp;
cannam@86 106 static GtkWidget *resolution_normal_dither_24_to_16;
cannam@86 107 static GtkWidget *resolution_replaygain_dither;
cannam@86 108 static GtkWidget *resolution_replaygain_noise_shaping_frame;
cannam@86 109 static GtkWidget *resolution_replaygain_noise_shaping_radio_none;
cannam@86 110 static GtkWidget *resolution_replaygain_noise_shaping_radio_low;
cannam@86 111 static GtkWidget *resolution_replaygain_noise_shaping_radio_medium;
cannam@86 112 static GtkWidget *resolution_replaygain_noise_shaping_radio_high;
cannam@86 113 static GtkWidget *resolution_replaygain_bps_out_frame;
cannam@86 114 static GtkWidget *resolution_replaygain_bps_out_radio_16bps;
cannam@86 115 static GtkWidget *resolution_replaygain_bps_out_radio_24bps;
cannam@86 116
cannam@86 117 static GtkObject *streaming_size_adj, *streaming_pre_adj;
cannam@86 118 static GtkWidget *streaming_proxy_use, *streaming_proxy_host_entry;
cannam@86 119 static GtkWidget *streaming_proxy_port_entry, *streaming_save_use, *streaming_save_entry;
cannam@86 120 static GtkWidget *streaming_proxy_auth_use;
cannam@86 121 static GtkWidget *streaming_proxy_auth_pass_entry, *streaming_proxy_auth_user_entry;
cannam@86 122 static GtkWidget *streaming_proxy_auth_user_label, *streaming_proxy_auth_pass_label;
cannam@86 123 #ifdef FLAC_ICECAST
cannam@86 124 static GtkWidget *streaming_cast_title, *streaming_udp_title;
cannam@86 125 #endif
cannam@86 126 static GtkWidget *streaming_proxy_hbox, *streaming_proxy_auth_hbox, *streaming_save_dirbrowser;
cannam@86 127 static GtkWidget *streaming_save_hbox;
cannam@86 128
cannam@86 129 static gchar *gtk_entry_get_text_1 (GtkWidget *widget);
cannam@86 130 static void flac_configurewin_ok(GtkWidget * widget, gpointer data);
cannam@86 131 static void configure_destroy(GtkWidget * w, gpointer data);
cannam@86 132
cannam@86 133 static void flac_configurewin_ok(GtkWidget * widget, gpointer data)
cannam@86 134 {
cannam@86 135 ConfigFile *cfg;
cannam@86 136 gchar *filename;
cannam@86 137
cannam@86 138 (void)widget, (void)data; /* unused arguments */
cannam@86 139 g_free(flac_cfg.title.tag_format);
cannam@86 140 flac_cfg.title.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry)));
cannam@86 141 flac_cfg.title.user_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(userCharacterSetEntry));
cannam@86 142
cannam@86 143 filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL);
cannam@86 144 cfg = xmms_cfg_open_file(filename);
cannam@86 145 if (!cfg)
cannam@86 146 cfg = xmms_cfg_new();
cannam@86 147 /* title */
cannam@86 148 xmms_cfg_write_boolean(cfg, "flac", "title.tag_override", flac_cfg.title.tag_override);
cannam@86 149 xmms_cfg_write_string(cfg, "flac", "title.tag_format", flac_cfg.title.tag_format);
cannam@86 150 xmms_cfg_write_boolean(cfg, "flac", "title.convert_char_set", flac_cfg.title.convert_char_set);
cannam@86 151 xmms_cfg_write_string(cfg, "flac", "title.user_char_set", flac_cfg.title.user_char_set);
cannam@86 152 /* output */
cannam@86 153 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.enable", flac_cfg.output.replaygain.enable);
cannam@86 154 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.album_mode", flac_cfg.output.replaygain.album_mode);
cannam@86 155 xmms_cfg_write_int(cfg, "flac", "output.replaygain.preamp", flac_cfg.output.replaygain.preamp);
cannam@86 156 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.hard_limit", flac_cfg.output.replaygain.hard_limit);
cannam@86 157 xmms_cfg_write_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", flac_cfg.output.resolution.normal.dither_24_to_16);
cannam@86 158 xmms_cfg_write_boolean(cfg, "flac", "output.resolution.replaygain.dither", flac_cfg.output.resolution.replaygain.dither);
cannam@86 159 xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", flac_cfg.output.resolution.replaygain.noise_shaping);
cannam@86 160 xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.bps_out", flac_cfg.output.resolution.replaygain.bps_out);
cannam@86 161 /* streaming */
cannam@86 162 flac_cfg.stream.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value;
cannam@86 163 flac_cfg.stream.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value;
cannam@86 164
cannam@86 165 flac_cfg.stream.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
cannam@86 166 if(flac_cfg.stream.proxy_host)
cannam@86 167 g_free(flac_cfg.stream.proxy_host);
cannam@86 168 flac_cfg.stream.proxy_host = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry)));
cannam@86 169 flac_cfg.stream.proxy_port = atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry)));
cannam@86 170
cannam@86 171 flac_cfg.stream.proxy_use_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use));
cannam@86 172
cannam@86 173 if(flac_cfg.stream.proxy_user)
cannam@86 174 g_free(flac_cfg.stream.proxy_user);
cannam@86 175 flac_cfg.stream.proxy_user = NULL;
cannam@86 176 if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0)
cannam@86 177 flac_cfg.stream.proxy_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry)));
cannam@86 178
cannam@86 179 if(flac_cfg.stream.proxy_pass)
cannam@86 180 g_free(flac_cfg.stream.proxy_pass);
cannam@86 181 flac_cfg.stream.proxy_pass = NULL;
cannam@86 182 if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0)
cannam@86 183 flac_cfg.stream.proxy_pass = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry)));
cannam@86 184
cannam@86 185
cannam@86 186 flac_cfg.stream.save_http_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
cannam@86 187 if (flac_cfg.stream.save_http_path)
cannam@86 188 g_free(flac_cfg.stream.save_http_path);
cannam@86 189 flac_cfg.stream.save_http_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry)));
cannam@86 190
cannam@86 191 #ifdef FLAC_ICECAST
cannam@86 192 flac_cfg.stream.cast_title_streaming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_cast_title));
cannam@86 193 flac_cfg.stream.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title));
cannam@86 194 #endif
cannam@86 195
cannam@86 196 xmms_cfg_write_int(cfg, "flac", "stream.http_buffer_size", flac_cfg.stream.http_buffer_size);
cannam@86 197 xmms_cfg_write_int(cfg, "flac", "stream.http_prebuffer", flac_cfg.stream.http_prebuffer);
cannam@86 198 xmms_cfg_write_boolean(cfg, "flac", "stream.use_proxy", flac_cfg.stream.use_proxy);
cannam@86 199 xmms_cfg_write_string(cfg, "flac", "stream.proxy_host", flac_cfg.stream.proxy_host);
cannam@86 200 xmms_cfg_write_int(cfg, "flac", "stream.proxy_port", flac_cfg.stream.proxy_port);
cannam@86 201 xmms_cfg_write_boolean(cfg, "flac", "stream.proxy_use_auth", flac_cfg.stream.proxy_use_auth);
cannam@86 202 if(flac_cfg.stream.proxy_user)
cannam@86 203 xmms_cfg_write_string(cfg, "flac", "stream.proxy_user", flac_cfg.stream.proxy_user);
cannam@86 204 else
cannam@86 205 xmms_cfg_remove_key(cfg, "flac", "stream.proxy_user");
cannam@86 206 if(flac_cfg.stream.proxy_pass)
cannam@86 207 xmms_cfg_write_string(cfg, "flac", "stream.proxy_pass", flac_cfg.stream.proxy_pass);
cannam@86 208 else
cannam@86 209 xmms_cfg_remove_key(cfg, "flac", "stream.proxy_pass");
cannam@86 210 xmms_cfg_write_boolean(cfg, "flac", "stream.save_http_stream", flac_cfg.stream.save_http_stream);
cannam@86 211 xmms_cfg_write_string(cfg, "flac", "stream.save_http_path", flac_cfg.stream.save_http_path);
cannam@86 212 #ifdef FLAC_ICECAST
cannam@86 213 xmms_cfg_write_boolean(cfg, "flac", "stream.cast_title_streaming", flac_cfg.stream.cast_title_streaming);
cannam@86 214 xmms_cfg_write_boolean(cfg, "flac", "stream.use_udp_channel", flac_cfg.stream.use_udp_channel);
cannam@86 215 #endif
cannam@86 216
cannam@86 217 xmms_cfg_write_file(cfg, filename);
cannam@86 218 xmms_cfg_free(cfg);
cannam@86 219 g_free(filename);
cannam@86 220 gtk_widget_destroy(flac_configurewin);
cannam@86 221 }
cannam@86 222
cannam@86 223 static void configure_destroy(GtkWidget *widget, gpointer data)
cannam@86 224 {
cannam@86 225 (void)widget, (void)data; /* unused arguments */
cannam@86 226 }
cannam@86 227
cannam@86 228 static void title_tag_override_cb(GtkWidget *widget, gpointer data)
cannam@86 229 {
cannam@86 230 (void)widget, (void)data; /* unused arguments */
cannam@86 231 flac_cfg.title.tag_override = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_tag_override));
cannam@86 232
cannam@86 233 gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
cannam@86 234 gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
cannam@86 235
cannam@86 236 }
cannam@86 237
cannam@86 238 static void convert_char_set_cb(GtkWidget *widget, gpointer data)
cannam@86 239 {
cannam@86 240 (void)widget, (void)data; /* unused arguments */
cannam@86 241 flac_cfg.title.convert_char_set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(convert_char_set));
cannam@86 242
cannam@86 243 gtk_widget_set_sensitive(fileCharacterSetEntry, FALSE);
cannam@86 244 gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);
cannam@86 245 }
cannam@86 246
cannam@86 247 static void replaygain_enable_cb(GtkWidget *widget, gpointer data)
cannam@86 248 {
cannam@86 249 (void)widget, (void)data; /* unused arguments */
cannam@86 250 flac_cfg.output.replaygain.enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_enable));
cannam@86 251
cannam@86 252 gtk_widget_set_sensitive(replaygain_album_mode, flac_cfg.output.replaygain.enable);
cannam@86 253 gtk_widget_set_sensitive(replaygain_preamp_hscale, flac_cfg.output.replaygain.enable);
cannam@86 254 gtk_widget_set_sensitive(replaygain_hard_limit, flac_cfg.output.replaygain.enable);
cannam@86 255 }
cannam@86 256
cannam@86 257 static void replaygain_album_mode_cb(GtkWidget *widget, gpointer data)
cannam@86 258 {
cannam@86 259 (void)widget, (void)data; /* unused arguments */
cannam@86 260 flac_cfg.output.replaygain.album_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_album_mode));
cannam@86 261 }
cannam@86 262
cannam@86 263 static void replaygain_hard_limit_cb(GtkWidget *widget, gpointer data)
cannam@86 264 {
cannam@86 265 (void)widget, (void)data; /* unused arguments */
cannam@86 266 flac_cfg.output.replaygain.hard_limit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit));
cannam@86 267 }
cannam@86 268
cannam@86 269 static void replaygain_preamp_cb(GtkWidget *widget, gpointer data)
cannam@86 270 {
cannam@86 271 GString *gstring = g_string_new("");
cannam@86 272 (void)widget, (void)data; /* unused arguments */
cannam@86 273 flac_cfg.output.replaygain.preamp = (int) floor(GTK_ADJUSTMENT(replaygain_preamp)->value + 0.5);
cannam@86 274
cannam@86 275 g_string_sprintf(gstring, "%i dB", flac_cfg.output.replaygain.preamp);
cannam@86 276 gtk_label_set_text(GTK_LABEL(replaygain_preamp_label), _(gstring->str));
cannam@86 277 }
cannam@86 278
cannam@86 279 static void resolution_normal_dither_24_to_16_cb(GtkWidget *widget, gpointer data)
cannam@86 280 {
cannam@86 281 (void)widget, (void)data; /* unused arguments */
cannam@86 282 flac_cfg.output.resolution.normal.dither_24_to_16 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16));
cannam@86 283 }
cannam@86 284
cannam@86 285 static void resolution_replaygain_dither_cb(GtkWidget *widget, gpointer data)
cannam@86 286 {
cannam@86 287 (void)widget, (void)data; /* unused arguments */
cannam@86 288 flac_cfg.output.resolution.replaygain.dither = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither));
cannam@86 289
cannam@86 290 gtk_widget_set_sensitive(resolution_replaygain_noise_shaping_frame, flac_cfg.output.resolution.replaygain.dither);
cannam@86 291 }
cannam@86 292
cannam@86 293 static void resolution_replaygain_noise_shaping_cb(GtkWidget *widget, gpointer data)
cannam@86 294 {
cannam@86 295 (void)widget, (void)data; /* unused arguments */
cannam@86 296 flac_cfg.output.resolution.replaygain.noise_shaping =
cannam@86 297 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none))? 0 :
cannam@86 298 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low))? 1 :
cannam@86 299 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium))? 2 :
cannam@86 300 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high))? 3 :
cannam@86 301 0
cannam@86 302 ;
cannam@86 303 }
cannam@86 304
cannam@86 305 static void resolution_replaygain_bps_out_cb(GtkWidget *widget, gpointer data)
cannam@86 306 {
cannam@86 307 (void)widget, (void)data; /* unused arguments */
cannam@86 308 flac_cfg.output.resolution.replaygain.bps_out =
cannam@86 309 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps))? 16 :
cannam@86 310 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps))? 24 :
cannam@86 311 16
cannam@86 312 ;
cannam@86 313 }
cannam@86 314
cannam@86 315 static void proxy_use_cb(GtkWidget * w, gpointer data)
cannam@86 316 {
cannam@86 317 gboolean use_proxy, use_proxy_auth;
cannam@86 318 (void) w;
cannam@86 319 (void) data;
cannam@86 320
cannam@86 321 use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
cannam@86 322 use_proxy_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use));
cannam@86 323
cannam@86 324 gtk_widget_set_sensitive(streaming_proxy_hbox, use_proxy);
cannam@86 325 gtk_widget_set_sensitive(streaming_proxy_auth_use, use_proxy);
cannam@86 326 gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy && use_proxy_auth);
cannam@86 327 }
cannam@86 328
cannam@86 329 static void proxy_auth_use_cb(GtkWidget *w, gpointer data)
cannam@86 330 {
cannam@86 331 gboolean use_proxy, use_proxy_auth;
cannam@86 332 (void) w;
cannam@86 333 (void) data;
cannam@86 334
cannam@86 335 use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
cannam@86 336 use_proxy_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use));
cannam@86 337
cannam@86 338 gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy && use_proxy_auth);
cannam@86 339 }
cannam@86 340
cannam@86 341 static void streaming_save_dirbrowser_cb(gchar * dir)
cannam@86 342 {
cannam@86 343 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), dir);
cannam@86 344 }
cannam@86 345
cannam@86 346 static void streaming_save_browse_cb(GtkWidget * w, gpointer data)
cannam@86 347 {
cannam@86 348 (void) w;
cannam@86 349 (void) data;
cannam@86 350 if (!streaming_save_dirbrowser)
cannam@86 351 {
cannam@86 352 streaming_save_dirbrowser = xmms_create_dir_browser(_("Select the directory where you want to store the MPEG streams:"),
cannam@86 353 flac_cfg.stream.save_http_path, GTK_SELECTION_SINGLE, streaming_save_dirbrowser_cb);
cannam@86 354 gtk_signal_connect(GTK_OBJECT(streaming_save_dirbrowser), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &streaming_save_dirbrowser);
cannam@86 355 gtk_window_set_transient_for(GTK_WINDOW(streaming_save_dirbrowser), GTK_WINDOW(flac_configurewin));
cannam@86 356 gtk_widget_show(streaming_save_dirbrowser);
cannam@86 357 }
cannam@86 358 }
cannam@86 359
cannam@86 360 static void streaming_save_use_cb(GtkWidget * w, gpointer data)
cannam@86 361 {
cannam@86 362 gboolean save_stream;
cannam@86 363 (void) w;
cannam@86 364 (void) data;
cannam@86 365
cannam@86 366 save_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
cannam@86 367
cannam@86 368 gtk_widget_set_sensitive(streaming_save_hbox, save_stream);
cannam@86 369 }
cannam@86 370
cannam@86 371
cannam@86 372 void FLAC_XMMS__configure(void)
cannam@86 373 {
cannam@86 374 GtkWidget *title_frame, *title_tag_vbox, *title_tag_label;
cannam@86 375 GtkWidget *replaygain_frame, *resolution_frame, *output_vbox, *resolution_normal_frame, *resolution_replaygain_frame;
cannam@86 376 GtkWidget *replaygain_vbox, *resolution_hbox, *resolution_normal_vbox, *resolution_replaygain_vbox;
cannam@86 377 GtkWidget *resolution_replaygain_noise_shaping_vbox;
cannam@86 378 GtkWidget *resolution_replaygain_bps_out_vbox;
cannam@86 379 GtkWidget *label, *hbox;
cannam@86 380 GtkWidget *bbox, *ok, *cancel;
cannam@86 381 GList *list;
cannam@86 382
cannam@86 383 GtkWidget *streaming_vbox;
cannam@86 384 GtkWidget *streaming_buf_frame, *streaming_buf_hbox;
cannam@86 385 GtkWidget *streaming_size_box, *streaming_size_label, *streaming_size_spin;
cannam@86 386 GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin;
cannam@86 387 GtkWidget *streaming_proxy_frame, *streaming_proxy_vbox;
cannam@86 388 GtkWidget *streaming_proxy_port_label, *streaming_proxy_host_label;
cannam@86 389 GtkWidget *streaming_save_frame, *streaming_save_vbox;
cannam@86 390 GtkWidget *streaming_save_label, *streaming_save_browse;
cannam@86 391 #ifdef FLAC_ICECAST
cannam@86 392 GtkWidget *streaming_cast_frame, *streaming_cast_vbox;
cannam@86 393 #endif
cannam@86 394 char *temp;
cannam@86 395
cannam@86 396 if (flac_configurewin != NULL) {
cannam@86 397 gdk_window_raise(flac_configurewin->window);
cannam@86 398 return;
cannam@86 399 }
cannam@86 400 flac_configurewin = gtk_window_new(GTK_WINDOW_DIALOG);
cannam@86 401 gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &flac_configurewin);
cannam@86 402 gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(configure_destroy), &flac_configurewin);
cannam@86 403 gtk_window_set_title(GTK_WINDOW(flac_configurewin), _("Flac Configuration"));
cannam@86 404 gtk_window_set_policy(GTK_WINDOW(flac_configurewin), FALSE, FALSE, FALSE);
cannam@86 405 gtk_container_border_width(GTK_CONTAINER(flac_configurewin), 10);
cannam@86 406
cannam@86 407 vbox = gtk_vbox_new(FALSE, 10);
cannam@86 408 gtk_container_add(GTK_CONTAINER(flac_configurewin), vbox);
cannam@86 409
cannam@86 410 notebook = gtk_notebook_new();
cannam@86 411 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
cannam@86 412
cannam@86 413 /* Title config.. */
cannam@86 414
cannam@86 415 title_frame = gtk_frame_new(_("Tag Handling"));
cannam@86 416 gtk_container_border_width(GTK_CONTAINER(title_frame), 5);
cannam@86 417
cannam@86 418 title_tag_vbox = gtk_vbox_new(FALSE, 10);
cannam@86 419 gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5);
cannam@86 420 gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox);
cannam@86 421
cannam@86 422 /* Convert Char Set */
cannam@86 423
cannam@86 424 convert_char_set = gtk_check_button_new_with_label(_("Convert Character Set"));
cannam@86 425 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(convert_char_set), flac_cfg.title.convert_char_set);
cannam@86 426 gtk_signal_connect(GTK_OBJECT(convert_char_set), "clicked", convert_char_set_cb, NULL);
cannam@86 427 gtk_box_pack_start(GTK_BOX(title_tag_vbox), convert_char_set, FALSE, FALSE, 0);
cannam@86 428 /* Combo boxes... */
cannam@86 429 hbox = gtk_hbox_new(FALSE,4);
cannam@86 430 gtk_container_add(GTK_CONTAINER(title_tag_vbox),hbox);
cannam@86 431 label = gtk_label_new(_("Convert character set from :"));
cannam@86 432 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
cannam@86 433 fileCharacterSetEntry = gtk_combo_new();
cannam@86 434 gtk_box_pack_start(GTK_BOX(hbox),fileCharacterSetEntry,TRUE,TRUE,0);
cannam@86 435
cannam@86 436 label = gtk_label_new (_("to :"));
cannam@86 437 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
cannam@86 438 userCharacterSetEntry = gtk_combo_new();
cannam@86 439 gtk_box_pack_start(GTK_BOX(hbox),userCharacterSetEntry,TRUE,TRUE,0);
cannam@86 440
cannam@86 441 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fileCharacterSetEntry)->entry),FALSE);
cannam@86 442 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),FALSE);
cannam@86 443 gtk_combo_set_value_in_list(GTK_COMBO(fileCharacterSetEntry),TRUE,FALSE);
cannam@86 444 gtk_combo_set_value_in_list(GTK_COMBO(userCharacterSetEntry),TRUE,FALSE);
cannam@86 445
cannam@86 446 list = Charset_Create_List();
cannam@86 447 gtk_combo_set_popdown_strings(GTK_COMBO(fileCharacterSetEntry),Charset_Create_List_UTF8_Only());
cannam@86 448 gtk_combo_set_popdown_strings(GTK_COMBO(userCharacterSetEntry),list);
cannam@86 449 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),Charset_Get_Title_From_Name(flac_cfg.title.user_char_set));
cannam@86 450 gtk_widget_set_sensitive(fileCharacterSetEntry, FALSE);
cannam@86 451 gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);
cannam@86 452
cannam@86 453 /* Override Tagging Format */
cannam@86 454
cannam@86 455 title_tag_override = gtk_check_button_new_with_label(_("Override generic titles"));
cannam@86 456 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override), flac_cfg.title.tag_override);
cannam@86 457 gtk_signal_connect(GTK_OBJECT(title_tag_override), "clicked", title_tag_override_cb, NULL);
cannam@86 458 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_override, FALSE, FALSE, 0);
cannam@86 459
cannam@86 460 title_tag_box = gtk_hbox_new(FALSE, 5);
cannam@86 461 gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
cannam@86 462 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_box, FALSE, FALSE, 0);
cannam@86 463
cannam@86 464 title_tag_label = gtk_label_new(_("Title format:"));
cannam@86 465 gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_label, FALSE, FALSE, 0);
cannam@86 466
cannam@86 467 title_tag_entry = gtk_entry_new();
cannam@86 468 gtk_entry_set_text(GTK_ENTRY(title_tag_entry), flac_cfg.title.tag_format);
cannam@86 469 gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_entry, TRUE, TRUE, 0);
cannam@86 470
cannam@86 471 title_desc = xmms_titlestring_descriptions("pafFetnygc", 2);
cannam@86 472 gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
cannam@86 473 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_desc, FALSE, FALSE, 0);
cannam@86 474
cannam@86 475 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, gtk_label_new(_("Title")));
cannam@86 476
cannam@86 477 /* Output config.. */
cannam@86 478
cannam@86 479 output_vbox = gtk_vbox_new(FALSE, 10);
cannam@86 480 gtk_container_border_width(GTK_CONTAINER(output_vbox), 5);
cannam@86 481
cannam@86 482 /* replaygain */
cannam@86 483
cannam@86 484 replaygain_frame = gtk_frame_new(_("ReplayGain"));
cannam@86 485 gtk_container_border_width(GTK_CONTAINER(replaygain_frame), 5);
cannam@86 486 gtk_box_pack_start(GTK_BOX(output_vbox), replaygain_frame, TRUE, TRUE, 0);
cannam@86 487
cannam@86 488 replaygain_vbox = gtk_vbox_new(FALSE, 10);
cannam@86 489 gtk_container_border_width(GTK_CONTAINER(replaygain_vbox), 5);
cannam@86 490 gtk_container_add(GTK_CONTAINER(replaygain_frame), replaygain_vbox);
cannam@86 491
cannam@86 492 replaygain_enable = gtk_check_button_new_with_label(_("Enable ReplayGain processing"));
cannam@86 493 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_enable), flac_cfg.output.replaygain.enable);
cannam@86 494 gtk_signal_connect(GTK_OBJECT(replaygain_enable), "clicked", replaygain_enable_cb, NULL);
cannam@86 495 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_enable, FALSE, FALSE, 0);
cannam@86 496
cannam@86 497 replaygain_album_mode = gtk_check_button_new_with_label(_("Album mode"));
cannam@86 498 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_album_mode), flac_cfg.output.replaygain.album_mode);
cannam@86 499 gtk_signal_connect(GTK_OBJECT(replaygain_album_mode), "clicked", replaygain_album_mode_cb, NULL);
cannam@86 500 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_album_mode, FALSE, FALSE, 0);
cannam@86 501
cannam@86 502 hbox = gtk_hbox_new(FALSE,3);
cannam@86 503 gtk_container_add(GTK_CONTAINER(replaygain_vbox),hbox);
cannam@86 504 label = gtk_label_new(_("Preamp:"));
cannam@86 505 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
cannam@86 506 replaygain_preamp = gtk_adjustment_new(flac_cfg.output.replaygain.preamp, -24.0, +24.0, 1.0, 6.0, 0.0);
cannam@86 507 gtk_signal_connect(GTK_OBJECT(replaygain_preamp), "value-changed", replaygain_preamp_cb, NULL);
cannam@86 508 replaygain_preamp_hscale = gtk_hscale_new(GTK_ADJUSTMENT(replaygain_preamp));
cannam@86 509 gtk_scale_set_draw_value(GTK_SCALE(replaygain_preamp_hscale), FALSE);
cannam@86 510 gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_hscale,TRUE,TRUE,0);
cannam@86 511 replaygain_preamp_label = gtk_label_new(_("0 dB"));
cannam@86 512 gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_label,FALSE,FALSE,0);
cannam@86 513 gtk_adjustment_value_changed(GTK_ADJUSTMENT(replaygain_preamp));
cannam@86 514
cannam@86 515 replaygain_hard_limit = gtk_check_button_new_with_label(_("6dB hard limiting"));
cannam@86 516 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit), flac_cfg.output.replaygain.hard_limit);
cannam@86 517 gtk_signal_connect(GTK_OBJECT(replaygain_hard_limit), "clicked", replaygain_hard_limit_cb, NULL);
cannam@86 518 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_hard_limit, FALSE, FALSE, 0);
cannam@86 519
cannam@86 520 replaygain_enable_cb(replaygain_enable, NULL);
cannam@86 521
cannam@86 522 /* resolution */
cannam@86 523
cannam@86 524 resolution_frame = gtk_frame_new(_("Resolution"));
cannam@86 525 gtk_container_border_width(GTK_CONTAINER(resolution_frame), 5);
cannam@86 526 gtk_box_pack_start(GTK_BOX(output_vbox), resolution_frame, TRUE, TRUE, 0);
cannam@86 527
cannam@86 528 resolution_hbox = gtk_hbox_new(FALSE, 10);
cannam@86 529 gtk_container_border_width(GTK_CONTAINER(resolution_hbox), 5);
cannam@86 530 gtk_container_add(GTK_CONTAINER(resolution_frame), resolution_hbox);
cannam@86 531
cannam@86 532 resolution_normal_frame = gtk_frame_new(_("Without ReplayGain"));
cannam@86 533 gtk_container_border_width(GTK_CONTAINER(resolution_normal_frame), 5);
cannam@86 534 gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_normal_frame, TRUE, TRUE, 0);
cannam@86 535
cannam@86 536 resolution_normal_vbox = gtk_vbox_new(FALSE, 10);
cannam@86 537 gtk_container_border_width(GTK_CONTAINER(resolution_normal_vbox), 5);
cannam@86 538 gtk_container_add(GTK_CONTAINER(resolution_normal_frame), resolution_normal_vbox);
cannam@86 539
cannam@86 540 resolution_normal_dither_24_to_16 = gtk_check_button_new_with_label(_("Dither 24bps to 16bps"));
cannam@86 541 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16), flac_cfg.output.resolution.normal.dither_24_to_16);
cannam@86 542 gtk_signal_connect(GTK_OBJECT(resolution_normal_dither_24_to_16), "clicked", resolution_normal_dither_24_to_16_cb, NULL);
cannam@86 543 gtk_box_pack_start(GTK_BOX(resolution_normal_vbox), resolution_normal_dither_24_to_16, FALSE, FALSE, 0);
cannam@86 544
cannam@86 545 resolution_replaygain_frame = gtk_frame_new(_("With ReplayGain"));
cannam@86 546 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_frame), 5);
cannam@86 547 gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_replaygain_frame, TRUE, TRUE, 0);
cannam@86 548
cannam@86 549 resolution_replaygain_vbox = gtk_vbox_new(FALSE, 10);
cannam@86 550 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_vbox), 5);
cannam@86 551 gtk_container_add(GTK_CONTAINER(resolution_replaygain_frame), resolution_replaygain_vbox);
cannam@86 552
cannam@86 553 resolution_replaygain_dither = gtk_check_button_new_with_label(_("Enable dithering"));
cannam@86 554 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither), flac_cfg.output.resolution.replaygain.dither);
cannam@86 555 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_dither), "clicked", resolution_replaygain_dither_cb, NULL);
cannam@86 556 gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), resolution_replaygain_dither, FALSE, FALSE, 0);
cannam@86 557
cannam@86 558 hbox = gtk_hbox_new(FALSE, 10);
cannam@86 559 gtk_container_border_width(GTK_CONTAINER(hbox), 5);
cannam@86 560 gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), hbox, TRUE, TRUE, 0);
cannam@86 561
cannam@86 562 resolution_replaygain_noise_shaping_frame = gtk_frame_new(_("Noise shaping"));
cannam@86 563 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), 5);
cannam@86 564 gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_noise_shaping_frame, TRUE, TRUE, 0);
cannam@86 565
cannam@86 566 resolution_replaygain_noise_shaping_vbox = gtk_vbutton_box_new();
cannam@86 567 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), 5);
cannam@86 568 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), resolution_replaygain_noise_shaping_vbox);
cannam@86 569
cannam@86 570 resolution_replaygain_noise_shaping_radio_none = gtk_radio_button_new_with_label(NULL, _("none"));
cannam@86 571 if(flac_cfg.output.resolution.replaygain.noise_shaping == 0)
cannam@86 572 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none), TRUE);
cannam@86 573 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_none), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
cannam@86 574 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_none);
cannam@86 575
cannam@86 576 resolution_replaygain_noise_shaping_radio_low = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("low"));
cannam@86 577 if(flac_cfg.output.resolution.replaygain.noise_shaping == 1)
cannam@86 578 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low), TRUE);
cannam@86 579 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_low), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
cannam@86 580 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_low);
cannam@86 581
cannam@86 582 resolution_replaygain_noise_shaping_radio_medium = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("medium"));
cannam@86 583 if(flac_cfg.output.resolution.replaygain.noise_shaping == 2)
cannam@86 584 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium), TRUE);
cannam@86 585 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_medium), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
cannam@86 586 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_medium);
cannam@86 587
cannam@86 588 resolution_replaygain_noise_shaping_radio_high = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("high"));
cannam@86 589 if(flac_cfg.output.resolution.replaygain.noise_shaping == 3)
cannam@86 590 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high), TRUE);
cannam@86 591 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_high), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
cannam@86 592 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_high);
cannam@86 593
cannam@86 594 resolution_replaygain_bps_out_frame = gtk_frame_new(_("Dither to"));
cannam@86 595 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_frame), 5);
cannam@86 596 gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_bps_out_frame, FALSE, FALSE, 0);
cannam@86 597
cannam@86 598 resolution_replaygain_bps_out_vbox = gtk_vbutton_box_new();
cannam@86 599 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), 0);
cannam@86 600 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_frame), resolution_replaygain_bps_out_vbox);
cannam@86 601
cannam@86 602 resolution_replaygain_bps_out_radio_16bps = gtk_radio_button_new_with_label(NULL, _("16 bps"));
cannam@86 603 if(flac_cfg.output.resolution.replaygain.bps_out == 16)
cannam@86 604 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps), TRUE);
cannam@86 605 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_16bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
cannam@86 606 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_16bps);
cannam@86 607
cannam@86 608 resolution_replaygain_bps_out_radio_24bps = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_bps_out_radio_16bps), _("24 bps"));
cannam@86 609 if(flac_cfg.output.resolution.replaygain.bps_out == 24)
cannam@86 610 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps), TRUE);
cannam@86 611 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_24bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
cannam@86 612 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_24bps);
cannam@86 613
cannam@86 614 resolution_replaygain_dither_cb(resolution_replaygain_dither, NULL);
cannam@86 615
cannam@86 616 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), output_vbox, gtk_label_new(_("Output")));
cannam@86 617
cannam@86 618 /* Streaming */
cannam@86 619
cannam@86 620 streaming_vbox = gtk_vbox_new(FALSE, 0);
cannam@86 621
cannam@86 622 streaming_buf_frame = gtk_frame_new(_("Buffering:"));
cannam@86 623 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5);
cannam@86 624 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE, FALSE, 0);
cannam@86 625
cannam@86 626 streaming_buf_hbox = gtk_hbox_new(TRUE, 5);
cannam@86 627 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5);
cannam@86 628 gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox);
cannam@86 629
cannam@86 630 streaming_size_box = gtk_hbox_new(FALSE, 5);
cannam@86 631 /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_size_box,0,1,0,1); */
cannam@86 632 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box, TRUE, TRUE, 0);
cannam@86 633 streaming_size_label = gtk_label_new(_("Buffer size (kb):"));
cannam@86 634 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label, FALSE, FALSE, 0);
cannam@86 635 streaming_size_adj = gtk_adjustment_new(flac_cfg.stream.http_buffer_size, 4, 4096, 4, 4, 4);
cannam@86 636 streaming_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0);
cannam@86 637 gtk_widget_set_usize(streaming_size_spin, 60, -1);
cannam@86 638 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin, FALSE, FALSE, 0);
cannam@86 639
cannam@86 640 streaming_pre_box = gtk_hbox_new(FALSE, 5);
cannam@86 641 /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_pre_box,1,2,0,1); */
cannam@86 642 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box, TRUE, TRUE, 0);
cannam@86 643 streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):"));
cannam@86 644 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label, FALSE, FALSE, 0);
cannam@86 645 streaming_pre_adj = gtk_adjustment_new(flac_cfg.stream.http_prebuffer, 0, 90, 1, 1, 1);
cannam@86 646 streaming_pre_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0);
cannam@86 647 gtk_widget_set_usize(streaming_pre_spin, 60, -1);
cannam@86 648 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin, FALSE, FALSE, 0);
cannam@86 649
cannam@86 650 /*
cannam@86 651 * Proxy config.
cannam@86 652 */
cannam@86 653 streaming_proxy_frame = gtk_frame_new(_("Proxy:"));
cannam@86 654 gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_frame), 5);
cannam@86 655 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_proxy_frame, FALSE, FALSE, 0);
cannam@86 656
cannam@86 657 streaming_proxy_vbox = gtk_vbox_new(FALSE, 5);
cannam@86 658 gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_vbox), 5);
cannam@86 659 gtk_container_add(GTK_CONTAINER(streaming_proxy_frame), streaming_proxy_vbox);
cannam@86 660
cannam@86 661 streaming_proxy_use = gtk_check_button_new_with_label(_("Use proxy"));
cannam@86 662 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_use), flac_cfg.stream.use_proxy);
cannam@86 663 gtk_signal_connect(GTK_OBJECT(streaming_proxy_use), "clicked", GTK_SIGNAL_FUNC(proxy_use_cb), NULL);
cannam@86 664 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_use, FALSE, FALSE, 0);
cannam@86 665
cannam@86 666 streaming_proxy_hbox = gtk_hbox_new(FALSE, 5);
cannam@86 667 gtk_widget_set_sensitive(streaming_proxy_hbox, flac_cfg.stream.use_proxy);
cannam@86 668 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_hbox, FALSE, FALSE, 0);
cannam@86 669
cannam@86 670 streaming_proxy_host_label = gtk_label_new(_("Host:"));
cannam@86 671 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_label, FALSE, FALSE, 0);
cannam@86 672
cannam@86 673 streaming_proxy_host_entry = gtk_entry_new();
cannam@86 674 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry), flac_cfg.stream.proxy_host? flac_cfg.stream.proxy_host : "");
cannam@86 675 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_entry, TRUE, TRUE, 0);
cannam@86 676
cannam@86 677 streaming_proxy_port_label = gtk_label_new(_("Port:"));
cannam@86 678 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_label, FALSE, FALSE, 0);
cannam@86 679
cannam@86 680 streaming_proxy_port_entry = gtk_entry_new();
cannam@86 681 gtk_widget_set_usize(streaming_proxy_port_entry, 50, -1);
cannam@86 682 temp = g_strdup_printf("%d", flac_cfg.stream.proxy_port);
cannam@86 683 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_port_entry), temp);
cannam@86 684 g_free(temp);
cannam@86 685 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_entry, FALSE, FALSE, 0);
cannam@86 686
cannam@86 687 streaming_proxy_auth_use = gtk_check_button_new_with_label(_("Use authentication"));
cannam@86 688 gtk_widget_set_sensitive(streaming_proxy_auth_use, flac_cfg.stream.use_proxy);
cannam@86 689 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use), flac_cfg.stream.proxy_use_auth);
cannam@86 690 gtk_signal_connect(GTK_OBJECT(streaming_proxy_auth_use), "clicked", GTK_SIGNAL_FUNC(proxy_auth_use_cb), NULL);
cannam@86 691 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_use, FALSE, FALSE, 0);
cannam@86 692
cannam@86 693 streaming_proxy_auth_hbox = gtk_hbox_new(FALSE, 5);
cannam@86 694 gtk_widget_set_sensitive(streaming_proxy_auth_hbox, flac_cfg.stream.use_proxy && flac_cfg.stream.proxy_use_auth);
cannam@86 695 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_hbox, FALSE, FALSE, 0);
cannam@86 696
cannam@86 697 streaming_proxy_auth_user_label = gtk_label_new(_("Username:"));
cannam@86 698 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_user_label, FALSE, FALSE, 0);
cannam@86 699
cannam@86 700 streaming_proxy_auth_user_entry = gtk_entry_new();
cannam@86 701 if(flac_cfg.stream.proxy_user)
cannam@86 702 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_user_entry), flac_cfg.stream.proxy_user);
cannam@86 703 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_user_entry, TRUE, TRUE, 0);
cannam@86 704
cannam@86 705 streaming_proxy_auth_pass_label = gtk_label_new(_("Password:"));
cannam@86 706 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_pass_label, FALSE, FALSE, 0);
cannam@86 707
cannam@86 708 streaming_proxy_auth_pass_entry = gtk_entry_new();
cannam@86 709 if(flac_cfg.stream.proxy_pass)
cannam@86 710 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_pass_entry), flac_cfg.stream.proxy_pass);
cannam@86 711 gtk_entry_set_visibility(GTK_ENTRY(streaming_proxy_auth_pass_entry), FALSE);
cannam@86 712 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_pass_entry, TRUE, TRUE, 0);
cannam@86 713
cannam@86 714
cannam@86 715 /*
cannam@86 716 * Save to disk config.
cannam@86 717 */
cannam@86 718 streaming_save_frame = gtk_frame_new(_("Save stream to disk:"));
cannam@86 719 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5);
cannam@86 720 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame, FALSE, FALSE, 0);
cannam@86 721
cannam@86 722 streaming_save_vbox = gtk_vbox_new(FALSE, 5);
cannam@86 723 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5);
cannam@86 724 gtk_container_add(GTK_CONTAINER(streaming_save_frame), streaming_save_vbox);
cannam@86 725
cannam@86 726 streaming_save_use = gtk_check_button_new_with_label(_("Save stream to disk"));
cannam@86 727 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use), flac_cfg.stream.save_http_stream);
cannam@86 728 gtk_signal_connect(GTK_OBJECT(streaming_save_use), "clicked", GTK_SIGNAL_FUNC(streaming_save_use_cb), NULL);
cannam@86 729 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use, FALSE, FALSE, 0);
cannam@86 730
cannam@86 731 streaming_save_hbox = gtk_hbox_new(FALSE, 5);
cannam@86 732 gtk_widget_set_sensitive(streaming_save_hbox, flac_cfg.stream.save_http_stream);
cannam@86 733 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox, FALSE, FALSE, 0);
cannam@86 734
cannam@86 735 streaming_save_label = gtk_label_new(_("Path:"));
cannam@86 736 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label, FALSE, FALSE, 0);
cannam@86 737
cannam@86 738 streaming_save_entry = gtk_entry_new();
cannam@86 739 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), flac_cfg.stream.save_http_path? flac_cfg.stream.save_http_path : "");
cannam@86 740 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, TRUE, TRUE, 0);
cannam@86 741
cannam@86 742 streaming_save_browse = gtk_button_new_with_label(_("Browse"));
cannam@86 743 gtk_signal_connect(GTK_OBJECT(streaming_save_browse), "clicked", GTK_SIGNAL_FUNC(streaming_save_browse_cb), NULL);
cannam@86 744 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse, FALSE, FALSE, 0);
cannam@86 745
cannam@86 746 #ifdef FLAC_ICECAST
cannam@86 747 streaming_cast_frame = gtk_frame_new(_("SHOUT/Icecast:"));
cannam@86 748 gtk_container_set_border_width(GTK_CONTAINER(streaming_cast_frame), 5);
cannam@86 749 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_cast_frame, FALSE, FALSE, 0);
cannam@86 750
cannam@86 751 streaming_cast_vbox = gtk_vbox_new(5, FALSE);
cannam@86 752 gtk_container_add(GTK_CONTAINER(streaming_cast_frame), streaming_cast_vbox);
cannam@86 753
cannam@86 754 streaming_cast_title = gtk_check_button_new_with_label(_("Enable SHOUT/Icecast title streaming"));
cannam@86 755 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_cast_title), flac_cfg.stream.cast_title_streaming);
cannam@86 756 gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_cast_title, FALSE, FALSE, 0);
cannam@86 757
cannam@86 758 streaming_udp_title = gtk_check_button_new_with_label(_("Enable Icecast Metadata UDP Channel"));
cannam@86 759 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title), flac_cfg.stream.use_udp_channel);
cannam@86 760 gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title, FALSE, FALSE, 0);
cannam@86 761 #endif
cannam@86 762
cannam@86 763 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox, gtk_label_new(_("Streaming")));
cannam@86 764
cannam@86 765 /* Buttons */
cannam@86 766
cannam@86 767 bbox = gtk_hbutton_box_new();
cannam@86 768 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
cannam@86 769 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
cannam@86 770 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
cannam@86 771
cannam@86 772 ok = gtk_button_new_with_label(_("Ok"));
cannam@86 773 gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(flac_configurewin_ok), NULL);
cannam@86 774 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
cannam@86 775 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
cannam@86 776 gtk_widget_grab_default(ok);
cannam@86 777
cannam@86 778 cancel = gtk_button_new_with_label(_("Cancel"));
cannam@86 779 gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(flac_configurewin));
cannam@86 780 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
cannam@86 781 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
cannam@86 782
cannam@86 783 gtk_widget_show_all(flac_configurewin);
cannam@86 784 }
cannam@86 785
cannam@86 786 void FLAC_XMMS__aboutbox(void)
cannam@86 787 {
cannam@86 788 static GtkWidget *about_window;
cannam@86 789
cannam@86 790 if (about_window)
cannam@86 791 gdk_window_raise(about_window->window);
cannam@86 792
cannam@86 793 about_window = xmms_show_message(
cannam@86 794 _("About Flac Plugin"),
cannam@86 795 _("Flac Plugin by Josh Coalson\n"
cannam@86 796 "contributions by\n"
cannam@86 797 "......\n"
cannam@86 798 "......\n"
cannam@86 799 "and\n"
cannam@86 800 "Daisuke Shimamura\n"
cannam@86 801 "Visit http://flac.sourceforge.net/"),
cannam@86 802 _("Ok"), FALSE, NULL, NULL);
cannam@86 803 gtk_signal_connect(GTK_OBJECT(about_window), "destroy",
cannam@86 804 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
cannam@86 805 &about_window);
cannam@86 806 }
cannam@86 807
cannam@86 808 /*
cannam@86 809 * Get text of an Entry or a ComboBox
cannam@86 810 */
cannam@86 811 static gchar *gtk_entry_get_text_1 (GtkWidget *widget)
cannam@86 812 {
cannam@86 813 if (GTK_IS_COMBO(widget))
cannam@86 814 {
cannam@86 815 return gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(widget)->entry));
cannam@86 816 }else if (GTK_IS_ENTRY(widget))
cannam@86 817 {
cannam@86 818 return gtk_entry_get_text(GTK_ENTRY(widget));
cannam@86 819 }else
cannam@86 820 {
cannam@86 821 return NULL;
cannam@86 822 }
cannam@86 823 }