changeset 2282:cd57c9fe416e

Merge from respository
author Sascha Hlusiak <contact@saschahlusiak.de>
date Thu, 03 Jan 2008 15:48:50 +0100
parents 6ca0d83ce51d (current diff) cc31a9aed84c (diff)
children 689bdfacb10c d19b53359b24
files
diffstat 12 files changed, 333 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/src/filewriter/mp3.c	Thu Jan 03 15:46:23 2008 +0100
+++ b/src/filewriter/mp3.c	Thu Jan 03 15:48:50 2008 +0100
@@ -20,6 +20,8 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+/* #define AUD_DEBUG 1 */
+
 #include "plugins.h"
 
 #ifdef FILEWRITER_MP3
@@ -156,8 +158,6 @@
     (void) vfprintf(stdout, format, ap);
 }
 
-
-
 static void mp3_init(void)
 {
     ConfigDb *db = aud_cfg_db_open();
@@ -206,9 +206,9 @@
 
     if (tuple) {
         /* XXX write UTF-8 even though libmp3lame does id3v2.3. --yaz */
-#ifdef DEBUG
-        g_print("track_name = %s\n", aud_tuple_get_string(tuple, FIELD_TITLE, NULL));
-#endif
+
+        AUDDBG("track_name = %s\n", aud_tuple_get_string(tuple, FIELD_TITLE, NULL));
+
         lameid3.track_name = g_strdup(aud_tuple_get_string(tuple, FIELD_TITLE, NULL));
         id3tag_set_title(gfp, lameid3.track_name);
 
@@ -244,9 +244,7 @@
     lame_set_bWriteVbrTag(gfp, toggle_xing_val);
     lame_set_quality(gfp, algo_quality_val);
     if (audio_mode_val != 4) {
-#ifdef DEBUG
-        printf("set mode to %d\n", audio_mode_val);
-#endif
+        AUDDBG("set mode to %d\n", audio_mode_val);
         lame_set_mode(gfp, audio_mode_val);
     }
     if(auto_ms_val)
@@ -328,10 +326,7 @@
 
 static gint mp3_playing(void)
 {
-#ifdef DEBUG
-    printf("lame: buffer_playing = %d\n", encout ? 1 : 0);
-#endif
-    return encout ? 1 : 0;
+    return 0;
 }
 
 static gint mp3_get_written_time(void)
--- a/src/lirc/Makefile	Thu Jan 03 15:46:23 2008 +0100
+++ b/src/lirc/Makefile	Thu Jan 03 15:48:50 2008 +0100
@@ -1,7 +1,10 @@
 PLUGIN = lirc${PLUGIN_SUFFIX}
 
 SRCS = about.c \
-       lirc.c
+       lirc.c \
+       lirc_cfg.c \
+       callbacks.c \
+       interface.c
 
 include ../../buildsys.mk
 include ../../extra.mk
--- a/src/lirc/about.c	Thu Jan 03 15:46:23 2008 +0100
+++ b/src/lirc/about.c	Thu Jan 03 15:48:50 2008 +0100
@@ -96,8 +96,9 @@
 "from the XMMS LIRC plugin by:\n"
 "Carl van Schaik <carl@leg.uct.ac.za>\n"
 "Christoph Bartelmus <xmms@bartelmus.de>\n"
+"Andrew O. Shadoura <bugzilla@tut.by>\n"
 "You can get LIRC information at:\n"
-"http://fsinfo.cs.uni-sb.de/~columbus/lirc/index.html"));
+"http://lirc.org"));
 
 	label=gtk_label_new( logo_text->str );
         g_string_free( logo_text, TRUE );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lirc/callbacks.c	Thu Jan 03 15:48:50 2008 +0100
