[vlc-devel] [PATCH 2/2] core: add an option to select an audio-device
Thomas Guillem
thomas at gllm.fr
Wed Mar 22 09:50:26 CET 2017
---
src/audio_output/output.c | 4 +++-
src/libvlc-module.c | 9 +++++++++
src/playlist/engine.c | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 8a70cdfddc..f1055149d2 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -189,7 +189,9 @@ audio_output_t *aout_New (vlc_object_t *parent)
vlc_mutex_init (&owner->lock);
vlc_mutex_init (&owner->req.lock);
vlc_mutex_init (&owner->dev.lock);
- owner->req.device = (char *)unset_str;
+ owner->req.device = var_InheritString(parent, "audio-device");
+ if (likely(owner->req.device == NULL))
+ owner->req.device = (char *)unset_str;
owner->req.volume = -1.f;
owner->req.mute = -1;
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index cd52b77d87..74d01eadac 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -124,6 +124,13 @@ static const char *const ppsz_snap_formats[] =
"The default behavior is to automatically select the best method " \
"available.")
+#define AOUT_DEVICE_TEXT N_("Audio device")
+#define AOUT_DEVICE_LONGTEXT N_( \
+ "This is the audio device selected by the audio output module. " \
+ "The default behavior is to automatically select the best method " \
+ "available. Use the \"--list-audio-devices\" option to list available " \
+ "audio devices.")
+
#define ROLE_TEXT N_("Media role")
#define ROLE_LONGTEXT N_("Media (player) role for operating system policy.")
@@ -1497,6 +1504,8 @@ vlc_module_begin ()
add_module( "aout", "audio output", NULL, AOUT_TEXT, AOUT_LONGTEXT,
true )
change_short('A')
+ add_string( "audio-device", NULL, AOUT_DEVICE_TEXT,
+ AOUT_DEVICE_LONGTEXT, false )
add_string( "role", "video", ROLE_TEXT, ROLE_LONGTEXT, true )
change_string_list( ppsz_roles, ppsz_roles_text )
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index a295b80cba..1f41912863 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -452,7 +452,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, "audio-device", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_playlist, "mute", VLC_VAR_BOOL );
var_Create( p_playlist, "volume", VLC_VAR_FLOAT );
var_SetFloat( p_playlist, "volume", -1.f );
--
2.11.0
More information about the vlc-devel
mailing list