mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-04-09 08:21:21 -04:00
sink, source: Change the set_port() callback return value to void
The callback implementations didn't report any errors, so checking for set_port() failure was pointless (and the reported error code was bogus, PA_ERR_NOENTITY). The UCM set_port() implementation used to report errors, but I removed that reporting too when I changed pa_alsa_ucm_set_port() implementation to use pa_alsa_ucm_port_enable_devices(), which doesn't report errors. I could report errors from pa_alsa_ucm_port_enable_devices(), but I really don't see much benefit in that.
This commit is contained in:
parent
dc0cf0afeb
commit
926722cb6a
9 changed files with 13 additions and 22 deletions
|
|
@ -1658,7 +1658,7 @@ static void mixer_volume_init(struct userdata *u) {
|
|||
}
|
||||
}
|
||||
|
||||
static int sink_set_port_ucm_cb(pa_sink *s, pa_device_port *p) {
|
||||
static void sink_set_port_ucm_cb(pa_sink *s, pa_device_port *p) {
|
||||
struct userdata *u = s->userdata;
|
||||
pa_alsa_ucm_port_data *data;
|
||||
|
||||
|
|
@ -1675,10 +1675,10 @@ static int sink_set_port_ucm_cb(pa_sink *s, pa_device_port *p) {
|
|||
else
|
||||
sync_mixer(u, p);
|
||||
|
||||
return pa_alsa_ucm_set_port(s->active_port, p);
|
||||
pa_alsa_ucm_set_port(s->active_port, p);
|
||||
}
|
||||
|
||||
static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
|
||||
static void sink_set_port_cb(pa_sink *s, pa_device_port *p) {
|
||||
struct userdata *u = s->userdata;
|
||||
pa_alsa_port_data *data;
|
||||
|
||||
|
|
@ -1700,8 +1700,6 @@ static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
|
|||
pa_sink_suspend(s, true, PA_SUSPEND_UNAVAILABLE);
|
||||
else
|
||||
pa_sink_suspend(s, false, PA_SUSPEND_UNAVAILABLE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sink_update_requested_latency_cb(pa_sink *s) {
|
||||
|
|
|
|||
|
|
@ -1529,7 +1529,7 @@ static void mixer_volume_init(struct userdata *u) {
|
|||
}
|
||||
}
|
||||
|
||||
static int source_set_port_ucm_cb(pa_source *s, pa_device_port *p) {
|
||||
static void source_set_port_ucm_cb(pa_source *s, pa_device_port *p) {
|
||||
struct userdata *u = s->userdata;
|
||||
pa_alsa_ucm_port_data *data;
|
||||
|
||||
|
|
@ -1546,10 +1546,10 @@ static int source_set_port_ucm_cb(pa_source *s, pa_device_port *p) {
|
|||
else
|
||||
sync_mixer(u, p);
|
||||
|
||||
return pa_alsa_ucm_set_port(s->active_port, p);
|
||||
pa_alsa_ucm_set_port(s->active_port, p);
|
||||
}
|
||||
|
||||
static int source_set_port_cb(pa_source *s, pa_device_port *p) {
|
||||
static void source_set_port_cb(pa_source *s, pa_device_port *p) {
|
||||
struct userdata *u = s->userdata;
|
||||
pa_alsa_port_data *data;
|
||||
|
||||
|
|
@ -1566,8 +1566,6 @@ static int source_set_port_cb(pa_source *s, pa_device_port *p) {
|
|||
pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_SYNC_MIXER, p, 0, NULL);
|
||||
else
|
||||
sync_mixer(u, p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void source_update_requested_latency_cb(pa_source *s) {
|
||||
|
|
|
|||
|
|
@ -1286,14 +1286,12 @@ int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *
|
|||
return ret;
|
||||
}
|
||||
|
||||
int pa_alsa_ucm_set_port(pa_device_port *old_port, pa_device_port *new_port) {
|
||||
void pa_alsa_ucm_set_port(pa_device_port *old_port, pa_device_port *new_port) {
|
||||
pa_assert(old_port);
|
||||
pa_assert(new_port);
|
||||
|
||||
pa_alsa_ucm_port_enable_devices(PA_DEVICE_PORT_DATA(old_port), false);
|
||||
pa_alsa_ucm_port_enable_devices(PA_DEVICE_PORT_DATA(new_port), true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ucm_add_mapping(pa_alsa_profile *p, pa_alsa_mapping *m) {
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ void pa_alsa_ucm_add_ports_combination(
|
|||
pa_hashmap *ports,
|
||||
pa_card_profile *cp,
|
||||
pa_core *core);
|
||||
int pa_alsa_ucm_set_port(pa_device_port *old_port, pa_device_port *new_port);
|
||||
void pa_alsa_ucm_set_port(pa_device_port *old_port, pa_device_port *new_port);
|
||||
|
||||
void pa_alsa_ucm_free(pa_alsa_ucm_config *ucm);
|
||||
void pa_alsa_ucm_mapping_context_free(pa_alsa_ucm_mapping_context *context);
|
||||
|
|
|
|||
|
|
@ -622,8 +622,7 @@ finish:
|
|||
pa_log_debug("Thread shutting down");
|
||||
}
|
||||
|
||||
static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
|
||||
return 0;
|
||||
static void sink_set_port_cb(pa_sink *s, pa_device_port *p) {
|
||||
}
|
||||
|
||||
static pa_device_port *raop_create_port(struct userdata *u, const char *server) {
|
||||
|
|
|
|||
|
|
@ -3420,8 +3420,7 @@ int pa_sink_set_port(pa_sink *s, const char *name, bool save) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (s->set_port(s, port) < 0)
|
||||
return -PA_ERR_NOENTITY;
|
||||
s->set_port(s, port);
|
||||
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ struct pa_sink {
|
|||
|
||||
/* Called whenever the port shall be changed. Called from the main
|
||||
* thread. */
|
||||
int (*set_port)(pa_sink *s, pa_device_port *port); /* may be NULL */
|
||||
void (*set_port)(pa_sink *s, pa_device_port *port); /* may be NULL */
|
||||
|
||||
/* Called to get the list of formats supported by the sink, sorted
|
||||
* in descending order of preference. */
|
||||
|
|
|
|||
|
|
@ -2686,8 +2686,7 @@ int pa_source_set_port(pa_source *s, const char *name, bool save) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (s->set_port(s, port) < 0)
|
||||
return -PA_ERR_NOENTITY;
|
||||
s->set_port(s, port);
|
||||
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ struct pa_source {
|
|||
|
||||
/* Called whenever the port shall be changed. Called from the main
|
||||
* thread. */
|
||||
int (*set_port)(pa_source *s, pa_device_port *port); /*ditto */
|
||||
void (*set_port)(pa_source *s, pa_device_port *port); /*ditto */
|
||||
|
||||
/* Called to get the list of formats supported by the source, sorted
|
||||
* in descending order of preference. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue