]> git.sesse.net Git - vlc/commitdiff
PulseAudio: add a "?" choice if our stream moves to an unknown sink
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 6 Oct 2011 17:07:41 +0000 (20:07 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 6 Oct 2011 17:07:41 +0000 (20:07 +0300)
This happens if the stream to a device that appeared after the stream
was started.

modules/audio_output/pulse.c

index 8f48bf27cd633da8a76da8c1f212de4f68ef909e..61fe648b727079569f2176cb0e375f33bfec3baf 100644 (file)
@@ -392,6 +392,16 @@ static void stream_moved_cb(pa_stream *s, void *userdata)
     /* Update the variable if someone else moved our stream */
     var_Change(aout, "audio-device", VLC_VAR_SETVALUE,
                &(vlc_value_t){ .i_int = idx }, NULL);
+
+    /* Sink unknown as yet, create stub choice for it */
+    if (var_GetInteger(aout, "audio-device") != idx)
+    {
+        var_Change(aout, "audio-device", VLC_VAR_ADDCHOICE,
+                   &(vlc_value_t){ .i_int = idx },
+                   &(vlc_value_t){ .psz_string = (char *)"?" });
+        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)