changeset 1332:b77c70a82d33

Automated merge with ssh://majeru@hg.atheme.org//hg/audacious-plugins
author Cristi Magherusan <majeru@atheme-project.org>
date Sat, 21 Jul 2007 12:46:58 +0300
parents 392ca3811f49 (current diff) f0b81aeed25f (diff)
children c4260daee9bf
files
diffstat 13 files changed, 248 insertions(+), 179 deletions(-) [+]
line wrap: on
line diff
--- a/src/amidi-plug/i_utils.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/amidi-plug/i_utils.c	Sat Jul 21 12:46:58 2007 +0300
@@ -33,6 +33,7 @@
   GtkWidget *hseparator , *hbuttonbox , *button_ok;
   GtkTextBuffer *info_textbuffer;
   GdkPixbuf *logo_pixbuf;
+  gchar *info_textbuffer_content = NULL;
 
   if ( aboutwin != NULL )
     return;
@@ -64,22 +65,22 @@
   gtk_text_view_set_justification( GTK_TEXT_VIEW(info_textview) , GTK_JUSTIFY_LEFT );
   gtk_text_view_set_left_margin( GTK_TEXT_VIEW(info_textview) , 10 );
 
-  gtk_text_buffer_set_text( info_textbuffer ,
-                            "\nAMIDI-Plug " AMIDIPLUG_VERSION
-                            "\nmodular MIDI music player\n"
-                            "http://www.develia.org/projects.php?p=amidiplug\n\n"
-                            "written by Giacomo Lozito\n"
-                            "< james@develia.org >\n\n\n"
-                            "special thanks to...\n\n"
-                            "Clemens Ladisch and Jaroslav Kysela\n"
-                            "for their cool programs aplaymidi and amixer; those\n"
-                            "were really useful, along with alsa-lib docs, in order\n"
-                            "to learn more about the ALSA API\n\n"
-                            "Alfredo Spadafina\n"
-                            "for the nice midi keyboard logo\n\n"
-                            "Tony Vroon\n"
-                            "for the good help with alpha testing\n\n"
-                            , -1 );
+  info_textbuffer_content = g_strjoin( NULL , _("\nAMIDI-Plug ") , AMIDIPLUG_VERSION ,
+                                       _("\nmodular MIDI music player\n"
+                                         "http://www.develia.org/projects.php?p=amidiplug\n\n"
+                                         "written by Giacomo Lozito\n"
+                                         "< james@develia.org >\n\n\n"
+                                         "special thanks to...\n\n"
+                                         "Clemens Ladisch and Jaroslav Kysela\n"
+                                         "for their cool programs aplaymidi and amixer; those\n"
+                                         "were really useful, along with alsa-lib docs, in order\n"
+                                         "to learn more about the ALSA API\n\n"
+                                         "Alfredo Spadafina\n"
+                                         "for the nice midi keyboard logo\n\n"
+                                         "Tony Vroon\n"
+                                         "for the good help with alpha testing\n\n") , NULL );
+  gtk_text_buffer_set_text( info_textbuffer , info_textbuffer_content , -1 );
+  g_free( info_textbuffer_content );
 
   info_scrolledwin = gtk_scrolled_window_new( NULL , NULL );
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(info_scrolledwin) ,
--- a/src/aosd/aosd_ui.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/aosd/aosd_ui.c	Sat Jul 21 12:46:58 2007 +0300
@@ -1096,6 +1096,7 @@
   GtkWidget *bbar_bbox, *bbar_bt_ok;
   GtkTextBuffer *info_tb;
   GdkGeometry abount_win_hints;
+  gchar *info_tb_content = NULL;
 
   if ( about_win != NULL )
   {
@@ -1136,14 +1137,15 @@
   gtk_text_view_set_justification( GTK_TEXT_VIEW(info_tv) , GTK_JUSTIFY_LEFT );
   gtk_text_view_set_left_margin( GTK_TEXT_VIEW(info_tv) , 10 );
 
-  gtk_text_buffer_set_text( info_tb ,
-                            _("\nAudacious OSD " AOSD_VERSION_PLUGIN
-                              "\nhttp://www.develia.org/projects.php?p=aosd\n"
-                              "written by Giacomo Lozito\n"
-                              "< james@develia.org >\n\n"
-                              "On-Screen-Display is based on Ghosd library\n"
-                              "written by Evan Martin\n"
-                              "http://neugierig.org/software/ghosd/\n\n") , -1 );
+  info_tb_content = g_strjoin( NULL , "\nAudacious OSD " , AOSD_VERSION_PLUGIN ,
+                               _("\nhttp://www.develia.org/projects.php?p=audacious#aosd\n"
+                                 "written by Giacomo Lozito\n") ,
+                               "< james@develia.org >\n\n" ,
+                               _("On-Screen-Display is based on Ghosd library\n"
+                                 "written by Evan Martin\n"
+                                 "http://neugierig.org/software/ghosd/\n\n") , NULL );
+  gtk_text_buffer_set_text( info_tb , info_tb_content , -1 );
+  g_free( info_tb_content );
 
   info_tv_sw = gtk_scrolled_window_new( NULL , NULL );
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(info_tv_sw) ,
--- a/src/arts/arts.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/arts/arts.c	Sat Jul 21 12:46:58 2007 +0300
@@ -15,15 +15,15 @@
 static void about(void)
 {
 	static GtkWidget *dialog;
-	
+
 	if (dialog)
 		return;
 
-	dialog = xmms_show_message("About aRts Output",
-				   "aRts output plugin by "
+	dialog = xmms_show_message(_("About aRts Output"),
+				   _("aRts output plugin by "
 				   "H\303\245vard Kv\303\245len <havardk@xmms.org>\n"
-				   "Audacious port by Giacomo Lozito from develia.org",
-				   "Ok", FALSE, NULL, NULL);
+				   "Audacious port by Giacomo Lozito from develia.org"),
+				   _("Ok"), FALSE, NULL, NULL);
 	gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
 			   GTK_SIGNAL_FUNC(gtk_widget_destroyed),
 			   &dialog);
--- a/src/arts/arts.h	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/arts/arts.h	Sat Jul 21 12:46:58 2007 +0300
@@ -26,6 +26,8 @@
 
 #include "audacious/plugin.h"
 #include "audacious/configdb.h"
+#include <audacious/i18n.h>
+# include "config.h"
 
 struct arts_config
 {
--- a/src/arts/configure.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/arts/configure.c	Sat Jul 21 12:46:58 2007 +0300
@@ -10,7 +10,6 @@
  */
 
 #include "arts.h"
-#define _(string) (string)
 
 #include <gtk/gtk.h>
 
@@ -23,7 +22,7 @@
 
 	artsxmms_cfg.buffer_size =
 		gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_spin));
