diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-07-20 01:07:06 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-07-20 01:07:06 +0000 |
commit | bb0b105b83c0f4ee56b4c7e9a179606aee296aa9 (patch) | |
tree | c7a83efa8830adee3b4c94a8e28d5c03c9573f20 /polyp/clitext.c | |
parent | 527faf01d0605a6ced9a73017cc8155adba59d24 (diff) |
sample cache work
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@98 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/clitext.c')
-rw-r--r-- | polyp/clitext.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/polyp/clitext.c b/polyp/clitext.c index c1b9953b..d0c3f9a7 100644 --- a/polyp/clitext.c +++ b/polyp/clitext.c @@ -24,6 +24,7 @@ #endif #include <assert.h> +#include <string.h> #include "clitext.h" #include "module.h" @@ -34,6 +35,7 @@ #include "source-output.h" #include "strbuf.h" #include "sample-util.h" +#include "scache.h" char *pa_module_list_to_string(struct pa_core *c) { struct pa_strbuf *s; @@ -201,3 +203,36 @@ char *pa_sink_input_list_to_string(struct pa_core *c) { return pa_strbuf_tostring_free(s); } + +char *pa_scache_list_to_string(struct pa_core *c) { + struct pa_scache_entry *e; + void *state = NULL; + struct pa_strbuf *s; + assert(c); + + s = pa_strbuf_new(); + assert(s); + + pa_strbuf_printf(s, "%u cache entries available.\n", c->scache_hashmap ? pa_hashmap_ncontents(c->scache_hashmap) : 0); + + if (c->scache_hashmap) { + + while ((e = pa_hashmap_iterate(c->scache_hashmap, &state))) { + double l; + char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + pa_sample_snprint(ss, sizeof(ss), &e->sample_spec); + + l = (double) e->memchunk.length / pa_bytes_per_second(&e->sample_spec); + + pa_strbuf_printf( + s, " name: <%s>\n\tindex: <%i>\n\tsample_spec: <%s>\n\tlength: <%u>\n\tduration: <%0.1fs>\n", + e->name, + e->index, + ss, + e->memchunk.length, + l); + } + } + + return pa_strbuf_tostring_free(s); +} |