mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
node: improve callbacks
Make separate callbacks for events and RT notifications.
This commit is contained in:
parent
fb0919b8b7
commit
3b33e3d362
32 changed files with 557 additions and 481 deletions
|
|
@ -122,7 +122,7 @@ struct _SpaAudioTestSrc {
|
|||
uint8_t props_buffer[512];
|
||||
SpaAudioTestSrcProps props;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
SpaSource timer_source;
|
||||
|
|
@ -238,13 +238,11 @@ spa_audiotestsrc_node_set_props (SpaNode *node,
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
static inline SpaResult
|
||||
send_have_output (SpaAudioTestSrc *this)
|
||||
{
|
||||
if (this->event_cb) {
|
||||
SpaEvent event = SPA_EVENT_INIT (this->type.event_node.HaveOutput);
|
||||
this->event_cb (&this->node, &event, this->user_data);
|
||||
}
|
||||
if (this->callbacks.have_output)
|
||||
this->callbacks.have_output (&this->node, this->user_data);
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -419,9 +417,10 @@ spa_audiotestsrc_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_audiotestsrc_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event_cb,
|
||||
void *user_data)
|
||||
spa_audiotestsrc_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaAudioTestSrc *this;
|
||||
|
||||
|
|
@ -429,7 +428,7 @@ spa_audiotestsrc_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
|
||||
|
||||
this->event_cb = event_cb;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -556,11 +555,11 @@ clear_buffers (SpaAudioTestSrc *this)
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_audiotestsrc_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_audiotestsrc_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaAudioTestSrc *this;
|
||||
|
||||
|
|
@ -870,7 +869,7 @@ static const SpaNode audiotestsrc_node = {
|
|||
spa_audiotestsrc_node_get_props,
|
||||
spa_audiotestsrc_node_set_props,
|
||||
spa_audiotestsrc_node_send_command,
|
||||
spa_audiotestsrc_node_set_event_callback,
|
||||
spa_audiotestsrc_node_set_callbacks,
|
||||
spa_audiotestsrc_node_get_n_ports,
|
||||
spa_audiotestsrc_node_get_port_ids,
|
||||
spa_audiotestsrc_node_add_port,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue