summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_alsa.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-16 19:15:32 +0200
committerwm4 <wm4@nowhere>2013-06-16 19:36:56 +0200
commit4d3a2c7e0dac38546f5fc2c7737a6ec1f09e30f6 (patch)
tree8324cc1b661ff83ad9a8f50c5f08b42d838e4731 /audio/out/ao_alsa.c
parentf88193091b3de59b496633682b659cd388e24a59 (diff)
downloadmpv-4d3a2c7e0dac38546f5fc2c7737a6ec1f09e30f6.tar.bz2
mpv-4d3a2c7e0dac38546f5fc2c7737a6ec1f09e30f6.tar.xz
audio/out: remove ao->outburst/buffersize fields
The core didn't use these fields, and use of them was inconsistent accross AOs. Some didn't use them at all. Some only set them; the values were completely unused by the core. Some made full use of them. Remove these fields. In places where they are still needed, make them private AO state. Remove the --abs option. It set the buffer size for ao_oss and ao_dsound (being ignored by all other AOs), and was already marked as obsolete. If it turns out that it's still needed for ao_oss or ao_dsound, their default buffer sizes could be adjusted, and if even that doesn't help, AO suboptions could be added in these cases.
Diffstat (limited to 'audio/out/ao_alsa.c')
-rw-r--r--audio/out/ao_alsa.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index 6dd04d2967..bbd4603d18 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -57,6 +57,8 @@ struct priv {
int can_pause;
snd_pcm_sframes_t prepause_frames;
float delay_before_pause;
+ int buffersize;
+ int outburst;
};
#define BUFFER_TIME 500000 // 0.5 s
@@ -579,15 +581,15 @@ static int init(struct ao *ao, char *params)
err = snd_pcm_hw_params_get_buffer_size(alsa_hwparams, &bufsize);
CHECK_ALSA_ERROR("Unable to get buffersize");
- ao->buffersize = bufsize * p->bytes_per_sample;
+ p->buffersize = bufsize * p->bytes_per_sample;
mp_msg(MSGT_AO, MSGL_V, "alsa-init: got buffersize=%i\n",
- ao->buffersize);
+ p->buffersize);
err = snd_pcm_hw_params_get_period_size(alsa_hwparams, &chunk_size, NULL);
CHECK_ALSA_ERROR("Unable to get period size");
mp_msg(MSGT_AO, MSGL_V, "alsa-init: got period size %li\n", chunk_size);
- ao->outburst = chunk_size * p->bytes_per_sample;
+ p->outburst = chunk_size * p->bytes_per_sample;
/* setting software parameters */
err = snd_pcm_sw_params_current(p->alsa, alsa_swparams);
@@ -621,7 +623,7 @@ static int init(struct ao *ao, char *params)
mp_msg(MSGT_AO, MSGL_V,
"alsa: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n",
ao->samplerate, ao->channels.num, (int)p->bytes_per_sample,
- ao->buffersize, snd_pcm_format_description(p->alsa_fmt));
+ p->buffersize, snd_pcm_format_description(p->alsa_fmt));
return 0;
@@ -733,7 +735,7 @@ static int play(struct ao *ao, void *data, int len, int flags)
int num_frames;
snd_pcm_sframes_t res = 0;
if (!(flags & AOPLAY_FINAL_CHUNK))
- len = len / ao->outburst * ao->outburst;
+ len = len / p->outburst * p->outburst;
num_frames = len / p->bytes_per_sample;
//mp_msg(MSGT_AO,MSGL_ERR,"alsa-play: frames=%i, len=%i\n",num_frames,len);
@@ -789,8 +791,8 @@ static int get_space(struct ao *ao)
CHECK_ALSA_ERROR("cannot get pcm status");
unsigned space = snd_pcm_status_get_avail(status) * p->bytes_per_sample;
- if (space > ao->buffersize) // Buffer underrun?
- space = ao->buffersize;
+ if (space > p->buffersize) // Buffer underrun?
+ space = p->buffersize;
return space;
alsa_error: