From 9bd62aef042c65427f60473e591e719c51121903 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 2 Sep 2008 19:33:16 +0200 Subject: add tdb based shared lookup cache --- src/pulse.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/pulse.c') diff --git a/src/pulse.c b/src/pulse.c index 067a63d..aa8dc30 100644 --- a/src/pulse.c +++ b/src/pulse.c @@ -644,6 +644,7 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal int try = 3; int ret; pa_operation *o; + char *sp; ca_return_val_if_fail(c, CA_ERROR_INVALID); ca_return_val_if_fail(proplist, CA_ERROR_INVALID); @@ -744,9 +745,15 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal out->type = OUTSTANDING_STREAM; /* Let's stream the sample directly */ - if ((ret = ca_lookup_sound(&out->file, &p->theme, c->props, proplist)) < 0) + if ((ret = ca_lookup_sound(&out->file, &sp, &p->theme, c->props, proplist)) < 0) goto finish; + if (sp) + if (!pa_proplist_contains(l, CA_PROP_MEDIA_FILENAME)) + pa_proplist_sets(l, CA_PROP_MEDIA_FILENAME, sp); + + ca_free(sp); + ss.format = sample_type_table[ca_sound_file_get_sample_type(out->file)]; ss.channels = (uint8_t) ca_sound_file_get_nchannels(out->file); ss.rate = ca_sound_file_get_rate(out->file); @@ -894,6 +901,7 @@ int driver_cache(ca_context *c, ca_proplist *proplist) { ca_cache_control_t cache_control = CA_CACHE_CONTROL_PERMANENT; struct outstanding *out; int ret; + char *sp; ca_return_val_if_fail(c, CA_ERROR_INVALID); ca_return_val_if_fail(proplist, CA_ERROR_INVALID); @@ -943,9 +951,15 @@ int driver_cache(ca_context *c, ca_proplist *proplist) { add_common(l); /* Let's stream the sample directly */ - if ((ret = ca_lookup_sound(&out->file, &p->theme, c->props, proplist)) < 0) + if ((ret = ca_lookup_sound(&out->file, &sp, &p->theme, c->props, proplist)) < 0) goto finish; + if (sp) + if (!pa_proplist_contains(l, CA_PROP_MEDIA_FILENAME)) + pa_proplist_sets(l, CA_PROP_MEDIA_FILENAME, sp); + + ca_free(sp); + ss.format = sample_type_table[ca_sound_file_get_sample_type(out->file)]; ss.channels = (uint8_t) ca_sound_file_get_nchannels(out->file); ss.rate = ca_sound_file_get_rate(out->file); -- cgit