@@ -0,0 +1,33 @@
+#include <config.h>
+
+#include <gtk/gtk.h>
+
+#include "common.h"
+
+void
+on_reconnectcheck_toggled              (GtkToggleButton *togglebutton,
+                                        GtkWidget       *reconnectspin)
+{
+  gtk_widget_set_sensitive(reconnectspin, gtk_toggle_button_get_active(togglebutton));
+}
+
+
+void
+on_cancelbutton1_clicked               (GtkButton       *button,
+                                        gpointer         user_data)
+{
+  gtk_widget_destroy(lirc_cfg);
+  lirc_cfg=NULL;
+}
+
+
+void
+on_okbutton1_clicked                   (GtkButton       *button,
+                                        gpointer         user_data)
+{
+  b_enable_reconnect=(gint)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_object_get_data(G_OBJECT(lirc_cfg), "reconnectcheck")));
+  reconnect_timeout=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(g_object_get_data(G_OBJECT(lirc_cfg), "reconnectspin")));
+  save_cfg();
+  gtk_widget_destroy(lirc_cfg);
+  lirc_cfg=NULL;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lirc/common.h	Thu Jan 03 15:48:50 2008 +0100
@@ -0,0 +1,22 @@
+extern GtkWidget *lirc_cfg;
+
+extern gint b_enable_reconnect;
+extern gint reconnect_timeout;
+
+void load_cfg(void);
+void save_cfg(void);
+
+void configure(void);
+
+GtkWidget* create_lirc_cfg (void);
+
+void
+on_reconnectcheck_toggled              (GtkToggleButton *togglebutton,
+                                        GtkWidget       *reconnectspin);
+void
+on_cancelbutton1_clicked               (GtkButton       *button,
+                                        gpointer         user_data);
+void
+on_okbutton1_clicked                   (GtkButton       *button,
+                                        gpointer         user_data);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lirc/interface.c	Thu Jan 03 15:48:50 2008 +0100
@@ -0,0 +1,109 @@
+#include <config.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#include <audacious/i18n.h>
+
+#include "common.h"
+
+GtkWidget*
+create_lirc_cfg (void)
+{
+  GtkWidget *dialog_vbox1;
+  GtkWidget *notebook1;
+  GtkWidget *vbox2;
+  GtkWidget *frame1;
+  GtkWidget *alignment1;
+  GtkWidget *vbox3;
+  GtkWidget *hbox1;
+  GtkWidget *label3;
+  GtkWidget *reconnectcheck;
+  GtkWidget *reconnectspin;
+  GtkObject *reconnectspin_adj;
+  GtkWidget *label2;
+  GtkWidget *label1;
+  GtkWidget *dialog_action_area1;
+  GtkWidget *cancelbutton1;
+  GtkWidget *okbutton1;
+
+  lirc_cfg = gtk_dialog_new ();
+  gtk_window_set_title (GTK_WINDOW (lirc_cfg), _("LIRC plugin settings"));
+  gtk_window_set_position (GTK_WINDOW (lirc_cfg), GTK_WIN_POS_CENTER_ON_PARENT);
+  gtk_window_set_resizable (GTK_WINDOW (lirc_cfg), FALSE);
+  gtk_window_set_type_hint (GTK_WINDOW (lirc_cfg), GDK_WINDOW_TYPE_HINT_DIALOG);
+  g_signal_connect(G_OBJECT(lirc_cfg),"destroy", G_CALLBACK(gtk_widget_destroyed), &lirc_cfg);
+
+  dialog_vbox1 = GTK_DIALOG (lirc_cfg)->vbox;
+
+  notebook1 = gtk_notebook_new ();
+  gtk_box_pack_start (GTK_BOX (dialog_vbox1), notebook1, TRUE, TRUE, 0);
+
+  vbox2 = gtk_vbox_new (FALSE, 0);
+  gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
+
+  frame1 = gtk_frame_new (NULL);
+  gtk_box_pack_start (GTK_BOX (vbox2), frame1, TRUE, TRUE, 0);
+
+  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_container_add (GTK_CONTAINER (frame1), alignment1);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
+
+  vbox3 = gtk_vbox_new (FALSE, 0);
+  gtk_container_add (GTK_CONTAINER (alignment1), vbox3);
+
+  reconnectcheck = gtk_check_button_new_with_mnemonic (_("Reconnect to LIRC server"));
+  gtk_box_pack_start (GTK_BOX (vbox3), reconnectcheck, FALSE, FALSE, 0);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reconnectcheck), (gboolean)b_enable_reconnect);
+
+  hbox1 = gtk_hbox_new (FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox3), hbox1, TRUE, TRUE, 0);
+
+  label3 = gtk_label_new (_("Timeout before reconnecting (seconds): "));
+  gtk_box_pack_start (GTK_BOX (hbox1), label3, FALSE, FALSE, 17);
+
+  reconnectspin_adj = gtk_adjustment_new (reconnect_timeout, 1, 100, 1, 10, 10);
+  reconnectspin = gtk_spin_button_new (GTK_ADJUSTMENT (reconnectspin_adj), 1, 0);
+  gtk_box_pack_start (GTK_BOX (hbox1), reconnectspin, TRUE, TRUE, 15);
+
+  label2 = gtk_label_new (_("Reconnect"));
+  gtk_frame_set_label_widget (GTK_FRAME (frame1), label2);
+  gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
+
+  label1 = gtk_label_new (_("Connection"));
+  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);
+
+  dialog_action_area1 = GTK_DIALOG (lirc_cfg)->action_area;
+  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
+
+  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
+  gtk_dialog_add_action_widget (GTK_DIALOG (lirc_cfg), cancelbutton1, GTK_RESPONSE_CANCEL);
+  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
+
+  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
+  gtk_dialog_add_action_widget (GTK_DIALOG (lirc_cfg), okbutton1, GTK_RESPONSE_OK);
+  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
+
+  g_signal_connect (G_OBJECT (reconnectcheck), "toggled",
+                    G_CALLBACK (on_reconnectcheck_toggled),
+                    G_OBJECT (reconnectspin));
+  g_signal_connect (G_OBJECT (cancelbutton1), "clicked",
+                    G_CALLBACK (on_cancelbutton1_clicked),
+                    NULL);
+  g_signal_connect (G_OBJECT (okbutton1), "clicked",
+                    G_CALLBACK (on_okbutton1_clicked),
+                    NULL);
+  gtk_widget_set_sensitive(reconnectspin, (gboolean)b_enable_reconnect);
+
+  g_object_set_data(G_OBJECT(lirc_cfg), "reconnectcheck", G_OBJECT(reconnectcheck));
+  g_object_set_data(G_OBJECT(lirc_cfg), "reconnectspin", G_OBJECT(reconnectspin));
+
+  return lirc_cfg;
+}
+
--- a/src/lirc/lirc.c	Thu Jan 03 15:46:23 2008 +0100
+++ b/src/lirc/lirc.c	Thu Jan 03 15:48:50 2008 +0100
@@ -46,13 +46,15 @@
 
 #include "lirc.h"
 
