mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -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
|
|
@ -99,7 +99,7 @@ do_send_event (SpaLoop *loop,
|
|||
{
|
||||
SpaALSASink *this = user_data;
|
||||
|
||||
this->event_cb (&this->node, data, this->user_data);
|
||||
this->callbacks.event (&this->node, data, this->user_data);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -171,9 +171,10 @@ spa_alsa_sink_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_alsa_sink_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event,
|
||||
void *user_data)
|
||||
spa_alsa_sink_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaALSASink *this;
|
||||
|
||||
|
|
@ -181,7 +182,7 @@ spa_alsa_sink_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaALSASink, node);
|
||||
|
||||
this->event_cb = event;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -271,11 +272,11 @@ spa_alsa_clear_buffers (SpaALSASink *this)
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_alsa_sink_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_alsa_sink_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaALSASink *this;
|
||||
SpaPODBuilder b = { NULL };
|
||||
|
|
@ -590,7 +591,7 @@ static const SpaNode alsasink_node = {
|
|||
spa_alsa_sink_node_get_props,
|
||||
spa_alsa_sink_node_set_props,
|
||||
spa_alsa_sink_node_send_command,
|
||||
spa_alsa_sink_node_set_event_callback,
|
||||
spa_alsa_sink_node_set_callbacks,
|
||||
spa_alsa_sink_node_get_n_ports,
|
||||
spa_alsa_sink_node_get_port_ids,
|
||||
spa_alsa_sink_node_add_port,
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ do_send_event (SpaLoop *loop,
|
|||
{
|
||||
SpaALSASource *this = user_data;
|
||||
|
||||
this->event_cb (&this->node, data, this->user_data);
|
||||
this->callbacks.event (&this->node, data, this->user_data);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -204,9 +204,10 @@ spa_alsa_source_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_alsa_source_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event,
|
||||
void *user_data)
|
||||
spa_alsa_source_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaALSASource *this;
|
||||
|
||||
|
|
@ -214,7 +215,7 @@ spa_alsa_source_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaALSASource, node);
|
||||
|
||||
this->event_cb = event;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -319,11 +320,11 @@ spa_alsa_clear_buffers (SpaALSASource *this)
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_alsa_source_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_alsa_source_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaALSASource *this;
|
||||
SpaPODBuilder b = { NULL };
|
||||
|
|
@ -631,7 +632,7 @@ static const SpaNode alsasource_node = {
|
|||
spa_alsa_source_node_get_props,
|
||||
spa_alsa_source_node_set_props,
|
||||
spa_alsa_source_node_send_command,
|
||||
spa_alsa_source_node_set_event_callback,
|
||||
spa_alsa_source_node_set_callbacks,
|
||||
spa_alsa_source_node_get_n_ports,
|
||||
spa_alsa_source_node_get_port_ids,
|
||||
spa_alsa_source_node_add_port,
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ spa_alsa_enum_format (SpaALSAState *state,
|
|||
}
|
||||
|
||||
int
|
||||
spa_alsa_set_format (SpaALSAState *state, SpaAudioInfo *fmt, SpaPortFormatFlags flags)
|
||||
spa_alsa_set_format (SpaALSAState *state, SpaAudioInfo *fmt, uint32_t flags)
|
||||
{
|
||||
unsigned int rrate, rchannels;
|
||||
snd_pcm_uframes_t period_size;
|
||||
|
|
@ -336,13 +336,11 @@ pull_frames (SpaALSAState *state,
|
|||
SpaPortIO *io = state->io;
|
||||
|
||||
if (spa_list_is_empty (&state->ready) && do_pull) {
|
||||
SpaEvent event = SPA_EVENT_INIT (state->type.event_node.NeedInput);
|
||||
|
||||
io->status = SPA_RESULT_NEED_BUFFER;
|
||||
io->range.offset = state->sample_count * state->frame_size;
|
||||
io->range.min_size = state->threshold * state->frame_size;
|
||||
io->range.max_size = frames * state->frame_size;
|
||||
state->event_cb (&state->node, &event, state->user_data);
|
||||
state->callbacks.need_input (&state->node, state->user_data);
|
||||
}
|
||||
while (!spa_list_is_empty (&state->ready) && to_write > 0) {
|
||||
uint8_t *src, *dst;
|
||||
|
|
@ -389,14 +387,11 @@ pull_frames (SpaALSAState *state,
|
|||
reuse = (state->ready_offset >= size);
|
||||
}
|
||||
if (reuse) {
|
||||
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (state->type.event_node.ReuseBuffer,
|
||||
0, b->outbuf->id);
|
||||
|
||||
spa_list_remove (&b->link);
|
||||
b->outstanding = true;
|
||||
state->io->buffer_id = b->outbuf->id;
|
||||
spa_log_trace (state->log, "alsa-util %p: reuse buffer %u", state, b->outbuf->id);
|
||||
state->event_cb (&state->node, (SpaEvent *)&rb, state->user_data);
|
||||
state->callbacks.reuse_buffer (&state->node, 0, b->outbuf->id, state->user_data);
|
||||
state->ready_offset = 0;
|
||||
}
|
||||
total_frames += n_frames;
|
||||
|
|
@ -450,13 +445,10 @@ push_frames (SpaALSAState *state,
|
|||
d[0].chunk->stride = 0;
|
||||
|
||||
{
|
||||
SpaEvent event = SPA_EVENT_INIT (state->type.event_node.HaveOutput);
|
||||
|
||||
b->outstanding = true;
|
||||
io->buffer_id = b->outbuf->id;
|
||||
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||
|
||||
state->event_cb (&state->node, &event, state->user_data);
|
||||
state->callbacks.have_output (&state->node, state->user_data);
|
||||
}
|
||||
}
|
||||
return total_frames;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ struct _SpaALSAState {
|
|||
snd_pcm_stream_t stream;
|
||||
snd_output_t *output;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
uint8_t props_buffer[1024];
|
||||
|
|
@ -185,7 +185,7 @@ spa_alsa_enum_format (SpaALSAState *state,
|
|||
|
||||
int spa_alsa_set_format (SpaALSAState *state,
|
||||
SpaAudioInfo *info,
|
||||
SpaPortFormatFlags flags);
|
||||
uint32_t flags);
|
||||
|
||||
SpaResult spa_alsa_start (SpaALSAState *state, bool xrun_recover);
|
||||
SpaResult spa_alsa_pause (SpaALSAState *state, bool xrun_recover);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ struct _SpaAudioMixer {
|
|||
SpaTypeMap *map;
|
||||
SpaLog *log;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
int port_count;
|
||||
|
|
@ -161,9 +161,10 @@ spa_audiomixer_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_audiomixer_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event,
|
||||
void *user_data)
|
||||
spa_audiomixer_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaAudioMixer *this;
|
||||
|
||||
|
|
@ -171,7 +172,7 @@ spa_audiomixer_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaAudioMixer, node);
|
||||
|
||||
this->event_cb = event;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -335,11 +336,11 @@ clear_buffers (SpaAudioMixer *this, SpaAudioMixerPort *port)
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_audiomixer_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_audiomixer_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaAudioMixer *this;
|
||||
SpaAudioMixerPort *port;
|
||||
|
|
@ -789,7 +790,7 @@ static const SpaNode audiomixer_node = {
|
|||
spa_audiomixer_node_get_props,
|
||||
spa_audiomixer_node_set_props,
|
||||
spa_audiomixer_node_send_command,
|
||||
spa_audiomixer_node_set_event_callback,
|
||||
spa_audiomixer_node_set_callbacks,
|
||||
spa_audiomixer_node_get_n_ports,
|
||||
spa_audiomixer_node_get_port_ids,
|
||||
spa_audiomixer_node_add_port,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ struct _SpaFFMpegDec {
|
|||
SpaTypeMap *map;
|
||||
SpaLog *log;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
SpaFFMpegPort in_ports[1];
|
||||
|
|
@ -127,9 +127,10 @@ spa_ffmpeg_dec_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_ffmpeg_dec_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event,
|
||||
void *user_data)
|
||||
spa_ffmpeg_dec_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaFFMpegDec *this;
|
||||
|
||||
|
|
@ -138,7 +139,7 @@ spa_ffmpeg_dec_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaFFMpegDec, node);
|
||||
|
||||
this->event_cb = event;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -231,11 +232,11 @@ spa_ffmpeg_dec_node_port_enum_formats (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_ffmpeg_dec_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_ffmpeg_dec_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaFFMpegDec *this;
|
||||
SpaFFMpegPort *port;
|
||||
|
|
@ -453,7 +454,7 @@ static const SpaNode ffmpeg_dec_node = {
|
|||
spa_ffmpeg_dec_node_get_props,
|
||||
spa_ffmpeg_dec_node_set_props,
|
||||
spa_ffmpeg_dec_node_send_command,
|
||||
spa_ffmpeg_dec_node_set_event_callback,
|
||||
spa_ffmpeg_dec_node_set_callbacks,
|
||||
spa_ffmpeg_dec_node_get_n_ports,
|
||||
spa_ffmpeg_dec_node_get_port_ids,
|
||||
spa_ffmpeg_dec_node_add_port,
|
||||
|
|
@ -520,8 +521,8 @@ spa_ffmpeg_dec_init (SpaHandle *handle,
|
|||
|
||||
this->node = ffmpeg_dec_node;
|
||||
|
||||
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||
this->out_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||
this->in_ports[0].info.flags = 0;
|
||||
this->out_ports[0].info.flags = 0;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ struct _SpaFFMpegEnc {
|
|||
SpaTypeMap *map;
|
||||
SpaLog *log;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
SpaFFMpegPort in_ports[1];
|
||||
|
|
@ -128,9 +128,10 @@ spa_ffmpeg_enc_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_ffmpeg_enc_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event,
|
||||
void *user_data)
|
||||
spa_ffmpeg_enc_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaFFMpegEnc *this;
|
||||
|
||||
|
|
@ -139,7 +140,7 @@ spa_ffmpeg_enc_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaFFMpegEnc, node);
|
||||
|
||||
this->event_cb = event;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -235,11 +236,11 @@ spa_ffmpeg_enc_node_port_enum_formats (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_ffmpeg_enc_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_ffmpeg_enc_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaFFMpegEnc *this;
|
||||
SpaFFMpegPort *port;
|
||||
|
|
@ -456,7 +457,7 @@ static const SpaNode ffmpeg_enc_node = {
|
|||
spa_ffmpeg_enc_node_get_props,
|
||||
spa_ffmpeg_enc_node_set_props,
|
||||
spa_ffmpeg_enc_node_send_command,
|
||||
spa_ffmpeg_enc_node_set_event_callback,
|
||||
spa_ffmpeg_enc_node_set_callbacks,
|
||||
spa_ffmpeg_enc_node_get_n_ports,
|
||||
spa_ffmpeg_enc_node_get_port_ids,
|
||||
spa_ffmpeg_enc_node_add_port,
|
||||
|
|
@ -522,8 +523,8 @@ spa_ffmpeg_enc_init (SpaHandle *handle,
|
|||
|
||||
this->node = ffmpeg_enc_node;
|
||||
|
||||
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||
this->out_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||
this->in_ports[0].info.flags = 0;
|
||||
this->out_ports[0].info.flags = 0;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ struct _SpaV4l2Source {
|
|||
uint8_t props_buffer[512];
|
||||
SpaV4l2SourceProps props;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
SpaV4l2State state[1];
|
||||
|
|
@ -244,7 +244,7 @@ do_pause_done (SpaLoop *loop,
|
|||
if (SPA_RESULT_IS_OK (ac->body.res.value))
|
||||
ac->body.res.value = spa_v4l2_stream_off (this);
|
||||
|
||||
this->event_cb (&this->node, (SpaEvent *)ac, this->user_data);
|
||||
this->callbacks.event (&this->node, (SpaEvent *)ac, this->user_data);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ do_start_done (SpaLoop *loop,
|
|||
SpaV4l2Source *this = user_data;
|
||||
SpaEventNodeAsyncComplete *ac = data;
|
||||
|
||||
this->event_cb (&this->node, (SpaEvent *)ac, this->user_data);
|
||||
this->callbacks.event (&this->node, (SpaEvent *)ac, this->user_data);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -381,9 +381,10 @@ spa_v4l2_source_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_v4l2_source_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event,
|
||||
void *user_data)
|
||||
spa_v4l2_source_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaV4l2Source *this;
|
||||
|
||||
|
|
@ -391,7 +392,7 @@ spa_v4l2_source_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
|
||||
|
||||
this->event_cb = event;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -474,11 +475,11 @@ spa_v4l2_source_node_port_enum_formats (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_v4l2_source_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_v4l2_source_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaV4l2Source *this;
|
||||
SpaV4l2State *state;
|
||||
|
|
@ -823,7 +824,7 @@ static const SpaNode v4l2source_node = {
|
|||
spa_v4l2_source_node_get_props,
|
||||
spa_v4l2_source_node_set_props,
|
||||
spa_v4l2_source_node_send_command,
|
||||
spa_v4l2_source_node_set_event_callback,
|
||||
spa_v4l2_source_node_set_callbacks,
|
||||
spa_v4l2_source_node_get_n_ports,
|
||||
spa_v4l2_source_node_get_port_ids,
|
||||
spa_v4l2_source_node_add_port,
|
||||
|
|
|
|||
|
|
@ -972,15 +972,11 @@ mmap_read (SpaV4l2Source *this)
|
|||
d[0].chunk->size = buf.bytesused;
|
||||
d[0].chunk->stride = state->fmt.fmt.pix.bytesperline;
|
||||
|
||||
{
|
||||
SpaEvent event = SPA_EVENT_INIT (this->type.event_node.HaveOutput);
|
||||
b->outstanding = true;
|
||||
io->buffer_id = b->outbuf->id;
|
||||
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||
this->callbacks.have_output (&this->node, this->user_data);
|
||||
|
||||
b->outstanding = true;
|
||||
io->buffer_id = b->outbuf->id;
|
||||
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||
|
||||
this->event_cb (&this->node, &event, this->user_data);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ struct _SpaVideoTestSrc {
|
|||
uint8_t props_buffer[512];
|
||||
SpaVideoTestSrcProps props;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
SpaSource timer_source;
|
||||
|
|
@ -221,13 +221,11 @@ spa_videotestsrc_node_set_props (SpaNode *node,
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
static inline SpaResult
|
||||
send_have_output (SpaVideoTestSrc *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;
|
||||
}
|
||||
|
||||
|
|
@ -381,9 +379,10 @@ spa_videotestsrc_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_videotestsrc_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event_cb,
|
||||
void *user_data)
|
||||
spa_videotestsrc_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaVideoTestSrc *this;
|
||||
|
||||
|
|
@ -391,7 +390,7 @@ spa_videotestsrc_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
|
||||
|
||||
this->event_cb = event_cb;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -523,11 +522,11 @@ clear_buffers (SpaVideoTestSrc *this)
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_videotestsrc_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_videotestsrc_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaVideoTestSrc *this;
|
||||
|
||||
|
|
@ -831,7 +830,7 @@ static const SpaNode videotestsrc_node = {
|
|||
spa_videotestsrc_node_get_props,
|
||||
spa_videotestsrc_node_set_props,
|
||||
spa_videotestsrc_node_send_command,
|
||||
spa_videotestsrc_node_set_event_callback,
|
||||
spa_videotestsrc_node_set_callbacks,
|
||||
spa_videotestsrc_node_get_n_ports,
|
||||
spa_videotestsrc_node_get_port_ids,
|
||||
spa_videotestsrc_node_add_port,
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ struct _SpaVolume {
|
|||
uint8_t props_buffer[512];
|
||||
SpaVolumeProps props;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
uint8_t format_buffer[1024];
|
||||
|
|
@ -215,9 +215,10 @@ spa_volume_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_volume_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event,
|
||||
void *user_data)
|
||||
spa_volume_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaVolume *this;
|
||||
|
||||
|
|
@ -225,7 +226,7 @@ spa_volume_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaVolume, node);
|
||||
|
||||
this->event_cb = event;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -352,11 +353,11 @@ clear_buffers (SpaVolume *this, SpaVolumePort *port)
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_volume_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_volume_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaVolume *this;
|
||||
SpaVolumePort *port;
|
||||
|
|
@ -623,12 +624,10 @@ find_free_buffer (SpaVolume *this, SpaVolumePort *port)
|
|||
return b->outbuf;
|
||||
}
|
||||
|
||||
static void
|
||||
static inline void
|
||||
release_buffer (SpaVolume *this, SpaBuffer *buffer)
|
||||
{
|
||||
SpaEventNodeReuseBuffer rb = SPA_EVENT_NODE_REUSE_BUFFER_INIT (this->type.event_node.ReuseBuffer,
|
||||
0, buffer->id);
|
||||
this->event_cb (&this->node, (SpaEvent *)&rb, this->user_data);
|
||||
this->callbacks.reuse_buffer (&this->node, 0, buffer->id, this->user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -740,7 +739,7 @@ static const SpaNode volume_node = {
|
|||
spa_volume_node_get_props,
|
||||
spa_volume_node_set_props,
|
||||
spa_volume_node_send_command,
|
||||
spa_volume_node_set_event_callback,
|
||||
spa_volume_node_set_callbacks,
|
||||
spa_volume_node_get_n_ports,
|
||||
spa_volume_node_get_port_ids,
|
||||
spa_volume_node_add_port,
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ struct _SpaXvSink {
|
|||
uint8_t props_buffer[512];
|
||||
SpaXvSinkProps props;
|
||||
|
||||
SpaEventNodeCallback event_cb;
|
||||
SpaNodeCallbacks callbacks;
|
||||
void *user_data;
|
||||
|
||||
bool have_format;
|
||||
|
|
@ -196,9 +196,10 @@ spa_xv_sink_node_send_command (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_xv_sink_node_set_event_callback (SpaNode *node,
|
||||
SpaEventNodeCallback event,
|
||||
void *user_data)
|
||||
spa_xv_sink_node_set_callbacks (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data)
|
||||
{
|
||||
SpaXvSink *this;
|
||||
|
||||
|
|
@ -207,7 +208,7 @@ spa_xv_sink_node_set_event_callback (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaXvSink, node);
|
||||
|
||||
this->event_cb = event;
|
||||
this->callbacks = *callbacks;
|
||||
this->user_data = user_data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -298,11 +299,11 @@ spa_xv_sink_node_port_enum_formats (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_xv_sink_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortFormatFlags flags,
|
||||
const SpaFormat *format)
|
||||
spa_xv_sink_node_port_set_format (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format)
|
||||
{
|
||||
SpaXvSink *this;
|
||||
|
||||
|
|
@ -482,7 +483,7 @@ static const SpaNode xvsink_node = {
|
|||
spa_xv_sink_node_get_props,
|
||||
spa_xv_sink_node_set_props,
|
||||
spa_xv_sink_node_send_command,
|
||||
spa_xv_sink_node_set_event_callback,
|
||||
spa_xv_sink_node_set_callbacks,
|
||||
spa_xv_sink_node_get_n_ports,
|
||||
spa_xv_sink_node_get_port_ids,
|
||||
spa_xv_sink_node_add_port,
|
||||
|
|
@ -561,7 +562,7 @@ xv_sink_init (const SpaHandleFactory *factory,
|
|||
this->node = xvsink_node;
|
||||
reset_xv_sink_props (&this->props);
|
||||
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||
this->info.flags = 0;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue