diff options
author | Adriaan de Groot <adridg@FreeBSD.org> | 2021-09-15 13:41:33 +0000 |
---|---|---|
committer | Adriaan de Groot <adridg@FreeBSD.org> | 2021-09-15 15:43:25 +0000 |
commit | bfcd467d8fd8760db835ea2fc9134a79f5a9e13e (patch) | |
tree | 008888df8384a52e44709d8b5068915d3f59a217 /audio | |
parent | 3c1f4f5c80627a368ea17fe0918e3623e1b10b84 (diff) | |
download | ports-bfcd467d8fd8760db835ea2fc9134a79f5a9e13e.tar.gz ports-bfcd467d8fd8760db835ea2fc9134a79f5a9e13e.zip |
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)
Diffstat (limited to 'audio')
-rw-r--r-- | audio/pulseaudio/Makefile | 2 | ||||
-rw-r--r-- | audio/pulseaudio/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; + } |