+#include "common.h"
+
 const char *plugin_name="LIRC Plugin";
 
 GeneralPlugin lirc_plugin = {
     .description = "LIRC Plugin",
     .init = init,
     .about = about,
-    .configure = NULL,
+    .configure = configure,
     .cleanup = cleanup
 };
 
@@ -67,7 +69,7 @@
 
 gint input_tag;
 
-void init(void)
+void init_lirc(void)
 {
 	int flags;
 	
@@ -98,6 +100,19 @@
 	fflush(stdout);
 }
 
+void init(void)
+{
+	load_cfg();
+	init_lirc();
+}
+
+gboolean reconnect_lirc(gpointer data)
+{
+	fprintf(stderr,_("%s: trying to reconnect...\n"),plugin_name);
+	init();
+	return (lirc_fd==-1);
+}
+
 void lirc_input_callback(gpointer data,gint source,
 			 GdkInputCondition condition)
 {
@@ -304,7 +319,11 @@
 		/* something went badly wrong */
 		fprintf(stderr,_("%s: disconnected from LIRC\n"),plugin_name);
 		cleanup();
-		return;
+		if(b_enable_reconnect)
+		{
+			fprintf(stderr,_("%s: will try reconnect every %d seconds...\n"),plugin_name,reconnect_timeout);
+			g_timeout_add(1000*reconnect_timeout, reconnect_lirc, NULL);
+		}
 	}
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lirc/lirc_cfg.c	Thu Jan 03 15:48:50 2008 +0100
@@ -0,0 +1,44 @@
+#include <config.h>
+
+#include <gtk/gtk.h>
+#include <audacious/i18n.h>
+#include <audacious/plugin.h>
+#include <audacious/configdb.h>
+
+#include "common.h"
+
+GtkWidget *lirc_cfg = NULL;
+
+gint b_enable_reconnect;
+gint reconnect_timeout;
+
+void load_cfg(void)
+{
+  ConfigDb *db;
+  db = aud_cfg_db_open();
+  aud_cfg_db_get_int(db, "lirc", "enable_reconnect", &b_enable_reconnect);
+  aud_cfg_db_get_int(db, "lirc", "reconnect_timeout", &reconnect_timeout);
+  if (!reconnect_timeout) reconnect_timeout = 5;
+  aud_cfg_db_close(db);
+}
+
+void save_cfg(void)
+{
+  ConfigDb *db;
+  db = aud_cfg_db_open();
+  aud_cfg_db_set_int(db, "lirc", "enable_reconnect", b_enable_reconnect);
+  aud_cfg_db_set_int(db, "lirc", "reconnect_timeout", reconnect_timeout);
+  aud_cfg_db_close(db);
+}
+
+void configure(void)
+{
+  if (lirc_cfg)
+  {
+    gtk_window_present(GTK_WINDOW(lirc_cfg));
+    return;
+  }
+  load_cfg();
+  lirc_cfg = create_lirc_cfg();
+  gtk_widget_show_all(lirc_cfg);
+}
--- a/src/madplug/decoder.c	Thu Jan 03 15:46:23 2008 +0100
+++ b/src/madplug/decoder.c	Thu Jan 03 15:48:50 2008 +0100
@@ -196,8 +196,8 @@
         info->fileinfo_request = FALSE;
     }
 
-    AUDDBG("f: scan_file");
-    AUDDBG("scan_file frames = %d", info->frames);
+    AUDDBG("f: scan_file\n");
+    AUDDBG("scan_file frames = %d\n", info->frames);
 
     while (1) {
         remainder = stream.bufend - stream.next_frame;
@@ -214,7 +214,7 @@
                              BUFFER_SIZE - remainder);
 
         if (len <= 0) {
-            AUDDBG("scan_file: len <= 0 len = %d", len);
+            AUDDBG("scan_file: len <= 0 len = %d\n", len);
             break;
         }
 
