[vlc-commits] Qt4: list hardware ALSA devices in capture panel

Rémi Denis-Courmont git at videolan.org
Tue Oct 18 18:26:15 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Oct 18 19:24:43 2011 +0300| [60dbf35539b53d1529711daecd419ab566f4b8df] | committer: Rémi Denis-Courmont

Qt4: list hardware ALSA devices in capture panel

...rather than V4L2 audio tuner and OSS device nodes.

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

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

 modules/gui/qt4/components/open_panels.cpp |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index d74bdec..40ca3b0 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -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 );
 



More information about the vlc-commits mailing list