]> git.sesse.net Git - vlc/commitdiff
PulseAudio: update audio-device
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 12 Apr 2011 17:25:49 +0000 (20:25 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 12 Apr 2011 17:26:53 +0000 (20:26 +0300)
This keeps the VLC value in sync with the PulseAudio one. For some
reason, the Qt4 interface does not pick up the correct default though.

modules/audio_output/pulse.c

index 3041a5b4d5eefaffd211c6c065caf7493c2454a6..0f97a36ff836a01707efc478676aa7b0cdb54a37 100644 (file)
@@ -163,6 +163,10 @@ static void stream_moved_cb(pa_stream *s, void *userdata)
                                            sink_info_cb, aout);
     if (likely(op != NULL))
         pa_operation_unref(op);
+
+    /* Update the variable if someone else moved our stream */
+    var_Change(aout, "audio-device", VLC_VAR_SETVALUE,
+               &(vlc_value_t){ .i_int = idx }, NULL);
 }
 
 static void stream_overflow_cb(pa_stream *s, void *userdata)
@@ -553,7 +557,6 @@ static int Open(vlc_object_t *obj)
         error(aout, "cannot connect stream", ctx);
         goto fail;
     }
-    stream_moved_cb(s, aout);
 
     const struct pa_buffer_attr *pba = pa_stream_get_buffer_attr(s);
     msg_Dbg(aout, "using buffer metrics: maxlength=%u, tlength=%u, "
@@ -571,6 +574,7 @@ static int Open(vlc_object_t *obj)
     /* We may need to wait for completion... once LibVLC supports this */
     if (op != NULL)
         pa_operation_unref(op);
+    stream_moved_cb(s, aout);
     pa_threaded_mainloop_unlock(mainloop);
 
     aout->output.pf_play = Play;