-	
+
 	db = bmp_cfg_db_open();
 	bmp_cfg_db_set_int(db, "arts", "buffer_size", artsxmms_cfg.buffer_size);
 	bmp_cfg_db_close(db);
@@ -43,7 +42,7 @@
 
 	if (configure_win)
 		return;
-	
+
 	configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 	gtk_window_set_type_hint( GTK_WINDOW(configure_win), GDK_WINDOW_TYPE_HINT_DIALOG );
 	gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
@@ -52,23 +51,23 @@
 	gtk_window_set_policy(GTK_WINDOW(configure_win), FALSE, FALSE, FALSE);
 	gtk_window_set_position(GTK_WINDOW(configure_win), GTK_WIN_POS_MOUSE);
 	gtk_container_border_width(GTK_CONTAINER(configure_win), 10);
-	
+
 	vbox = gtk_vbox_new(FALSE, 10);
 	gtk_container_add(GTK_CONTAINER(configure_win), vbox);
-	
+
 	notebook = gtk_notebook_new();
 	gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
-	
+
 	buffer_frame = gtk_frame_new(_("Buffering:"));
 	gtk_container_set_border_width(GTK_CONTAINER(buffer_frame), 5);
-	
+
 	buffer_vbox = gtk_vbox_new(FALSE, 0);
 	gtk_container_add(GTK_CONTAINER(buffer_frame), buffer_vbox);
-	
+
 	buffer_table = gtk_table_new(2, 1, TRUE);
 	gtk_container_set_border_width(GTK_CONTAINER(buffer_table), 5);
 	gtk_box_pack_start(GTK_BOX(buffer_vbox), buffer_table, FALSE, FALSE, 0);
-	
+
 	buffer_size_box = gtk_hbox_new(FALSE, 5);
 	gtk_table_attach_defaults(GTK_TABLE(buffer_table), buffer_size_box, 0, 1, 0, 1);
 	buffer_size_label = gtk_label_new(_("Buffer size (ms):"));
@@ -79,15 +78,15 @@
 	buffer_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(buffer_size_adj), 8, 0);
 	gtk_widget_set_usize(buffer_size_spin, 60, -1);
 	gtk_box_pack_start(GTK_BOX(buffer_size_box), buffer_size_spin, FALSE, FALSE, 0);
-	
+
 	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buffer_frame,
 				 gtk_label_new(_("Buffering")));
-	
+
 	bbox = gtk_hbutton_box_new();
 	gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
 	gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
 	gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
-	
+
 	ok = gtk_button_new_with_label(_("Ok"));
 	cancel = gtk_button_new_with_label(_("Cancel"));
 	GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
@@ -100,6 +99,6 @@
 	gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
 	gtk_widget_grab_default(ok);
 	gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
-	
+
 	gtk_widget_show_all(configure_win);
 }
--- a/src/cdaudio-ng/cdaudio-ng.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/cdaudio-ng/cdaudio-ng.c	Sat Jul 21 12:46:58 2007 +0300
@@ -1,7 +1,6 @@
 
 /*
 	todo: 
-		- fileinfo dialog
 		- about dialog
 */
 
@@ -49,6 +48,7 @@
 static gboolean			debug = FALSE;
 static char				cddb_server[DEF_STRING_LEN];
 static int				cddb_port;
+static InputPlayback	*pglobalinputplayback = NULL;
 
 static void				cdaudio_init();
 static void				cdaudio_about();
@@ -64,7 +64,6 @@
 static gint				cdaudio_set_volume(gint l, gint r);
 static void				cdaudio_cleanup();
 static void				cdaudio_get_song_info(gchar *filename, gchar **title, gint *length);
-static void				cdaudio_file_info_box(gchar *filename);
 static TitleInput		*cdaudio_get_song_tuple(gchar *filename);
 
 static void				*dae_playing_thread_core(dae_params_t *pdae_params);
@@ -96,7 +95,7 @@
 	NULL,
 	NULL,
 	cdaudio_get_song_info,
