changeset 2464:590ab274e759

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 27 Mar 2008 04:15:28 +0200
parents 0c2b8d901d47 (current diff) 85e03a981a7c (diff)
children 2df887365f92
files
diffstat 9 files changed, 124 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/src/alsa/audio.c	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/alsa/audio.c	Thu Mar 27 04:15:28 2008 +0200
@@ -53,7 +53,8 @@
 static snd_mixer_elem_t *pcm_element;
 static snd_mixer_t *mixer;
 
-static gboolean going, paused, mixer_start = TRUE;
+static volatile gboolean going;
+static gboolean paused, mixer_start = TRUE;
 static gboolean prebuffer, remove_prebuffer;
 
 static gboolean alsa_can_pause;
@@ -64,7 +65,7 @@
 static char *thread_buffer;	 /* audio intermediate buffer */
 static int rd_index, wr_index;	 /* current read/write position in int-buffer */
 static gboolean pause_request;	 /* pause status currently requested */
-static int flush_request;	 /* flush status (time) currently requested */
+static volatile int flush_request;	 /* flush status (time) currently requested */
 static int prebuffer_size;
 GStaticMutex alsa_mutex = G_STATIC_MUTEX_INIT;
 
@@ -329,7 +330,7 @@
 void alsa_flush(int time)
 {
 	flush_request = time;
-	while (flush_request != -1)
+	while ((flush_request != -1) && (going))
 		g_usleep(10000);
 }
 
--- a/src/cdaudio-ng/cdaudio-ng.c	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/cdaudio-ng/cdaudio-ng.c	Thu Mar 27 04:15:28 2008 +0200
@@ -200,8 +200,6 @@
 		cdng_cfg.use_dae, cdng_cfg.limitspeed, cdng_cfg.use_cdtext, cdng_cfg.use_cddb,
 		cdng_cfg.cddb_server, cdng_cfg.cddb_port, cdng_cfg.cddb_http, cdng_cfg.device, cdng_cfg.debug);
 
-	configure_create_gui();
-
 	menu_item_text = _("Add CD");
 	main_menu_item = gtk_image_menu_item_new_with_label(menu_item_text);
 	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(main_menu_item), gtk_image_new_from_stock(GTK_STOCK_CDROM, GTK_ICON_SIZE_MENU));
--- a/src/cdaudio-ng/configure.c	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/cdaudio-ng/configure.c	Thu Mar 27 04:15:28 2008 +0200
@@ -9,29 +9,29 @@
 
 extern cdng_cfg_t cdng_cfg;
 
-static GtkWidget *configwindow,
-		*okbutton,
-		*cancelbutton,
-		*maintable,
-		*daeframe,
-		*titleinfoframe,
-		*miscframe,
-		*daetable,
-		*titleinfotable,
-		*misctable,
-		*limitcheckbutton,
-		*usecdtextcheckbutton,
-		*usecddbcheckbutton,
-		*cddbserverlabel,
-		*cddbportlabel,
-		*cddbserverentry,
-		*cddbportentry,
-		*cddbhttpcheckbutton,
-		*usedevicecheckbutton,
-		*buttonbox,
-		*limitspinbutton,
-		*deviceentry,
-		*debugcheckbutton;
+static GtkWidget *configwindow = NULL,
+                 *okbutton = NULL,
+                 *cancelbutton = NULL,
+                 *maintable = NULL,
+                 *daeframe = NULL,
+                 *titleinfoframe = NULL,
+                 *miscframe = NULL,
+                 *daetable = NULL,
+                 *titleinfotable = NULL,
+                 *misctable = NULL,
+                 *limitcheckbutton = NULL,
+                 *usecdtextcheckbutton = NULL,
+                 *usecddbcheckbutton = NULL,
+                 *cddbserverlabel = NULL,
+                 *cddbportlabel = NULL,
+                 *cddbserverentry = NULL,
+                 *cddbportentry = NULL,
+                 *cddbhttpcheckbutton = NULL,
+                 *usedevicecheckbutton = NULL,
+                 *buttonbox = NULL,
+                 *limitspinbutton = NULL,
+                 *deviceentry = NULL,
+                 *debugcheckbutton = NULL;
 
 
 static void configure_values_to_gui(void)
@@ -265,6 +265,9 @@
 
 void configure_show_gui(void)
 {
+    if (configwindow == NULL)
+        configure_create_gui();
+
 	configure_values_to_gui();
 	gtk_widget_show(configwindow);
 	gtk_window_present(GTK_WINDOW(configwindow));
--- a/src/filewriter/mp3.c	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/filewriter/mp3.c	Thu Mar 27 04:15:28 2008 +0200
@@ -198,7 +198,8 @@
 
 static gint mp3_open(void)
 {
-    if ((gfp = lame_init()) == (void *)-1)
+    gfp = lame_init();
+    if (gfp == NULL)
         return 0;
 
     /* setup id3 data */
@@ -206,9 +207,6 @@
 
     if (tuple) {
         /* XXX write UTF-8 even though libmp3lame does id3v2.3. --yaz */
-
-        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);
 
@@ -227,8 +225,15 @@
         lameid3.track_number = g_strdup_printf("%d", aud_tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL));
         id3tag_set_track(gfp, lameid3.track_number);
 
-        //        id3tag_write_v1(gfp);
-        id3tag_add_v2(gfp);
+        if(force_v2_val) {
+            id3tag_add_v2(gfp);
+        }
+        if(only_v1_val) {
+            id3tag_v1_only(gfp);
+        }
+        if(only_v2_val) {
+            id3tag_v2_only(gfp);
+        }
     }
 
     /* input stream description */
@@ -309,9 +314,10 @@
         encout = lame_encode_flush_nogap(gfp, encbuffer, ENCBUFFER_SIZE);
         aud_vfs_fwrite(encbuffer, 1, encout, output_file);
 
-        //        lame_mp3_tags_fid(gfp, output_file); // will erase id3v2 tag??
+//        lame_mp3_tags_fid(gfp, output_file); // will erase id3v2 tag??
 
         lame_close(gfp);
+        AUDDBG("lame_close() done\n");
 
         free_lameid3(&lameid3);
 
--- a/src/madplug/plugin.c	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/madplug/plugin.c	Thu Mar 27 04:15:28 2008 +0200
@@ -98,7 +98,7 @@
     audmad_config = g_malloc0(sizeof(audmad_config_t));
 
     audmad_config->dither = TRUE;
-    audmad_config->force_reopen_audio = FALSE;
+    audmad_config->force_reopen_audio = TRUE;
     audmad_config->fast_play_time_calc = TRUE;
     audmad_config->use_xing = TRUE;
     audmad_config->sjis = FALSE;
--- a/src/modplug/archive/open.cxx	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/modplug/archive/open.cxx	Thu Mar 27 04:15:28 2008 +0200
@@ -11,102 +11,114 @@
 #include "arch_rar.h"
 #include "arch_bz2.h"
 
-Archive* OpenArchive(const string& aFileName)
+Archive* OpenArchive(const string& aFileName) //aFilename is url --yaz
 {
 	string lExt;
 	uint32 lPos;
 
-	lPos = aFileName.find_last_of('.');
-	if(lPos > aFileName.length())
+	// convert from uri to fs based filepath
+	gchar *filename;
+	filename = g_filename_from_uri(aFileName.c_str(), NULL, NULL);
+	string lRealFileName(filename);
+	g_free(filename);
+
+	lPos = lRealFileName.find_last_of('.');
+	if(lPos > lRealFileName.length())
 		return NULL;
-	lExt = aFileName.substr(lPos);
+	lExt = lRealFileName.substr(lPos);
 	for(uint32 i = 0; i < lExt.length(); i++)
 		lExt[i] = tolower(lExt[i]);
 
 	if (lExt == ".mdz")
-		return new arch_Zip(aFileName);
+		return new arch_Zip(lRealFileName);
 	if (lExt == ".mdr")
-		return new arch_Rar(aFileName);
+		return new arch_Rar(lRealFileName);
 	if (lExt == ".mdgz")
-		return new arch_Gzip(aFileName);
+		return new arch_Gzip(lRealFileName);
 	if (lExt == ".mdbz")
-		return new arch_Bzip2(aFileName);
+		return new arch_Bzip2(lRealFileName);
 	if (lExt == ".s3z")
-		return new arch_Zip(aFileName);
+		return new arch_Zip(lRealFileName);
 	if (lExt == ".s3r")
-		return new arch_Rar(aFileName);
+		return new arch_Rar(lRealFileName);
 	if (lExt == ".s3gz")
-		return new arch_Gzip(aFileName);
+		return new arch_Gzip(lRealFileName);
 	if (lExt == ".xmz")
-		return new arch_Zip(aFileName);
+		return new arch_Zip(lRealFileName);
 	if (lExt == ".xmr")
-		return new arch_Rar(aFileName);
+		return new arch_Rar(lRealFileName);
 	if (lExt == ".xmgz")
-		return new arch_Gzip(aFileName);
+		return new arch_Gzip(lRealFileName);
 	if (lExt == ".itz")
-		return new arch_Zip(aFileName);
+		return new arch_Zip(lRealFileName);
 	if (lExt == ".itr")
-		return new arch_Rar(aFileName);
+		return new arch_Rar(lRealFileName);
 	if (lExt == ".itgz")
-		return new arch_Gzip(aFileName);
+		return new arch_Gzip(lRealFileName);
 	if (lExt == ".zip")
-		return new arch_Zip(aFileName);
+		return new arch_Zip(lRealFileName);
 	if (lExt == ".rar")
-		return new arch_Rar(aFileName);
+		return new arch_Rar(lRealFileName);
 	if (lExt == ".gz")
-		return new arch_Gzip(aFileName);
+		return new arch_Gzip(lRealFileName);
 	if (lExt == ".bz2")
-		return new arch_Bzip2(aFileName);
+		return new arch_Bzip2(lRealFileName);
 
-	return new arch_Raw(aFileName);
+	return new arch_Raw(lRealFileName);
 }
 
