mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
sample cache work
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@98 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
527faf01d0
commit
bb0b105b83
17 changed files with 539 additions and 24 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue