[MPlayer-dev-eng] [PATCH 4/5] ao_alsa: remove superfluous function calls

Clemens Ladisch clemens at ladisch.de
Mon Jan 30 09:14:48 CET 2006


Remove a call to snd_pcm_prepare() because snd_pcm_hw_params() does it
automatically, and remove a call to snd_pcm_drop() because
snd_pcm_close() does it automatically.

Index: MPlayer/libao2/ao_alsa.c
===================================================================
--- MPlayer.orig/libao2/ao_alsa.c	2006-01-29 19:16:15.000000000 +0100
+++ MPlayer/libao2/ao_alsa.c	2006-01-29 19:17:14.000000000 +0100
@@ -660,11 +660,6 @@ static int init(int rate_hz, int channel
       }
       /* end setting sw-params */
 
-      if ((err = snd_pcm_prepare(alsa_handler)) < 0)
-	{
-	  mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: pcm prepare error: %s\n", snd_strerror(err));
-	}
-
       mp_msg(MSGT_AO,MSGL_INFO,"alsa: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n",
 	     ao_data.samplerate, ao_data.channels, bytes_per_sample, ao_data.buffersize,
 	     snd_pcm_format_description(alsa_format));
@@ -685,12 +680,6 @@ static void uninit(int immed)
     if (!immed)
       snd_pcm_drain(alsa_handler);
 
-    if ((err = snd_pcm_drop(alsa_handler)) < 0)
-      {
-	mp_msg(MSGT_AO,MSGL_ERR,"alsa-uninit: pcm drop error: %s\n", snd_strerror(err));
-	return;
-      }
-
     if ((err = snd_pcm_close(alsa_handler)) < 0)
       {
 	mp_msg(MSGT_AO,MSGL_ERR,"alsa-uninit: pcm close error: %s\n", snd_strerror(err));




More information about the MPlayer-dev-eng mailing list