-bool ContainsMod(const string& aFileName)
+bool ContainsMod(const string& aFileName) //aFilename is url --yaz
 {
 	string lExt;
 	uint32 lPos;
 
-	lPos = aFileName.find_last_of('.');
-	if(lPos > aFileName.length())
+	// convert from uri to fs based filepath
+	gchar *filename;
+	filename = g_filename_from_uri(aFileName.c_str(), NULL, NULL);
+	string lRealFileName(filename);
+	g_free(filename);
+
+	lPos = lRealFileName.find_last_of('.');
+	if(lPos > lRealFileName.length())
 		return false;
-	lExt = aFileName.substr(lPos);
+	lExt = lRealFileName.substr(lPos);
 	for(uint32 i = 0; i < lExt.length(); i++)
 		lExt[i] = tolower(lExt[i]);
 
 	if (lExt == ".mdz")
-		return arch_Zip::ContainsMod(aFileName);
+		return arch_Zip::ContainsMod(lRealFileName);
 	if (lExt == ".mdr")
-		return arch_Rar::ContainsMod(aFileName);
+		return arch_Rar::ContainsMod(lRealFileName);
 	if (lExt == ".mdgz")
-		return arch_Gzip::ContainsMod(aFileName);
+		return arch_Gzip::ContainsMod(lRealFileName);
 	if (lExt == ".mdbz")
-		return arch_Bzip2::ContainsMod(aFileName);
+		return arch_Bzip2::ContainsMod(lRealFileName);
 	if (lExt == ".s3z")
-		return arch_Zip::ContainsMod(aFileName);
+		return arch_Zip::ContainsMod(lRealFileName);
 	if (lExt == ".s3r")
-		return arch_Rar::ContainsMod(aFileName);
+		return arch_Rar::ContainsMod(lRealFileName);
 	if (lExt == ".s3gz")
-		return arch_Gzip::ContainsMod(aFileName);
+		return arch_Gzip::ContainsMod(lRealFileName);
 	if (lExt == ".xmz")
-		return arch_Zip::ContainsMod(aFileName);
+		return arch_Zip::ContainsMod(lRealFileName);
 	if (lExt == ".xmr")
-		return arch_Rar::ContainsMod(aFileName);
+		return arch_Rar::ContainsMod(lRealFileName);
 	if (lExt == ".xmgz")
-		return arch_Gzip::ContainsMod(aFileName);
+		return arch_Gzip::ContainsMod(lRealFileName);
 	if (lExt == ".itz")
-		return arch_Zip::ContainsMod(aFileName);
+		return arch_Zip::ContainsMod(lRealFileName);
 	if (lExt == ".itr")
-		return arch_Rar::ContainsMod(aFileName);
+		return arch_Rar::ContainsMod(lRealFileName);
 	if (lExt == ".itgz")
-		return arch_Gzip::ContainsMod(aFileName);
+		return arch_Gzip::ContainsMod(lRealFileName);
 	if (lExt == ".zip")
-		return arch_Zip::ContainsMod(aFileName);
+		return arch_Zip::ContainsMod(lRealFileName);
 	if (lExt == ".rar")
-		return arch_Rar::ContainsMod(aFileName);
+		return arch_Rar::ContainsMod(lRealFileName);
 	if (lExt == ".gz")
-		return arch_Gzip::ContainsMod(aFileName);
+		return arch_Gzip::ContainsMod(lRealFileName);
 	if (lExt == ".bz2")
-		return arch_Bzip2::ContainsMod(aFileName);
+		return arch_Bzip2::ContainsMod(lRealFileName);
 
-	return arch_Raw::ContainsMod(aFileName);
+	return arch_Raw::ContainsMod(lRealFileName);
 }
