context: add pa_context_load_cookie_from_file()

There is no function to load the authentication cookie for a context.
You can only set environment variables. This patch adds
pa_context_load_cookie_from_file().

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
This commit is contained in:
Alexander Couzens 2013-08-27 03:18:35 +02:00 committed by Tanu Kaskinen
parent 441a5a422c
commit 0157f4b25f
3 changed files with 20 additions and 0 deletions

View file

@ -1448,3 +1448,14 @@ size_t pa_context_get_tile_size(pa_context *c, const pa_sample_spec *ss) {
mbs = PA_ROUND_DOWN(pa_mempool_block_size_max(c->mempool), fs);
return PA_MAX(mbs, fs);
}
int pa_context_load_cookie_from_file(pa_context *c, const char *cookie_file_path) {
pa_assert(c);
pa_assert(cookie_file_path);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
PA_CHECK_VALIDITY(c, !pa_detect_fork(), PA_ERR_FORKED);
PA_CHECK_VALIDITY(c, c->state == PA_CONTEXT_UNCONNECTED, PA_ERR_BADSTATE);
return pa_client_conf_load_cookie_from_file(c->conf, cookie_file_path);
}