Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Aug 2024 13:54:50 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 8156d8598f59 - stable/14 - sound: Improve sndstat nvlist feederchain format
Message-ID:  <202408261354.47QDsoU3017510@gitrepo.freebsd.org>

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

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

commit 8156d8598f5926a8fa996b65b742a295599b131c
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-08-24 12:07:54 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-08-26 13:53:01 +0000

    sound: Improve sndstat nvlist feederchain format
    
    - Use snd_afmt2str() to display format conversions in feeder_format,
      instead of the plain hex value.
    - Simplify feeder_rate contents.
    - Print "ch" (e.g 2.1ch) after matrix values in feeder_matrix.
    - Use snd_afmt2str() instead of a plain hex for the the rest of the
      feeder classes.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 days
    Reviewed by:    dev_submerge.ch
    Differential Revision:  https://reviews.freebsd.org/D46309
    
    (cherry picked from commit 0864dfe6299b75e424b845c0d0e1a593da905ae3)
---
 sys/dev/sound/pcm/sndstat.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c
index 4fac6a97a3f0..4c5efb72cc0a 100644
--- a/sys/dev/sound/pcm/sndstat.c
+++ b/sys/dev/sound/pcm/sndstat.c
@@ -388,6 +388,7 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip)
 	uint32_t maxrate, minrate, fmts, minchn, maxchn, caps;
 	nvlist_t *di = NULL, *sound4di = NULL, *diinfo = NULL, *cdi = NULL;
 	int err, nchan;
+	char buf[AFMTSTR_LEN];
 
 	di = nvlist_create(0);
 	if (di == NULL) {
@@ -531,10 +532,12 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip)
 		while (f != NULL) {
 			sbuf_printf(&sb, "%s", f->class->name);
 			if (f->desc->type == FEEDER_FORMAT) {
-				sbuf_printf(&sb, "(0x%08x -> 0x%08x)",
-				    f->desc->in, f->desc->out);
+				snd_afmt2str(f->desc->in, buf, sizeof(buf));
+				sbuf_printf(&sb, "(%s -> ", buf);
+				snd_afmt2str(f->desc->out, buf, sizeof(buf));
+				sbuf_printf(&sb, "%s)", buf);
 			} else if (f->desc->type == FEEDER_MATRIX) {
-				sbuf_printf(&sb, "(%d.%d -> %d.%d)",
+				sbuf_printf(&sb, "(%d.%dch -> %d.%dch)",
 				    AFMT_CHANNEL(f->desc->in) -
 				    AFMT_EXTCHANNEL(f->desc->in),
 				    AFMT_EXTCHANNEL(f->desc->in),
@@ -542,15 +545,12 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip)
 				    AFMT_EXTCHANNEL(f->desc->out),
 				    AFMT_EXTCHANNEL(f->desc->out));
 			} else if (f->desc->type == FEEDER_RATE) {
-				sbuf_printf(&sb,
-				    "(0x%08x q:%d %d -> %d)",
-				    f->desc->out,
-				    FEEDER_GET(f, FEEDRATE_QUALITY),
+				sbuf_printf(&sb, "(%d -> %d)",
 				    FEEDER_GET(f, FEEDRATE_SRC),
 				    FEEDER_GET(f, FEEDRATE_DST));
 			} else {
-				sbuf_printf(&sb, "(0x%08x)",
-				    f->desc->out);
+				snd_afmt2str(f->desc->out, buf, sizeof(buf));
+				sbuf_printf(&sb, "(%s)", buf);
 			}
 			sbuf_printf(&sb, " -> ");
 			f = f->parent;



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