-	NULL /*cdaudio_file_info_box*/,	// todo: implement a file info dialog
+	NULL,
 	NULL,
 	cdaudio_get_song_tuple
 };
@@ -184,11 +183,17 @@
 		}
 
 			/* reload the cd information if the media has changed */
-		if (cdio_get_media_changed(pcdio)) {
+		if (cdio_get_media_changed(pcdio) && pcdio != NULL) {
 			if (debug)
 				printf("cdaudio-ng: cd changed, rescanning\n");
 			cdaudio_scan_dir(CDDA_DEFAULT);
 		}
+		
+		if (pcdio == NULL) {
+			if (debug)
+				printf("cdaudio-ng: \"%s\" is not our file\n", filename);
+			return FALSE;
+		}
 
 			/* check if the requested track actually exists on the current audio cd */
 		int trackno = find_trackno_from_filename(filename);
@@ -231,21 +236,22 @@
 	}
 	else {
 		char **ppcd_drives = cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false);
-		if (ppcd_drives != NULL) { /* we have at least one audio capable cd drive */
+		pcdio = NULL;
+		if (ppcd_drives != NULL && *ppcd_drives != NULL) { /* we have at least one audio capable cd drive */
 			pcdio = cdio_open(*ppcd_drives, DRIVER_UNKNOWN);
 			if (pcdio == NULL) {
 				fprintf(stderr, "cdaudio-ng: failed to open cd\n");
 				cleanup_on_error();
 				return NULL;
 			}
+			if (debug)
+				printf("cdaudio-ng: found cd drive \"%s\" with audio capable media\n", *ppcd_drives);
 		}
 		else {
 			fprintf(stderr, "cdaudio-ng: unable find or access a cdda capable drive\n");
 			cleanup_on_error();
 			return NULL;
 		}
-		if (debug)
-			printf("cdaudio-ng: found cd drive \"%s\" with audio capable media\n", *ppcd_drives);
 		cdio_free_device_list(ppcd_drives);
 	}
 
@@ -425,6 +431,8 @@
 {
 	if (debug)
 		printf("cdaudio-ng: cdaudio_play_file(\"%s\")\n", pinputplayback->filename);
+	
+	pglobalinputplayback = pinputplayback;
 
 	if (trackinfo == NULL) {
 		if (debug)
@@ -505,6 +513,11 @@
 {
 	if (debug)
 		printf("cdaudio-ng: cdaudio_stop(\"%s\")\n", pinputplayback != NULL ? pinputplayback->filename : "N/A");
+	
+	pglobalinputplayback = NULL;
+	
+	if (playing_track == -1)
+		return;
 
 	if (pinputplayback != NULL)
 		pinputplayback->playing = FALSE;
@@ -521,7 +534,6 @@
 	else {
 		if (cdio_audio_stop(pcdio) != DRIVER_OP_SUCCESS) {
 			fprintf(stderr, "cdaudio-ng: failed to stop analog cd\n");
-			cleanup_on_error();
 			return;
 		}
 	}
@@ -591,21 +603,22 @@
 		if (cdio_audio_read_subchannel(pcdio, &subchannel) != DRIVER_OP_SUCCESS) {
 			fprintf(stderr, "cdaudio-ng: failed to read analog cd subchannel\n");
 			cleanup_on_error();
-			return -1;
+			return 0;
 		}
 		int currlsn = cdio_msf_to_lsn(&subchannel.abs_addr);
 
 			/* check to see if we have reached the end of the song */
-		if (currlsn == trackinfo[playing_track].endlsn) {
-			cdaudio_stop(pinputplayback);
+		if (currlsn == trackinfo[playing_track].endlsn)
 			return -1;
-		}
 
 		return calculate_track_length(trackinfo[playing_track].startlsn, currlsn);
 	}
 	else {
 		if (pdae_params != NULL)
-			return pinputplayback->output->output_time();
+			if (pdae_params->pplayback->playing)
+				return pinputplayback->output->output_time();
+			else
+				return -1;
 		else
 			return -1;
 	}
@@ -707,12 +720,6 @@
 	*length = calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn);
 }
 
