changeset 1758:8dd3274ec57e

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 21 Sep 2007 02:01:06 +0300
parents 3c43d2d5acd9 (current diff) 99e468c53dff (diff)
children 5911d74d2954
files
diffstat 8 files changed, 81 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/alsa/alsa.c	Fri Sep 21 02:00:40 2007 +0300
+++ b/src/alsa/alsa.c	Fri Sep 21 02:01:06 2007 +0300
@@ -55,8 +55,4 @@
 		free(alsa_cfg.mixer_device);
 		alsa_cfg.mixer_device = NULL;
 	}
-
-	/* release our mutex */
-	g_mutex_free(alsa_mutex);
-	alsa_mutex = NULL;
 }
--- a/src/alsa/alsa.h	Fri Sep 21 02:00:40 2007 +0300
+++ b/src/alsa/alsa.h	Fri Sep 21 02:01:06 2007 +0300
@@ -81,6 +81,6 @@
 int alsa_get_written_time(void);
 void alsa_tell(AFormat * fmt, gint * rate, gint * nch);
 
-extern GMutex *alsa_mutex;
+extern GStaticMutex alsa_mutex;
 
 #endif
--- a/src/alsa/audio.c	Fri Sep 21 02:00:40 2007 +0300
+++ b/src/alsa/audio.c	Fri Sep 21 02:01:06 2007 +0300
@@ -66,7 +66,7 @@
 static gboolean pause_request;	 /* pause status currently requested */
 static int flush_request;	 /* flush status (time) currently requested */
 static int prebuffer_size;
-GMutex *alsa_mutex;
+GStaticMutex alsa_mutex = G_STATIC_MUTEX_INIT;
 
 static guint mixer_timeout;
 
@@ -265,7 +265,7 @@
 
 	g_thread_join(audio_thread);
 
-	g_mutex_lock(alsa_mutex); /* alsa_loop locks alsa_mutex! */
+	g_static_mutex_lock(&alsa_mutex); /* alsa_loop locks alsa_mutex! */
 
 	alsa_cleanup_mixer();
 
@@ -284,7 +284,7 @@
 		snd_output_close(logs);
 	debug("Device closed");
 
-	g_mutex_unlock(alsa_mutex);
+	g_static_mutex_unlock(&alsa_mutex);
 }
 
 /* reopen ALSA PCM */
@@ -679,7 +679,7 @@
 	int npfds = snd_pcm_poll_descriptors_count(alsa_pcm);
 	int wr = 0;
 
-	g_mutex_lock(alsa_mutex);
+	g_static_mutex_lock(&alsa_mutex);
 
 	if (npfds <= 0)
 		goto _error;
@@ -716,7 +716,7 @@
 	}
 
  _error:
-	g_mutex_unlock(alsa_mutex);
+	g_static_mutex_unlock(&alsa_mutex);
 	alsa_close_pcm();
 	g_free(thread_buffer);
 	thread_buffer = NULL;
@@ -740,7 +740,7 @@
 		return 0;
 	}
 
-	g_mutex_lock(alsa_mutex);
+	g_static_mutex_lock(&alsa_mutex);
 
 	if (!mixer)
 		alsa_setup_mixer();
@@ -769,7 +769,7 @@
 	pause_request = FALSE;
 	flush_request = -1;
 
-	g_mutex_unlock(alsa_mutex);
+	g_static_mutex_unlock(&alsa_mutex);
 	
 	audio_thread = g_thread_create((GThreadFunc)alsa_loop, NULL, TRUE, NULL);
 	return 1;
--- a/src/alsa/init.c	Fri Sep 21 02:00:40 2007 +0300
+++ b/src/alsa/init.c	Fri Sep 21 02:01:06 2007 +0300
@@ -55,6 +55,4 @@
 		g_message("Cannot load alsa library: %s", dlerror());
 		/* FIXME, this plugin wont work... */
 	}
-
-	alsa_mutex = g_mutex_new();
 }
--- a/src/neon/neon.c	Fri Sep 21 02:00:40 2007 +0300
+++ b/src/neon/neon.c	Fri Sep 21 02:01:06 2007 +0300
@@ -1,3 +1,22 @@
+/*
+ *  A neon HTTP input plugin for Audacious
+ *  Copyright (C) 2007 Ralf Ertzinger
+ *
+ *  This program 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.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
 #include <audacious/vfs.h>
 #include <audacious/plugin.h>
 
@@ -204,7 +223,7 @@
                      * End of tag name.
                      */
                     *p = '\0';
-                    strcpy(name, tstart);
+                    g_strlcpy(name, tstart, 4096);
                     _DEBUG("Found tag name: %s", name);
                     state = 2;
                 } else {
@@ -233,7 +252,7 @@
                      * End of value
                      */
                     *p = '\0';
-                    strcpy(value, tstart);
+                    g_strlcpy(value, tstart, 4096);
                     _DEBUG("Found tag value: %s", value);
                     add_icy(m, name, value);
                     state = 4;
@@ -940,7 +959,7 @@
          * The maximum number of bytes we can deliver is determined
          * by the number of bytes left until the next metadata announcement
          */
-        belem = h->icy_metaleft / size;
+        belem = MIN(used_rb(&h->rb), h->icy_metaleft) / size;
     } else {
         belem = used_rb(&h->rb) / size;
     }
--- a/src/neon/neon.h	Fri Sep 21 02:00:40 2007 +0300
+++ b/src/neon/neon.h	Fri Sep 21 02:01:06 2007 +0300
@@ -1,3 +1,22 @@
+/*
+ *  A neon HTTP input plugin for Audacious
+ *  Copyright (C) 2007 Ralf Ertzinger
+ *
+ *  This program 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.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
 #ifndef _NEON_PLUGIN_H
 #define _NEON_PLUGIN_H
 
--- a/src/neon/rb.c	Fri Sep 21 02:00:40 2007 +0300
+++ b/src/neon/rb.c	Fri Sep 21 02:01:06 2007 +0300
@@ -1,3 +1,19 @@
+/*
+ *  This program 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.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
 /*
  * Ringbuffer implementation
  *
--- a/src/neon/rb.h	Fri Sep 21 02:00:40 2007 +0300
+++ b/src/neon/rb.h	Fri Sep 21 02:01:06 2007 +0300
@@ -1,3 +1,19 @@
+/*
+ *  This program 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.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
 #ifndef _RB_H
 #define _RB_H