[vlc-commits] commit: ALSA: use default device if none specified instead of failing ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sun Jul 18 18:09:43 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 18 18:59:59 2010 +0300| [e0499d3813fc84e6f77f6bad8b9cd525dfb79180] | committer: Rémi Denis-Courmont 

ALSA: use default device if none specified instead of failing

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

 modules/audio_output/alsa.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 146e11d..af87d42 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -345,14 +345,15 @@ static int Open( vlc_object_t *p_this )
         return VLC_ENOMEM;
 
     /* Get device name */
-    if( (psz_device = var_InheritString( p_aout, "alsa-audio-device" )) == NULL )
+    psz_device = var_InheritString( p_aout, "alsa-audio-device" );
+    if( unlikely(psz_device == NULL) )
     {
-        msg_Err( p_aout, "no audio device given (maybe \"default\" ?)" );
-        dialog_Fatal( p_aout, _("No Audio Device"), "%s",
-                        _("No audio device name was given. You might want to " \
-                          "enter \"default\".") );
-        free( p_sys );
-        return VLC_EGENERIC;
+        psz_device = strdup( DEFAULT_ALSA_DEVICE );
+        if( unlikely(psz_device == NULL) )
+        {
+            free( p_sys );
+            return VLC_ENOMEM;
+        }
     }
 
     /* Choose the IEC device for S/PDIF output:



More information about the vlc-commits mailing list