qt6 QMediaDevices::audioInputs() does not return all input devices
-
I used the example programs from .../qt6/examples/multimedia/audiodevices and consistently find that the QMediaDevices method that replaced the qt5 QAudioDeviceInfo method returns just one device.
This is not the case for the audio devices example from ..../qt5/examples/multimemdia/audiodevices .
The problem occurs with both Fedora 42 and Fedora 43. The version in question is
Fedora 42:> qmake6 --version QMake version 3.1 Using Qt version 6.9.3 in /usr/lib64Fedora 43:
$ qmake6 --version QMake version 3.1 Using Qt version 6.10.1 in /usr/lib64So, what am I missing here? (I looked through the forums and was unable to find an earlier report of this issue. If there is one, please point me there.)
matt
-
It was rude of my not to include some code. Here is the relevant snippet from the qt6 example:
void AudioTest::updateAudioDevices() { deviceBox->clear(); const auto devices = m_mode == QAudioDevice::Input ? m_devices->audioInputs() : m_devices->audioOutputs(); for (auto &deviceInfo : devices) { QString description = deviceInfo.description(); description.replace(u"\n"_s, u" - "_s); deviceBox->addItem(description, QVariant::fromValue(deviceInfo)); } } -
Hi and welcome to devnet,
What is your audio software stack ?
Can you show the output your get on each of them ? -
Thanks for the response.
I'm not quite sure how to answer the question - I've always been a bit confused wrt Linux audio. So this might be more information than is needed...
The stack: I believe the answer is "pipewire" though pulse-audio is in there somewhere.
But the qt6 version dumps some disturbing chatter to stdout:
qt.multimedia.ffmpeg: Using Qt multimedia with FFmpeg version 7.1.2 GPL version 3 or later Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory libva info: VA-API version 1.22.0 libva info: Trying to open /usr/lib64/dri-nonfree/iHD_drv_video.so libva info: Trying to open /usr/lib64/dri-freeworld/iHD_drv_video.so libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_22 libva info: va_openDriver() returns 0 libva info: VA-API version 1.22.0 libva info: Trying to open /usr/lib64/dri-nonfree/iHD_drv_video.so libva info: Trying to open /usr/lib64/dri-freeworld/iHD_drv_video.so libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_22 libva info: va_openDriver() returns 0I know that pulse is involved as I set up a couple of virtual devices like this:
pactl load-module module-null-sink sink_name=RSink sink_properties=device.description="RadioSink" pactl load-module module-null-sink sink_name=MSink sink_properties=device.description="ModemSink"(These are to provide paths between a modem inside one app (wsjtx) and an SDR running in a separate process.)
I modified both example programs to write directly to the qInfo stream:
qt6 version:const auto devices = m_mode == QAudioDevice::Input ? m_devices->audioInputs() : m_devices->audioOutputs(); for (auto &deviceInfo : devices) { QString description = deviceInfo.description(); description.replace(u"\n"_s, u" - "_s); deviceBox->addItem(description, QVariant::fromValue(deviceInfo)); qInfo() << QString("audio device [%1] from audio%2()") .arg(description) .arg((m_mode == QAudioDevice::Input) ? "Inputs" : "Outputs") ; }which produces this output:
"" "audio device [Built-in Audio Analog Stereo] from audioOutputs()" "audio device [RadioSink] from audioOutputs()" "audio device [ModemSink] from audioOutputs()" "audio device [NoMachine Output] from audioOutputs()" "" "audio device [Remapped nx_voice_out] from audioInputs()" ""The qt5 version looks like this:
const QAudio::Mode mode = idx == 0 ? QAudio::AudioInput : QAudio::AudioOutput; for (auto &deviceInfo: QAudioDeviceInfo::availableDevices(mode)) { deviceBox->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); qInfo() << QString("audio device [%1] from QAudioDeviceInfo::availableDevices(QAudio::Audio%2)") .arg(deviceInfo.deviceName()) .arg((mode == 0) ? "Input" : "Output") ; }and I get this for the output:
QSocketNotifier: Can only be used with threads started with QThread "audio device [pipewire] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" "audio device [default] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" "audio device [sysdefault:CARD=PCH] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" "audio device [front:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" "audio device [nx_remapped_out] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" "audio device [alsa_output.pci-0000_00_1f.3.analog-stereo.monitor] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" "audio device [RSink.monitor] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" "audio device [MSink.monitor] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" "audio device [nx_voice_out.monitor] from QAudioDeviceInfo::availableDevices(QAudio::AudioInput)" qt.qpa.wayland: Wayland does not support QWindow::requestActivate() "audio device [pipewire] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [default] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [sysdefault:CARD=PCH] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [front:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [surround21:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [surround40:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [surround41:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [surround50:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [surround51:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [surround71:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [hdmi:CARD=PCH,DEV=0] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [hdmi:CARD=PCH,DEV=1] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [hdmi:CARD=PCH,DEV=2] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [hdmi:CARD=PCH,DEV=3] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [alsa_output.pci-0000_00_1f.3.analog-stereo] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [RSink] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [MSink] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" "audio device [nx_voice_out] from QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)"(Sorry for the monster blobs...)
So. The qt5 operations do what I expect.
I don't believe the problem comes from the virtual MSink and RSink devices.
The complaint about the VDPAU backend may be a hint. I've been unable to figure out where it comes from. I don't have any nVidia hardware on this box.I'm building the dev branch from the git sources now. I'll see if a new built-from-source version has the same lib...nvidia problem. That'll take a while, it may take until the weekend.
Thank you for your help.
Is there more information I can provide.? I apologize for the lack of linux audio sophistication.