}
/* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
pa_sink_state_t old_state;
struct userdata *u;
u->sink->parent.process_msg = sink_process_msg;
if (u->use_tsched)
u->sink->update_requested_latency = sink_update_requested_latency_cb;
- u->sink->set_state = sink_set_state_cb;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
if (u->ucm_context)
u->sink->set_port = sink_set_port_ucm_cb;
else
}
/* Called from main context */
-static int source_set_state_cb(pa_source *s, pa_source_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
pa_source_state_t old_state;
struct userdata *u;
u->source->parent.process_msg = source_process_msg;
if (u->use_tsched)
u->source->update_requested_latency = source_update_requested_latency_cb;
- u->source->set_state = source_set_state_cb;
+ u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
if (u->ucm_context)
u->source->set_port = source_set_port_ucm_cb;
else
}
/* Called from main context */
-static int source_set_state_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_source_assert_ref(s);
}
/* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
}
u->source->parent.process_msg = source_process_msg_cb;
- u->source->set_state = source_set_state_cb;
+ u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
u->source->update_requested_latency = source_update_requested_latency_cb;
pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
if (!u->use_volume_sharing) {
}
u->sink->parent.process_msg = sink_process_msg_cb;
- u->sink->set_state = sink_set_state_cb;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
u->sink->update_requested_latency = sink_update_requested_latency_cb;
u->sink->request_rewind = sink_request_rewind_cb;
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
return pa_source_process_msg(o, code, data, offset, chunk);;
}
-static int ca_sink_set_state(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int ca_sink_set_state_in_main_thread(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
coreaudio_sink *sink = s->userdata;
switch (state) {
sink->parent.process_msg = sink_process_msg;
sink->userdata = ca_sink;
- sink->set_state = ca_sink_set_state;
+ sink->set_state_in_main_thread = ca_sink_set_state_in_main_thread;
pa_sink_set_asyncmsgq(sink, u->thread_mq.inq);
pa_sink_set_rtpoll(sink, u->rtpoll);
return 0;
}
-static int ca_source_set_state(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
+static int ca_source_set_state_in_main_thread(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
coreaudio_source *source = s->userdata;
switch (state) {
source->parent.process_msg = source_process_msg;
source->userdata = ca_source;
- source->set_state = ca_source_set_state;
+ source->set_state_in_main_thread = ca_source_set_state_in_main_thread;
pa_source_set_asyncmsgq(source, u->thread_mq.inq);
pa_source_set_rtpoll(source, u->rtpoll);
}
/* Called from main context */
-static int sink_set_state(pa_sink *sink, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *sink, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(sink);
}
u->sink->parent.process_msg = sink_process_msg;
- u->sink->set_state = sink_set_state;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
u->sink->update_requested_latency = sink_update_requested_latency;
u->sink->userdata = u;
}
/* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
}
u->sink->parent.process_msg = sink_process_msg_cb;
- u->sink->set_state = sink_set_state_cb;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
u->sink->update_requested_latency = sink_update_requested_latency_cb;
u->sink->request_rewind = sink_request_rewind_cb;
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
}
/* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
}
u->sink->parent.process_msg = sink_process_msg_cb;
- u->sink->set_state = sink_set_state_cb;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
u->sink->update_requested_latency = sink_update_requested_latency_cb;
u->sink->request_rewind = sink_request_rewind_cb;
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
}
/* Called from main context */
-static int sink_set_state(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
}
u->sink->parent.process_msg = sink_process_msg;
- u->sink->set_state = sink_set_state;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread;
u->sink->update_requested_latency = sink_update_requested_latency;
u->sink->request_rewind = sink_request_rewind;
u->sink->userdata = u;
}
/* Called from main context */
-static int source_set_state_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_source_assert_ref(s);
}
u->source->parent.process_msg = source_process_msg_cb;
- u->source->set_state = source_set_state_cb;
+ u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
u->source->update_requested_latency = source_update_requested_latency_cb;
u->source->userdata = u;
}
/* Called from main context */
-static int sink_set_state(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
u = s->userdata;
}
/* Called from main context */
-static int source_set_state(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_source_assert_ref(s);
u = s->userdata;
u->sink->parent.process_msg = sink_process_msg;
u->sink->userdata = u;
- u->sink->set_state = sink_set_state;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
pa_sink_set_set_mute_callback(u->sink, sink_set_mute);
}
u->source->parent.process_msg = source_process_msg;
- u->source->set_state = source_set_state;
+ u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
u->source->userdata = u;
/* pa_source_set_latency_range(u->source, MIN_NETWORK_LATENCY_USEC, 0); */
}
/* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
}
u->sink->parent.process_msg = sink_process_msg_cb;
- u->sink->set_state = sink_set_state_cb;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
u->sink->update_requested_latency = sink_update_requested_latency_cb;
u->sink->request_rewind = sink_request_rewind_cb;
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
}
/* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
}
/* Called from main context */
-static int source_set_state_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
+static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_source_assert_ref(s);
}
u->source->parent.process_msg = source_process_msg_cb;
- u->source->set_state = source_set_state_cb;
+ u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
u->source->update_requested_latency = source_update_requested_latency_cb;
pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
if (!use_volume_sharing) {
u->sink->parent.process_msg = sink_process_msg_cb;
u->sink->update_requested_latency = sink_update_requested_latency_cb;
u->sink->request_rewind = sink_request_rewind_cb;
- u->sink->set_state = sink_set_state_cb;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
u->sink->userdata = u;
pa_sink_set_asyncmsgq(u->sink, master->asyncmsgq);
}
/* Called from main context */
-static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
+static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
}
u->sink->parent.process_msg = sink_process_msg_cb;
- u->sink->set_state = sink_set_state_cb;
+ u->sink->set_state_in_main_thread = sink_set_state_in_main_thread_cb;
u->sink->update_requested_latency = sink_update_requested_latency_cb;
u->sink->request_rewind = sink_request_rewind_cb;
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
static void reset_callbacks(pa_sink *s) {
pa_assert(s);
- s->set_state = NULL;
+ s->set_state_in_main_thread = NULL;
s->get_volume = NULL;
s->set_volume = NULL;
s->write_volume = NULL;
* cause, or it might just add unnecessary complexity, given that the
* current approach of not setting any suspend cause works well enough. */
- if (s->set_state) {
- ret = s->set_state(s, state, suspend_cause);
- /* set_state() is allowed to fail only when resuming. */
+ if (s->set_state_in_main_thread) {
+ ret = s->set_state_in_main_thread(s, state, suspend_cause);
+ /* set_state_in_main_thread() is allowed to fail only when resuming. */
pa_assert(ret >= 0 || resuming);
}
/* SET_STATE is allowed to fail only when resuming. */
pa_assert(resuming);
- if (s->set_state)
- s->set_state(s, PA_SINK_SUSPENDED, 0);
+ if (s->set_state_in_main_thread)
+ s->set_state_in_main_thread(s, PA_SINK_SUSPENDED, 0);
}
if (suspend_cause_changed) {
* s->state and s->suspend_cause haven't been updated yet when this is
* called, so the callback can get the old state through those variables.
*
- * If set_state() is successful, the IO thread will be notified with the
- * SET_STATE message. The message handler is allowed to fail, in which
- * case the old state is restored, and set_state() is called again. */
- int (*set_state)(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause); /* may be NULL */
+ * If set_state_in_main_thread() is successful, the IO thread will be
+ * notified with the SET_STATE message. The message handler is allowed to
+ * fail, in which case the old state is restored, and
+ * set_state_in_main_thread() is called again. */
+ int (*set_state_in_main_thread)(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause); /* may be NULL */
/* Sink drivers that support hardware volume may set this
* callback. This is called when the current volume needs to be
static void reset_callbacks(pa_source *s) {
pa_assert(s);
- s->set_state = NULL;
+ s->set_state_in_main_thread = NULL;
s->get_volume = NULL;
s->set_volume = NULL;
s->write_volume = NULL;
* cause, or it might just add unnecessary complexity, given that the
* current approach of not setting any suspend cause works well enough. */
- if (s->set_state) {
- ret = s->set_state(s, state, suspend_cause);
- /* set_state() is allowed to fail only when resuming. */
+ if (s->set_state_in_main_thread) {
+ ret = s->set_state_in_main_thread(s, state, suspend_cause);
+ /* set_state_in_main_thread() is allowed to fail only when resuming. */
pa_assert(ret >= 0 || resuming);
}
/* SET_STATE is allowed to fail only when resuming. */
pa_assert(resuming);
- if (s->set_state)
- s->set_state(s, PA_SOURCE_SUSPENDED, 0);
+ if (s->set_state_in_main_thread)
+ s->set_state_in_main_thread(s, PA_SOURCE_SUSPENDED, 0);
}
if (suspend_cause_changed) {
* s->state and s->suspend_cause haven't been updated yet when this is
* called, so the callback can get the old state through those variables.
*
- * If set_state() is successful, the IO thread will be notified with the
- * SET_STATE message. The message handler is allowed to fail, in which
- * case the old state is restored, and set_state() is called again. */
- int (*set_state)(pa_source *source, pa_source_state_t state, pa_suspend_cause_t suspend_cause); /* may be NULL */
+ * If set_state_in_main_thread() is successful, the IO thread will be
+ * notified with the SET_STATE message. The message handler is allowed to
+ * fail, in which case the old state is restored, and
+ * set_state_in_main_thread() is called again. */
+ int (*set_state_in_main_thread)(pa_source *source, pa_source_state_t state, pa_suspend_cause_t suspend_cause); /* may be NULL */
/* Called when the volume is queried. Called from main loop
* context. If this is NULL a PA_SOURCE_MESSAGE_GET_VOLUME message