43 default:
return PA_SAMPLE_INVALID;
64 switch (pa_context_get_state(c)) {
65 case PA_CONTEXT_FAILED:
66 case PA_CONTEXT_TERMINATED:
69 case PA_CONTEXT_READY:
83 pa_context_set_state_callback(*pa_ctx, NULL, NULL);
84 pa_context_disconnect(*pa_ctx);
85 pa_context_unref(*pa_ctx);
88 pa_mainloop_free(*pa_ml);
94 const char *server,
const char *description)
97 pa_mainloop_api *pa_mlapi = NULL;
106 if (!(*pa_ml = pa_mainloop_new()))
108 if (!(pa_mlapi = pa_mainloop_get_api(*pa_ml))) {
112 if (!(*pa_ctx = pa_context_new(pa_mlapi, description))) {
116 pa_context_set_state_callback(*pa_ctx,
pa_state_cb, &context_state);
117 if (pa_context_connect(*pa_ctx, server, 0, NULL) < 0) {
123 pa_mainloop_iterate(*pa_ml, 1, NULL);
136 const char *
name,
const char *description)
173 int eol,
void *userdata)
180 int eol,
void *userdata)
199 pa_mainloop *pa_ml = NULL;
200 pa_operation *pa_op = NULL;
201 pa_context *pa_ctx = NULL;
202 enum pa_operation_state op_state;
220 while ((op_state = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING)
221 pa_mainloop_iterate(pa_ml, 1, NULL);
222 if (op_state != PA_OPERATION_DONE)
224 pa_operation_unref(pa_op);
229 while ((op_state = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING)
230 pa_mainloop_iterate(pa_ml, 1, NULL);
231 if (op_state != PA_OPERATION_DONE)
233 pa_operation_unref(pa_op);