-void cdaudio_file_info_box(gchar *filename)
-{
-	if (debug)
-		printf("cdaudio-ng: cdaudio_file_info_box(\"%s\")\n", filename);
-}
-
 TitleInput *cdaudio_get_song_tuple(gchar *filename)
 {
 	if (debug)
@@ -751,6 +758,7 @@
 	cdio_lseek(pcdio, pdae_params->startlsn * CDIO_CD_FRAMESIZE_RAW, SEEK_SET);
 
 	gboolean output_paused = FALSE;
+	int read_error_counter = 0;
 
 	while (pdae_params->pplayback->playing) {
 			/* handle pause status */
@@ -792,8 +800,14 @@
 
 		if (cdio_read_audio_sectors(pcdio, buffer, pdae_params->currlsn, lsncount) != DRIVER_OP_SUCCESS) {
 			fprintf(stderr, "cdaudio-ng: failed to read audio sector\n");
-			/* ok, that's it, we go on */
+			read_error_counter++;
+			if (read_error_counter >= 2) {
+				fprintf(stderr, "cdaudio-ng: this cd can no longer be played, stopping\n");
+				break;
+			}
 		}
+		else
+			read_error_counter = 0;
 
 		int remainingbytes = lsncount * CDIO_CD_FRAMESIZE_RAW;
 		unsigned char *bytebuff = buffer;
@@ -815,7 +829,7 @@
 		printf("cdaudio-ng: dae thread ended\n");
 
 	pdae_params->pplayback->playing = FALSE;
-	playing_track = -1;
+	pdae_params->pplayback->output->close_audio();
 	is_paused = FALSE;
 
 	pdae_params->pplayback->output->close_audio();
@@ -843,14 +857,14 @@
 
 void cleanup_on_error()
 {
-	if (pcdio != NULL) {
-		if (playing_track != -1 && !use_dae)
-			cdio_audio_stop(pcdio);
+	if (playing_track != -1) {
+		playing_track = -1;
+		playback_stop();
 	}
+
 	if (trackinfo != NULL) {
 		free(trackinfo);
 		trackinfo = NULL;
 	}
-	playing_track = -1;
 }
 
--- a/src/evdev-plug/ed_ui.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/evdev-plug/ed_ui.c	Sat Jul 21 12:46:58 2007 +0300
@@ -1445,6 +1445,7 @@
   GtkWidget *bbar_bbox, *bbar_bt_ok;
   GtkTextBuffer *info_tb;
   GdkGeometry abount_win_hints;
+  gchar *info_tb_content = NULL;
 
   if ( about_win != NULL )
   {
@@ -1485,12 +1486,13 @@
   gtk_text_view_set_justification( GTK_TEXT_VIEW(info_tv) , GTK_JUSTIFY_LEFT );
   gtk_text_view_set_left_margin( GTK_TEXT_VIEW(info_tv) , 10 );
 
-  gtk_text_buffer_set_text( info_tb ,
-                            _("\nEvDev-Plug " ED_VERSION_PLUGIN
-                              "\nplayer remote control via event devices\n"
-                              "http://www.develia.org/projects.php?p=evdevplug\n\n"
-                              "written by Giacomo Lozito\n"
-                              "< james@develia.org >\n\n") , -1 );
+  info_tb_content = g_strjoin( NULL , "\nEvDev-Plug " , ED_VERSION_PLUGIN ,
+                               _("\nplayer remote control via event devices\n"
+                                 "http://www.develia.org/projects.php?p=audacious#evdevplug\n\n"
+                                 "written by Giacomo Lozito\n") ,
+                              "< james@develia.org >\n\n" , NULL );
+  gtk_text_buffer_set_text( info_tb , info_tb_content , -1 );
+  g_free( info_tb_content );
 
   info_tv_sw = gtk_scrolled_window_new( NULL , NULL );
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(info_tv_sw) ,
--- a/src/flacng/flacng.h	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/flacng/flacng.h	Sat Jul 21 12:46:58 2007 +0300
@@ -22,6 +22,8 @@
 #include <glib.h>
 #include <audacious/plugin.h>
 #include <audacious/vfs.h>
+#include <audacious/i18n.h>
+# include "config.h"
 
 #define OUTPUT_BLOCK_SIZE (8192u)
 #define MAX_SUPPORTED_CHANNELS (2u)
--- a/src/flacng/plugin.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/flacng/plugin.c	Sat Jul 21 12:46:58 2007 +0300
@@ -413,7 +413,7 @@
                     main_info->stream.samplerate, stream_info.samplerate);
                 break;
             }
-            
+
             if (stream_info.channels != main_info->stream.channels) {
                 _ERROR("Number of channels changed midstream (now: %d, was: %d). This is not supported yet.",
                     main_info->stream.channels, stream_info.channels);
@@ -508,7 +508,7 @@
             /*
              * Yes. Drain the output buffer and stop playing.
              */
-            
+
             _DEBUG("End of stream reached, draining output buffer");
 
             while((-1 == seek_to) && flac_ip.output->buffer_playing() && playback->playing == TRUE) {
@@ -540,7 +540,7 @@
      * Release the play loop mutex
      */
     g_mutex_unlock(flac_pl_mutex);
-    
+
     g_thread_exit(NULL);
 
     _LEAVE NULL;
@@ -739,18 +739,23 @@
 void flac_aboutbox(void) {
 
     static GtkWidget* about_window;
+    gchar *about_text;
 
     if (about_window) {
         gdk_window_raise(about_window->window);
     }
 
+    about_text = g_strjoin("", _("FLAC Audio Plugin "), _VERSION,
+			       _("\n\nOriginal code by\n"
+                               "Ralf Ertzinger <ralf@skytale.net>\n"
+                               "\n"
+                               "http://www.skytale.net/projects/bmp-flac2/"), NULL);
+
     about_window = xmms_show_message(_("About FLAC Audio Plugin"),
-                                     ("FLAC Audio Plugin (" _VERSION ")\n\n"
-                                      "Original code by\n"
-                                      "Ralf Ertzinger <ralf@skytale.net>\n"
-                                      "\n"
-                                      "http://www.skytale.net/projects/bmp-flac2/"),
+                                     about_text,
                                      _("OK"), FALSE, NULL, NULL);
+
+    g_free(about_text);
     g_signal_connect(G_OBJECT(about_window), "destroy",
                      G_CALLBACK(gtk_widget_destroyed), &about_window);
 }
--- a/src/madplug/fileinfo.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/madplug/fileinfo.c	Sat Jul 21 12:46:58 2007 +0300
@@ -29,6 +29,7 @@
 #include <math.h>
 #include <audacious/util.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 
 /* yaz */
 #include <langinfo.h>
@@ -277,6 +278,21 @@
     gtk_widget_set_sensitive(GTK_WIDGET(object), TRUE);
 }
 
+#ifndef NOGUI
+static gboolean
+on_fileinfo_window_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data)
+{
+	g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE);
+
+	if (event->keyval == GDK_Escape)
+	{      
+		gtk_widget_hide(widget);
+	}
+
+	return FALSE;
+}
+#endif
+
 void create_window()
 {
     GtkWidget *vbox, *hbox, *left_vbox, *table;
@@ -293,6 +309,8 @@
     gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
     g_signal_connect(G_OBJECT(window), "destroy",
                        G_CALLBACK(close_window), &window);
+    g_signal_connect(G_OBJECT(window), "key-press-event",
+                       G_CALLBACK(on_fileinfo_window_key_press), &window);
     gtk_container_set_border_width(GTK_CONTAINER(window), 10);
 
     vbox = gtk_vbox_new(FALSE, 10);
@@ -540,6 +558,7 @@
                              G_OBJECT(window));
     GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
     gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
+    gtk_window_set_focus(GTK_WINDOW(window), cancel);
 
     gtk_widget_show_all(window);
 }
