The branch main has been updated by christos:

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

commit 0864dfe6299b75e424b845c0d0e1a593da905ae3
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2024-08-24 12:07:54 +0000
Commit:     Christos Margiolis <[email protected]>
CommitDate: 2024-08-24 12:07:54 +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
---
 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;

Reply via email to