--- a/src/modplug/modplugbmp.cxx	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/modplug/modplugbmp.cxx	Thu Mar 27 04:15:28 2008 +0200
@@ -1,3 +1,4 @@
+#define AUD_DEBUG 1
 /* Modplug XMMS Plugin
  * Authors: Kenton Varda <temporal@gauge3d.org>
  *
@@ -238,6 +239,10 @@
 		return ContainsMod(aFilename);
 	if (lExt == ".bz2")
 		return ContainsMod(aFilename);
+	if (lExt == ".rar")
+		return ContainsMod(aFilename);
+	if (lExt == ".rb")
+		return ContainsMod(aFilename);
 
 	return false;
 }
--- a/src/modplug/plugin.cxx	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/modplug/plugin.cxx	Thu Mar 27 04:15:28 2008 +0200
@@ -4,6 +4,8 @@
  * This source code is public domain.
  */
 
+// #define AUD_DEBUG 1
+
 #include "modplug.h"
 #include "gui/main.h"
 extern "C" {
@@ -20,6 +22,7 @@
 
 static int CanPlayFileFromVFS(char* aFilename, VFSFile *VFSFile)
 {
+    AUDDBG("aFilename=%s\n", aFilename);
     if(gModplugXMMS.CanPlayFileFromVFS(aFilename, VFSFile))
         return 1;
     return 0;
@@ -27,7 +30,7 @@
 
 static void PlayFile(InputPlayback *data)
 {
-        char* aFilename = data->filename;
+    char* aFilename = data->filename;
     gModplugXMMS.SetOutputPlugin(*data->output);
     gModplugXMMS.PlayFile(aFilename, data);
 }
@@ -81,7 +84,9 @@
 const gchar *fmts[] =
     { "amf", "ams", "dbm", "dbf", "dsm", "far", "mdl", "stm", "ult", "j2b", "mt2",
       "mdz", "mdr", "mdgz", "mdbz", "mod", "s3z", "s3r", "s3gz", "s3m", "xmz", "xmr", "xmgz",
-      "itz", "itr", "itgz", "dmf", "umx", "it", "669", "xm", "mtm", "psm", "ft2", NULL };
+      "itz", "itr", "itgz", "dmf", "umx", "it", "669", "xm", "mtm", "psm", "ft2",
+      "zip", "gz", "bz2", "rar", "rb",
+      NULL };
 
 InputPlugin gModPlug =
 {
@@ -114,7 +119,11 @@
     NULL,
     NULL,
     CanPlayFileFromVFS, // vfs
-    (gchar **)fmts
+    (gchar **)fmts,
+    NULL,
+    NULL,
+    TRUE,   // subtune. to exclude .zip etc which doesn't contain any mod file --yaz
+    NULL
 };
 
 InputPlugin *modplug_iplist[] = { &gModPlug, NULL };
--- a/src/xspf/xspf.c	Tue Mar 25 22:04:31 2008 +0200
+++ b/src/xspf/xspf.c	Thu Mar 27 04:15:28 2008 +0200
@@ -367,7 +367,7 @@
     if (playlist->attribute & PLAYLIST_USE_RELATIVE) {
         /* prescan to determine base uri */
         for (node = playlist->entries; node != NULL; node = g_list_next(node)) {
-            gchar *ptr1, *ptr2;
+            gchar *ptr1, *ptr2, *ptrslash;
             PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
             gchar *tmp;
             gint tmplen = 0;
@@ -385,15 +385,18 @@
             }
             
             ptr1 = base;
-            ptr2 = tmp;
+            ptrslash = ptr2 = tmp;
 
             while(ptr1 && ptr2 && *ptr1 && *ptr2 && *ptr1 == *ptr2) {
+                if (*ptr2 == '/') ptrslash = ptr2 + 1;
+
                 ptr1++;
                 ptr2++;
             }
             
-            *ptr2 = '\0';       //terminate
-            tmplen = ptr2 - tmp;
+            if (!(*ptrslash)) ptrslash--;
+            *ptrslash = '\0';       //terminate
+            tmplen = ptrslash - tmp;
 
             if (tmplen <= baselen) {
                 g_free(base);