diff options
author | wm4 <wm4@nowhere> | 2012-07-29 22:46:10 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-07-30 01:46:04 +0200 |
commit | f113e20794960881f1ce621e69131e6bb831ce36 (patch) | |
tree | f5f52c21aef48e9cedc0fe021af3379afaa8cfe0 | |
parent | d80b84f1a070630a2320ccf4d8ec1da1cdda1904 (diff) | |
download | mpv-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.)
-rw-r--r-- | libao2/ao_pulse.c | 7 | ||||
-rw-r--r-- | libao2/audio_out.c | 2 | ||||
-rw-r--r-- | libao2/audio_out.h | 1 |
3 files changed, 8 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; diff --git a/libao2/audio_out.c b/libao2/audio_out.c index 6836963d66..744bcaf9bd 100644 --- a/libao2/audio_out.c +++ b/libao2/audio_out.c @@ -167,7 +167,9 @@ void ao_init(struct ao *ao, char **ao_list) for (int i = 0; audio_out_drivers[i]; i++) { const struct ao_driver *audio_out = audio_out_drivers[i]; ao->driver = audio_out; + ao->probing = true; if (audio_out->init(ao, NULL) >= 0) { + ao->probing = false; ao->initialized = true; ao->driver = audio_out; return; diff --git a/libao2/audio_out.h b/libao2/audio_out.h index 955376d460..316341752b 100644 --- a/libao2/audio_out.h +++ b/libao2/audio_out.h @@ -100,6 +100,7 @@ struct ao { double pts; struct bstr buffer; int buffer_playable_size; + bool probing; bool initialized; bool untimed; bool no_persistent_volume; |