--- a/src/madplug/plugin.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/madplug/plugin.c	Sat Jul 21 12:46:58 2007 +0300
@@ -597,7 +597,7 @@
 
 
 // tuple stuff
-static TitleInput *audmad_get_song_tuple(char *filename)
+static TitleInput *__audmad_get_song_tuple(char *filename, VFSFile *fd)
 {
     TitleInput *tuple = NULL;
     gchar *string = NULL;
@@ -657,7 +657,11 @@
 
     tuple = bmp_title_input_new();
 
-    id3file = id3_file_open(filename, ID3_FILE_MODE_READONLY);
+    if (!fd)
+        id3file = id3_file_open(filename, ID3_FILE_MODE_READONLY);
+    else
+        id3file = id3_file_vfsopen(fd, ID3_FILE_MODE_READONLY);
+
     if (id3file) {
 
         tag = id3_file_tag(id3file);
@@ -747,6 +751,18 @@
     return tuple;
 }
 
+static TitleInput *audmad_get_song_tuple(char *filename)
+{
+    return __audmad_get_song_tuple(filename, NULL);
+}
+
+static TitleInput *audmad_probe_for_tuple(char *filename, VFSFile *fd)
+{
+    if (!audmad_is_our_fd(filename, fd))
+        return NULL;
+
+    return __audmad_get_song_tuple(filename, fd);
+}
 
 static gchar *fmts[] = { "mp3", "mp2", "mpg", NULL };
 
@@ -766,7 +782,8 @@
     .get_song_tuple = audmad_get_song_tuple,
     .is_our_file_from_vfs = audmad_is_our_fd,
     .vfs_extensions = fmts,
-    .mseek = audmad_mseek
+    .mseek = audmad_mseek,
+    .probe_for_tuple = audmad_probe_for_tuple
 };
 
 InputPlugin *madplug_iplist[] = { &mad_ip, NULL };
--- a/src/pulse_audio/pulse_audio.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/pulse_audio/pulse_audio.c	Sat Jul 21 12:46:58 2007 +0300
@@ -1,16 +1,16 @@
 /***
   This file is part of xmms-pulse.
- 
+
   xmms-pulse is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
- 
+
   xmms-pulse is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   General Public License for more details.
- 
+
   You should have received a copy of the GNU General Public License
   along with xmms-pulse; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
@@ -32,6 +32,7 @@
 #include <audacious/plugin.h>
 #include <audacious/playlist.h>
 #include <audacious/util.h>
+#include <audacious/i18n.h>
 
 #include <pulse/pulseaudio.h>
 
@@ -81,7 +82,7 @@
 
     snprintf(t, sizeof(t), "%s", u = pa_locale_to_utf8(str));
     pa_xfree(u);
-    
+
     return t;
 }
 
@@ -97,7 +98,7 @@
 
 static void subscribe_cb(struct pa_context *c, enum pa_subscription_event_type t, uint32_t index, void *userdata) {
     pa_operation *o;
-    
+
     assert(c);
 
     if (!stream ||
@@ -110,7 +111,7 @@
         g_warning("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(c)));
         return;
     }
-    
+
     pa_operation_unref(o);
 }
 
@@ -154,7 +155,7 @@
 
     if (userdata)
         *(int*) userdata = success;
-    
+
     pa_threaded_mainloop_signal(mainloop, 0);
 }
 
@@ -163,7 +164,7 @@
 
     if (userdata)
         *(int*) userdata = success;
-    
+
     pa_threaded_mainloop_signal(mainloop, 0);
 }
 
@@ -188,7 +189,7 @@
     if (connected) {
         pa_threaded_mainloop_lock(mainloop);
         CHECK_DEAD_GOTO(fail, 1);
-        
+
         v = volume;
         b = volume_valid;
 
@@ -198,7 +199,7 @@
         v = volume;
         b = volume_valid;
     }
-    
+
     if (b) {
         if (v.channels == 2) {
             *l = (int) ((v.values[0]*100)/PA_VOLUME_NORM);
@@ -210,8 +211,8 @@
 
 static void volume_time_cb(pa_mainloop_api *api, pa_time_event *e, const struct timeval *tv, void *userdata) {
     pa_operation *o;
-    
-    if (!(o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL))) 
+
+    if (!(o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL)))
         g_warning("pa_context_set_sink_input_volume() failed: %s", pa_strerror(pa_context_errno(context)));
     else
         pa_operation_unref(o);
@@ -264,7 +265,7 @@
         g_warning("pa_stream_cork() failed: %s", pa_strerror(pa_context_errno(context)));
         goto fail;
     }
-    
+
     while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
         CHECK_DEAD_GOTO(fail, 1);
         pa_threaded_mainloop_wait(mainloop);
@@ -272,12 +273,12 @@
 
     if (!success)
         g_warning("pa_stream_cork() failed: %s", pa_strerror(pa_context_errno(context)));
-    
+
 fail:
 
     if (o)
         pa_operation_unref(o);
-    
+
     pa_threaded_mainloop_unlock(mainloop);
 }
 
@@ -300,25 +301,25 @@
      * between this means we should trigger the playback */
     if (do_trigger) {
         int success = 0;
-        
+
         if (!(o = pa_stream_trigger(stream, stream_success_cb, &success))) {
             g_warning("pa_stream_trigger() failed: %s", pa_strerror(pa_context_errno(context)));
             goto fail;
         }
-        
+
         while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
             CHECK_DEAD_GOTO(fail, 1);
             pa_threaded_mainloop_wait(mainloop);
         }
