From eaa69ee9a94a83d3ede79c147b33e52254ed0862 Mon Sep 17 00:00:00 2001 From: Cameron Grant Date: Mon, 7 Jul 2003 17:40:02 +0000 Subject: [PATCH] * add a function to display a complete feeder chain on the console, for debugging. * set the parent of non-format feeders, so that sndstat doesn't miss out things like feeder_rate. MFC: 1 week --- sys/dev/sound/pcm/feeder.c | 18 +++++++++++++++++- sys/dev/sound/pcm/feeder.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index 0c2f7847cefe..2aa1e2af0004 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -194,11 +194,13 @@ chn_addfeeder(struct pcm_channel *c, struct feeder_class *fc, struct pcm_feederd nf->source = c->feeder; + /* XXX we should use the lowest common denominator for align */ if (nf->align > 0) c->align += nf->align; else if (nf->align < 0 && c->align < -nf->align) c->align = -nf->align; - + if (c->feeder != NULL) + c->feeder->parent = nf; c->feeder = nf; return 0; @@ -372,6 +374,20 @@ chn_fmtchain(struct pcm_channel *c, u_int32_t *to) return (c->direction == PCMDIR_REC)? best : c->feeder->desc->out; } +void +feeder_printchain(struct pcm_feeder *head) +{ + struct pcm_feeder *f; + + printf("feeder chain (head @%p)\n", head); + f = head; + while (f != NULL) { + printf("%s/%d @ %p\n", f->class->name, f->desc->idx, f); + f = f->source; + } + printf("[end]\n\n"); +} + /*****************************************************************************/ static int diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index 9fb8ff79ed0f..10c3c67a5d1c 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -57,6 +57,7 @@ u_int32_t chn_fmtchain(struct pcm_channel *c, u_int32_t *to); int chn_addfeeder(struct pcm_channel *c, struct feeder_class *fc, struct pcm_feederdesc *desc); int chn_removefeeder(struct pcm_channel *c); struct pcm_feeder *chn_findfeeder(struct pcm_channel *c, u_int32_t type); +void feeder_printchain(struct pcm_feeder *head); #define FEEDER_DECLARE(feeder, palign, pdata) \ static struct feeder_class feeder ## _class = { \