]> git.sesse.net Git - vlc/commitdiff
Qt4: list hardware ALSA devices in capture panel
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 18 Oct 2011 16:24:43 +0000 (19:24 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 18 Oct 2011 16:24:43 +0000 (19:24 +0300)
...rather than V4L2 audio tuner and OSS device nodes.

This is not quite correct, but we can do no better without alsa-lib.

modules/gui/qt4/components/open_panels.cpp

index d74bdec5c1b7ef2946b92d4a60a90ba2b46e489e..40ca3b01e2593515a7703e48c8d5623206bdfbfb 100644 (file)
@@ -728,12 +728,7 @@ void CaptureOpenPanel::initialize()
         "video*"
     };
 
-    char const * const ppsz_v4ladevices[] = {
-        "dsp*",
-        "radio*"
-    };
-
-    /* V4l Main panel */
+    /* V4L2 main panel */
     QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
     v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
 
@@ -748,7 +743,17 @@ void CaptureOpenPanel::initialize()
 
     v4l2AudioDevice = new QComboBox( this );
     v4l2AudioDevice->setEditable( true );
-    POPULATE_WITH_DEVS( ppsz_v4ladevices, v4l2AudioDevice );
+    {
+        QStringList patterns = QStringList();
+        patterns << QString( "pcmC*D*c" );
+
+        QStringList nodes = QDir( "/dev/snd" ).entryList( patterns,
+                                                          QDir::System );
+        QStringList names = nodes.replaceInStrings( QRegExp("^pcmC"), "hw:" )
+                                 .replaceInStrings( QRegExp("c$"), "" )
+                                 .replaceInStrings( QRegExp("D"), "," );
+        v4l2AudioDevice->addItems( names );
+    }
     v4l2AudioDevice->clearEditText();
     v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );