Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jan 2018 12:45:13 +0000 (UTC)
From:      Adriaan de Groot <adridg@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r459518 - in head/multimedia/qt5-multimedia: . files
Message-ID:  <201801201245.w0KCjDbE006609@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adridg
Date: Sat Jan 20 12:45:13 2018
New Revision: 459518
URL: https://svnweb.freebsd.org/changeset/ports/459518

Log:
  Allow ALSA aliases in the Qt5 sound devices list.
  
  Patch by Stephen Hurd, seems to be ignored upstream. The new patch describes
  what it does and why it is needed.
  
  PR:		208570
  Submitted by:	Stephen Hurd
  Reported by:	Stephen Hurd
  Approved by:	tcberner (mentor)
  Differential Revision:	https://reviews.freebsd.org/D13992

Added:
  head/multimedia/qt5-multimedia/files/patch-src_plugins_alsa_qalsaaudiodeviceinfo.cpp   (contents, props changed)
Modified:
  head/multimedia/qt5-multimedia/Makefile

Modified: head/multimedia/qt5-multimedia/Makefile
==============================================================================
--- head/multimedia/qt5-multimedia/Makefile	Sat Jan 20 12:38:20 2018	(r459517)
+++ head/multimedia/qt5-multimedia/Makefile	Sat Jan 20 12:45:13 2018	(r459518)
@@ -2,7 +2,7 @@
 
 PORTNAME=	multimedia
 DISTVERSION=	${QT5_VERSION}
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	multimedia
 PKGNAMEPREFIX=	qt5-
 

Added: head/multimedia/qt5-multimedia/files/patch-src_plugins_alsa_qalsaaudiodeviceinfo.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/qt5-multimedia/files/patch-src_plugins_alsa_qalsaaudiodeviceinfo.cpp	Sat Jan 20 12:45:13 2018	(r459518)
@@ -0,0 +1,70 @@
+Patch from Stephen Hurd. PR208570. Allow ALSA aliases.
+
+When using ALSA with FreeBSD, the direct snd_device instances are not
+available, only plugin devices and "default".  For programs which use
+QAudio, this means there are *no* devices enumerated using
+QAudio::availableDevices().
+
+The attached patch adds the aliases to the available device list.
+
+--- src/plugins/alsa/qalsaaudiodeviceinfo.cpp.orig	2017-11-08 14:04:46 UTC
++++ src/plugins/alsa/qalsaaudiodeviceinfo.cpp
+@@ -353,6 +353,58 @@ QList<QByteArray> QAlsaAudioDeviceInfo::
+         ++n;
+     }
+     snd_device_name_free_hint(hints);
++
++#ifdef Q_OS_FREEBSD
++    // Now find aliases...
++    snd_config_iterator_t pos, next;
++    snd_config_t *top, *node, *type;
++    snd_pcm_t *pcm;
++    snd_pcm_stream_t streamType;
++    const char *idString;
++    const char **ignoreId;
++    static const char *ignore[] = {"hw", "plughw", "plug", "dsnoop", "tee",
++                                   "file", "null", "shm", "cards", "rate_convert", NULL};
++
++    // Populate snd_config...
++    if (snd_config == NULL)
++        snd_config_update();
++    if (snd_config != NULL) {
++        switch (mode) {
++        case QAudio::AudioInput:
++            streamType = SND_PCM_STREAM_CAPTURE;
++            break;
++        case QAudio::AudioOutput:
++            streamType = SND_PCM_STREAM_PLAYBACK;
++            break;
++        default:
++            goto bad_mode;
++        }
++        // Find "pcm" nodes...
++        if (snd_config_search(snd_config, "pcm", &top) >= 0) {
++            for (pos = snd_config_iterator_first(top), next = snd_config_iterator_next(pos);
++                    pos != snd_config_iterator_end(top);
++                    pos = next, next = snd_config_iterator_next(pos)) {
++                node = snd_config_iterator_entry(pos);
++                if (snd_config_search(node, "type", &type) < 0)
++                    continue;
++                snd_config_get_id(node, &idString);
++                for (ignoreId = ignore; *ignoreId; ignoreId++) {
++                    if (strcmp(*ignoreId, idString) == 0)
++                        break;
++                }
++                if (*ignoreId)
++                    continue;
++                // Ensure it's available...
++                if (snd_pcm_open(&pcm, idString, streamType, 0))
++                    continue;
++                snd_pcm_close(pcm);
++                const QString deviceName = QLatin1String(idString);
++                devices.append(deviceName.toLocal8Bit().constData());
++            }
++        }
++    }
++bad_mode:
++#endif
+ #else
+     int idx = 0;
+     char* name;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801201245.w0KCjDbE006609>