summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-06 21:46:44 +0200
committerAlessandro Ghedini <alessandro@ghedini.me>2014-10-11 13:59:43 +0200
commit381843eb88785980b8905e4da76407d0af000b48 (patch)
tree8ad32ac705140dc3f29085783e2dd832d44a316f /audio
parent9258d0461ee7391c60f8c36dcb42937719c5d6a8 (diff)
downloadmpv-381843eb88785980b8905e4da76407d0af000b48.tar.bz2
mpv-381843eb88785980b8905e4da76407d0af000b48.tar.xz
ao_pulse: don't use pa_format_info_to_sample_spec()
This function is available starting with PulseAudio 2.0, while we only require 1.0. This broke compilation on Ubuntu 12.04.5 LTS. Use our own function to calculate the buffer size, which is actually simpler and needs slightly less code. Hopefully fixes #1154. CC: @mpv-player/stable
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_pulse.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c
index edbb009729..cadd032e58 100644
--- a/audio/out/ao_pulse.c
+++ b/audio/out/ao_pulse.c
@@ -381,20 +381,15 @@ static int init(struct ao *ao)
pa_proplist_free(proplist);
proplist = NULL;
- pa_sample_spec ss;
- pa_channel_map map2;
-
- if (pa_format_info_to_sample_spec(format, &ss, &map2) < 0)
- goto unlock_and_fail;
-
pa_stream_set_state_callback(priv->stream, stream_state_cb, ao);
pa_stream_set_write_callback(priv->stream, stream_request_cb, ao);
pa_stream_set_latency_update_callback(priv->stream,
stream_latency_update_cb, ao);
+ int buf_size = af_fmt_seconds_to_bytes(ao->format, priv->cfg_buffer / 1000.0,
+ ao->channels.num, ao->samplerate);
pa_buffer_attr bufattr = {
.maxlength = -1,
- .tlength = priv->cfg_buffer > 0 ?
- pa_usec_to_bytes(priv->cfg_buffer * 1000, &ss) : (uint32_t)-1,
+ .tlength = buf_size > 0 ? buf_size : (uint32_t)-1,
.prebuf = -1,
.minreq = -1,
.fragsize = -1,
@@ -733,7 +728,7 @@ const struct ao_driver audio_out_pulse = {
.options = (const struct m_option[]) {
OPT_STRING("host", cfg_host, 0),
OPT_STRING("sink", cfg_sink, 0),
- OPT_CHOICE_OR_INT("buffer", cfg_buffer, 0, 1, 2000, ({"native", -1})),
+ OPT_CHOICE_OR_INT("buffer", cfg_buffer, 0, 1, 2000, ({"native", 0})),
OPT_FLAG("latency-hacks", cfg_latency_hacks, 0),
{0}
},