summaryrefslogtreecommitdiffstats
path: root/libao2/ao_pulse.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-07-29 22:46:10 +0200
committerwm4 <wm4@nowhere>2012-07-30 01:46:04 +0200
commitf113e20794960881f1ce621e69131e6bb831ce36 (patch)
treef5f52c21aef48e9cedc0fe021af3379afaa8cfe0 /libao2/ao_pulse.c
parentd80b84f1a070630a2320ccf4d8ec1da1cdda1904 (diff)
downloadmpv-f113e20794960881f1ce621e69131e6bb831ce36.tar.bz2
mpv-f113e20794960881f1ce621e69131e6bb831ce36.tar.xz
ao_pulse: don't always print error message if PulseAudio unavailable
PulseAudio is rather high on the auto proving order (to avoid using an emulated sound API), but it prints an annoying error message if the PA client library can't connect to a server. On the other hand, we do want this error message printed if the user explicitly selects the pulse audio output driver. Add a flag to indicate that an AO is opened due to auto probing. ao_pulse checks that flag, and if it's set, do not print if the initialization error is PA_ERR_CONNECTIONREFUSED, whcih I assume is the error signalling PulseAudio unavailability. (This error happens if no PulseAudio server is installed.)
Diffstat (limited to 'libao2/ao_pulse.c')
-rw-r--r--libao2/ao_pulse.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c
index e48c402fa6..062dde9ecf 100644
--- a/libao2/ao_pulse.c
+++ b/libao2/ao_pulse.c
@@ -297,8 +297,11 @@ unlock_and_fail:
pa_threaded_mainloop_unlock(priv->mainloop);
fail:
- if (priv->context)
- GENERIC_ERR_MSG(priv->context, "Init failed");
+ if (priv->context) {
+ if (!(pa_context_errno(priv->context) == PA_ERR_CONNECTIONREFUSED
+ && ao->probing))
+ GENERIC_ERR_MSG(priv->context, "Init failed");
+ }
free(devarg);
uninit(ao, true);
return -1;