-        
+
         if (!success)
             g_warning("pa_stream_trigger() failed: %s", pa_strerror(pa_context_errno(context)));
     }
-    
+
 fail:
     if (o)
         pa_operation_unref(o);
-    
+
     pa_threaded_mainloop_unlock(mainloop);
 
     do_trigger = !!l;
@@ -327,12 +328,12 @@
 
 static int pulse_get_written_time(void) {
     int r = 0;
-    
+
     CHECK_CONNECTED(0);
 
     pa_threaded_mainloop_lock(mainloop);
     CHECK_DEAD_GOTO(fail, 1);
-    
+
     r = (int) (((double) written*1000) / pa_bytes_per_second(pa_stream_get_sample_spec(stream)));
 
 fail:
@@ -344,14 +345,14 @@
 static int pulse_get_output_time(void) {
     int r = 0;
     pa_usec_t t;
-    
+
     CHECK_CONNECTED(0);
 
     pa_threaded_mainloop_lock(mainloop);
 
     for (;;) {
         CHECK_DEAD_GOTO(fail, 1);
-        
+
         if (pa_stream_get_time(stream, &t) >= 0)
             break;
 
@@ -368,13 +369,13 @@
     if (just_flushed) {
         time_offset_msec -= r;
         just_flushed = 0;
-    } 
+    }
 
     r += time_offset_msec;
 
 fail:
     pa_threaded_mainloop_unlock(mainloop);
-    
+
     return r;
 }
 
@@ -383,7 +384,7 @@
     const pa_timing_info *i;
 
     CHECK_CONNECTED(0);
-    
+
     pa_threaded_mainloop_lock(mainloop);
 
     for (;;) {
@@ -391,7 +392,7 @@
 
         if ((i = pa_stream_get_timing_info(stream)))
             break;
-        
+
         if (pa_context_errno(context) != PA_ERR_NODATA) {
             g_warning("pa_stream_get_timing_info() failed: %s", pa_strerror(pa_context_errno(context)));
             goto fail;
@@ -421,7 +422,7 @@
         g_warning("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context)));
         goto fail;
     }
-    
+
     while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
         CHECK_DEAD_GOTO(fail, 1);
         pa_threaded_mainloop_wait(mainloop);
@@ -429,15 +430,15 @@
 
     if (!success)
         g_warning("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context)));
-    
+
     written = (uint64_t) (((double) time * pa_bytes_per_second(pa_stream_get_sample_spec(stream))) / 1000);
     just_flushed = 1;
     time_offset_msec = time;
-    
+
 fail:
     if (o)
         pa_operation_unref(o);
-    
+
     pa_threaded_mainloop_unlock(mainloop);
 }
 
@@ -452,12 +453,12 @@
         g_warning("pa_stream_write() failed: %s", pa_strerror(pa_context_errno(context)));
         goto fail;
     }
-    
+
     do_trigger = 0;
     written += length;
 
 fail:
-    
+
     pa_threaded_mainloop_unlock(mainloop);
 }
 
@@ -474,7 +475,7 @@
         g_warning("pa_stream_drain() failed: %s", pa_strerror(pa_context_errno(context)));
         goto fail;
     }
-    
+
     while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
         CHECK_DEAD_GOTO(fail, 1);
         pa_threaded_mainloop_wait(mainloop);
@@ -482,11 +483,11 @@
 
     if (!success)
         g_warning("pa_stream_drain() failed: %s", pa_strerror(pa_context_errno(context)));
-    
+
 fail:
     if (o)
         pa_operation_unref(o);
-    
+
     pa_threaded_mainloop_unlock(mainloop);
 }
 
@@ -510,7 +511,7 @@
         pa_context_unref(context);
         context = NULL;
     }
-    
+
     if (mainloop) {
         pa_threaded_mainloop_free(mainloop);
         mainloop = NULL;
@@ -528,7 +529,7 @@
     g_assert(!context);
     g_assert(!stream);
     g_assert(!connected);
-    
+
     if (fmt == FMT_U8)
         ss.format = PA_SAMPLE_U8;
     else if (fmt == FMT_S16_LE)
@@ -558,7 +559,7 @@
     }
 
     pa_threaded_mainloop_lock(mainloop);
-    
+
     if (!(context = pa_context_new(pa_threaded_mainloop_get_api(mainloop), "Audacious"))) {
         g_warning("Failed to allocate context");
         goto unlock_and_fail;
@@ -612,7 +613,7 @@
         g_warning("pa_context_subscribe() failed: %s", pa_strerror(pa_context_errno(context)));
         goto unlock_and_fail;
     }
-    
+
     success = 0;
     while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
         CHECK_DEAD_GOTO(fail, 1);
@@ -631,7 +632,7 @@
         g_warning("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(context)));
         goto unlock_and_fail;
     }
-    
+
     while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
         CHECK_DEAD_GOTO(fail, 1);
         pa_threaded_mainloop_wait(mainloop);
@@ -648,34 +649,34 @@
     just_flushed = 0;
     connected = 1;
     volume_time_event = NULL;
-    
+
     pa_threaded_mainloop_unlock(mainloop);
-    
+
     return TRUE;
 
 unlock_and_fail:
 
     if (o)
         pa_operation_unref(o);
-    
+
     pa_threaded_mainloop_unlock(mainloop);
-    
+
 fail:
 
     pulse_close();
-    
+
     return FALSE;
 }
 
 static void pulse_about(void) {
     static GtkWidget *dialog;
-    
+
     if (dialog != NULL)
         return;
-    
+
     dialog = xmms_show_message(
-            "About Audacious PulseAudio Output Plugin",
-            "Audacious PulseAudio Output Plugin\n\n "
+            _("About Audacious PulseAudio Output Plugin"),
+            _("Audacious PulseAudio Output Plugin\n\n "
             "This program is free software; you can redistribute it and/or modify\n"
             "it under the terms of the GNU General Public License as published by\n"
             "the Free Software Foundation; either version 2 of the License, or\n"
@@ -689,12 +690,12 @@
             "You should have received a copy of the GNU General Public License\n"
             "along with this program; if not, write to the Free Software\n"
             "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n"
-            "USA.",
-            "OK",
+            "USA."),
+            _("OK"),
             FALSE,
             NULL,
             NULL);
-    
+
     gtk_signal_connect(
             GTK_OBJECT(dialog),
             "destroy",
@@ -707,21 +708,21 @@
         NULL,
         "PulseAudio Output Plugin",
         NULL,
-	NULL,                        
+	NULL,
         pulse_about,
         NULL,
         pulse_get_volume,
         pulse_set_volume,
-        pulse_open,                         
-        pulse_write,                        
-        pulse_close,                        
-        pulse_flush,                        
-        pulse_pause,                        
-        pulse_free,                         
-        pulse_playing,                      
-        pulse_get_output_time,              
+        pulse_open,
+        pulse_write,
+        pulse_close,
+        pulse_flush,
+        pulse_pause,
+        pulse_free,
+        pulse_playing,
+        pulse_get_output_time,
         pulse_get_written_time,
-	NULL,             
+	NULL,
 };
 
 OutputPlugin *pulse_oplist[] = { &pulse_op, NULL };
--- a/src/tta/libtta.c	Sat Jul 21 01:52:04 2007 +0300
+++ b/src/tta/libtta.c	Sat Jul 21 12:46:58 2007 +0300
@@ -84,7 +84,7 @@
 
 gchar *tta_fmts[] = { "tta", NULL };
 
-InputPlugin tta_ip = 
+InputPlugin tta_ip =
 {
 	NULL,
 	NULL,
@@ -108,7 +108,7 @@
 	NULL,
 	NULL,
 	get_song_info,
-	file_info,	
+	file_info,
 	NULL,
 	get_song_tuple, // get_song_tuple
 	NULL, // set_song_tuple
@@ -131,7 +131,7 @@
 	{
 	    vfs_fseek (f, 0, SEEK_END);
 	    size = vfs_ftell (f);
-	    vfs_fclose (f); 
+	    vfs_fclose (f);
 	}
 	return size;
 }
@@ -146,30 +146,30 @@
 	switch (error)
 	{
         case OPEN_ERROR:
-	    message = "Can't open file\n";
+	    message = _("Can't open file\n");
 	    break;
         case FORMAT_ERROR:
-	    message = "Not supported file format\n";
+	    message = _("Not supported file format\n");
 	    break;
         case FILE_ERROR:
-	    message = "File is corrupted\n";
+	    message = _("File is corrupted\n");
 	    break;
         case READ_ERROR:
-	    message = "Can't read from file\n";
+	    message = _("Can't read from file\n");
 	    break;
         case MEMORY_ERROR:
-	    message = "Insufficient memory available\n";
+	    message = _("Insufficient memory available\n");
 	    break;
         case OUTPUT_ERROR:
-	    message = "Output plugin error\n";
+	    message = _("Output plugin error\n");
 	    break;
 	default:
-	    message = "Unknown error\n";
+	    message = _("Unknown error\n");
 	    break;
 	}
 
-	xmms_show_message ("TTA Decoder Error", message,
-	    "Ok", FALSE, NULL, NULL);
+	xmms_show_message (_("TTA Decoder Error"), message,
+	    _("Ok"), FALSE, NULL, NULL);
 
 	gtk_signal_connect(GTK_OBJECT(errorbox), "destroy",
     	    G_CALLBACK(gtk_widget_destroyed), &errorbox);
@@ -275,14 +275,19 @@
 about ()
 {
 	static GtkWidget *aboutbox;
+        gchar *about_text;
+
 	if (aboutbox != NULL) return;
 
-	aboutbox = xmms_show_message(
-	    "About True Audio Plugin",
-	    "TTA input plugin" PLUGIN_VERSION "for BMP\n"
-	    "Copyright (c) 2004 True Audio Software\n"
-	    PROJECT_URL, "Ok", FALSE, NULL, NULL);
+	about_text = g_strjoin("", _("TTA input plugin "), PLUGIN_VERSION,
+				   _(" for BMP\n"
+		        	   "Copyright (c) 2004 True Audio Software\n"), PROJECT_URL, NULL);
 
+	aboutbox = xmms_show_message(_("About True Audio Plugin"),
+				     about_text,
+				     _("Ok"), FALSE, NULL, NULL);
+
+	g_free(about_text);
 	gtk_signal_connect(GTK_OBJECT(aboutbox), "destroy",
     	    G_CALLBACK(gtk_widget_destroyed), &aboutbox);
 }
@@ -311,13 +316,13 @@
 	    gtk_signal_connect(GTK_OBJECT(window), "destroy",
 		G_CALLBACK(gtk_widget_destroyed), &window);
 	    gtk_container_set_border_width(GTK_CONTAINER(window), 10);
-    
+
 	    vbox = gtk_vbox_new(FALSE, 10);
 	    gtk_container_add(GTK_CONTAINER(window), vbox);
 
 	    filename_hbox = gtk_hbox_new(FALSE, 5);
 	    gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0);
