summaryrefslogtreecommitdiffstats
path: root/libao2/ao_alsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'libao2/ao_alsa.c')
-rw-r--r--libao2/ao_alsa.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c
index 032d1d132a..5e848446f2 100644
--- a/libao2/ao_alsa.c
+++ b/libao2/ao_alsa.c
@@ -57,7 +57,7 @@
#include "audio_out_internal.h"
#include "libaf/af_format.h"
-static const ao_info_t info =
+static const ao_info_t info =
{
"ALSA-0.9.x-1.x audio output",
"alsa",
@@ -73,7 +73,7 @@ static snd_pcm_hw_params_t *alsa_hwparams;
static snd_pcm_sw_params_t *alsa_swparams;
/* 16 sets buffersize to 16 * chunksize is as default 1024
- * which seems to be good avarge for most situations
+ * 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;
@@ -156,7 +156,7 @@ static int control(int cmd, void *arg)
//allocate simple id
snd_mixer_selem_id_alloca(&sid);
-
+
//sets simple-mixer index and name
snd_mixer_selem_id_set_index(sid, mix_index);
snd_mixer_selem_id_set_name(sid, mix_name);
@@ -172,7 +172,7 @@ static int control(int cmd, void *arg)
}
if ((err = snd_mixer_attach(handle, card)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_MixerAttachError,
+ mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_MixerAttachError,
card, snd_strerror(err));
snd_mixer_close(handle);
return CONTROL_ERROR;
@@ -207,7 +207,7 @@ static int control(int cmd, void *arg)
//setting channels
if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, set_vol)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingLeftChannel,
+ mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingLeftChannel,
snd_strerror(err));
return CONTROL_ERROR;
}
@@ -216,11 +216,11 @@ static int control(int cmd, void *arg)
set_vol = vol->right / f_multi + pmin + 0.5;
if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_RIGHT, set_vol)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingRightChannel,
+ mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingRightChannel,
snd_strerror(err));
return CONTROL_ERROR;
}
- mp_msg(MSGT_AO,MSGL_DBG2,"right=%li, pmin=%li, pmax=%li, mult=%f\n",
+ mp_msg(MSGT_AO,MSGL_DBG2,"right=%li, pmin=%li, pmax=%li, mult=%f\n",
set_vol, pmin, pmax, f_multi);
if (snd_mixer_selem_has_playback_switch(elem)) {
@@ -245,7 +245,7 @@ static int control(int cmd, void *arg)
snd_mixer_close(handle);
return CONTROL_OK;
}
-
+
} //end switch
return CONTROL_UNKNOWN;
}
@@ -349,7 +349,7 @@ static int init(int rate_hz, int channels, int format, int flags)
#endif
snd_lib_error_set_handler(alsa_error_handler);
-
+
ao_data.samplerate = rate_hz;
ao_data.format = format;
ao_data.channels = channels;
@@ -409,7 +409,7 @@ static int init(int rate_hz, int channels, int format, int flags)
alsa_format = SND_PCM_FORMAT_MPEG; //? default should be -1
break;
}
-
+
//subdevice parsing
// set defaults
block = 1;
@@ -537,11 +537,11 @@ static int init(int rate_hz, int channels, int format, int flags)
snd_strerror(err));
return 0;
}
-
+
err = snd_pcm_hw_params_set_access(alsa_handler, alsa_hwparams,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetAccessType,
+ mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetAccessType,
snd_strerror(err));
return 0;
}
@@ -585,8 +585,8 @@ static int init(int rate_hz, int channels, int format, int flags)
}
#endif
- if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams,
- &ao_data.samplerate, NULL)) < 0)
+ if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams,
+ &ao_data.samplerate, NULL)) < 0)
{
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetSamplerate2,
snd_strerror(err));
@@ -602,7 +602,7 @@ static int init(int rate_hz, int channels, int format, int flags)
int alsa_buffer_time = 500000; /* original 60 */
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,
+ if ((err = snd_pcm_hw_params_set_buffer_time_near(alsa_handler, alsa_hwparams,
&alsa_buffer_time, NULL)) < 0)
{
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetBufferTimeNear,
@@ -611,7 +611,7 @@ static int init(int rate_hz, int channels, int format, int flags)
} else
alsa_buffer_time = err;
- if ((err = snd_pcm_hw_params_set_period_time_near(alsa_handler, alsa_hwparams,
+ if ((err = snd_pcm_hw_params_set_period_time_near(alsa_handler, alsa_hwparams,
&alsa_period_time, NULL)) < 0)
/* original: alsa_buffer_time/ao_data.bps */
{
@@ -621,13 +621,13 @@ static int init(int rate_hz, int channels, int format, int flags)
}
mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_ALSA_BufferTimePeriodTime,
alsa_buffer_time, err);
- }
+ }
#endif//end SET_BUFFERTIME
#ifdef SET_CHUNKSIZE
{
//set chunksize
- if ((err = snd_pcm_hw_params_set_period_size_near(alsa_handler, alsa_hwparams,
+ if ((err = snd_pcm_hw_params_set_period_size_near(alsa_handler, alsa_hwparams,
&chunk_size, NULL)) < 0)
{
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetPeriodSize,
@@ -639,7 +639,7 @@ static int init(int rate_hz, int channels, int format, int flags)
}
if ((err = snd_pcm_hw_params_set_periods_near(alsa_handler, alsa_hwparams,
&alsa_fragcount, NULL)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetPeriods,
+ mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetPeriods,
snd_strerror(err));
return 0;
}
@@ -870,15 +870,15 @@ static int get_space(void)
{
snd_pcm_status_t *status;
int ret;
-
+
snd_pcm_status_alloca(&status);
-
+
if ((ret = snd_pcm_status(alsa_handler, status)) < 0)
{
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_CannotGetPcmStatus, snd_strerror(ret));
return 0;
}
-
+
ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
if (ret > ao_data.buffersize) // Buffer underrun?
ret = ao_data.buffersize;
@@ -890,10 +890,10 @@ static float get_delay(void)
{
if (alsa_handler) {
snd_pcm_sframes_t delay;
-
+
if (snd_pcm_delay(alsa_handler, &delay) < 0)
return 0;
-
+
if (delay < 0) {
/* underrun - move the application pointer forward to catch up */
#if SND_LIB_VERSION >= 0x000901 /* snd_pcm_forward() exists since 0.9.0rc8 */