[MPlayer-dev-eng] [PATCH] -ao alsa9:hw:0,0 fix

Wojtek Kaniewski wojtekka at bydg.pdi.net
Fri May 2 14:49:20 CEST 2003


hello,

i could be wrong but it seems that with -ao fallback code it's
impossible to specify alsa9 devices like "hw:0,1", because mplayer
treats "1" as secondary ao. i have made two simple patches -- first one
changes all points followed by a number to commas in alsa device name,
so it's possible to use hw:0,1 by "-ao alsa9:hw:0.1". second patch
adds an example to the manpage.

regards,
wojtek
-------------- next part --------------
--- libao2/ao_alsa9.c.orig	Fri May  2 13:36:40 2003
+++ libao2/ao_alsa9.c	Fri May  2 14:12:48 2003
@@ -317,8 +317,12 @@
 	  }
 	  else if (strcmp(*(token_str+i3), "hw") == 0) {
 	    if ((i3 < i2-1) && (strcmp(*(token_str+i3+1), "noblock") != 0) && (strcmp(*(token_str+i3+1), "mmap") != 0)) {
+              char *tmp;
+
 	      alsa_device = alloca(ALSA_DEVICE_SIZE);
 	      snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%s", *(token_str+(i3+1)));
+	      if ((tmp = strchr(alsa_device, '.')) && isdigit(*(tmp+1)))
+                *tmp = ',';
 	      device_set = 1;
 	    }
 		else {
@@ -421,9 +425,9 @@
 	printf("alsa-help: available options are:\n");
 	printf("           mmap: sets mmap-mode\n");
 	printf("           noblock: sets noblock-mode\n");
-	printf("           device-name: sets device name\n");
-	printf("           example -ao alsa9:mmap:noblock:hw:0,3 sets noblock-mode,\n");
-	printf("           mmap-mode and the device-name as first card third device\n");
+	printf("           device-name: sets device name (change comma to point)\n");
+	printf("           example -ao alsa9:mmap:noblock:hw:0.3 sets noblock-mode,\n");
+	printf("           mmap-mode and the device-name as first card fourth device\n");
 	return(0);
       } else {
 		printf("alsa-init: soundcard set to %s\n", alsa_device);
-------------- next part --------------
--- DOCS/en/mplayer.1.orig	Fri May  2 14:16:44 2003
+++ DOCS/en/mplayer.1	Fri May  2 14:16:13 2003
@@ -1296,6 +1296,9 @@
 .IPs "\-ao oss:/\:dev/\:dsp2,oss:/\:dev/\:dsp1,"
 try to use OSS with the specified sound devices and fallback to others if it
 fails
+.IPs "\-ao alsa9:hw:0.1"
+select second device on first card handled by ALSA (you need to change comma
+to point in device name)
 .IPs "\-ao sdl:esd"
 specify the SDL subdriver
 .RE


More information about the MPlayer-dev-eng mailing list