* 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
This commit is contained in:
Cameron Grant 2003-07-07 17:40:02 +00:00
parent db6104d462
commit eaa69ee9a9
2 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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 = { \