mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
devices: Use wrapper functions to set the *_volume and *_mute callbacks.
This is not currently useful but future commits will make further changes concerning automatic setting of flags and event delivery that makes this structure necessary.
This commit is contained in:
parent
8840ebf9c3
commit
ded07a5898
17 changed files with 175 additions and 67 deletions
|
|
@ -1777,9 +1777,9 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_v
|
|||
u->sink->n_volume_steps = u->mixer_path->max_volume - u->mixer_path->min_volume + 1;
|
||||
}
|
||||
|
||||
u->sink->get_volume = sink_get_volume_cb;
|
||||
u->sink->set_volume = sink_set_volume_cb;
|
||||
u->sink->write_volume = sink_write_volume_cb;
|
||||
pa_sink_set_get_volume_callback(u->sink, sink_get_volume_cb);
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
|
||||
pa_sink_set_write_volume_callback(u->sink, sink_write_volume_cb);
|
||||
|
||||
u->sink->flags |= PA_SINK_HW_VOLUME_CTRL;
|
||||
if (u->mixer_path->has_dB) {
|
||||
|
|
@ -1796,8 +1796,8 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_v
|
|||
if (!u->mixer_path->has_mute) {
|
||||
pa_log_info("Driver does not support hardware mute control, falling back to software mute control.");
|
||||
} else {
|
||||
u->sink->get_mute = sink_get_mute_cb;
|
||||
u->sink->set_mute = sink_set_mute_cb;
|
||||
pa_sink_set_get_mute_callback(u->sink, sink_get_mute_cb);
|
||||
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
|
||||
u->sink->flags |= PA_SINK_HW_MUTE_CTRL;
|
||||
pa_log_info("Using hardware mute control.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1552,9 +1552,9 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_v
|
|||
u->source->n_volume_steps = u->mixer_path->max_volume - u->mixer_path->min_volume + 1;
|
||||
}
|
||||
|
||||
u->source->get_volume = source_get_volume_cb;
|
||||
u->source->set_volume = source_set_volume_cb;
|
||||
u->source->write_volume = source_write_volume_cb;
|
||||
pa_source_set_get_volume_callback(u->source, source_get_volume_cb);
|
||||
pa_source_set_set_volume_callback(u->source, source_set_volume_cb);
|
||||
pa_source_set_write_volume_callback(u->source, source_write_volume_cb);
|
||||
|
||||
u->source->flags |= PA_SOURCE_HW_VOLUME_CTRL;
|
||||
if (u->mixer_path->has_dB) {
|
||||
|
|
@ -1571,8 +1571,8 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_v
|
|||
if (!u->mixer_path->has_mute) {
|
||||
pa_log_info("Driver does not support hardware mute control, falling back to software mute control.");
|
||||
} else {
|
||||
u->source->get_mute = source_get_mute_cb;
|
||||
u->source->set_mute = source_set_mute_cb;
|
||||
pa_source_set_get_mute_callback(u->source, source_get_mute_cb);
|
||||
pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
|
||||
u->source->flags |= PA_SOURCE_HW_MUTE_CTRL;
|
||||
pa_log_info("Using hardware mute control.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2040,7 +2040,7 @@ static int add_sink(struct userdata *u) {
|
|||
}
|
||||
|
||||
if (u->profile == PROFILE_HSP) {
|
||||
u->sink->set_volume = sink_set_volume_cb;
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
|
||||
u->sink->n_volume_steps = 16;
|
||||
|
||||
k = pa_sprintf_malloc("bluetooth-device@%p", (void*) u->sink);
|
||||
|
|
@ -2111,7 +2111,7 @@ static int add_source(struct userdata *u) {
|
|||
}
|
||||
|
||||
if (u->profile == PROFILE_HSP) {
|
||||
u->source->set_volume = source_set_volume_cb;
|
||||
pa_source_set_set_volume_callback(u->source, source_set_volume_cb);
|
||||
u->source->n_volume_steps = 16;
|
||||
|
||||
k = pa_sprintf_malloc("bluetooth-device@%p", (void*) u->source);
|
||||
|
|
@ -2510,8 +2510,8 @@ static void restore_sco_volume_callbacks(struct userdata *u) {
|
|||
pa_assert(u);
|
||||
pa_assert(USE_SCO_OVER_PCM(u));
|
||||
|
||||
u->hsp.sco_sink->set_volume = u->hsp.sco_sink_set_volume;
|
||||
u->hsp.sco_source->set_volume = u->hsp.sco_source_set_volume;
|
||||
pa_sink_set_set_volume_callback(u->hsp.sco_sink, u->hsp.sco_sink_set_volume);
|
||||
pa_source_set_set_volume_callback(u->hsp.sco_source, u->hsp.sco_source_set_volume);
|
||||
}
|
||||
|
||||
/* Run from main thread */
|
||||
|
|
|
|||
|
|
@ -1535,10 +1535,10 @@ int pa__init(pa_module*m) {
|
|||
u->source->parent.process_msg = source_process_msg_cb;
|
||||
u->source->set_state = source_set_state_cb;
|
||||
u->source->update_requested_latency = source_update_requested_latency_cb;
|
||||
u->source->set_volume = source_set_volume_cb;
|
||||
u->source->set_mute = source_set_mute_cb;
|
||||
u->source->get_volume = source_get_volume_cb;
|
||||
u->source->get_mute = source_get_mute_cb;
|
||||
pa_source_set_get_volume_callback(u->source, source_get_volume_cb);
|
||||
pa_source_set_set_volume_callback(u->source, source_set_volume_cb);
|
||||
pa_source_set_get_mute_callback(u->source, source_get_mute_cb);
|
||||
pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
|
||||
u->source->userdata = u;
|
||||
|
||||
pa_source_set_asyncmsgq(u->source, source_master->asyncmsgq);
|
||||
|
|
@ -1584,8 +1584,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink->set_state = sink_set_state_cb;
|
||||
u->sink->update_requested_latency = sink_update_requested_latency_cb;
|
||||
u->sink->request_rewind = sink_request_rewind_cb;
|
||||
u->sink->set_volume = sink_set_volume_cb;
|
||||
u->sink->set_mute = sink_set_mute_cb;
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
|
||||
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
|
||||
u->sink->userdata = u;
|
||||
|
||||
pa_sink_set_asyncmsgq(u->sink, sink_master->asyncmsgq);
|
||||
|
|
|
|||
|
|
@ -1191,8 +1191,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink->set_state = sink_set_state_cb;
|
||||
u->sink->update_requested_latency = sink_update_requested_latency_cb;
|
||||
u->sink->request_rewind = sink_request_rewind_cb;
|
||||
u->sink->set_volume = sink_set_volume_cb;
|
||||
u->sink->set_mute = sink_set_mute_cb;
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
|
||||
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
|
||||
u->sink->userdata = u;
|
||||
|
||||
u->input_q = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, fs, 1, 1, 0, &u->sink->silence);
|
||||
|
|
|
|||
|
|
@ -896,8 +896,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink->set_state = sink_set_state_cb;
|
||||
u->sink->update_requested_latency = sink_update_requested_latency_cb;
|
||||
u->sink->request_rewind = sink_request_rewind_cb;
|
||||
u->sink->set_volume = sink_set_volume_cb;
|
||||
u->sink->set_mute = sink_set_mute_cb;
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
|
||||
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
|
||||
u->sink->userdata = u;
|
||||
|
||||
pa_sink_set_asyncmsgq(u->sink, master->asyncmsgq);
|
||||
|
|
|
|||
|
|
@ -949,8 +949,8 @@ int pa__init(pa_module *m) {
|
|||
pa_source_set_rtpoll(u->source, u->rtpoll);
|
||||
pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->buffer_size, &u->source->sample_spec));
|
||||
|
||||
u->source->get_volume = source_get_volume;
|
||||
u->source->set_volume = source_set_volume;
|
||||
pa_source_set_get_volume_callback(u->source, source_get_volume);
|
||||
pa_source_set_set_volume_callback(u->source, source_set_volume);
|
||||
u->source->refresh_volume = TRUE;
|
||||
} else
|
||||
u->source = NULL;
|
||||
|
|
@ -994,10 +994,10 @@ int pa__init(pa_module *m) {
|
|||
pa_sink_set_max_request(u->sink, u->buffer_size);
|
||||
pa_sink_set_max_rewind(u->sink, u->buffer_size);
|
||||
|
||||
u->sink->get_volume = sink_get_volume;
|
||||
u->sink->set_volume = sink_set_volume;
|
||||
u->sink->get_mute = sink_get_mute;
|
||||
u->sink->set_mute = sink_set_mute;
|
||||
pa_sink_set_get_volume_callback(u->sink, sink_get_volume);
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
|
||||
pa_sink_set_get_mute_callback(u->sink, sink_get_mute);
|
||||
pa_sink_set_set_mute_callback(u->sink, sink_set_mute);
|
||||
u->sink->refresh_volume = u->sink->refresh_muted = TRUE;
|
||||
} else
|
||||
u->sink = NULL;
|
||||
|
|
|
|||
|
|
@ -2014,8 +2014,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink->parent.process_msg = sink_process_msg;
|
||||
u->sink->userdata = u;
|
||||
u->sink->set_state = sink_set_state;
|
||||
u->sink->set_volume = sink_set_volume;
|
||||
u->sink->set_mute = sink_set_mute;
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
|
||||
pa_sink_set_set_mute_callback(u->sink, sink_set_mute);
|
||||
|
||||
u->sink->refresh_volume = u->sink->refresh_muted = FALSE;
|
||||
|
||||
|
|
|
|||
|
|
@ -567,8 +567,8 @@ int pa__init(pa_module*m) {
|
|||
u->sink->set_state = sink_set_state_cb;
|
||||
u->sink->update_requested_latency = sink_update_requested_latency_cb;
|
||||
u->sink->request_rewind = sink_request_rewind_cb;
|
||||
u->sink->set_volume = use_volume_sharing ? NULL : sink_set_volume_cb;
|
||||
u->sink->set_mute = sink_set_mute_cb;
|
||||
pa_sink_set_set_volume_callback(u->sink, use_volume_sharing ? NULL : sink_set_volume_cb);
|
||||
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
|
||||
u->sink->userdata = u;
|
||||
|
||||
pa_sink_set_asyncmsgq(u->sink, master->asyncmsgq);
|
||||
|
|
|
|||
|
|
@ -594,8 +594,8 @@ int pa__init(pa_module*m) {
|
|||
u->source->parent.process_msg = source_process_msg_cb;
|
||||
u->source->set_state = source_set_state_cb;
|
||||
u->source->update_requested_latency = source_update_requested_latency_cb;
|
||||
u->source->set_volume = use_volume_sharing ? NULL : source_set_volume_cb;
|
||||
u->source->set_mute = source_set_mute_cb;
|
||||
pa_source_set_set_volume_callback(u->source, use_volume_sharing ? NULL : source_set_volume_cb);
|
||||
pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
|
||||
u->source->userdata = u;
|
||||
|
||||
pa_source_set_asyncmsgq(u->source, master->asyncmsgq);
|
||||
|
|
|
|||
|
|
@ -637,8 +637,8 @@ int pa__init(pa_module *m) {
|
|||
pa_sink_new_data_done(&data);
|
||||
|
||||
pa_assert(u->sink);
|
||||
u->sink->get_volume = sink_get_volume_cb;
|
||||
u->sink->set_volume = sink_set_volume_cb;
|
||||
pa_sink_set_get_volume_callback(u->sink, sink_get_volume_cb);
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
|
||||
u->sink->userdata = u;
|
||||
pa_sink_set_description(u->sink, description);
|
||||
u->sink->parent.process_msg = process_msg;
|
||||
|
|
|
|||
|
|
@ -1423,8 +1423,8 @@ int pa__init(pa_module*m) {
|
|||
if (u->sink && (u->mixer_devmask & (SOUND_MASK_VOLUME|SOUND_MASK_PCM))) {
|
||||
pa_log_debug("Found hardware mixer track for playback.");
|
||||
u->sink->flags |= PA_SINK_HW_VOLUME_CTRL;
|
||||
u->sink->get_volume = sink_get_volume;
|
||||
u->sink->set_volume = sink_set_volume;
|
||||
pa_sink_set_get_volume_callback(u->sink, sink_get_volume);
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
|
||||
u->sink->n_volume_steps = 101;
|
||||
do_close = FALSE;
|
||||
}
|
||||
|
|
@ -1432,8 +1432,8 @@ int pa__init(pa_module*m) {
|
|||
if (u->source && (u->mixer_devmask & (SOUND_MASK_RECLEV|SOUND_MASK_IGAIN))) {
|
||||
pa_log_debug("Found hardware mixer track for recording.");
|
||||
u->source->flags |= PA_SOURCE_HW_VOLUME_CTRL;
|
||||
u->source->get_volume = source_get_volume;
|
||||
u->source->set_volume = source_set_volume;
|
||||
pa_source_set_get_volume_callback(u->source, source_get_volume);
|
||||
pa_source_set_set_volume_callback(u->source, source_set_volume);
|
||||
u->source->n_volume_steps = 101;
|
||||
do_close = FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,8 +594,8 @@ int pa__init(pa_module*m) {
|
|||
|
||||
u->sink->parent.process_msg = sink_process_msg;
|
||||
u->sink->userdata = u;
|
||||
u->sink->set_volume = sink_set_volume_cb;
|
||||
u->sink->set_mute = sink_set_mute_cb;
|
||||
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
|
||||
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
|
||||
u->sink->flags = PA_SINK_LATENCY|PA_SINK_NETWORK|PA_SINK_HW_VOLUME_CTRL;
|
||||
|
||||
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
|
||||
|
|
|
|||
|
|
@ -449,6 +449,36 @@ static int sink_set_state(pa_sink *s, pa_sink_state_t state) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void pa_sink_set_get_volume_callback(pa_sink *s, pa_sink_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->get_volume = cb;
|
||||
}
|
||||
|
||||
void pa_sink_set_set_volume_callback(pa_sink *s, pa_sink_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->set_volume = cb;
|
||||
}
|
||||
|
||||
void pa_sink_set_write_volume_callback(pa_sink *s, pa_sink_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->write_volume = cb;
|
||||
}
|
||||
|
||||
void pa_sink_set_get_mute_callback(pa_sink *s, pa_sink_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->get_mute = cb;
|
||||
}
|
||||
|
||||
void pa_sink_set_set_mute_callback(pa_sink *s, pa_sink_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->set_mute = cb;
|
||||
}
|
||||
|
||||
/* Called from main context */
|
||||
void pa_sink_put(pa_sink* s) {
|
||||
pa_sink_assert_ref(s);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ struct pa_device_port {
|
|||
|
||||
#define PA_DEVICE_PORT_DATA(d) ((void*) ((uint8_t*) d + PA_ALIGN(sizeof(pa_device_port))))
|
||||
|
||||
/* A generic definition for void callback functions */
|
||||
typedef void(*pa_sink_cb_t)(pa_sink *s);
|
||||
|
||||
struct pa_sink {
|
||||
pa_msgobject parent;
|
||||
|
||||
|
|
@ -141,8 +144,11 @@ struct pa_sink {
|
|||
* PA_SINK_MESSAGE_GET_VOLUME (the main thread is waiting while
|
||||
* the message is being processed), so there's no choice of where
|
||||
* to do the volume reading - it has to be done in the IO thread
|
||||
* always. */
|
||||
void (*get_volume)(pa_sink *s); /* may be NULL */
|
||||
* always.
|
||||
*
|
||||
* You must use the function pa_sink_set_get_volume_callback() to
|
||||
* set this callback. */
|
||||
pa_sink_cb_t get_volume; /* may be NULL */
|
||||
|
||||
/* Sink drivers that support hardware volume must set this
|
||||
* callback. This is called when the hardware volume needs to be
|
||||
|
|
@ -161,8 +167,11 @@ struct pa_sink {
|
|||
* requested volume the hardware volume can be set, and update
|
||||
* s->real_volume and/or s->soft_volume so that they together
|
||||
* match the actual hardware volume that will be set later in the
|
||||
* write_volume callback. */
|
||||
void (*set_volume)(pa_sink *s); /* ditto */
|
||||
* write_volume callback.
|
||||
*
|
||||
* You must use the function pa_sink_set_set_volume_callback() to
|
||||
* set this callback. */
|
||||
pa_sink_cb_t set_volume; /* may be NULL */
|
||||
|
||||
/* Sink drivers that set PA_SINK_SYNC_VOLUME must provide this
|
||||
* callback. This callback is not used with sinks that do not set
|
||||
|
|
@ -174,27 +183,36 @@ struct pa_sink {
|
|||
* The call is done inside pa_sink_volume_change_apply(), which is
|
||||
* not called automatically - it is the driver's responsibility to
|
||||
* schedule that function to be called at the right times in the
|
||||
* IO thread. */
|
||||
void (*write_volume)(pa_sink *s); /* ditto */
|
||||
* IO thread.
|
||||
*
|
||||
* You must use the function pa_sink_set_write_volume_callback() to
|
||||
* set this callback. */
|
||||
pa_sink_cb_t write_volume; /* may be NULL */
|
||||
|
||||
/* Called when the mute setting is queried. A PA_SINK_MESSAGE_GET_MUTE
|
||||
* message will also be sent. Called from IO thread if PA_SINK_SYNC_VOLUME
|
||||
* flag is set otherwise from main loop context. If refresh_mute is FALSE
|
||||
* neither this function is called nor a message is sent.*/
|
||||
void (*get_mute)(pa_sink *s); /* ditto */
|
||||
* neither this function is called nor a message is sent.
|
||||
*
|
||||
* You must use the function pa_sink_set_get_mute_callback() to
|
||||
* set this callback. */
|
||||
pa_sink_cb_t get_mute; /* may be NULL */
|
||||
|
||||
/* Called when the mute setting shall be changed. A PA_SINK_MESSAGE_SET_MUTE
|
||||
* message will also be sent. Called from IO thread if PA_SINK_SYNC_VOLUME
|
||||
* flag is set otherwise from main loop context. */
|
||||
void (*set_mute)(pa_sink *s); /* ditto */
|
||||
* flag is set otherwise from main loop context.
|
||||
*
|
||||
* You must use the function pa_sink_set_set_mute_callback() to
|
||||
* set this callback. */
|
||||
pa_sink_cb_t set_mute; /* may be NULL */
|
||||
|
||||
/* Called when a rewind request is issued. Called from IO thread
|
||||
* context. */
|
||||
void (*request_rewind)(pa_sink *s); /* ditto */
|
||||
pa_sink_cb_t request_rewind; /* may be NULL */
|
||||
|
||||
/* Called when a the requested latency is changed. Called from IO
|
||||
* thread context. */
|
||||
void (*update_requested_latency)(pa_sink *s); /* ditto */
|
||||
pa_sink_cb_t update_requested_latency; /* may be NULL */
|
||||
|
||||
/* Called whenever the port shall be changed. Called from main
|
||||
* thread. */
|
||||
|
|
@ -339,6 +357,12 @@ pa_sink* pa_sink_new(
|
|||
pa_sink_new_data *data,
|
||||
pa_sink_flags_t flags);
|
||||
|
||||
void pa_sink_set_get_volume_callback(pa_sink *s, pa_sink_cb_t cb);
|
||||
void pa_sink_set_set_volume_callback(pa_sink *s, pa_sink_cb_t cb);
|
||||
void pa_sink_set_write_volume_callback(pa_sink *s, pa_sink_cb_t cb);
|
||||
void pa_sink_set_get_mute_callback(pa_sink *s, pa_sink_cb_t cb);
|
||||
void pa_sink_set_set_mute_callback(pa_sink *s, pa_sink_cb_t cb);
|
||||
|
||||
void pa_sink_put(pa_sink *s);
|
||||
void pa_sink_unlink(pa_sink* s);
|
||||
|
||||
|
|
|
|||
|
|
@ -381,6 +381,36 @@ static int source_set_state(pa_source *s, pa_source_state_t state) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void pa_source_set_get_volume_callback(pa_source *s, pa_source_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->get_volume = cb;
|
||||
}
|
||||
|
||||
void pa_source_set_set_volume_callback(pa_source *s, pa_source_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->set_volume = cb;
|
||||
}
|
||||
|
||||
void pa_source_set_write_volume_callback(pa_source *s, pa_source_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->write_volume = cb;
|
||||
}
|
||||
|
||||
void pa_source_set_get_mute_callback(pa_source *s, pa_source_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->get_mute = cb;
|
||||
}
|
||||
|
||||
void pa_source_set_set_mute_callback(pa_source *s, pa_source_cb_t cb) {
|
||||
pa_assert(s);
|
||||
|
||||
s->set_mute = cb;
|
||||
}
|
||||
|
||||
/* Called from main context */
|
||||
void pa_source_put(pa_source *s) {
|
||||
pa_source_assert_ref(s);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ static inline pa_bool_t PA_SOURCE_IS_LINKED(pa_source_state_t x) {
|
|||
return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE || x == PA_SOURCE_SUSPENDED;
|
||||
}
|
||||
|
||||
/* A generic definition for void callback functions */
|
||||
typedef void(*pa_source_cb_t)(pa_source *s);
|
||||
|
||||
struct pa_source {
|
||||
pa_msgobject parent;
|
||||
|
||||
|
|
@ -111,13 +114,19 @@ struct pa_source {
|
|||
/* Callled when the volume is queried. Called from main loop
|
||||
* context. If this is NULL a PA_SOURCE_MESSAGE_GET_VOLUME message
|
||||
* will be sent to the IO thread instead. If refresh_volume is
|
||||
* FALSE neither this function is called nor a message is sent. */
|
||||
void (*get_volume)(pa_source *s); /* ditto */
|
||||
* FALSE neither this function is called nor a message is sent.
|
||||
*
|
||||
* You must use the function pa_source_set_get_volume_callback() to
|
||||
* set this callback. */
|
||||
pa_source_cb_t get_volume; /* may be NULL */
|
||||
|
||||
/* Called when the volume shall be changed. Called from main loop
|
||||
* context. If this is NULL a PA_SOURCE_MESSAGE_SET_VOLUME message
|
||||
* will be sent to the IO thread instead. */
|
||||
void (*set_volume)(pa_source *s); /* ditto */
|
||||
* will be sent to the IO thread instead.
|
||||
*
|
||||
* You must use the function pa_source_set_set_volume_callback() to
|
||||
* set this callback. */
|
||||
pa_source_cb_t set_volume; /* may be NULL */
|
||||
|
||||
/* Source drivers that set PA_SOURCE_SYNC_VOLUME must provide this
|
||||
* callback. This callback is not used with source that do not set
|
||||
|
|
@ -129,23 +138,32 @@ struct pa_source {
|
|||
* The call is done inside pa_source_volume_change_apply(), which is
|
||||
* not called automatically - it is the driver's responsibility to
|
||||
* schedule that function to be called at the right times in the
|
||||
* IO thread. */
|
||||
void (*write_volume)(pa_source *s); /* ditto */
|
||||
* IO thread.
|
||||
*
|
||||
* You must use the function pa_source_set_write_volume_callback() to
|
||||
* set this callback. */
|
||||
pa_source_cb_t write_volume; /* may be NULL */
|
||||
|
||||
/* Called when the mute setting is queried. Called from main loop
|
||||
* context. If this is NULL a PA_SOURCE_MESSAGE_GET_MUTE message
|
||||
* will be sent to the IO thread instead. If refresh_mute is
|
||||
* FALSE neither this function is called nor a message is sent.*/
|
||||
void (*get_mute)(pa_source *s); /* ditto */
|
||||
* FALSE neither this function is called nor a message is sent.
|
||||
*
|
||||
* You must use the function pa_source_set_get_mute_callback() to
|
||||
* set this callback. */
|
||||
pa_source_cb_t get_mute; /* may be NULL */
|
||||
|
||||
/* Called when the mute setting shall be changed. Called from main
|
||||
* loop context. If this is NULL a PA_SOURCE_MESSAGE_SET_MUTE
|
||||
* message will be sent to the IO thread instead. */
|
||||
void (*set_mute)(pa_source *s); /* ditto */
|
||||
* message will be sent to the IO thread instead.
|
||||
*
|
||||
* You must use the function pa_source_set_set_mute_callback() to
|
||||
* set this callback. */
|
||||
pa_source_cb_t set_mute; /* may be NULL */
|
||||
|
||||
/* Called when a the requested latency is changed. Called from IO
|
||||
* thread context. */
|
||||
void (*update_requested_latency)(pa_source *s); /* ditto */
|
||||
pa_source_cb_t update_requested_latency; /* may be NULL */
|
||||
|
||||
/* Called whenever the port shall be changed. Called from main
|
||||
* thread. */
|
||||
|
|
@ -270,6 +288,12 @@ pa_source* pa_source_new(
|
|||
pa_source_new_data *data,
|
||||
pa_source_flags_t flags);
|
||||
|
||||
void pa_source_set_get_volume_callback(pa_source *s, pa_source_cb_t cb);
|
||||
void pa_source_set_set_volume_callback(pa_source *s, pa_source_cb_t cb);
|
||||
void pa_source_set_write_volume_callback(pa_source *s, pa_source_cb_t cb);
|
||||
void pa_source_set_get_mute_callback(pa_source *s, pa_source_cb_t cb);
|
||||
void pa_source_set_set_mute_callback(pa_source *s, pa_source_cb_t cb);
|
||||
|
||||
void pa_source_put(pa_source *s);
|
||||
void pa_source_unlink(pa_source *s);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue