Mercurial > audlegacy-plugins
changeset 2806:9e06acde819e
branch merge
author | Andrew O. Shadoura <bugzilla@tut.by> |
---|---|
date | Sat, 12 Jul 2008 03:39:55 +0300 |
parents | 2d3594eaa18a (diff) 11fb1503ee4b (current diff) |
children | f06ec6936b7e |
files | |
diffstat | 4 files changed, 98 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/buildsys.mk.in Sat Jul 12 00:27:39 2008 +0300 +++ b/buildsys.mk.in Sat Jul 12 03:39:55 2008 +0300 @@ -29,6 +29,7 @@ OBJC = @OBJC@ AR = @AR@ LD = ${CC} +TR = @TR@ CFLAGS = @CFLAGS@ CXXFLAGS = @CXXFLAGS@ CPPFLAGS = @CPPFLAGS@ @@ -45,7 +46,8 @@ LIB_LDFLAGS = @LIB_LDFLAGS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ -PLUGIN_CPPFLAGS = @PLUGIN_CPPFLAGS@ +PLUGIN_DEFNAME = `echo -n ${subst ${PLUGIN_SUFFIX},,${PLUGIN}} | tr [:lower:] [:upper:] | tr -C [:alnum:] _` +PLUGIN_CPPFLAGS = @PLUGIN_CPPFLAGS@ -D${PLUGIN_DEFNAME}_CFGID=\"${subst ${PLUGIN_SUFFIX},,${PLUGIN}}\" PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ PLUGIN_LDFLAGS = @PLUGIN_LDFLAGS@ PLUGIN_SUFFIX = @PLUGIN_SUFFIX@
--- a/configure.ac Sat Jul 12 00:27:39 2008 +0300 +++ b/configure.ac Sat Jul 12 03:39:55 2008 +0300 @@ -93,6 +93,7 @@ AC_PATH_PROG(MV, mv) AC_PATH_PROG(CP, cp) AC_PATH_PROG(AR, ar) +AC_PATH_PROG(TR, tr) AC_PATH_PROG(RANLIB, ranlib) dnl Gettext -nenolod
--- a/extra.mk.in Sat Jul 12 00:27:39 2008 +0300 +++ b/extra.mk.in Sat Jul 12 03:39:55 2008 +0300 @@ -270,6 +270,7 @@ TAGLIB_CFLAGS ?= @TAGLIB_CFLAGS@ TAGLIB_CONFIG ?= @TAGLIB_CONFIG@ TAGLIB_LIBS ?= @TAGLIB_LIBS@ +TR ?= @TR@ USE_INCLUDED_LIBINTL ?= @USE_INCLUDED_LIBINTL@ USE_NLS ?= @USE_NLS@ USE_X86ASM_FALSE ?= @USE_X86ASM_FALSE@
--- a/src/icecast/icecast.c Sat Jul 12 00:27:39 2008 +0300 +++ b/src/icecast/icecast.c Sat Jul 12 03:39:55 2008 +0300 @@ -1,5 +1,7 @@ /* Icecast-Plugin - * (C) copyright 2008 based of FileWriter-plugin + * (C) copyright 2008 Andrew O. Shadoura + * Based on FileWriter-plugin + * (C) copyright 2007 merging of Disk Writer and Out-Lame by Michael Färber * * Original Out-Lame-Plugin: * (C) copyright 2002 Lars Siebold <khandha5@gmx.net> @@ -28,6 +30,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; static GtkWidget *configure_bbox, *configure_ok, *configure_cancel; static guint ice_tid=0; @@ -63,16 +66,21 @@ static guint outputlength=0; static gint buffersize; static gint bufferflush; +static gint buffersize_new; +static gint bufferflush_new; static gdouble bufferflushperc; static gchar *server_address = NULL; static gint server_port=8000; +static gchar *server_user = NULL; +static gchar *server_password = NULL; + VFSFile *output_file = NULL; guint64 written = 0; guint64 offset = 0; Tuple *tuple = NULL; static shout_t *shout = NULL; -gboolean paused = FALSE; +static gboolean paused = FALSE; static void ice_init(void); static void ice_cleanup(void); @@ -140,22 +148,26 @@ static void ice_init(void) { ConfigDb *db; - puts("ICE_INIT"); + g_debug("ICE_INIT"); shout_init(); - printf("Using libshout %s\n", shout_version(NULL, NULL, NULL)); + g_message("Using libshout %s", shout_version(NULL, NULL, NULL)); db = aud_cfg_db_open(); - aud_cfg_db_get_int(db, "icecast", "streamformat", &streamformat); - aud_cfg_db_get_string(db, "icecast", "server_address", &server_address); - aud_cfg_db_get_int(db, "icecast", "server_port", &server_port); + aud_cfg_db_get_int(db, ICECAST_CFGID, "streamformat", &streamformat); + aud_cfg_db_get_string(db, ICECAST_CFGID, "server_address", &server_address); + aud_cfg_db_get_int(db, ICECAST_CFGID, "server_port", &server_port); if (!server_port) server_port=8000; - aud_cfg_db_get_int(db, "icecast", "timeout", &ice_close_timeout); + aud_cfg_db_get_int(db, ICECAST_CFGID, "timeout", &ice_close_timeout); if (!ice_close_timeout) ice_close_timeout=5; - aud_cfg_db_get_int(db, "icecast", "buffersize", &buffersize); + aud_cfg_db_get_int(db, ICECAST_CFGID, "buffersize", &buffersize); if (!buffersize) buffersize=8192; - aud_cfg_db_get_double(db, "icecast", "bufferflush", &bufferflushperc); + buffersize_new=buffersize; + aud_cfg_db_get_double(db, ICECAST_CFGID, "bufferflush", &bufferflushperc); if (!bufferflushperc) bufferflushperc=80.0; bufferflush=(gint)(buffersize*bufferflushperc); + bufferflush_new=bufferflush; + 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_close(db); outputbuffer=g_try_malloc(buffersize); @@ -209,6 +221,15 @@ gint pos; Playlist *playlist; + if (buffersize!=buffersize_new) + { + buffersize=buffersize_new; + outputbuffer=g_try_realloc(outputbuffer, buffersize); + } + + if (bufferflush!=bufferflush_new) + bufferflush=bufferflush_new; + if (!outputbuffer) return 0; @@ -223,7 +244,7 @@ input.channels = nch; playlist = aud_playlist_get_active(); - if(!playlist) + if (!playlist) return 0; pos = aud_playlist_get_position(playlist); @@ -238,49 +259,49 @@ if (shout_set_host(shout, server_address) != SHOUTERR_SUCCESS) { - printf("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) { - printf("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) { - printf("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, "password") != SHOUTERR_SUCCESS) { - printf("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, "/test") != SHOUTERR_SUCCESS) { - printf("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_user(shout, "source") != SHOUTERR_SUCCESS) { - printf("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) { - printf("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) { - printf("Error connecting to server: %s\n", shout_get_error(shout)); + g_warning("Error connecting to server: %s\n", shout_get_error(shout)); return 0; } } @@ -300,7 +321,7 @@ } } - puts("ICE_OPEN"); + g_debug("ICE_OPEN"); return rv; } @@ -372,39 +393,37 @@ static gint ice_real_write(void* ptr, gint length) { - int ret; + gint ret; if (!length) return length; ret = shout_send(shout, ptr, length); - //shout_send_raw(shout, ptr, length); shout_sync(shout); - printf("ice_write[%d:%d](", ret, length); + g_debug("ice_write[%d:%d](", ret, length); { - int i; - for (i=0;(i<length)&&(i<16);i++) printf("%c",g_ascii_isprint(((char*)ptr)[i])?(((char*)ptr)[i]):'.'); + gint i; + for (i=0;(i<length)&&(i<16);i++) g_debug("%c",g_ascii_isprint(((char*)ptr)[i])?(((char*)ptr)[i]):'.'); } - printf(")\n"); + g_debug(")"); return 0; - //return ret; } static gint ice_write_output(void *ptr, gint length) { if ((!shout) || (!length)) return 0; - printf("outputlength=%d, length=%d...",outputlength, length); + g_debug("outputlength=%d, length=%d...",outputlength, length); if ((outputlength>bufferflush)||((outputlength+length)>buffersize)) { - printf("flushing\n"); + g_debug("flushing"); outputlength=ice_real_write(outputbuffer, outputlength); } { if (length>buffersize) { - printf("data too long, flushing\n"); + g_debug("data too long, flushing"); ice_real_write(ptr, length); } else { - printf("adding\n"); + g_debug("adding"); memcpy(&(outputbuffer[outputlength]), ptr, length); outputlength+=length; } @@ -423,7 +442,7 @@ } shout = NULL; ice_tid=0; - puts("ICE_REAL_CLOSE"); + g_debug("ICE_REAL_CLOSE"); return FALSE; } @@ -432,7 +451,7 @@ { if (ice_tid) g_source_remove(ice_tid); ice_tid=g_timeout_add_seconds(3, ice_real_close, NULL); - puts("ICE_CLOSE: starting timer"); + g_debug("ICE_CLOSE: starting timer"); } static void ice_flush(gint time) @@ -480,22 +499,30 @@ g_free(server_address); server_address = g_strdup(gtk_entry_get_text(GTK_ENTRY(addr_entry))); + g_free(server_user); + server_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_entry))); + + g_free(server_password); + server_password = g_strdup(gtk_entry_get_text(GTK_ENTRY(password_entry))); + server_port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(port_spin)); ice_close_timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(timeout_spin)); - buffersize = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffersize_spin)); + buffersize_new = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffersize_spin)); bufferflushperc = gtk_spin_button_get_value(GTK_SPIN_BUTTON(bufferflush_spin)); - bufferflush=(gint)(buffersize*bufferflushperc); + bufferflush_new=(gint)(buffersize*bufferflushperc); db = aud_cfg_db_open(); - aud_cfg_db_set_int(db, "icecast", "streamformat", streamformat); - aud_cfg_db_set_string(db, "icecast", "server_address", server_address); - aud_cfg_db_set_int(db, "icecast", "server_port", server_port); - aud_cfg_db_set_int(db, "icecast", "timeout", ice_close_timeout); - aud_cfg_db_set_int(db, "icecast", "buffersize", buffersize); - aud_cfg_db_set_double(db, "icecast", "bufferflush", bufferflushperc); + aud_cfg_db_set_int(db, ICECAST_CFGID, "streamformat", streamformat); + aud_cfg_db_set_string(db, ICECAST_CFGID, "server_address", server_address); + aud_cfg_db_set_string(db, ICECAST_CFGID, "server_user", server_user); + aud_cfg_db_set_string(db, ICECAST_CFGID, "server_password", server_password); + aud_cfg_db_set_int(db, ICECAST_CFGID, "server_port", server_port); + aud_cfg_db_set_int(db, ICECAST_CFGID, "timeout", ice_close_timeout); + aud_cfg_db_set_int(db, ICECAST_CFGID, "buffersize", buffersize_new); + aud_cfg_db_set_double(db, ICECAST_CFGID, "bufferflush", bufferflushperc); aud_cfg_db_close(db); @@ -598,6 +625,31 @@ hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0); + label = gtk_label_new(_("User name:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + user_entry = gtk_entry_new(); + + gtk_entry_set_text(GTK_ENTRY(user_entry), server_user); + + gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 0); + + label = gtk_label_new(_("Password:")); + 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_visibility(GTK_ENTRY(password_entry), FALSE); + + gtk_box_pack_start(GTK_BOX(hbox), password_entry, TRUE, TRUE, 0); + + 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); + label = gtk_label_new(_("Connection timeout (seconds):")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);