[pulseaudio-discuss] [PATCH] context: add pa_context_load_cookie_file()
Alexander Couzens
lynxis at fe80.eu
Mon Aug 26 18:18:35 PDT 2013
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_file()
Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
src/pulse/context.c | 10 ++++++++++
src/pulse/context.h | 3 +++
2 files changed, 13 insertions(+)
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 1ba2672..5c0405f 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -1448,3 +1448,13 @@ 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(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);
+}
diff --git a/src/pulse/context.h b/src/pulse/context.h
index 6e615f6..b52c0d4 100644
--- a/src/pulse/context.h
+++ b/src/pulse/context.h
@@ -280,6 +280,9 @@ void pa_context_rttime_restart(pa_context *c, pa_time_event *e, pa_usec_t usec);
* pa_stream_get_sample_spec(ss)); \since 0.9.20 */
size_t pa_context_get_tile_size(pa_context *c, const pa_sample_spec *ss);
+/** Load the authentication cookie from a file \since 5.0 */
+int pa_context_load_cookie_from_file(pa_context *c, const char *cookie_file_path);
+
PA_C_DECL_END
#endif
--
1.8.3.4
More information about the pulseaudio-discuss
mailing list