Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Jul 2024 11:56:16 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: bd5bcc848c57 - main - sound: Add OSS channel capabilities to sndstat nvlist
Message-ID:  <202407271156.46RBuGW3039561@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=bd5bcc848c5764229926ad27a4bd77af4f87d189

commit bd5bcc848c5764229926ad27a4bd77af4f87d189
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-07-27 11:54:27 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-07-27 11:54:27 +0000

    sound: Add OSS channel capabilities to sndstat nvlist
    
    Assignment taken from dsp_oss_engineinfo().
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 days
    Reviewed by:    dev_submerge.ch
    Differential Revision:  https://reviews.freebsd.org/D46166
---
 share/man/man4/sndstat.4    | 3 +++
 sys/dev/sound/pcm/sndstat.c | 7 ++++++-
 sys/sys/sndstat.h           | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/share/man/man4/sndstat.4 b/share/man/man4/sndstat.4
index 2f745f418b79..2fc55f0045c1 100644
--- a/share/man/man4/sndstat.4
+++ b/share/man/man4/sndstat.4
@@ -86,6 +86,7 @@ dsps (NVLIST ARRAY): 1
 			name (STRING): pcm0:virtual_play:dsp0.vp0
 			parentchan (STRING): pcm0:play:dsp0.p0
 			unit (NUMBER): 1
+			caps (NUMBER): 0x073200
 			latency (NUMBER): 2
 			rate (NUMBER): 48000
 			format (NUMBER): 0x201000
@@ -201,6 +202,8 @@ Channel name.
 Parent channel name (e.g., in the case of virtual channels).
 .It Dv unit
 Channel unit.
+.It Dv caps
+OSS capabilities.
 .It Dv latency
 Latency.
 .It Dv rate
diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c
index b0d2c5b6ca21..f09fa7139884 100644
--- a/sys/dev/sound/pcm/sndstat.c
+++ b/sys/dev/sound/pcm/sndstat.c
@@ -385,7 +385,7 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip)
 	struct pcm_channel *c;
 	struct pcm_feeder *f;
 	struct sbuf sb;
-	uint32_t maxrate, minrate, fmts, minchn, maxchn;
+	uint32_t maxrate, minrate, fmts, minchn, maxchn, caps;
 	nvlist_t *di = NULL, *sound4di = NULL, *diinfo = NULL, *cdi = NULL;
 	int err, nchan;
 
@@ -467,10 +467,15 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip)
 
 		CHN_LOCK(c);
 
+		caps = PCM_CAP_REALTIME | PCM_CAP_MMAP | PCM_CAP_TRIGGER |
+		    ((c->flags & CHN_F_VIRTUAL) ? PCM_CAP_VIRTUAL : 0) |
+		    ((c->direction == PCMDIR_PLAY) ? PCM_CAP_OUTPUT : PCM_CAP_INPUT);
+
 		nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_NAME, c->name);
 		nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_PARENTCHAN,
 		    c->parentchannel != NULL ? c->parentchannel->name : "");
 		nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_UNIT, nchan++);
+		nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_CAPS, caps);
 		nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_LATENCY,
 		    c->latency);
 		nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_RATE, c->speed);
diff --git a/sys/sys/sndstat.h b/sys/sys/sndstat.h
index f7d0b2f29bd5..6fd2e06ac483 100644
--- a/sys/sys/sndstat.h
+++ b/sys/sys/sndstat.h
@@ -82,6 +82,7 @@ struct sndstioc_nv_arg {
 #define SNDST_DSPS_SOUND4_CHAN_NAME		"name"
 #define SNDST_DSPS_SOUND4_CHAN_PARENTCHAN	"parentchan"
 #define SNDST_DSPS_SOUND4_CHAN_UNIT		"unit"
+#define SNDST_DSPS_SOUND4_CHAN_CAPS		"caps"
 #define SNDST_DSPS_SOUND4_CHAN_LATENCY		"latency"
 #define SNDST_DSPS_SOUND4_CHAN_RATE		"rate"
 #define SNDST_DSPS_SOUND4_CHAN_FORMAT		"format"



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