Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Sep 2021 15:43:30 GMT
From:      Adriaan de Groot <adridg@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: bfcd467d8fd8 - main - audio/pulseaudio: parse /dev/sndstat correctly to get device name
Message-ID:  <202109151543.18FFhUMM058682@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by adridg:

URL: https://cgit.FreeBSD.org/ports/commit/?id=bfcd467d8fd8760db835ea2fc9134a79f5a9e13e

commit bfcd467d8fd8760db835ea2fc9134a79f5a9e13e
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2021-09-15 13:41:33 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2021-09-15 15:43:25 +0000

    audio/pulseaudio: parse /dev/sndstat correctly to get device name
    
    This provides nice human-readable strings for devices in PA-
    aware applications (e.g. Firefox shows something nicer than "pcm0").
    
    This bumps PORTREVISION again, even though there's a sequence
    of PA updates and fixes (which could conceivably be mashed into
    a single PORTREVISION increase).
    
    PR:             245156
    Provided by:    Henry Hu (original patches)
    Provided by:    lightside (v3 patches)
---
 audio/pulseaudio/Makefile                          |  2 +-
 .../files/patch-src_modules_oss_oss-util.c         | 52 +++++++++++++++++++++-
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/audio/pulseaudio/Makefile b/audio/pulseaudio/Makefile
index a363d610e35b..d88ae8c9776d 100644
--- a/audio/pulseaudio/Makefile
+++ b/audio/pulseaudio/Makefile
@@ -5,7 +5,7 @@
 
 PORTNAME=	pulseaudio
 DISTVERSION=	14.2
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	audio
 MASTER_SITES=	https://freedesktop.org/software/pulseaudio/releases/
 
diff --git a/audio/pulseaudio/files/patch-src_modules_oss_oss-util.c b/audio/pulseaudio/files/patch-src_modules_oss_oss-util.c
index 5641f9b82dbf..eae53fbffcda 100644
--- a/audio/pulseaudio/files/patch-src_modules_oss_oss-util.c
+++ b/audio/pulseaudio/files/patch-src_modules_oss_oss-util.c
@@ -1,7 +1,7 @@
 Support 24bit audio see Comment 6 of 
 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198567
 
---- src/modules/oss/oss-util.c.orig	2015-09-10 04:51:41 UTC
+--- src/modules/oss/oss-util.c.orig	2018-07-13 19:06:14 UTC
 +++ src/modules/oss/oss-util.c
 @@ -39,6 +39,22 @@
  
@@ -37,3 +37,53 @@ https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198567
          [PA_SAMPLE_S24_32LE] = AFMT_QUERY, /* not supported */
          [PA_SAMPLE_S24_32BE] = AFMT_QUERY, /* not supported */
      };
+@@ -348,7 +364,7 @@ int pa_oss_get_hw_description(const char
+     }
+ 
+     while (!feof(f)) {
+-        char line[64];
++        char line[1024];
+         int device;
+ 
+         if (!fgets(line, sizeof(line), f))
+@@ -357,14 +373,22 @@ int pa_oss_get_hw_description(const char
+         line[strcspn(line, "\r\n")] = 0;
+ 
+         if (!b) {
++#ifdef __FreeBSD__
++            b = pa_streq(line, "Installed devices:");
++#else
+             b = pa_streq(line, "Audio devices:");
++#endif
+             continue;
+         }
+ 
+         if (line[0] == 0)
+             break;
+ 
++#ifdef __FreeBSD__
++        if (sscanf(line, "pcm%i: ", &device) != 1)
++#else
+         if (sscanf(line, "%i: ", &device) != 1)
++#endif
+             continue;
+ 
+         if (device == n) {
+@@ -376,7 +400,16 @@ int pa_oss_get_hw_description(const char
+             if (pa_endswith(k, " (DUPLEX)"))
+                 k[strlen(k)-9] = 0;
+ 
+-            pa_strlcpy(name, k, l);
++            if (*k == '<') {
++                char *e = strrchr(k, '>');
++
++                if (e) {
++                    *e = 0;
++                    ++k;
++                }
++            }
++            // Include the number to disambiguate devices with the same name
++            pa_snprintf(name, l, "%d: %s", device, k);
+             r = 0;
+             break;
+         }



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