[MPlayer-users] can't control volume on multiple mplayer instances using esd!

Benjamin Osheroff ben at gimbo.net
Sun Dec 14 13:57:00 CET 2003


On Sun, 14 Dec 2003 01:11:12 -0800 (PST)
dave giffin <givdav01 at yahoo.com> wrote:

> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> I would like to be able to playback multiple audio and
> or video clips and have the audio from all of them
> play out of my sound card. Since only one program can
> have access to my sound card(/dev/dsp), I am using
> 'esd', which allows multiple mplayer instances
> simultaneous access to my sound card. 

Try this patch to libao2/ao_esd.c, should fix it.

diff -u -r1.5 ao_esd.c
--- ao_esd.c	10 Dec 2003 12:19:13 -0000	1.5
+++ ao_esd.c	14 Dec 2003 12:58:58 -0000
@@ -48,7 +48,7 @@
 #endif
 
 
-#define	ESD_CLIENT_NAME	"MPlayer"
+#define	ESD_CLIENT_NAME	"MPlayer."
 #define	ESD_MAX_DELAY	(1.0f)	/* max amount of data buffered in esd (#sec) */
 
 static ao_info_t info =
@@ -68,6 +68,7 @@
 static int esd_bytes_per_sample;
 static unsigned long esd_samples_written;
 static struct timeval esd_play_start;
+static char clientname[9 + sizeof(pid_t)];
 extern float audio_delay;
 
 /*
@@ -94,7 +95,7 @@
 	    return CONTROL_ERROR;
 
 	for (esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next)
-	    if (strcmp(esd_pi->name, ESD_CLIENT_NAME) == 0)
+	    if (strcmp(esd_pi->name, clientname) == 0)
 		break;
 
 	if (esd_pi != NULL) {
@@ -115,7 +116,7 @@
 	    return CONTROL_ERROR;
 
 	for (esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next)
-	    if (strcmp(esd_pi->name, ESD_CLIENT_NAME) == 0)
+	    if (strcmp(esd_pi->name, clientname) == 0)
 		break;
 
 	if (esd_pi != NULL) {
@@ -234,9 +235,10 @@
 	       "AO: [esd] latency: [server: %0.2fs, net: %0.2fs] "
 	       "(adjust %0.2fs)\n", lag_serv, lag_net, lag_seconds);
     }
-    
+ 
+    snprintf(clientname, 9 + sizeof(pid_t), "%s.%d", ESD_CLIENT_NAME, getpid()); 
     esd_play_fd = esd_play_stream_fallback(esd_fmt, rate_hz,
-					   server, ESD_CLIENT_NAME);
+					   server, clientname);
     if (esd_play_fd < 0) {
 	mp_msg(MSGT_AO, MSGL_ERR,
 	       "AO: [esd] failed to open esd playback stream: %s\n",



More information about the MPlayer-users mailing list