[MPlayer-users] problems with ao_alsa

Marcel Sebek sebek64 at post.cz
Thu May 27 19:21:58 CEST 2004


Hi.

I upgraded mplayer from dev-CVS-040418-17:22-3.3.3 version to the latest
cvs version. But there was some problems with ao=alsa. In the previous
version I used ao=alsa1x, now it isn't available anymore. I had to
change it to ao=alsa.

When I ran 'mplayer -ao alsa somefile' either signal 11 or 6 was sent to
mplayer. Thus I did some debugging. I diffed ao_alsa.c and ao_alsa1x.c
and removed printf/mp_msg lines from the result. Then I was "backporting"
each change if it helps.

The crash was fixed by this change:


--- libao2/ao_alsa.c.old	2004-05-25 17:10:53.000000000 +0200
+++ libao2/ao_alsa.c	2004-05-25 18:17:07.000000000 +0200
@@ -80,7 +80,7 @@
 #define ALSA_DEVICE_SIZE 48
 
 #undef BUFFERTIME
-#undef SET_CHUNKSIZE
+#define SET_CHUNKSIZE
 #undef USE_POLL
 
 /* to set/get/query special features/parameters */


Then mplayer was playing something, but not correctly. It skipped some
parts of the file (note that I used .wav file identified by 'file' utility
as "RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 8000
Hz"). It was fixed by the following change:

--- libao2/ao_alsa.c.old	2004-05-25 17:10:53.000000000 +0200
+++ libao2/ao_alsa.c	2004-05-25 18:17:07.000000000 +0200
@@ -299,7 +299,7 @@
 	return(0);
 	break;
       default:
-	ao_data.bps *= 2;
+//	ao_data.bps *= 2;
 	mp_msg(MSGT_AO,MSGL_WARN,"alsa-init: couldn't convert to right format. setting bps to: %d", ao_data.bps);
       }

Then mplayer was playing all files correctly, but there was a difference
in its output (both text output and resulting sound). In the old version it
prints this:

Building audio filter chain for 8000Hz/1ch/8bit -> 48000Hz/2ch/8bit...

But in new version it prints this:

Building audio filter chain for 8000Hz/1ch/8bit -> 8000Hz/2ch/8bit...

This isn't big problem, but the resulting sound differs from the previous
version (it's the same as with ao=oss). It might be fixed either by using
'-ao alsa:hw:0' or by this patch:

--- libao2/ao_alsa.c.old	2004-05-25 17:10:53.000000000 +0200
+++ libao2/ao_alsa.c	2004-05-25 18:17:07.000000000 +0200
@@ -449,7 +449,7 @@
 
 	//we are setting here device to default cause it could be configured by the user
 	//if its not set by the user, it defaults to hw:0,0
-	if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "default")) <= 0)
+	if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%1d,%1d", tmp_device, tmp_subdevice)) <= 0)
 	  {
 	    mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: can't write device-id\n");
 	  }


I know all patches in this e-mail only reverts new changes. I don't know
much about programming ALSA. I think there are better ways to fix it.

Some important version information:

distribution:		Debian testing
gcc:			gcc version 3.3.3 (Debian 20040401)
glibc:			2.3.2.ds1-12
alsa-lib:		1.0.4-1
kernel:			vanilla 2.6.7-rc1/2.6.6 with usagi patches
mplayer:		dev-CVS-040522-09:05-3.3.3

-- 
Marcel Sebek
jabber: sebek at jabber.cz                     ICQ: 279852819
linux user number: 307850                 GPG ID: 5F88735E
GPG FP: 0F01 BAB8 3148 94DB B95D  1FCA 8B63 CA06 5F88 735E




More information about the MPlayer-users mailing list