@@ -226,10 +226,10 @@
                     break;
                 }
                 if (!MAD_RECOVERABLE(stream.error)) {
-                    AUDDBG("(fatal) error decoding header %d: %s",
+                    AUDDBG("(fatal) error decoding header %d: %s\n",
                               info->frames, mad_stream_errorstr(&stream));
-                    AUDDBG("remainder = %d", remainder);
-                    AUDDBG("len = %d", len);
+                    AUDDBG("remainder = %d\n", remainder);
+                    AUDDBG("len = %d\n", len);
                     break;
                 }
                 if (stream.error == MAD_ERROR_LOSTSYNC) {
@@ -238,27 +238,27 @@
                                             stream.bufend -
                                             stream.this_frame);
                     if (tagsize > 0) {
-                        AUDDBG("skipping id3_tag: %d", tagsize);
+                        AUDDBG("skipping id3_tag: %d\n", tagsize);
                         mad_stream_skip(&stream, tagsize);
                         continue;
                     }
                 }
 
-                AUDDBG("(recovered) error decoding header %d: %s",
+                AUDDBG("(recovered) error decoding header %d: %s\n",
                           info->frames, mad_stream_errorstr(&stream));
-                AUDDBG("remainder = %d", remainder);
-                AUDDBG("len = %d", len);
+                AUDDBG("remainder = %d\n", remainder);
+                AUDDBG("len = %d\n", len);
 
                 continue;
             }
             info->frames++;
 
 #ifdef DEBUG_INTENSIVELY
