[vlc-commits] aout: propagate current device to parent input manager

Rémi Denis-Courmont git at videolan.org
Mon Jul 27 15:36:11 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul 27 16:30:06 2015 +0300| [c14e7a5988ddc1faa09fd10b8f5d80b159ce3632] | committer: Rémi Denis-Courmont

aout: propagate current device to parent input manager

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

 lib/media_player.c        |    1 +
 src/audio_output/output.c |   11 +++++++++++
 src/playlist/engine.c     |    1 +
 3 files changed, 13 insertions(+)

diff --git a/lib/media_player.c b/lib/media_player.c
index 1ddd4bf..9a687d5 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -621,6 +621,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
 
      /* Audio */
     var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
+    var_Create (mp, "audio-device", VLC_VAR_STRING);
     var_Create (mp, "mute", VLC_VAR_BOOL);
     var_Create (mp, "volume", VLC_VAR_FLOAT);
     var_Create (mp, "corks", VLC_VAR_INTEGER);
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 2be34e7..d3c1bb9 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -64,6 +64,15 @@ static int var_Copy (vlc_object_t *src, const char *name, vlc_value_t prev,
     return var_Set (dst, name, value);
 }
 
+static int var_CopyDevice (vlc_object_t *src, const char *name,
+                           vlc_value_t prev, vlc_value_t value, void *data)
+{
+    vlc_object_t *dst = data;
+
+    (void) src; (void) name; (void) prev;
+    return var_Set (dst, "audio-device", value);
+}
+
 /**
  * Supply or update the current custom ("hardware") volume.
  * @note This only makes sense after calling aout_VolumeHardInit().
@@ -192,6 +201,7 @@ audio_output_t *aout_New (vlc_object_t *parent)
     var_Create (aout, "mute", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
     var_AddCallback (aout, "mute", var_Copy, parent);
     var_Create (aout, "device", VLC_VAR_STRING);
+    var_AddCallback (aout, "device", var_CopyDevice, parent);
 
     aout->event.volume_report = aout_VolumeNotify;
     aout->event.mute_report = aout_MuteNotify;
@@ -324,6 +334,7 @@ void aout_Destroy (audio_output_t *aout)
     aout_OutputUnlock (aout);
 
     var_DelCallback (aout, "audio-filter", FilterCallback, NULL);
+    var_DelCallback (aout, "device", var_CopyDevice, aout->p_parent);
     var_DelCallback (aout, "mute", var_Copy, aout->p_parent);
     var_SetFloat (aout, "volume", -1.f);
     var_DelCallback (aout, "volume", var_Copy, aout->p_parent);
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index c34be2d..6000a37 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -480,6 +480,7 @@ static void VariablesInit( playlist_t *p_playlist )
     var_Create( p_playlist, "video-wallpaper", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
 
     /* Audio output parameters */
+    var_Create( p_playlist, "audio-device", VLC_VAR_STRING );
     var_Create( p_playlist, "mute", VLC_VAR_BOOL );
     var_Create( p_playlist, "volume", VLC_VAR_FLOAT );
     var_SetFloat( p_playlist, "volume", -1.f );



More information about the vlc-commits mailing list