[vlc-commits] PulseAudio: log context events

Rémi Denis-Courmont git at videolan.org
Wed Aug 8 18:10:07 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Aug  8 18:32:19 2012 +0300| [a666d9b2109c2b1b6e5ac8365eb3edce496830f2] | committer: Rémi Denis-Courmont

PulseAudio: log context events

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a666d9b2109c2b1b6e5ac8365eb3edce496830f2
---

 modules/audio_output/pulse.c    |    2 +-
 modules/audio_output/vlcpulse.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 9763027..f579398 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -382,7 +382,7 @@ static void stream_event_cb(pa_stream *s, const char *name, pa_proplist *pl,
                               dummy, dummy, NULL);
     } else
 #endif
-        msg_Warn (aout, "unhandled event %s", name);
+        msg_Warn (aout, "unhandled stream event \"%s\"", name);
     (void) s;
     (void) pl;
 }
diff --git a/modules/audio_output/vlcpulse.c b/modules/audio_output/vlcpulse.c
index 4b6465c..7926f6e 100644
--- a/modules/audio_output/vlcpulse.c
+++ b/modules/audio_output/vlcpulse.c
@@ -68,6 +68,16 @@ static bool context_wait (pa_context *ctx, pa_threaded_mainloop *mainloop)
     return 0;
 }
 
+static void context_event_cb(pa_context *c, const char *name, pa_proplist *pl,
+                             void *userdata)
+{
+    vlc_object_t *obj = userdata;
+
+    msg_Warn (obj, "unhandled context event \"%s\"", name);
+    (void) c;
+    (void) pl;
+}
+
 /**
  * Initializes the PulseAudio main loop and connects to the PulseAudio server.
  * @return a PulseAudio context on success, or NULL on error
@@ -144,6 +154,7 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp)
         goto fail;
 
     pa_context_set_state_callback (ctx, context_state_cb, mainloop);
+    pa_context_set_event_callback (ctx, context_event_cb, obj);
     if (pa_context_connect (ctx, NULL, 0, NULL) < 0
      || context_wait (ctx, mainloop))
     {
@@ -177,6 +188,7 @@ void vlc_pa_disconnect (vlc_object_t *obj, pa_context *ctx,
 {
     pa_threaded_mainloop_lock (mainloop);
     pa_context_disconnect (ctx);
+    pa_context_set_event_callback (ctx, NULL, NULL);
     pa_context_set_state_callback (ctx, NULL, NULL);
     pa_context_unref (ctx);
     pa_threaded_mainloop_unlock (mainloop);



More information about the vlc-commits mailing list