[pulseaudio-commits] src/map-file src/pulse

Tanu Kaskinen tanuk at kemper.freedesktop.org
Tue Aug 27 06:42:10 PDT 2013


 src/map-file        |    1 +
 src/pulse/context.c |   11 +++++++++++
 src/pulse/context.h |    8 ++++++++
 3 files changed, 20 insertions(+)

New commits:
commit 0157f4b25f5d64e532ef246d73c2d134be3a2042
Author: Alexander Couzens <lynxis at fe80.eu>
Date:   Tue Aug 27 03:18:35 2013 +0200

    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 at fe80.eu>

diff --git a/src/map-file b/src/map-file
index 466c828..39d5a01 100644
--- a/src/map-file
+++ b/src/map-file
@@ -67,6 +67,7 @@ pa_context_is_pending;
 pa_context_kill_client;
 pa_context_kill_sink_input;
 pa_context_kill_source_output;
+pa_context_load_cookie_from_file;
 pa_context_load_module;
 pa_context_move_sink_input_by_index;
 pa_context_move_sink_input_by_name;
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 1ba2672..3cb9d02 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -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);
+}
diff --git a/src/pulse/context.h b/src/pulse/context.h
index 6e615f6..3b8b9be 100644
--- a/src/pulse/context.h
+++ b/src/pulse/context.h
@@ -280,6 +280,14 @@ 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. This function is primarily
+ * meant for PulseAudio's own tunnel modules, which need to load the cookie
+ * from a custom location. Applications don't usually need to care about the
+ * cookie at all, but if it happens that you know what the authentication
+ * cookie is and your application needs to load it from a non-standard
+ * location, feel free to use this function. \since 5.0 */
+int pa_context_load_cookie_from_file(pa_context *c, const char *cookie_file_path);
+
 PA_C_DECL_END
 
 #endif



More information about the pulseaudio-commits mailing list