summaryrefslogtreecommitdiffstats
path: root/polyp/polyplib-context.c
diff options
context:
space:
mode:
Diffstat (limited to 'polyp/polyplib-context.c')
-rw-r--r--polyp/polyplib-context.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/polyp/polyplib-context.c b/polyp/polyplib-context.c
index 94df7ec0..a810bd98 100644
--- a/polyp/polyplib-context.c
+++ b/polyp/polyplib-context.c
@@ -633,3 +633,43 @@ fail:
return -1;
}
+
+struct pa_operation* pa_context_set_default_sink(struct pa_context *c, const char *name, void(*cb)(struct pa_context*c, int success, void *userdata), void *userdata) {
+ struct pa_tagstruct *t;
+ struct pa_operation *o;
+ uint32_t tag;
+ assert(c && cb);
+
+ o = pa_operation_new(c, NULL);
+ o->callback = cb;
+ o->userdata = userdata;
+
+ t = pa_tagstruct_new(NULL, 0);
+ pa_tagstruct_putu32(t, PA_COMMAND_SET_DEFAULT_SINK);
+ pa_tagstruct_putu32(t, tag = c->ctag++);
+ pa_tagstruct_puts(t, name);
+ pa_pstream_send_tagstruct(c->pstream, t);
+ pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, o);
+
+ return pa_operation_ref(o);
+}
+
+struct pa_operation* pa_context_set_default_source(struct pa_context *c, const char *name, void(*cb)(struct pa_context*c, int success, void *userdata), void *userdata) {
+ struct pa_tagstruct *t;
+ struct pa_operation *o;
+ uint32_t tag;
+ assert(c && cb);
+
+ o = pa_operation_new(c, NULL);
+ o->callback = cb;
+ o->userdata = userdata;
+
+ t = pa_tagstruct_new(NULL, 0);
+ pa_tagstruct_putu32(t, PA_COMMAND_SET_DEFAULT_SOURCE);
+ pa_tagstruct_putu32(t, tag = c->ctag++);
+ pa_tagstruct_puts(t, name);
+ pa_pstream_send_tagstruct(c->pstream, t);
+ pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, o);
+
+ return pa_operation_ref(o);
+}