[MPlayer-dev-eng] [PATCH 11/12] ao_alsa: some small fixes

Clemens Ladisch cl at cl.domainfactory-kunde.de
Mon Feb 6 09:29:21 CET 2006


Make all global variables static, remove some unused variables, and
remove the unused dir parameter from set_xxx_near() calls.

Index: MPlayer-1.0pre7try2/libao2/ao_alsa.c
===================================================================
--- MPlayer-1.0pre7try2.orig/libao2/ao_alsa.c	2006-02-05 22:52:17.000000000 +0100
+++ MPlayer-1.0pre7try2/libao2/ao_alsa.c	2006-02-05 22:52:18.000000000 +0100
@@ -54,19 +54,16 @@ static snd_pcm_format_t alsa_format;
 static snd_pcm_hw_params_t *alsa_hwparams;
 static snd_pcm_sw_params_t *alsa_swparams;
 
-/* possible 4096, original 8192 
- * was only needed for calculating chunksize? */
-static int alsa_fragsize = 4096;
 /* 16 sets buffersize to 16 * chunksize is as default 1024
  * which seems to be good avarge for most situations 
  * so buffersize is 16384 frames by default */
 static int alsa_fragcount = 16;
-static snd_pcm_uframes_t chunk_size = 1024;//is alsa_fragsize / 4
+static snd_pcm_uframes_t chunk_size = 1024;
 
 static size_t bytes_per_sample;
 
-int ao_mmap = 0;
-int ao_noblock = 0;
+static int ao_mmap = 0;
+static int ao_noblock = 0;
 
 static int open_mode;
 static int alsa_can_pause = 0;
@@ -257,8 +254,6 @@ static int init(int rate_hz, int channel
 {
     int err;
     int cards = -1;
-    snd_pcm_info_t *alsa_info;
-    int dir = 0;
     int block;
     strarg_t device;
     snd_pcm_uframes_t bufsize;
@@ -525,7 +520,7 @@ static int init(int rate_hz, int channel
 	}
 
       if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams, 
-						 &ao_data.samplerate, &dir)) < 0) 
+						 &ao_data.samplerate, NULL)) < 0) 
         {
 	  mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set samplerate-2: %s\n",
 		 snd_strerror(err));
@@ -542,7 +537,7 @@ static int init(int rate_hz, int channel
 	int alsa_period_time;
 	alsa_period_time = alsa_buffer_time/4;
 	if ((err = snd_pcm_hw_params_set_buffer_time_near(alsa_handler, alsa_hwparams, 
-							  &alsa_buffer_time, &dir)) < 0)
+							  &alsa_buffer_time, NULL)) < 0)
 	  {
 	    mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set buffer time near: %s\n",
 		   snd_strerror(err));
@@ -551,7 +546,7 @@ static int init(int rate_hz, int channel
 	    alsa_buffer_time = err;
 
 	if ((err = snd_pcm_hw_params_set_period_time_near(alsa_handler, alsa_hwparams, 
-							  &alsa_period_time, &dir)) < 0)
+							  &alsa_period_time, NULL)) < 0)
 	  /* original: alsa_buffer_time/ao_data.bps */
 	  {
 	    mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set period time: %s\n",
@@ -565,9 +560,8 @@ static int init(int rate_hz, int channel
 #ifdef SET_CHUNKSIZE
       {
 	//set chunksize
-	dir=0;
 	if ((err = snd_pcm_hw_params_set_period_size_near(alsa_handler, alsa_hwparams, 
-							  &chunk_size, &dir)) < 0)
+							  &chunk_size, NULL)) < 0)
 	  {
 	    mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set periodsize(%ld): %s\n",
 			    chunk_size, snd_strerror(err));
@@ -576,7 +570,7 @@ static int init(int rate_hz, int channel
 	  mp_msg(MSGT_AO,MSGL_V,"alsa-init: chunksize set to %li\n", chunk_size);
 	}
 	if ((err = snd_pcm_hw_params_set_periods_near(alsa_handler, alsa_hwparams,
-						      &alsa_fragcount, &dir)) < 0) {
+						      &alsa_fragcount, NULL)) < 0) {
 	  mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set periods: %s\n", 
 		 snd_strerror(err));
 	}




More information about the MPlayer-dev-eng mailing list