-            AUDDBG("header bitrate = %ld", header.bitrate);
-            AUDDBG("duration = %ul",
+            AUDDBG("header bitrate = %ld\n", header.bitrate);
+            AUDDBG("duration = %ul\n",
                       mad_timer_count(header.duration,
                                       MAD_UNITS_MILLISECONDS));
-            AUDDBG("size = %d", stream.next_frame - stream.this_frame);
+            AUDDBG("size = %d\n", stream.next_frame - stream.this_frame);
 #endif
             if(aud_tuple_get_int(info->tuple, FIELD_LENGTH, NULL) == -1)
                 mad_timer_add(&info->duration, header.duration);
@@ -280,15 +280,15 @@
                 if (audmad_config.use_xing) {
                     frame.header = header;
                     if (mad_frame_decode(&frame, &stream) == -1) {
-                        AUDDBG("xing frame decode failed");
+                        AUDDBG("xing frame decode failed\n");
                         goto no_xing;
                     }
                     if (xing_parse(&info->xing, stream.anc_ptr, stream.anc_bitlen) == 0) {
-                        AUDDBG("xing header found ");
+                        AUDDBG("xing header found\n");
                         has_xing = TRUE;
                         info->vbr = TRUE;   /* otherwise xing header would have been 'Info' */
 
-                        AUDDBG("xing: bytes = %ld frames = %ld", info->xing.bytes, info->xing.frames);
+                        AUDDBG("xing: bytes = %ld frames = %ld\n", info->xing.bytes, info->xing.frames);
 
                         /* we have enough info to calculate bitrate and duration */
                         if(info->xing.bytes && info->xing.frames) {
@@ -296,8 +296,8 @@
 #ifdef AUD_DEBUG
                             {
                                 gint tmp = (gint)(info->xing.bytes * 8 / xing_bitrate);
-                                AUDDBG("xing: bitrate = %4.1f kbps", xing_bitrate / 1000);
-                                AUDDBG("xing: duration = %d:%02d", tmp / 60, tmp % 60);
+                                AUDDBG("xing: bitrate = %4.1f kbps\n", xing_bitrate / 1000);
+                                AUDDBG("xing: duration = %d:%02d\n", tmp / 60, tmp % 60);
                             }
 #endif
                         }
@@ -305,7 +305,7 @@
                     }
 #ifdef AUD_DEBUG
                     else {
-                        AUDDBG("no usable xing header");
+                        AUDDBG("no usable xing header\n");
                         continue;
                     }
 #endif
@@ -332,14 +332,14 @@
             if (fast && info->frames >= N_AVERAGE_FRAMES) {
                 float frame_size = ((double) data_used) / N_AVERAGE_FRAMES;
 
-                AUDDBG("bitrate = %ld samplerate = %d", header.bitrate, header.samplerate);
-                AUDDBG("data_used = %d info->frames = %d info->size = %d tagsize = %d frame_size = %lf",
+                AUDDBG("bitrate = %ld samplerate = %d\n", header.bitrate, header.samplerate);
+                AUDDBG("data_used = %d info->frames = %d info->size = %d tagsize = %d frame_size = %lf\n",
                           data_used, info->frames, info->size, tagsize, frame_size);
 
                 if(info->size != 0)
                     info->frames = (info->size - tagsize) / frame_size;
 
-                AUDDBG("info->frames = %d", info->frames);
+                AUDDBG("info->frames = %d\n", info->frames);
 
                 if(aud_tuple_get_int(info->tuple, FIELD_LENGTH, NULL) == -1) {
                     if(xing_bitrate > 0.0) {
@@ -361,14 +361,14 @@
                     info->duration.fraction = length % 1000;
                 }
 #ifdef AUD_DEBUG
-                AUDDBG("using fast playtime calculation");
-                AUDDBG("data used = %d [tagsize=%d framesize=%f]",
+                AUDDBG("using fast playtime calculation\n");
+                AUDDBG("data used = %d [tagsize=%d framesize=%f]\n",
                           data_used, tagsize, frame_size);
-                AUDDBG("frames = %d, frequency = %d, channels = %d",
+                AUDDBG("frames = %d, frequency = %d, channels = %d\n",
                           info->frames, info->freq, info->channels);
                 long millis = mad_timer_count(info->duration,
                                               MAD_UNITS_MILLISECONDS);
-                AUDDBG("duration = %ld:%02ld", millis / 1000 / 60, (millis / 1000) % 60);
+                AUDDBG("duration = %ld:%02ld\n", millis / 1000 / 60, (millis / 1000) % 60);
 #endif                          /* DEBUG */
                 break;
             }
@@ -392,8 +392,8 @@
     mad_stream_finish(&stream);
     xing_finish(&info->xing);
 
-    AUDDBG("scan_file: info->frames = %d", info->frames);
-    AUDDBG("e: scan_file");
+    AUDDBG("scan_file: info->frames = %d\n", info->frames);
+    AUDDBG("e: scan_file\n");
 
     return (info->frames != 0 || info->remote == TRUE);
 }
@@ -428,7 +428,7 @@
     /* track info is passed in as thread argument */
     struct mad_info_t *info = (struct mad_info_t *) arg;
 
-    AUDDBG("f: decode");
+    AUDDBG("f: decode\n");
 
     /* init mad stuff */
     mad_frame_init(&frame);
@@ -437,11 +437,11 @@
     mad_synth_init(&synth);
 
     if(!info->playback){
-        AUDDBG("decode: playback == NULL");
+        AUDDBG("decode: playback == NULL\n");
         return NULL;
     }
 
-    AUDDBG("decode: fmt = %d freq = %d channels = %d", info->fmt, info->freq, info->channels);
+    AUDDBG("decode: fmt = %d freq = %d channels = %d\n", info->fmt, info->freq, info->channels);
 
     if(check_audio_param(info) == FALSE)
         return NULL;
@@ -467,12 +467,12 @@
                              (tlen == 0 || info->size <= 0) ? -1 : tlen,
                              info->bitrate, info->freq, info->channels);
 
-    AUDDBG("decode: tlen = %d", tlen);
+    AUDDBG("decode: tlen = %d\n", tlen);
 
     /* main loop */
     do {
         if (!info->playback->playing) {
-            AUDDBG("decode: stop signaled");
+            AUDDBG("decode: stop signaled\n");
             break;
         }
         if (seek_skip)
@@ -487,7 +487,7 @@
         input_process_remote_metadata(info);
 
         if (len <= 0) {
-            AUDDBG("finished decoding");
+            AUDDBG("finished decoding\n");
             break;
         }
         len += remainder;
@@ -502,7 +502,7 @@
 
         if (seek_skip) {
 
-            AUDDBG("skipping: %d", seek_skip);
+            AUDDBG("skipping: %d\n", seek_skip);
 
             int skip = 2;
             do {
@@ -526,7 +526,7 @@
         while (info->playback->playing) {
             if (info->seek != -1 && info->size > 0) {
 
-                AUDDBG("seeking: %ld", info->seek);
+                AUDDBG("seeking: %ld\n", info->seek);
 
                 int new_position;
                 gulong milliseconds =
@@ -541,7 +541,7 @@
                 if(new_position < 0)
                     new_position = 0;
 
-                AUDDBG("seeking to: %d bytes", new_position);
+                AUDDBG("seeking to: %d bytes\n", new_position);
 
                 if (aud_vfs_fseek(info->infile, new_position, SEEK_SET) == -1)
                     audmad_error("failed to seek to: %d", new_position);
@@ -570,7 +570,7 @@
                     }
                 }
 
-                AUDDBG("(recovered) error decoding header %d: %s",
+                AUDDBG("(recovered) error decoding header %d: %s\n",
                           info->current_frame,
                           mad_stream_errorstr(&stream));
 
@@ -582,7 +582,7 @@
             if (!audmad_config.show_avg_vbr_bitrate && info->vbr && (iteration % 40 == 0)) {
 
 #ifdef DEBUG_INTENSIVELY
-                AUDDBG("decode vbr tlen = %d", tlen);
+                AUDDBG("decode vbr tlen = %d\n", tlen);
 #endif
                 info->playback->set_params(info->playback, info->title,
                                      (tlen == 0 || info->size <= 0) ? -1 : tlen,
@@ -594,7 +594,7 @@
                 if (!MAD_RECOVERABLE(stream.error))
                     break;
 
-                AUDDBG("(recovered) error decoding frame %d: %s",
+                AUDDBG("(recovered) error decoding frame %d: %s\n",
                           info->current_frame,
                           mad_stream_errorstr(&stream));
 
@@ -606,10 +606,10 @@
                 || info->channels !=
                 (guint) MAD_NCHANNELS(&frame.header)) {
 
-                AUDDBG("change in audio type detected");
-                AUDDBG("old: frequency = %d, channels = %d", info->freq,
+                AUDDBG("change in audio type detected\n");
+                AUDDBG("old: frequency = %d, channels = %d\n", info->freq,
                           info->channels);
-                AUDDBG("new: frequency = %d, channels = %d",
+                AUDDBG("new: frequency = %d, channels = %d\n",
                           frame.header.samplerate,
                           (guint) MAD_NCHANNELS(&frame.header));
 
@@ -619,7 +619,7 @@
                 if(audmad_config.force_reopen_audio && check_audio_param(info)) {
                     gint current_time = info->playback->output->output_time();
 
-                    AUDDBG("re-opening audio due to change in audio type");
+                    AUDDBG("re-opening audio due to change in audio type\n");
 
                     info->playback->output->close_audio();
                     if (!info->playback->output->open_audio(info->fmt, info->freq,
@@ -660,7 +660,7 @@
         info->playback->output->buffer_free();
         while (info->playback->output->buffer_playing()) {
 
-            AUDDBG("f: buffer_playing=%d", info->playback->output->buffer_playing());
+            AUDDBG("f: buffer_playing=%d\n", info->playback->output->buffer_playing());
 
             g_get_current_time(&sleeptime);
             g_time_val_add(&sleeptime, 500000);
@@ -675,7 +675,7 @@
         }
     }
 
-    AUDDBG("e: decode");
+    AUDDBG("e: decode\n");
 
     aud_tuple_free(info->tuple);
     info->tuple = NULL;
--- a/src/madplug/input.c	Thu Jan 03 15:46:23 2008 +0100
+++ b/src/madplug/input.c	Thu Jan 03 15:48:50 2008 +0100
@@ -71,7 +71,7 @@
  */
 gboolean input_init(struct mad_info_t * info, const char *url, VFSFile *fd)
 {
-    AUDDBG("f: input_init");
+    AUDDBG("f: input_init\n");
 
     memset(info, 0, sizeof(struct mad_info_t)); // all fields are cleared to 0 --yaz
 
@@ -112,8 +112,8 @@
 
     info->fileinfo_request = FALSE;
 
-    AUDDBG("i: info->size = %lu", (long unsigned int)info->size);
-    AUDDBG("e: input_init");
+    AUDDBG("i: info->size = %lu\n", (long unsigned int)info->size);
+    AUDDBG("e: input_init\n");
 
     return TRUE;
 }
@@ -345,7 +345,7 @@
     Tuple *tuple;
     glong curpos = 0;
 
-    AUDDBG("f: input_read_tag");
+    AUDDBG("f: input_read_tag\n");
 
     if (info->tuple != NULL)
         aud_tuple_free(info->tuple);
@@ -362,13 +362,13 @@
     }
 
     if (!info->id3file) {
-        AUDDBG("read_tag: no id3file");
+        AUDDBG("read_tag: no id3file\n");
         return;
     }
 
     info->tag = id3_file_tag(info->id3file);
     if (!info->tag) {
-        AUDDBG("read_tag: no tag");
+        AUDDBG("read_tag: no tag\n");
         return;
     }
 
@@ -401,7 +401,7 @@
     string = input_id3_get_string(info->tag, "TLEN");
     if (string) {
         aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, atoi(string));
-        AUDDBG("input_read_tag: TLEN = %d", atoi(string));
+        AUDDBG("input_read_tag: TLEN = %d\n", atoi(string));
         g_free(string);
         string = NULL;
     } else
@@ -419,7 +419,7 @@
         aud_vfs_fseek(info->infile, curpos, SEEK_SET);
     }
     
-    AUDDBG("e: input_read_tag");
+    AUDDBG("e: input_read_tag\n");
 }
 
 void input_process_remote_metadata(struct mad_info_t *info)
@@ -430,7 +430,7 @@
         gchar *tmp = NULL;
 
 #ifdef DEBUG_INTENSIVELY
-        AUDDBG("process_remote_meta");
+        AUDDBG("process_remote_meta\n");
 #endif
         g_free(info->title);
         info->title = NULL;
@@ -500,7 +500,7 @@
 {
 #ifdef AUD_DEBUG
     gchar *tmp = g_filename_to_utf8(info->filename, -1, NULL, NULL, NULL);    
-    AUDDBG("f: input_get_info: %s, fast_scan = %s", tmp, fast_scan ? "TRUE" : "FALSE");
+    AUDDBG("f: input_get_info: %s, fast_scan = %s\n", tmp, fast_scan ? "TRUE" : "FALSE");
     g_free(tmp);
 #endif                          /* DEBUG */
 
@@ -513,7 +513,7 @@
 
     /* scan mp3 file, decoding headers */
     if (scan_file(info, fast_scan) == FALSE) {
-        AUDDBG("input_get_info: scan_file failed");
+        AUDDBG("input_get_info: scan_file failed\n");
         return FALSE;
     }
 
@@ -530,7 +530,7 @@
             info->title = g_strdup(info->filename); //XXX info->filename is uri. --yaz
     }
 
-    AUDDBG("e: input_get_info");
+    AUDDBG("e: input_get_info\n");
     return TRUE;
 }
 
@@ -549,7 +549,7 @@
 {
     int len = 0;
 #ifdef DEBUG_INTENSIVELY
-  AUDDBG ("f: input_get_data: %d", buffer_size);
+  AUDDBG ("f: input_get_data: %d\n", buffer_size);
 #endif
     /* simply read to data from the file */
     len = aud_vfs_fread(buffer, 1, buffer_size, info->infile); //aud_vfs_fread returns num of elements.
@@ -559,7 +559,7 @@
     }
 
 #ifdef DEBUG_INTENSIVELY
-    AUDDBG ("e: input_get_data: size=%d offset=%d", len, info->offset);
+    AUDDBG ("e: input_get_data: size=%d offset=%d\n", len, info->offset);
 #endif
 
     info->offset += len;
@@ -571,7 +571,7 @@
  */
 gboolean input_term(struct mad_info_t * info)
 {
-    AUDDBG("f: input_term");
+    AUDDBG("f: input_term\n");
 
     if (info->title)
         g_free(info->title);
@@ -608,7 +608,7 @@
     /* set everything to zero in case it gets used again. */
     memset(info, 0, sizeof(struct mad_info_t));
 
-    AUDDBG("e: input_term");
+    AUDDBG("e: input_term\n");
 
     return TRUE;
 }
--- a/src/madplug/plugin.c	Thu Jan 03 15:46:23 2008 +0100
+++ b/src/madplug/plugin.c	Thu Jan 03 15:48:50 2008 +0100
@@ -104,14 +104,14 @@
     else
       x = 0;
     config->pregain_scale = (x != 0) ? pow(10.0, x / 20) : 1;
-    AUDDBG("pregain=[%s] -> %g  -> %g", text, x, config->pregain_scale);
+    AUDDBG("pregain=[%s] -> %g  -> %g\n", text, x, config->pregain_scale);
     text = config->replaygain.default_db;
     if ( text != NULL )
       x = g_strtod(text, NULL);
     else
       x = 0;
     config->replaygain.default_scale = (x != 0) ? pow(10.0, x / 20) : 1;
-    AUDDBG("RG.default=[%s] -> %g  -> %g", text, x,
+    AUDDBG("RG.default=[%s] -> %g  -> %g\n", text, x,
               config->replaygain.default_scale);
 }
 
@@ -403,7 +403,7 @@
 
 static void audmad_stop(InputPlayback *playback)
 {
-    AUDDBG("f: audmad_stop");
+    AUDDBG("f: audmad_stop\n");
     g_mutex_lock(mad_mutex);
     info.playback = playback;
     g_mutex_unlock(mad_mutex);
@@ -415,15 +415,15 @@
         g_mutex_unlock(mad_mutex);
         g_cond_signal(mad_cond);
 
-        AUDDBG("waiting for thread");
+        AUDDBG("waiting for thread\n");
         g_thread_join(decode_thread);
-        AUDDBG("thread done");
+        AUDDBG("thread done\n");
 
         input_term(&info);
         decode_thread = NULL;
 
     }
-    AUDDBG("e: audmad_stop");
+    AUDDBG("e: audmad_stop\n");
 }
 
 static void audmad_play_file(InputPlayback *playback)
@@ -434,7 +434,7 @@
 #ifdef AUD_DEBUG
     {
         gchar *tmp = g_filename_to_utf8(url, -1, NULL, NULL, NULL);
-        AUDDBG("playing %s", tmp);
+        AUDDBG("playing %s\n", tmp);
         g_free(tmp);
     }
 #endif                          /* DEBUG */
@@ -496,12 +496,12 @@
     struct mad_info_t myinfo;
 #ifdef AUD_DEBUG
     gchar *tmp = g_filename_to_utf8(url, -1, NULL, NULL, NULL);
-    AUDDBG("f: audmad_get_song_info: %s", tmp);
+    AUDDBG("f: audmad_get_song_info: %s\n", tmp);
     g_free(tmp);
 #endif                          /* DEBUG */
 
     if (input_init(&myinfo, url, NULL) == FALSE) {
-        AUDDBG("error initialising input");
+        AUDDBG("error initialising input\n");
         return;
     }
 
@@ -520,17 +520,17 @@
         *length = -1;
     }
     input_term(&myinfo);
-    AUDDBG("e: audmad_get_song_info");
+    AUDDBG("e: audmad_get_song_info\n");
 }
 
 static gboolean
 audmad_fill_info(struct mad_info_t *info, VFSFile *fd)
 {
     if (fd == NULL || info == NULL) return FALSE;
-    AUDDBG("f: audmad_fill_info(): %s", fd->uri);
+    AUDDBG("f: audmad_fill_info(): %s\n", fd->uri);
 
     if (input_init(info, fd->uri, fd) == FALSE) {
-        AUDDBG("audmad_fill_info(): error initialising input");
+        AUDDBG("audmad_fill_info(): error initialising input\n");
         return FALSE;
     }
     
@@ -621,7 +621,7 @@
 
 #ifdef AUD_DEBUG
     string = aud_str_to_utf8(filename);
-    AUDDBG("f: mad: audmad_get_song_tuple: %s", string);
+    AUDDBG("f: mad: audmad_get_song_tuple: %s\n", string);
     g_free(string);
     string = NULL;
 #endif
@@ -635,7 +635,7 @@
 
 #ifdef AUD_DEBUG
             if(info.playback)
-                AUDDBG("info.playback->playing = %d",info.playback->playing);
+                AUDDBG("info.playback->playing = %d\n",info.playback->playing);
 #endif
             tmp = aud_vfs_get_metadata(info.infile ? info.infile : fd, "track-name");
             if(tmp){
@@ -660,14 +660,14 @@
                 tmp = NULL;
             }
 
-            AUDDBG("audmad_get_song_tuple: track_name = %s", aud_tuple_get_string(tuple, -1, "track-name"));
-            AUDDBG("audmad_get_song_tuple: stream_name = %s", aud_tuple_get_string(tuple, -1, "stream-name"));
+            AUDDBG("audmad_get_song_tuple: track_name = %s\n", aud_tuple_get_string(tuple, -1, "track-name"));
+            AUDDBG("audmad_get_song_tuple: stream_name = %s\n", aud_tuple_get_string(tuple, -1, "stream-name"));
             aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, -1);
             aud_tuple_associate_int(tuple, FIELD_MTIME, NULL, 0); // this indicates streaming
-            AUDDBG("get_song_tuple: remote: tuple");
+            AUDDBG("get_song_tuple: remote: tuple\n");
             return tuple;
         }
-        AUDDBG("get_song_tuple: remote: NULL");
+        AUDDBG("get_song_tuple: remote: NULL\n");
     } /* info.remote  */
 
     // if !fd, pre-open the file with aud_vfs_fopen() and reuse fd.
@@ -727,7 +727,7 @@
             // genre
             __set_and_free(tuple, FIELD_GENRE, NULL, input_id3_get_string(tag, ID3_FRAME_GENRE));
             __set_and_free(tuple, FIELD_COMMENT, NULL, input_id3_get_string(tag, ID3_FRAME_COMMENT));
-            AUDDBG("genre = %s", aud_tuple_get_string(tuple, FIELD_GENRE, NULL));
+            AUDDBG("genre = %s\n", aud_tuple_get_string(tuple, FIELD_GENRE, NULL));
         }
         id3_file_close(id3file);
     } // id3file
@@ -755,7 +755,7 @@
     if(local_fd)
         aud_vfs_fclose(fd);
 
-    AUDDBG("e: mad: audmad_get_song_tuple");
+    AUDDBG("e: mad: audmad_get_song_tuple\n");
     return tuple;
 }
 
--- a/src/madplug/replaygain.c	Thu Jan 03 15:46:23 2008 +0100
+++ b/src/madplug/replaygain.c	Thu Jan 03 15:48:50 2008 +0100
@@ -203,11 +203,11 @@
 	char *value;
 	struct id3_frame *frame;
 
-	AUDDBG("f: ReadId3v2TXXX");
+	AUDDBG("f: ReadId3v2TXXX\n");
 
 	/* tag must be read before! */
 	if (! file_info->tag ) {
-		AUDDBG("id3v2 not found");
+		AUDDBG("id3v2 not found\n");
 		return 0;
 	}
 
@@ -255,7 +255,7 @@
     VFSFile *fp;
     glong curpos = 0;
 
-    AUDDBG("f: read_replaygain");
+    AUDDBG("f: read_replaygain\n");
 
     file_info->has_replaygain = FALSE;
     file_info->replaygain_album_scale = -1;
@@ -265,10 +265,10 @@
 
     if (ReadId3v2TXXX(file_info)) {
 #ifdef AUD_DEBUG
-        AUDDBG("found ReplayGain info in id3v2 tag");
+        AUDDBG("found ReplayGain info in id3v2 tag\n");
 
 	gchar *tmp = g_filename_to_utf8(file_info->filename, -1, NULL, NULL, NULL);
-        AUDDBG("RG album scale= %g, RG track scale = %g, in %s",
+        AUDDBG("RG album scale= %g, RG track scale = %g, in %s\n",
 		  file_info->replaygain_album_scale,
 		  file_info->replaygain_track_scale, tmp);
         g_free(tmp);
@@ -318,13 +318,13 @@
         }
 #ifdef AUD_DEBUG
         else 
-            AUDDBG("replaygain: not found");
+            AUDDBG("replaygain: not found\n");
 #endif
     }
 #ifdef AUD_DEBUG
     if (res == 0) {             // got APE tags, show the result
         gchar *tmp = g_filename_to_utf8(file_info->filename, -1, NULL, NULL, NULL);        
-        AUDDBG("RG album scale= %g, RG track scale = %g, in %s",
+        AUDDBG("RG album scale= %g, RG track scale = %g, in %s\n",
 		  file_info->replaygain_album_scale,
 		  file_info->replaygain_track_scale, tmp);
         g_free(tmp);
@@ -340,5 +340,5 @@
 
     aud_vfs_fclose(fp);
 
-    AUDDBG("e: read_replaygain");
+    AUDDBG("e: read_replaygain\n");
 }