-	    label = gtk_label_new("Filename:");
+	    label = gtk_label_new(_("Filename:"));
 	    gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0);
 
 	    filename_entry = gtk_entry_new_with_max_length(1024);
@@ -329,14 +334,14 @@
 	    left_vbox = gtk_vbox_new(FALSE, 10);
 	    gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0);
 
-	    info_frame = gtk_frame_new("ID3 Tag:");
+	    info_frame = gtk_frame_new(_("ID3 Tag:"));
 	    gtk_box_pack_start(GTK_BOX(left_vbox), info_frame, FALSE, FALSE, 0);
 
 	    table = gtk_table_new(5, 5, FALSE);
 	    gtk_container_set_border_width(GTK_CONTAINER(table), 5);
 	    gtk_container_add(GTK_CONTAINER(info_frame), table);
 
-	    label = gtk_label_new("Title:");
+	    label = gtk_label_new(_("Title:"));
 	    gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 	    gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 5);
 
@@ -346,7 +351,7 @@
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK,
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
 
-	    label = gtk_label_new("Artist:");
+	    label = gtk_label_new(_("Artist:"));
 	    gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 	    gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
 		GTK_FILL, GTK_FILL, 5, 5);
@@ -357,7 +362,7 @@
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK,
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
 
-	    label = gtk_label_new("Album:");
+	    label = gtk_label_new(_("Album:"));
 	    gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 	    gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3,
 		GTK_FILL, GTK_FILL, 5, 5);
@@ -368,7 +373,7 @@
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK,
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
 
-	    label = gtk_label_new("Comment:");
+	    label = gtk_label_new(_("Comment:"));
 	    gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 	    gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4,
 		GTK_FILL, GTK_FILL, 5, 5);
@@ -379,7 +384,7 @@
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK,
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
 
-	    label = gtk_label_new("Year:");
+	    label = gtk_label_new(_("Year:"));
 	    gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 	    gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5,
 		GTK_FILL, GTK_FILL, 5, 5);
@@ -391,7 +396,7 @@
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK,
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
 
- 	    label = gtk_label_new("Track number:");
+ 	    label = gtk_label_new(_("Track number:"));
 	    gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 	    gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5,
 		GTK_FILL, GTK_FILL, 5, 5);
@@ -403,7 +408,7 @@
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK,
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
 
-	    label = gtk_label_new("Genre:");
+	    label = gtk_label_new(_("Genre:"));
 	    gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 	    gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6,
 		GTK_FILL, GTK_FILL, 5, 5);
@@ -415,7 +420,7 @@
         	GTK_FILL | GTK_EXPAND | GTK_SHRINK,
 		GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
 
-	    button_ok = gtk_button_new_with_label("Ok");
+	    button_ok = gtk_button_new_with_label(_("Ok"));
 	    gtk_signal_connect_object(GTK_OBJECT(button_ok), "clicked",
 		G_CALLBACK(gtk_widget_destroy), G_OBJECT(window));
 	    GTK_WIDGET_SET_FLAGS(button_ok, GTK_CAN_DEFAULT);
@@ -429,7 +434,7 @@
 	title = g_strdup_printf(_("File Info - %s"), g_basename(utf_filename));
 	gtk_window_set_title(GTK_WINDOW(window), title);
 	g_free(title);
-    
+
 	gtk_entry_set_text(GTK_ENTRY(filename_entry), utf_filename);
 	gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1);
 
@@ -512,7 +517,7 @@
 	        (info.SAMPLERATE * info.NCH * info.BPS));
 
 	tta_ip.set_info (title, 1000 * info.LENGTH, bitrate, info.SAMPLERATE, info.NCH);
-    
+
 	if (title)
 	    g_free (title);
 
@@ -819,7 +824,7 @@
     string = NULL;
 #ifdef DEBUG
     g_print("string = %s\n", rtn);
-#endif    
+#endif
 
     return rtn;
 }