Mercurial > audlegacy-plugins
changeset 2903:9c623f4ac901
Automated merge with ssh://chrome@hg.atheme.org//hg/audacious-plugins
author | Andrew O. Shadoura <bugzilla@tut.by> |
---|---|
date | Wed, 13 Aug 2008 14:10:14 +0300 |
parents | 5e0d42b0f690 (diff) 35773e919dba (current diff) |
children | ff9b4776b938 |
files | |
diffstat | 1 files changed, 148 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/icecast/icecast.c Wed Aug 13 09:35:56 2008 +0300 +++ b/src/icecast/icecast.c Wed Aug 13 14:10:14 2008 +0300 @@ -32,6 +32,7 @@ static GtkWidget *configure_win = NULL, *configure_vbox; static GtkWidget *addr_entry, *port_spin, *timeout_spin, *buffersize_spin, *bufferflush_spin; static GtkWidget *user_entry, *password_entry, *mount_entry; +static GtkWidget *public_check, *name_entry, *url_entry, *genre_entry, *description_entry; static GtkWidget *configure_bbox, *configure_ok, *configure_cancel; static guint ice_tid = 0; @@ -78,6 +79,12 @@ static gchar *server_password = NULL; static gchar *mountpoint = NULL; +static gint stream_is_public = 0; +static gchar *stream_name = NULL; +static gchar *stream_url = NULL; +static gchar *stream_genre = NULL; +static gchar *stream_description = NULL; + VFSFile *output_file = NULL; guint64 written = 0; guint64 offset = 0; @@ -176,6 +183,11 @@ aud_cfg_db_get_string(db, ICECAST_CFGID, "server_user", &server_user); aud_cfg_db_get_string(db, ICECAST_CFGID, "server_password", &server_password); aud_cfg_db_get_string(db, ICECAST_CFGID, "mountpoint", &mountpoint); + aud_cfg_db_get_int(db, ICECAST_CFGID, "stream_is_public", &stream_is_public); + aud_cfg_db_get_string(db, ICECAST_CFGID, "stream_name", &stream_name); + aud_cfg_db_get_string(db, ICECAST_CFGID, "stream_url", &stream_url); + aud_cfg_db_get_string(db, ICECAST_CFGID, "stream_genre", &stream_genre); + aud_cfg_db_get_string(db, ICECAST_CFGID, "stream_description", &stream_description); aud_cfg_db_close(db); outputbuffer = g_try_malloc(buffersize); @@ -243,8 +255,8 @@ if (ice_tid) { - g_source_remove(ice_tid); - ice_tid = 0; + g_source_remove(ice_tid); + ice_tid = 0; } input.format = fmt; @@ -267,49 +279,79 @@ if (shout_set_host(shout, server_address) != SHOUTERR_SUCCESS) { - g_warning("Error setting hostname: %s\n", shout_get_error(shout)); + g_warning(_("Error setting hostname: %s\n"), shout_get_error(shout)); return 0; } if (shout_set_protocol(shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) { - g_warning("Error setting protocol: %s\n", shout_get_error(shout)); + g_warning(_("Error setting protocol: %s\n"), shout_get_error(shout)); return 0; } if (shout_set_port(shout, server_port) != SHOUTERR_SUCCESS) { - g_warning("Error setting port: %s\n", shout_get_error(shout)); + g_warning(_("Error setting port: %s\n"), shout_get_error(shout)); return 0; } if (shout_set_password(shout, server_password) != SHOUTERR_SUCCESS) { - g_warning("Error setting password: %s\n", shout_get_error(shout)); + g_warning(_("Error setting password: %s\n"), shout_get_error(shout)); return 0; } if (shout_set_mount(shout, mountpoint) != SHOUTERR_SUCCESS) { - g_warning("Error setting mount: %s\n", shout_get_error(shout)); + g_warning(_("Error setting mount: %s\n"), shout_get_error(shout)); + return 0; + } + + if (shout_set_public(shout, stream_is_public) != SHOUTERR_SUCCESS) + { + g_warning(_("Error setting stream %s: %s\n"), stream_is_public?_("public"):_("private"), shout_get_error(shout)); + return 0; + } + + if (shout_set_name(shout, stream_name) != SHOUTERR_SUCCESS) + { + g_warning(_("Error setting stream name: %s\n"), shout_get_error(shout)); + return 0; + } + + if (shout_set_genre(shout, stream_genre) != SHOUTERR_SUCCESS) + { + g_warning(_("Error setting stream genre: %s\n"), shout_get_error(shout)); + return 0; + } + + if (shout_set_url(shout, stream_url) != SHOUTERR_SUCCESS) + { + g_warning(_("Error setting stream URL: %s\n"), shout_get_error(shout)); + return 0; + } + + if (shout_set_description(shout, stream_description) != SHOUTERR_SUCCESS) + { + g_warning(_("Error setting stream description: %s\n"), shout_get_error(shout)); return 0; } if (shout_set_user(shout, server_user) != SHOUTERR_SUCCESS) { - g_warning("Error setting user: %s\n", shout_get_error(shout)); + g_warning(_("Error setting user: %s\n"), shout_get_error(shout)); return 0; } if (shout_set_format(shout, streamformat_shout[streamformat]) != SHOUTERR_SUCCESS) { - g_warning("Error setting user: %s\n", shout_get_error(shout)); + g_warning(_("Error setting user: %s\n"), shout_get_error(shout)); return 0; } if (shout_open(shout) != SHOUTERR_SUCCESS) { - g_warning("Error connecting to server: %s\n", shout_get_error(shout)); + g_warning(_("Error connecting to server: %s\n"), shout_get_error(shout)); return 0; } } @@ -466,6 +508,18 @@ g_free(mountpoint); mountpoint = g_strdup(gtk_entry_get_text(GTK_ENTRY(mount_entry))); + g_free(stream_name); + stream_name = g_strdup(gtk_entry_get_text(GTK_ENTRY(name_entry))); + + g_free(stream_url); + stream_url = g_strdup(gtk_entry_get_text(GTK_ENTRY(url_entry))); + + g_free(stream_genre); + stream_genre = g_strdup(gtk_entry_get_text(GTK_ENTRY(genre_entry))); + + g_free(stream_description); + stream_description = g_strdup(gtk_entry_get_text(GTK_ENTRY(description_entry))); + db = aud_cfg_db_open(); aud_cfg_db_set_int(db, ICECAST_CFGID, "streamformat", streamformat); aud_cfg_db_set_string(db, ICECAST_CFGID, "server_address", server_address); @@ -476,6 +530,11 @@ aud_cfg_db_set_int(db, ICECAST_CFGID, "buffersize", buffersize_new); aud_cfg_db_set_double(db, ICECAST_CFGID, "bufferflush", bufferflushperc); aud_cfg_db_set_string(db, ICECAST_CFGID, "mountpoint", mountpoint); + aud_cfg_db_get_int(db, ICECAST_CFGID, "stream_is_public", &stream_is_public); + aud_cfg_db_set_string(db, ICECAST_CFGID, "stream_name", stream_name); + aud_cfg_db_set_string(db, ICECAST_CFGID, "stream_url", stream_url); + aud_cfg_db_set_string(db, ICECAST_CFGID, "stream_genre", stream_genre); + aud_cfg_db_set_string(db, ICECAST_CFGID, "stream_description", stream_description); aud_cfg_db_close(db); @@ -560,15 +619,17 @@ addr_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(addr_entry), server_address); + gtk_entry_set_text(GTK_ENTRY(addr_entry), server_address); + gtk_widget_set_tooltip_text(addr_entry, _("Server hostname or IP address")); gtk_box_pack_start(GTK_BOX(hbox), addr_entry, TRUE, TRUE, 0); port_spin = gtk_spin_button_new_with_range(0.0, 65535.0, 1.0); + gtk_widget_set_tooltip_text(port_spin, _("Server port number")); gtk_spin_button_set_digits(GTK_SPIN_BUTTON(port_spin), 0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(port_spin), (gdouble)server_port); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(port_spin), (gdouble)server_port); gtk_box_pack_start(GTK_BOX(hbox), port_spin, TRUE, TRUE, 0); @@ -582,7 +643,8 @@ mount_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(mount_entry), mountpoint); + gtk_entry_set_text(GTK_ENTRY(mount_entry), mountpoint); + gtk_widget_set_tooltip_text(mount_entry, _("Mount point for the stream")); gtk_box_pack_start(GTK_BOX(hbox), mount_entry, TRUE, TRUE, 0); @@ -596,7 +658,8 @@ user_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(user_entry), server_user); + gtk_entry_set_text(GTK_ENTRY(user_entry), server_user); + gtk_widget_set_tooltip_text(user_entry, _("Icecast source user name for the stream; depends on your server settings.\nThe default value is \"source\"")); gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 0); @@ -604,8 +667,9 @@ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); password_entry = gtk_entry_new(); - - gtk_entry_set_text(GTK_ENTRY(password_entry), server_password); + + gtk_entry_set_text(GTK_ENTRY(password_entry), server_password); + gtk_widget_set_tooltip_text(password_entry, _("Icecast source user password")); gtk_entry_set_visibility(GTK_ENTRY(password_entry), FALSE); @@ -620,10 +684,11 @@ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); timeout_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0); + gtk_widget_set_tooltip_text(timeout_spin, _("Amount of time before plugin closes connection to server when no audio data available")); gtk_spin_button_set_digits(GTK_SPIN_BUTTON(timeout_spin), 0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_spin), (gdouble)ice_close_timeout); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_spin), (gdouble)ice_close_timeout); gtk_box_pack_start(GTK_BOX(hbox), timeout_spin, TRUE, TRUE, 0); @@ -636,10 +701,11 @@ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); buffersize_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0); + gtk_widget_set_tooltip_text(buffersize_spin, _("Internal buffer size\nTry to increase this if you are experiencing audio skipping on client side")); gtk_spin_button_set_digits(GTK_SPIN_BUTTON(buffersize_spin), 0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(buffersize_spin), (gdouble)buffersize); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(buffersize_spin), (gdouble)buffersize); gtk_box_pack_start(GTK_BOX(hbox), buffersize_spin, TRUE, TRUE, 0); @@ -650,10 +716,11 @@ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); bufferflush_spin = gtk_spin_button_new_with_range(1.0, 65535.0, 1.0); + gtk_widget_set_tooltip_text(bufferflush_spin, _("Determines when to flush internal buffer to prevent its overflow")); gtk_spin_button_set_digits(GTK_SPIN_BUTTON(bufferflush_spin), 0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(bufferflush_spin), bufferflushperc); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(bufferflush_spin), bufferflushperc); gtk_box_pack_start(GTK_BOX(hbox), bufferflush_spin, TRUE, TRUE, 0); @@ -662,6 +729,68 @@ gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0); + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0); + + public_check = gtk_check_button_new_with_label(_("Stream is public")); + gtk_widget_set_tooltip_text(public_check, _("Setting this asks the server to list the stream in any directories it knows about")); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(public_check), stream_is_public?TRUE:FALSE); + + gtk_box_pack_start(GTK_BOX(hbox), public_check, TRUE, TRUE, 0); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(_("Stream name:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + name_entry = gtk_entry_new(); + + gtk_entry_set_text(GTK_ENTRY(name_entry), stream_name); + + gtk_box_pack_start(GTK_BOX(hbox), name_entry, TRUE, TRUE, 0); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(_("Stream URL:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + url_entry = gtk_entry_new(); + + gtk_entry_set_text(GTK_ENTRY(url_entry), stream_url); + gtk_widget_set_tooltip_text(url_entry, _("The URL of a site about this stream")); + + gtk_box_pack_start(GTK_BOX(hbox), url_entry, TRUE, TRUE, 0); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(_("Stream genre:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + genre_entry = gtk_entry_new(); + + gtk_entry_set_text(GTK_ENTRY(genre_entry), stream_genre); + gtk_widget_set_tooltip_text(genre_entry, _("The genre (or genres) of the stream. This is usually a keyword list, eg \"pop rock rap\"")); + + gtk_box_pack_start(GTK_BOX(hbox), genre_entry, TRUE, TRUE, 0); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(_("Stream description:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + description_entry = gtk_entry_new(); + + gtk_entry_set_text(GTK_ENTRY(description_entry), stream_description); + + gtk_box_pack_start(GTK_BOX(hbox), description_entry, TRUE, TRUE, 0); + + gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0); + configure_bbox = gtk_hbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(configure_bbox), GTK_BUTTONBOX_END);