Make events and command specific to the node
Remove some unused code
Improve state changes
Use easier fixate by just taking the element default value
Fix reuse buffer in the proxy
This commit is contained in:
Wim Taymans 2016-09-06 16:43:37 +02:00
parent ac3cd24d5c
commit 8ada6736c0
29 changed files with 686 additions and 708 deletions

View file

@ -79,7 +79,7 @@ struct _SpaALSASink {
SpaALSASinkProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
bool have_format;
@ -203,8 +203,8 @@ spa_alsa_sink_node_set_props (SpaNode *node,
}
static SpaResult
spa_alsa_sink_node_send_command (SpaNode *node,
SpaCommand *command)
spa_alsa_sink_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaALSASink *this;
@ -214,17 +214,17 @@ spa_alsa_sink_node_send_command (SpaNode *node,
this = (SpaALSASink *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
spa_alsa_start (this);
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = ≻
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_STREAMING;
@ -232,14 +232,14 @@ spa_alsa_sink_node_send_command (SpaNode *node,
this->event_cb (node, &event, this->user_data);
}
break;
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
spa_alsa_stop (this);
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = ≻
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_PAUSED;
@ -247,18 +247,18 @@ spa_alsa_sink_node_send_command (SpaNode *node,
this->event_cb (node, &event, this->user_data);
}
break;
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_alsa_sink_node_set_event_callback (SpaNode *node,
SpaEventCallback event,
void *user_data)
spa_alsa_sink_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
void *user_data)
{
SpaALSASink *this;
@ -579,9 +579,9 @@ spa_alsa_sink_node_port_get_status (SpaNode *node,
}
static SpaResult
spa_alsa_sink_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_alsa_sink_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
SpaALSASink *this;
unsigned int i;
@ -624,9 +624,9 @@ spa_alsa_sink_node_port_push_input (SpaNode *node,
}
static SpaResult
spa_alsa_sink_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_alsa_sink_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
return SPA_RESULT_INVALID_PORT;
}

View file

@ -224,10 +224,10 @@ xrun_recovery (snd_pcm_t *handle, int err)
static void
pull_input (SpaALSASink *this, void *data, snd_pcm_uframes_t frames)
{
SpaEvent event;
SpaEventNeedInput ni;
SpaNodeEvent event;
SpaNodeEventNeedInput ni;
event.type = SPA_EVENT_TYPE_NEED_INPUT;
event.type = SPA_NODE_EVENT_TYPE_NEED_INPUT;
event.size = sizeof (ni);
event.data = ∋
ni.port_id = 0;
@ -323,7 +323,7 @@ spa_alsa_start (SpaALSASink *this)
{
SpaALSAState *state = &this->state;
int err;
SpaEvent event;
SpaNodeEvent event;
if (spa_alsa_open (this) < 0)
return -1;
@ -344,7 +344,7 @@ spa_alsa_start (SpaALSASink *this)
return err;
}
event.type = SPA_EVENT_TYPE_ADD_POLL;
event.type = SPA_NODE_EVENT_TYPE_ADD_POLL;
event.data = &state->poll;
event.size = sizeof (state->poll);
@ -367,14 +367,14 @@ static int
spa_alsa_stop (SpaALSASink *this)
{
SpaALSAState *state = &this->state;
SpaEvent event;
SpaNodeEvent event;
if (!state->opened)
return 0;
snd_pcm_drop (state->handle);
event.type = SPA_EVENT_TYPE_REMOVE_POLL;
event.type = SPA_NODE_EVENT_TYPE_REMOVE_POLL;
event.data = &state->poll;
event.size = sizeof (state->poll);
this->event_cb (&this->node, &event, this->user_data);

View file

@ -69,7 +69,7 @@ struct _SpaAudioMixer {
SpaAudioMixerProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
int port_count;
@ -132,8 +132,8 @@ spa_audiomixer_node_set_props (SpaNode *node,
}
static SpaResult
spa_audiomixer_node_send_command (SpaNode *node,
SpaCommand *command)
spa_audiomixer_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaAudioMixer *this;
@ -143,15 +143,15 @@ spa_audiomixer_node_send_command (SpaNode *node,
this = (SpaAudioMixer *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_STREAMING;
@ -160,12 +160,12 @@ spa_audiomixer_node_send_command (SpaNode *node,
}
break;
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_PAUSED;
@ -174,18 +174,18 @@ spa_audiomixer_node_send_command (SpaNode *node,
}
break;
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_audiomixer_node_set_event_callback (SpaNode *node,
SpaEventCallback event,
void *user_data)
spa_audiomixer_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
void *user_data)
{
SpaAudioMixer *this;
@ -496,9 +496,9 @@ spa_audiomixer_node_port_get_status (SpaNode *node,
}
static SpaResult
spa_audiomixer_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_audiomixer_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
SpaAudioMixer *this;
unsigned int i;
@ -562,12 +562,12 @@ spa_audiomixer_node_port_push_input (SpaNode *node,
static void
pull_port (SpaAudioMixer *this, uint32_t port_id, SpaOutputInfo *info, size_t pull_size)
pull_port (SpaAudioMixer *this, uint32_t port_id, SpaPortOutputInfo *info, size_t pull_size)
{
SpaEvent event;
SpaEventNeedInput ni;
SpaNodeEvent event;
SpaNodeEventNeedInput ni;
event.type = SPA_EVENT_TYPE_NEED_INPUT;
event.type = SPA_NODE_EVENT_TYPE_NEED_INPUT;
event.size = sizeof (ni);
event.data = &ni;
ni.port_id = port_id;
@ -628,7 +628,7 @@ add_port_data (SpaAudioMixer *this, SpaBuffer *out, SpaAudioMixerPort *port)
}
static SpaResult
mix_data (SpaAudioMixer *this, SpaOutputInfo *info)
mix_data (SpaAudioMixer *this, SpaPortOutputInfo *info)
{
int i, min_size, min_port, pull_size;
SpaBuffer *buf;
@ -645,7 +645,7 @@ mix_data (SpaAudioMixer *this, SpaOutputInfo *info)
continue;
if (this->ports[i].buffer == NULL) {
if (pull_size && info->flags & SPA_OUTPUT_FLAG_PULL) {
if (pull_size && info->flags & SPA_PORT_OUTPUT_FLAG_PULL) {
pull_port (this, i, info, pull_size);
}
if (this->ports[i].buffer == NULL)
@ -676,9 +676,9 @@ mix_data (SpaAudioMixer *this, SpaOutputInfo *info)
}
static SpaResult
spa_audiomixer_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_audiomixer_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
SpaAudioMixer *this;
SpaAudioMixerPort *port;
@ -715,9 +715,9 @@ spa_audiomixer_node_port_pull_output (SpaNode *node,
}
static SpaResult
spa_audiomixer_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaEvent *event)
spa_audiomixer_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaNodeEvent *event)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -53,7 +53,7 @@ struct _SpaAudioTestSrc {
SpaAudioTestSrcProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
SpaPollItem idle;
@ -185,11 +185,11 @@ spa_audiotestsrc_node_set_props (SpaNode *node,
static SpaResult
send_have_output (SpaAudioTestSrc *this)
{
SpaEvent event;
SpaEventHaveOutput ho;
SpaNodeEvent event;
SpaNodeEventHaveOutput ho;
if (this->event_cb) {
event.type = SPA_EVENT_TYPE_HAVE_OUTPUT;
event.type = SPA_NODE_EVENT_TYPE_HAVE_OUTPUT;
event.size = sizeof (ho);
event.data = &ho;
ho.port_id = 0;
@ -202,8 +202,8 @@ send_have_output (SpaAudioTestSrc *this)
static void
update_state (SpaAudioTestSrc *this, SpaNodeState state)
{
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
if (this->node.state == state)
return;
@ -211,7 +211,7 @@ update_state (SpaAudioTestSrc *this, SpaNodeState state)
this->node.state = state;
if (this->event_cb) {
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = state;
@ -222,11 +222,11 @@ update_state (SpaAudioTestSrc *this, SpaNodeState state)
static SpaResult
update_idle_enabled (SpaAudioTestSrc *this, bool enabled)
{
SpaEvent event;
SpaNodeEvent event;
if (this->event_cb) {
this->idle.enabled = enabled;
event.type = SPA_EVENT_TYPE_UPDATE_POLL;
event.type = SPA_NODE_EVENT_TYPE_UPDATE_POLL;
event.data = &this->idle;
event.size = sizeof (this->idle);
this->event_cb (&this->node, &event, this->user_data);
@ -235,8 +235,8 @@ update_idle_enabled (SpaAudioTestSrc *this, bool enabled)
}
static SpaResult
spa_audiotestsrc_node_send_command (SpaNode *node,
SpaCommand *command)
spa_audiotestsrc_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaAudioTestSrc *this;
@ -246,10 +246,10 @@ spa_audiotestsrc_node_send_command (SpaNode *node,
this = (SpaAudioTestSrc *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
{
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
@ -262,7 +262,7 @@ spa_audiotestsrc_node_send_command (SpaNode *node,
update_state (this, SPA_NODE_STATE_STREAMING);
break;
}
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
{
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
@ -275,21 +275,21 @@ spa_audiotestsrc_node_send_command (SpaNode *node,
update_state (this, SPA_NODE_STATE_PAUSED);
break;
}
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_audiotestsrc_node_set_event_callback (SpaNode *node,
SpaEventCallback event_cb,
void *user_data)
spa_audiotestsrc_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event_cb,
void *user_data)
{
SpaAudioTestSrc *this;
SpaEvent event;
SpaNodeEvent event;
if (node == NULL || node->handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
@ -297,7 +297,7 @@ spa_audiotestsrc_node_set_event_callback (SpaNode *node,
this = (SpaAudioTestSrc *) node->handle;
if (event_cb == NULL && this->event_cb) {
event.type = SPA_EVENT_TYPE_REMOVE_POLL;
event.type = SPA_NODE_EVENT_TYPE_REMOVE_POLL;
event.data = &this->idle;
event.size = sizeof (this->idle);
this->event_cb (&this->node, &event, this->user_data);
@ -307,7 +307,7 @@ spa_audiotestsrc_node_set_event_callback (SpaNode *node,
this->user_data = user_data;
if (this->event_cb) {
event.type = SPA_EVENT_TYPE_ADD_POLL;
event.type = SPA_NODE_EVENT_TYPE_ADD_POLL;
event.data = &this->idle;
event.size = sizeof (this->idle);
this->event_cb (&this->node, &event, this->user_data);
@ -663,9 +663,9 @@ spa_audiotestsrc_node_port_get_status (SpaNode *node,
static SpaResult
spa_audiotestsrc_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_audiotestsrc_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
return SPA_RESULT_INVALID_PORT;
}
@ -707,9 +707,9 @@ audiotestsrc_idle (SpaPollNotifyData *data)
}
static SpaResult
spa_audiotestsrc_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_audiotestsrc_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
SpaAudioTestSrc *this;
unsigned int i;
@ -755,9 +755,9 @@ spa_audiotestsrc_node_port_pull_output (SpaNode *node,
}
static SpaResult
spa_audiotestsrc_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaEvent *event)
spa_audiotestsrc_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaNodeEvent *event)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -71,7 +71,7 @@ struct _SpaFFMpegDec {
SpaFFMpegDecProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
SpaFFMpegState state[2];
@ -128,8 +128,8 @@ spa_ffmpeg_dec_node_set_props (SpaNode *node,
}
static SpaResult
spa_ffmpeg_dec_node_send_command (SpaNode *node,
SpaCommand *command)
spa_ffmpeg_dec_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaFFMpegDec *this;
@ -139,15 +139,15 @@ spa_ffmpeg_dec_node_send_command (SpaNode *node,
this = (SpaFFMpegDec *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_STREAMING;
@ -155,12 +155,12 @@ spa_ffmpeg_dec_node_send_command (SpaNode *node,
this->event_cb (node, &event, this->user_data);
}
break;
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_PAUSED;
@ -169,18 +169,18 @@ spa_ffmpeg_dec_node_send_command (SpaNode *node,
}
break;
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_ffmpeg_dec_node_set_event_callback (SpaNode *node,
SpaEventCallback event,
void *user_data)
spa_ffmpeg_dec_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
void *user_data)
{
SpaFFMpegDec *this;
@ -447,17 +447,17 @@ spa_ffmpeg_dec_node_port_get_status (SpaNode *node,
}
static SpaResult
spa_ffmpeg_dec_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_ffmpeg_dec_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
return SPA_RESULT_INVALID_PORT;
}
static SpaResult
spa_ffmpeg_dec_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_ffmpeg_dec_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
SpaFFMpegDec *this;
SpaFFMpegState *state;
@ -491,9 +491,9 @@ spa_ffmpeg_dec_node_port_pull_output (SpaNode *node,
}
static SpaResult
spa_ffmpeg_dec_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaEvent *event)
spa_ffmpeg_dec_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaNodeEvent *event)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -71,7 +71,7 @@ struct _SpaFFMpegEnc {
SpaFFMpegEncProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
SpaFFMpegState state[2];
@ -128,8 +128,8 @@ spa_ffmpeg_enc_node_set_props (SpaNode *node,
}
static SpaResult
spa_ffmpeg_enc_node_send_command (SpaNode *node,
SpaCommand *command)
spa_ffmpeg_enc_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaFFMpegEnc *this;
@ -139,15 +139,15 @@ spa_ffmpeg_enc_node_send_command (SpaNode *node,
this = (SpaFFMpegEnc *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_STREAMING;
@ -155,12 +155,12 @@ spa_ffmpeg_enc_node_send_command (SpaNode *node,
this->event_cb (node, &event, this->user_data);
}
break;
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_PAUSED;
@ -169,18 +169,18 @@ spa_ffmpeg_enc_node_send_command (SpaNode *node,
}
break;
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_ffmpeg_enc_node_set_event_callback (SpaNode *node,
SpaEventCallback event,
void *user_data)
spa_ffmpeg_enc_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
void *user_data)
{
SpaFFMpegEnc *this;
@ -450,17 +450,17 @@ spa_ffmpeg_enc_node_port_get_status (SpaNode *node,
}
static SpaResult
spa_ffmpeg_enc_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_ffmpeg_enc_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
return SPA_RESULT_INVALID_PORT;
}
static SpaResult
spa_ffmpeg_enc_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_ffmpeg_enc_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
SpaFFMpegEnc *this;
SpaFFMpegState *state;
@ -495,9 +495,9 @@ spa_ffmpeg_enc_node_port_pull_output (SpaNode *node,
}
static SpaResult
spa_ffmpeg_enc_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaEvent *event)
spa_ffmpeg_enc_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaNodeEvent *event)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -70,7 +70,7 @@ struct _SpaLibvaDec {
SpaLibvaDecProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
SpaLibvaState state[2];
@ -136,11 +136,11 @@ spa_libva_dec_node_send_command (SpaHandle *handle,
case SPA_COMMAND_START:
if (this->event_cb) {
SpaEvent event;
SpaNodeEvent event;
event.refcount = 1;
event.notify = NULL;
event.type = SPA_EVENT_TYPE_STARTED;
event.type = SPA_NODE_EVENT_TYPE_STARTED;
event.port_id = -1;
event.data = NULL;
event.size = 0;
@ -150,11 +150,11 @@ spa_libva_dec_node_send_command (SpaHandle *handle,
break;
case SPA_COMMAND_STOP:
if (this->event_cb) {
SpaEvent event;
SpaNodeEvent event;
event.refcount = 1;
event.notify = NULL;
event.type = SPA_EVENT_TYPE_STOPPED;
event.type = SPA_NODE_EVENT_TYPE_STOPPED;
event.port_id = -1;
event.data = NULL;
event.size = 0;
@ -172,9 +172,9 @@ spa_libva_dec_node_send_command (SpaHandle *handle,
}
static SpaResult
spa_libva_dec_node_set_event_callback (SpaHandle *handle,
SpaEventCallback event,
void *user_data)
spa_libva_dec_node_set_event_callback (SpaHandle *handle,
SpaNodeEventCallback event,
void *user_data)
{
SpaLibvaDec *this = (SpaLibvaDec *) handle;

View file

@ -67,7 +67,7 @@ struct _SpaProxy {
SpaProxyProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
SpaPollFd fds[1];
@ -104,13 +104,13 @@ reset_proxy_props (SpaProxyProps *props)
static void
update_poll (SpaProxy *this, int socketfd)
{
SpaEvent event;
SpaNodeEvent event;
SpaProxyProps *p;
p = &this->props[1];
if (p->socketfd != -1) {
event.type = SPA_EVENT_TYPE_REMOVE_POLL;
event.type = SPA_NODE_EVENT_TYPE_REMOVE_POLL;
event.data = &this->poll;
event.size = sizeof (this->poll);
this->event_cb (&this->node, &event, this->user_data);
@ -119,7 +119,7 @@ update_poll (SpaProxy *this, int socketfd)
if (p->socketfd != -1) {
this->fds[0].fd = p->socketfd;
event.type = SPA_EVENT_TYPE_ADD_POLL;
event.type = SPA_NODE_EVENT_TYPE_ADD_POLL;
event.data = &this->poll;
event.size = sizeof (this->poll);
this->event_cb (&this->node, &event, this->user_data);
@ -130,12 +130,12 @@ static SpaResult
update_state (SpaProxy *this, SpaNodeState state)
{
if (this->node.state != state) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
this->node.state = state;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = state;
@ -196,8 +196,8 @@ spa_proxy_node_set_props (SpaNode *node,
}
static SpaResult
spa_proxy_node_send_command (SpaNode *node,
SpaCommand *command)
spa_proxy_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaProxy *this;
SpaResult res;
@ -208,10 +208,10 @@ spa_proxy_node_send_command (SpaNode *node,
this = (SpaProxy *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
{
SpaControlBuilder builder;
SpaControl control;
@ -229,7 +229,7 @@ spa_proxy_node_send_command (SpaNode *node,
break;
}
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
{
SpaControlBuilder builder;
SpaControl control;
@ -247,18 +247,18 @@ spa_proxy_node_send_command (SpaNode *node,
break;
}
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_set_event_callback (SpaNode *node,
SpaEventCallback event,
void *user_data)
spa_proxy_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
void *user_data)
{
SpaProxy *this;
@ -332,9 +332,9 @@ static void
do_update_port (SpaProxy *this,
SpaControlCmdPortUpdate *pu)
{
SpaEvent event;
SpaNodeEvent event;
SpaProxyPort *port;
SpaEventPortAdded pa;
SpaNodeEventPortAdded pa;
unsigned int i;
port = &this->ports[pu->port_id];
@ -364,7 +364,7 @@ do_update_port (SpaProxy *this,
else
this->n_outputs++;
event.type = SPA_EVENT_TYPE_PORT_ADDED;
event.type = SPA_NODE_EVENT_TYPE_PORT_ADDED;
event.size = sizeof (pa);
event.data = &pa;
pa.port_id = pu->port_id;
@ -376,9 +376,9 @@ static void
do_uninit_port (SpaProxy *this,
uint32_t port_id)
{
SpaEvent event;
SpaNodeEvent event;
SpaProxyPort *port;
SpaEventPortRemoved pr;
SpaNodeEventPortRemoved pr;
fprintf (stderr, "proxy %p: removing port %d\n", this, port_id);
port = &this->ports[port_id];
@ -393,7 +393,7 @@ do_uninit_port (SpaProxy *this,
spa_format_unref (port->format);
port->format = NULL;
event.type = SPA_EVENT_TYPE_PORT_REMOVED;
event.type = SPA_NODE_EVENT_TYPE_PORT_REMOVED;
event.size = sizeof (pr);
event.data = &pr;
pr.port_id = port_id;
@ -755,13 +755,40 @@ spa_proxy_node_port_reuse_buffer (SpaNode *node,
uint32_t port_id,
uint32_t buffer_id)
{
return SPA_RESULT_NOT_IMPLEMENTED;
SpaProxy *this;
SpaControlCmdReuseBuffer crb;
SpaControlBuilder builder;
SpaControl control;
uint8_t buf[128];
SpaResult res;
if (node == NULL || node->handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
this = (SpaProxy *) node->handle;
if (!CHECK_PORT_ID (this, port_id))
return SPA_RESULT_INVALID_PORT;
/* send start */
spa_control_builder_init_into (&builder, buf, sizeof (buf), NULL, 0);
crb.port_id = port_id;
crb.buffer_id = buffer_id;
spa_control_builder_add_cmd (&builder, SPA_CONTROL_CMD_REUSE_BUFFER, &crb);
spa_control_builder_end (&builder, &control);
if ((res = spa_control_write (&control, this->fds[0].fd)) < 0)
fprintf (stderr, "proxy %p: error writing control %d\n", this, res);
spa_control_clear (&control);
return res;
}
static SpaResult
spa_proxy_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_proxy_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
SpaProxy *this;
SpaProxyPort *port;
@ -826,9 +853,9 @@ spa_proxy_node_port_push_input (SpaNode *node,
}
static SpaResult
spa_proxy_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_proxy_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
SpaProxy *this;
SpaProxyPort *port;
@ -868,9 +895,9 @@ spa_proxy_node_port_pull_output (SpaNode *node,
}
static SpaResult
spa_proxy_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaEvent *event)
spa_proxy_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaNodeEvent *event)
{
SpaProxy *this;
SpaResult res;
@ -881,9 +908,9 @@ spa_proxy_node_port_push_event (SpaNode *node,
this = (SpaProxy *) node->handle;
switch (event->type) {
case SPA_EVENT_TYPE_REUSE_BUFFER:
case SPA_NODE_EVENT_TYPE_REUSE_BUFFER:
{
SpaEventReuseBuffer *rb = event->data;
SpaNodeEventReuseBuffer *rb = event->data;
SpaControlCmdReuseBuffer crb;
SpaControlBuilder builder;
SpaControl control;
@ -990,14 +1017,14 @@ parse_control (SpaProxy *this,
}
case SPA_CONTROL_CMD_HAVE_OUTPUT:
{
SpaEvent event;
SpaEventHaveOutput hu;
SpaNodeEvent event;
SpaNodeEventHaveOutput hu;
SpaControlCmdHaveOutput cmd;
if (spa_control_iter_parse_cmd (&it, &cmd) < 0)
break;
event.type = SPA_EVENT_TYPE_HAVE_OUTPUT;
event.type = SPA_NODE_EVENT_TYPE_HAVE_OUTPUT;
event.data = &hu;
event.size = sizeof (hu);
hu.port_id = cmd.port_id;
@ -1026,14 +1053,14 @@ parse_control (SpaProxy *this,
}
case SPA_CONTROL_CMD_REUSE_BUFFER:
{
SpaEvent event;
SpaEventReuseBuffer rb;
SpaNodeEvent event;
SpaNodeEventReuseBuffer rb;
SpaControlCmdReuseBuffer crb;
if (spa_control_iter_parse_cmd (&it, &crb) < 0)
break;
event.type = SPA_EVENT_TYPE_REUSE_BUFFER;
event.type = SPA_NODE_EVENT_TYPE_REUSE_BUFFER;
event.data = &rb;
event.size = sizeof (rb);
rb.port_id = crb.port_id;

View file

@ -123,12 +123,30 @@ struct _SpaV4l2Source {
SpaV4l2SourceProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
SpaV4l2State state[1];
};
static void
update_state (SpaV4l2Source *this, SpaNodeState state)
{
SpaNodeEvent event;
SpaNodeEventStateChange sc;
if (this->node.state == state)
return;
this->node.state = state;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = state;
this->event_cb (&this->node, &event, this->user_data);
}
#include "v4l2-utils.c"
enum {
@ -201,27 +219,9 @@ spa_v4l2_source_node_set_props (SpaNode *node,
return res;
}
static void
update_state (SpaV4l2Source *this, SpaNodeState state)
{
SpaEvent event;
SpaEventStateChange sc;
if (this->node.state == state)
return;
this->node.state = state;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = state;
this->event_cb (&this->node, &event, this->user_data);
}
static SpaResult
spa_v4l2_source_node_send_command (SpaNode *node,
SpaCommand *command)
spa_v4l2_source_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaV4l2Source *this;
SpaResult res;
@ -232,10 +232,10 @@ spa_v4l2_source_node_send_command (SpaNode *node,
this = (SpaV4l2Source *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
{
SpaV4l2State *state = &this->state[0];
@ -248,10 +248,9 @@ spa_v4l2_source_node_send_command (SpaNode *node,
if ((res = spa_v4l2_start (this)) < 0)
return res;
update_state (this, SPA_NODE_STATE_STREAMING);
break;
}
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
{
SpaV4l2State *state = &this->state[0];
@ -264,22 +263,21 @@ spa_v4l2_source_node_send_command (SpaNode *node,
if ((res = spa_v4l2_pause (this)) < 0)
return res;
update_state (this, SPA_NODE_STATE_PAUSED);
break;
}
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_v4l2_source_node_set_event_callback (SpaNode *node,
SpaEventCallback event,
void *user_data)
spa_v4l2_source_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
void *user_data)
{
SpaV4l2Source *this;
@ -647,17 +645,17 @@ spa_v4l2_source_node_port_get_status (SpaNode *node,
}
static SpaResult
spa_v4l2_source_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_v4l2_source_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
return SPA_RESULT_INVALID_PORT;
}
static SpaResult
spa_v4l2_source_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_v4l2_source_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
SpaV4l2Source *this;
SpaV4l2State *state;
@ -706,9 +704,9 @@ spa_v4l2_source_node_port_pull_output (SpaNode *node,
}
static SpaResult
spa_v4l2_source_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaEvent *event)
spa_v4l2_source_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaNodeEvent *event)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -450,9 +450,8 @@ again:
i = ++state->frmival.index;
}
fmt->infos[pi].n_range_values = i;
if (i == 1) {
fmt->framerate = fmt->framerates[0];
} else {
fmt->framerate = fmt->framerates[0];
if (i > 1) {
SPA_PROPS_INDEX_UNSET (&fmt->fmt.props, pi);
}
pi = ++fmt->fmt.props.n_prop_info;
@ -561,10 +560,11 @@ mmap_read (SpaV4l2Source *this)
if (xioctl (state->fd, VIDIOC_DQBUF, &buf) < 0) {
switch (errno) {
case EAGAIN:
return 0;
return SPA_RESULT_ERROR;
case EIO:
default:
perror ("VIDIOC_DQBUF");
usleep (50 * 1000);
return SPA_RESULT_ERROR;
}
}
@ -583,13 +583,13 @@ static int
v4l2_on_fd_events (SpaPollNotifyData *data)
{
SpaV4l2Source *this = data->user_data;
SpaEvent event;
SpaEventHaveOutput ho;
SpaNodeEvent event;
SpaNodeEventHaveOutput ho;
if (mmap_read (this) < 0)
return 0;
event.type = SPA_EVENT_TYPE_HAVE_OUTPUT;
event.type = SPA_NODE_EVENT_TYPE_HAVE_OUTPUT;
event.size = sizeof (ho);
event.data = &ho;
ho.port_id = 0;
@ -849,7 +849,7 @@ spa_v4l2_start (SpaV4l2Source *this)
{
SpaV4l2State *state = &this->state[0];
enum v4l2_buf_type type;
SpaEvent event;
SpaNodeEvent event;
if (state->started)
return SPA_RESULT_OK;
@ -859,8 +859,10 @@ spa_v4l2_start (SpaV4l2Source *this)
perror ("VIDIOC_STREAMON");
return SPA_RESULT_ERROR;
}
state->started = true;
update_state (this, SPA_NODE_STATE_STREAMING);
event.type = SPA_EVENT_TYPE_ADD_POLL;
event.type = SPA_NODE_EVENT_TYPE_ADD_POLL;
event.data = &state->poll;
event.size = sizeof (state->poll);
@ -878,8 +880,6 @@ spa_v4l2_start (SpaV4l2Source *this)
state->poll.user_data = this;
this->event_cb (&this->node, &event, this->user_data);
state->started = true;
return SPA_RESULT_OK;
}
@ -888,12 +888,12 @@ spa_v4l2_pause (SpaV4l2Source *this)
{
SpaV4l2State *state = &this->state[0];
enum v4l2_buf_type type;
SpaEvent event;
SpaNodeEvent event;
if (!state->started)
return SPA_RESULT_OK;
event.type = SPA_EVENT_TYPE_REMOVE_POLL;
event.type = SPA_NODE_EVENT_TYPE_REMOVE_POLL;
event.data = &state->poll;
event.size = sizeof (state->poll);
this->event_cb (&this->node, &event, this->user_data);
@ -905,6 +905,7 @@ spa_v4l2_pause (SpaV4l2Source *this)
perror ("VIDIOC_STREAMOFF");
return SPA_RESULT_ERROR;
}
update_state (this, SPA_NODE_STATE_PAUSED);
return SPA_RESULT_OK;
}

View file

@ -47,7 +47,7 @@ struct _SpaVolume {
SpaVolumeProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
bool have_format;
@ -137,8 +137,8 @@ spa_volume_node_set_props (SpaNode *node,
}
static SpaResult
spa_volume_node_send_command (SpaNode *node,
SpaCommand *command)
spa_volume_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaVolume *this;
@ -148,15 +148,15 @@ spa_volume_node_send_command (SpaNode *node,
this = (SpaVolume *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_STREAMING;
@ -165,12 +165,12 @@ spa_volume_node_send_command (SpaNode *node,
}
break;
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_PAUSED;
@ -179,18 +179,18 @@ spa_volume_node_send_command (SpaNode *node,
}
break;
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_volume_node_set_event_callback (SpaNode *node,
SpaEventCallback event,
void *user_data)
spa_volume_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
void *user_data)
{
SpaVolume *this;
@ -448,9 +448,9 @@ spa_volume_node_port_get_status (SpaNode *node,
static SpaResult
spa_volume_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_volume_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
SpaVolume *this;
unsigned int i;
@ -517,10 +517,10 @@ find_free_buffer (SpaVolume *this, SpaVolumePort *port)
static void
release_buffer (SpaVolume *this, SpaBuffer *buffer)
{
SpaEvent event;
SpaEventReuseBuffer rb;
SpaNodeEvent event;
SpaNodeEventReuseBuffer rb;
event.type = SPA_EVENT_TYPE_REUSE_BUFFER;
event.type = SPA_NODE_EVENT_TYPE_REUSE_BUFFER;
event.data = &rb;
event.size = sizeof (rb);
rb.port_id = 0;
@ -529,9 +529,9 @@ release_buffer (SpaVolume *this, SpaBuffer *buffer)
}
static SpaResult
spa_volume_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_volume_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
SpaVolume *this;
SpaVolumePort *port;
@ -610,9 +610,9 @@ spa_volume_node_port_pull_output (SpaNode *node,
}
static SpaResult
spa_volume_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaEvent *event)
spa_volume_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaNodeEvent *event)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}

View file

@ -73,7 +73,7 @@ struct _SpaXvSink {
SpaXvSinkProps props[2];
SpaEventCallback event_cb;
SpaNodeEventCallback event_cb;
void *user_data;
SpaFormatVideo format[2];
@ -159,8 +159,8 @@ spa_xv_sink_node_set_props (SpaNode *node,
}
static SpaResult
spa_xv_sink_node_send_command (SpaNode *node,
SpaCommand *command)
spa_xv_sink_node_send_command (SpaNode *node,
SpaNodeCommand *command)
{
SpaXvSink *this;
@ -170,17 +170,17 @@ spa_xv_sink_node_send_command (SpaNode *node,
this = (SpaXvSink *) node->handle;
switch (command->type) {
case SPA_COMMAND_INVALID:
case SPA_NODE_COMMAND_INVALID:
return SPA_RESULT_INVALID_COMMAND;
case SPA_COMMAND_START:
case SPA_NODE_COMMAND_START:
spa_xv_start (this);
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_STREAMING;
@ -188,14 +188,14 @@ spa_xv_sink_node_send_command (SpaNode *node,
this->event_cb (node, &event, this->user_data);
}
break;
case SPA_COMMAND_PAUSE:
case SPA_NODE_COMMAND_PAUSE:
spa_xv_stop (this);
if (this->event_cb) {
SpaEvent event;
SpaEventStateChange sc;
SpaNodeEvent event;
SpaNodeEventStateChange sc;
event.type = SPA_EVENT_TYPE_STATE_CHANGE;
event.type = SPA_NODE_EVENT_TYPE_STATE_CHANGE;
event.data = &sc;
event.size = sizeof (sc);
sc.state = SPA_NODE_STATE_PAUSED;
@ -204,18 +204,18 @@ spa_xv_sink_node_send_command (SpaNode *node,
}
break;
case SPA_COMMAND_FLUSH:
case SPA_COMMAND_DRAIN:
case SPA_COMMAND_MARKER:
case SPA_NODE_COMMAND_FLUSH:
case SPA_NODE_COMMAND_DRAIN:
case SPA_NODE_COMMAND_MARKER:
return SPA_RESULT_NOT_IMPLEMENTED;
}
return SPA_RESULT_OK;
}
static SpaResult
spa_xv_sink_node_set_event_callback (SpaNode *node,
SpaEventCallback event,
void *user_data)
spa_xv_sink_node_set_event_callback (SpaNode *node,
SpaNodeEventCallback event,
void *user_data)
{
SpaXvSink *this;
@ -474,25 +474,25 @@ spa_xv_sink_node_port_get_status (SpaNode *node,
}
static SpaResult
spa_xv_sink_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info)
spa_xv_sink_node_port_push_input (SpaNode *node,
unsigned int n_info,
SpaPortInputInfo *info)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_xv_sink_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info)
spa_xv_sink_node_port_pull_output (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info)
{
return SPA_RESULT_INVALID_PORT;
}
static SpaResult
spa_xv_sink_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaEvent *event)
spa_xv_sink_node_port_push_event (SpaNode *node,
uint32_t port_id,
SpaNodeEvent *event)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}