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

@ -1,104 +0,0 @@
/* Simple Plugin API
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_EVENT_H__
#define __SPA_EVENT_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _SpaEvent SpaEvent;
#include <spa/defs.h>
#include <spa/poll.h>
#include <spa/node.h>
/**
* SpaEventType:
* @SPA_EVENT_TYPE_INVALID: invalid event, should be ignored
* @SPA_EVENT_TYPE_PORT_ADDED: a new port is added
* @SPA_EVENT_TYPE_PORT_REMOVED: a port is removed
* @SPA_EVENT_TYPE_STATE_CHANGE: emited when the state changes
* @SPA_EVENT_TYPE_HAVE_OUTPUT: emited when an async node has output that can be pulled
* @SPA_EVENT_TYPE_NEED_INPUT: emited when more data can be pushed to an async node
* @SPA_EVENT_TYPE_REUSE_BUFFER: emited when a buffer can be reused
* @SPA_EVENT_TYPE_ADD_POLL: emited when a pollfd should be added. data points to #SpaPollItem
* @SPA_EVENT_TYPE_UPDATE_POLL: update the pollfd item
* @SPA_EVENT_TYPE_REMOVE_POLL: emited when a pollfd should be removed. data points to #SpaPollItem
* @SPA_EVENT_TYPE_DRAINED: emited when DRAIN command completed
* @SPA_EVENT_TYPE_MARKER: emited when MARK command completed
* @SPA_EVENT_TYPE_ERROR: emited when error occured
* @SPA_EVENT_TYPE_BUFFERING: emited when buffering is in progress
* @SPA_EVENT_TYPE_REQUEST_REFRESH: emited when a keyframe refresh is needed
*/
typedef enum {
SPA_EVENT_TYPE_INVALID = 0,
SPA_EVENT_TYPE_PORT_ADDED,
SPA_EVENT_TYPE_PORT_REMOVED,
SPA_EVENT_TYPE_STATE_CHANGE,
SPA_EVENT_TYPE_HAVE_OUTPUT,
SPA_EVENT_TYPE_NEED_INPUT,
SPA_EVENT_TYPE_REUSE_BUFFER,
SPA_EVENT_TYPE_ADD_POLL,
SPA_EVENT_TYPE_UPDATE_POLL,
SPA_EVENT_TYPE_REMOVE_POLL,
SPA_EVENT_TYPE_DRAINED,
SPA_EVENT_TYPE_MARKER,
SPA_EVENT_TYPE_ERROR,
SPA_EVENT_TYPE_BUFFERING,
SPA_EVENT_TYPE_REQUEST_REFRESH,
} SpaEventType;
struct _SpaEvent {
SpaEventType type;
void *data;
size_t size;
};
typedef struct {
uint32_t port_id;
} SpaEventPortAdded;
typedef struct {
uint32_t port_id;
} SpaEventPortRemoved;
typedef struct {
SpaNodeState state;
} SpaEventStateChange;
typedef struct {
uint32_t port_id;
} SpaEventHaveOutput;
typedef struct {
uint32_t port_id;
} SpaEventNeedInput;
typedef struct {
uint32_t port_id;
uint32_t buffer_id;
} SpaEventReuseBuffer;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_EVENT_H__ */

View file

@ -17,35 +17,35 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_COMMAND_H__
#define __SPA_COMMAND_H__
#ifndef __SPA_NODE_COMMAND_H__
#define __SPA_NODE_COMMAND_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _SpaCommand SpaCommand;
typedef struct _SpaNodeCommand SpaNodeCommand;
#include <spa/defs.h>
typedef enum {
SPA_COMMAND_INVALID = 0,
SPA_COMMAND_PAUSE,
SPA_COMMAND_START,
SPA_COMMAND_FLUSH,
SPA_COMMAND_DRAIN,
SPA_COMMAND_MARKER,
} SpaCommandType;
SPA_NODE_COMMAND_INVALID = 0,
SPA_NODE_COMMAND_PAUSE,
SPA_NODE_COMMAND_START,
SPA_NODE_COMMAND_FLUSH,
SPA_NODE_COMMAND_DRAIN,
SPA_NODE_COMMAND_MARKER,
} SpaNodeCommandType;
struct _SpaCommand {
SpaCommandType type;
uint32_t port_id;
void *data;
size_t size;
struct _SpaNodeCommand {
SpaNodeCommandType type;
uint32_t port_id;
void *data;
size_t size;
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_COMMAND_H__ */
#endif /* __SPA_NODE_COMMAND_H__ */

View file

@ -0,0 +1,104 @@
/* Simple Plugin API
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_NODE_EVENT_H__
#define __SPA_NODE_EVENT_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _SpaNodeEvent SpaNodeEvent;
#include <spa/defs.h>
#include <spa/poll.h>
#include <spa/node.h>
/**
* SpaEventType:
* @SPA_NODE_EVENT_TYPE_INVALID: invalid event, should be ignored
* @SPA_NODE_EVENT_TYPE_PORT_ADDED: a new port is added
* @SPA_NODE_EVENT_TYPE_PORT_REMOVED: a port is removed
* @SPA_NODE_EVENT_TYPE_STATE_CHANGE: emited when the state changes
* @SPA_NODE_EVENT_TYPE_HAVE_OUTPUT: emited when an async node has output that can be pulled
* @SPA_NODE_EVENT_TYPE_NEED_INPUT: emited when more data can be pushed to an async node
* @SPA_NODE_EVENT_TYPE_REUSE_BUFFER: emited when a buffer can be reused
* @SPA_NODE_EVENT_TYPE_ADD_POLL: emited when a pollfd should be added. data points to #SpaPollItem
* @SPA_NODE_EVENT_TYPE_UPDATE_POLL: update the pollfd item
* @SPA_NODE_EVENT_TYPE_REMOVE_POLL: emited when a pollfd should be removed. data points to #SpaPollItem
* @SPA_NODE_EVENT_TYPE_DRAINED: emited when DRAIN command completed
* @SPA_NODE_EVENT_TYPE_MARKER: emited when MARK command completed
* @SPA_NODE_EVENT_TYPE_ERROR: emited when error occured
* @SPA_NODE_EVENT_TYPE_BUFFERING: emited when buffering is in progress
* @SPA_NODE_EVENT_TYPE_REQUEST_REFRESH: emited when a keyframe refresh is needed
*/
typedef enum {
SPA_NODE_EVENT_TYPE_INVALID = 0,
SPA_NODE_EVENT_TYPE_PORT_ADDED,
SPA_NODE_EVENT_TYPE_PORT_REMOVED,
SPA_NODE_EVENT_TYPE_STATE_CHANGE,
SPA_NODE_EVENT_TYPE_HAVE_OUTPUT,
SPA_NODE_EVENT_TYPE_NEED_INPUT,
SPA_NODE_EVENT_TYPE_REUSE_BUFFER,
SPA_NODE_EVENT_TYPE_ADD_POLL,
SPA_NODE_EVENT_TYPE_UPDATE_POLL,
SPA_NODE_EVENT_TYPE_REMOVE_POLL,
SPA_NODE_EVENT_TYPE_DRAINED,
SPA_NODE_EVENT_TYPE_MARKER,
SPA_NODE_EVENT_TYPE_ERROR,
SPA_NODE_EVENT_TYPE_BUFFERING,
SPA_NODE_EVENT_TYPE_REQUEST_REFRESH,
} SpaNodeEventType;
struct _SpaNodeEvent {
SpaNodeEventType type;
void *data;
size_t size;
};
typedef struct {
uint32_t port_id;
} SpaNodeEventPortAdded;
typedef struct {
uint32_t port_id;
} SpaNodeEventPortRemoved;
typedef struct {
SpaNodeState state;
} SpaNodeEventStateChange;
typedef struct {
uint32_t port_id;
} SpaNodeEventHaveOutput;
typedef struct {
uint32_t port_id;
} SpaNodeEventNeedInput;
typedef struct {
uint32_t port_id;
uint32_t buffer_id;
} SpaNodeEventReuseBuffer;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_NODE_EVENT_H__ */

View file

@ -49,9 +49,9 @@ typedef enum {
#include <spa/plugin.h>
#include <spa/props.h>
#include <spa/port.h>
#include <spa/event.h>
#include <spa/node-event.h>
#include <spa/node-command.h>
#include <spa/buffer.h>
#include <spa/command.h>
#include <spa/format.h>
/**
@ -70,15 +70,15 @@ typedef enum {
} SpaPortFormatFlags;
/**
* SpaInputFlags:
* SpaPortInputFlags:
* @SPA_INPUT_FLAG_NONE: no flag
*/
typedef enum {
SPA_INPUT_FLAG_NONE = 0,
} SpaInputFlags;
SPA_PORT_INPUT_FLAG_NONE = 0,
} SpaPortInputFlags;
/**
* SpaInputInfo:
* SpaPortInputInfo:
* @port_id: the port id
* @flags: extra flags
* @buffer_id: a buffer id
@ -87,29 +87,29 @@ typedef enum {
* Input information for a node.
*/
typedef struct {
uint32_t port_id;
SpaInputFlags flags;
uint32_t buffer_id;
SpaResult status;
} SpaInputInfo;
uint32_t port_id;
SpaPortInputFlags flags;
uint32_t buffer_id;
SpaResult status;
} SpaPortInputInfo;
/**
* SpaOutputFlags:
* @SPA_OUTPUT_FLAG_NONE: no flag
* @SPA_OUTPUT_FLAG_PULL: force a #SPA_EVENT_NEED_INPUT event on the
* SpaPortOutputFlags:
* @SPA_PORT_OUTPUT_FLAG_NONE: no flag
* @SPA_PORT_OUTPUT_FLAG_PULL: force a #SPA_NODE_EVENT_NEED_INPUT event on the
* peer input ports when no data is available.
* @SPA_OUTPUT_FLAG_DISCARD: discard the buffer data
* @SPA_OUTPUT_FLAG_NO_BUFFER: no buffer was produced on the port
* @SPA_PORT_OUTPUT_FLAG_DISCARD: discard the buffer data
* @SPA_PORT_OUTPUT_FLAG_NO_BUFFER: no buffer was produced on the port
*/
typedef enum {
SPA_OUTPUT_FLAG_NONE = 0,
SPA_OUTPUT_FLAG_PULL = (1 << 0),
SPA_OUTPUT_FLAG_DISCARD = (1 << 1),
SPA_OUTPUT_FLAG_NO_BUFFER = (1 << 2),
} SpaOutputFlags;
SPA_PORT_OUTPUT_FLAG_NONE = 0,
SPA_PORT_OUTPUT_FLAG_PULL = (1 << 0),
SPA_PORT_OUTPUT_FLAG_DISCARD = (1 << 1),
SPA_PORT_OUTPUT_FLAG_NO_BUFFER = (1 << 2),
} SpaPortOutputFlags;
/**
* SpaOutputInfo:
* SpaPortOutputInfo:
* @port_id: the port id
* @flags: extra flags
* @buffer_id: a buffer id will be set
@ -119,15 +119,15 @@ typedef enum {
* Output information for a node.
*/
typedef struct {
uint32_t port_id;
SpaOutputFlags flags;
uint32_t buffer_id;
SpaEvent *event;
SpaResult status;
} SpaOutputInfo;
uint32_t port_id;
SpaPortOutputFlags flags;
uint32_t buffer_id;
SpaNodeEvent *event;
SpaResult status;
} SpaPortOutputInfo;
/**
* SpaEventCallback:
* SpaNodeCallback:
* @node: a #SpaNode emiting the event
* @event: the event that was emited
* @user_data: user data provided when registering the callback
@ -135,9 +135,9 @@ typedef struct {
* This will be called when an out-of-bound event is notified
* on @node.
*/
typedef void (*SpaEventCallback) (SpaNode *node,
SpaEvent *event,
void *user_data);
typedef void (*SpaNodeEventCallback) (SpaNode *node,
SpaNodeEvent *event,
void *user_data);
#define SPA_INTERFACE_ID_NODE 0
#define SPA_INTERFACE_ID_NODE_NAME "Node interface"
@ -205,7 +205,7 @@ struct _SpaNode {
/**
* SpaNode::send_command:
* @node: a #SpaNode
* @command: a #SpaCommand
* @command: a #SpaNodeCommand
*
* Send a command to @node.
*
@ -215,7 +215,7 @@ struct _SpaNode {
* #SPA_RESULT_INVALID_COMMAND @command is an invalid command
*/
SpaResult (*send_command) (SpaNode *node,
SpaCommand *command);
SpaNodeCommand *command);
/**
* SpaNode::set_event_callback:
* @node: a #SpaNode
@ -231,9 +231,9 @@ struct _SpaNode {
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/
SpaResult (*set_event_callback) (SpaNode *node,
SpaEventCallback callback,
void *user_data);
SpaResult (*set_event_callback) (SpaNode *node,
SpaNodeEventCallback callback,
void *user_data);
/**
* SpaNode::get_n_ports:
* @node: a #SpaNode
@ -450,8 +450,8 @@ struct _SpaNode {
/**
* SpaNode::port_push_input:
* @node: a #SpaNode
* @n_info: number of #SpaInputInfo in @info
* @info: array of #SpaInputInfo
* @n_info: number of #SpaPortInputInfo in @info
* @info: array of #SpaPortInputInfo
*
* Push a buffer id into one or more input ports of @node.
*
@ -464,12 +464,12 @@ struct _SpaNode {
*/
SpaResult (*port_push_input) (SpaNode *node,
unsigned int n_info,
SpaInputInfo *info);
SpaPortInputInfo *info);
/**
* SpaNode::port_pull_output:
* @node: a #SpaNode
* @n_info: number of #SpaOutputInfo in @info
* @info: array of #SpaOutputInfo
* @n_info: number of #SpaPortOutputInfo in @info
* @info: array of #SpaPortOutputInfo
*
* Pull a buffer id from one or more output ports of @node.
*
@ -486,13 +486,13 @@ struct _SpaNode {
* #SPA_RESULT_NEED_MORE_INPUT when no output can be produced
* because more input is needed.
*/
SpaResult (*port_pull_output) (SpaNode *node,
unsigned int n_info,
SpaOutputInfo *info);
SpaResult (*port_pull_output) (SpaNode *node,
unsigned int n_info,
SpaPortOutputInfo *info);
SpaResult (*port_push_event) (SpaNode *node,
uint32_t port_id,
SpaEvent *event);
SpaNodeEvent *event);
};

View file

@ -65,8 +65,8 @@ typedef int (*SpaPollNotify) (SpaPollNotifyData *data);
* @fds: array of file descriptors to watch
* @n_fds: number of elements in @fds
* @idle_cb: callback called when there is no other work
* @idle_cb: callback called before starting the poll
* @idle_cb: callback called after the poll loop
* @before_cb: callback called before starting the poll
* @after_cb: callback called after the poll loop
* @user_data: user data pass to callbacks
*/
typedef struct {

View file

@ -234,7 +234,6 @@ spa_format_audio_init (SpaMediaType type,
format->info.raw = default_raw_info;
break;
}
case SPA_MEDIA_SUBTYPE_MP3:
case SPA_MEDIA_SUBTYPE_AAC:
case SPA_MEDIA_SUBTYPE_VORBIS:

View file

@ -36,13 +36,18 @@ spa_format_to_string (const SpaFormat *format, char **result)
SpaResult
spa_format_fixate (SpaFormat *format)
{
#if 0
unsigned int i, j;
SpaProps *props;
uint32_t mask;
#endif
if (format == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
format->props.unset_mask = 0;
#if 0
props = &format->props;
mask = props->unset_mask;
@ -75,5 +80,6 @@ spa_format_fixate (SpaFormat *format)
}
mask >>= 1;
}
#endif
return SPA_RESULT_OK;
}

View file

@ -28,8 +28,8 @@
static const SpaVideoInfoRaw default_raw_info = {
SPA_VIDEO_FORMAT_UNKNOWN,
{ 320, 240 },
{ 0, 1 },
{ 0, 1 },
{ 1, 25 },
{ 1, 25 },
1,
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE,
{ 1, 1},

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 = &sc;
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 = &sc;
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;
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;
}

View file

@ -89,20 +89,20 @@ make_node (SpaNode **node, const char *lib, const char *name)
}
static void
on_mix_event (SpaNode *node, SpaEvent *event, void *user_data)
on_mix_event (SpaNode *node, SpaNodeEvent *event, void *user_data)
{
AppData *data = user_data;
switch (event->type) {
case SPA_EVENT_TYPE_NEED_INPUT:
case SPA_NODE_EVENT_TYPE_NEED_INPUT:
{
SpaInputInfo iinfo;
SpaOutputInfo oinfo;
SpaPortInputInfo iinfo;
SpaPortOutputInfo oinfo;
SpaResult res;
SpaEventNeedInput *ni = event->data;
SpaNodeEventNeedInput *ni = event->data;
oinfo.port_id = 0;
oinfo.flags = SPA_OUTPUT_FLAG_NONE;
oinfo.flags = SPA_PORT_OUTPUT_FLAG_NONE;
if (ni->port_id == data->mix_ports[0]) {
if ((res = spa_node_port_pull_output (data->source1, 1, &oinfo)) < 0)
@ -113,7 +113,7 @@ on_mix_event (SpaNode *node, SpaEvent *event, void *user_data)
}
iinfo.port_id = ni->port_id;
iinfo.flags = SPA_INPUT_FLAG_NONE;
iinfo.flags = SPA_PORT_INPUT_FLAG_NONE;
iinfo.buffer_id = oinfo.buffer_id;
if ((res = spa_node_port_push_input (data->mix, 1, &iinfo)) < 0)
@ -127,33 +127,33 @@ on_mix_event (SpaNode *node, SpaEvent *event, void *user_data)
}
static void
on_sink_event (SpaNode *node, SpaEvent *event, void *user_data)
on_sink_event (SpaNode *node, SpaNodeEvent *event, void *user_data)
{
AppData *data = user_data;
switch (event->type) {
case SPA_EVENT_TYPE_NEED_INPUT:
case SPA_NODE_EVENT_TYPE_NEED_INPUT:
{
SpaInputInfo iinfo;
SpaOutputInfo oinfo;
SpaPortInputInfo iinfo;
SpaPortOutputInfo oinfo;
SpaResult res;
SpaEventNeedInput *ni = event->data;
SpaNodeEventNeedInput *ni = event->data;
oinfo.port_id = 0;
oinfo.flags = SPA_OUTPUT_FLAG_PULL;
oinfo.flags = SPA_PORT_OUTPUT_FLAG_PULL;
if ((res = spa_node_port_pull_output (data->mix, 1, &oinfo)) < 0)
printf ("got error %d\n", res);
iinfo.port_id = ni->port_id;
iinfo.flags = SPA_INPUT_FLAG_NONE;
iinfo.flags = SPA_PORT_INPUT_FLAG_NONE;
iinfo.buffer_id = oinfo.buffer_id;
if ((res = spa_node_port_push_input (data->sink, 1, &iinfo)) < 0)
printf ("got error %d\n", res);
break;
}
case SPA_EVENT_TYPE_ADD_POLL:
case SPA_NODE_EVENT_TYPE_ADD_POLL:
{
SpaPollItem *poll = event->data;
int i;
@ -312,10 +312,10 @@ static void
run_async_sink (AppData *data)
{
SpaResult res;
SpaCommand cmd;
SpaNodeCommand cmd;
int err;
cmd.type = SPA_COMMAND_START;
cmd.type = SPA_NODE_COMMAND_START;
if ((res = spa_node_send_command (data->sink, &cmd)) < 0)
printf ("got error %d\n", res);
@ -333,7 +333,7 @@ run_async_sink (AppData *data)
pthread_join (data->thread, NULL);
}
cmd.type = SPA_COMMAND_PAUSE;
cmd.type = SPA_NODE_COMMAND_PAUSE;
if ((res = spa_node_send_command (data->sink, &cmd)) < 0)
printf ("got error %d\n", res);
}

View file

@ -110,14 +110,14 @@ make_node (SpaNode **node, const char *lib, const char *name)
}
static void
on_source_event (SpaNode *node, SpaEvent *event, void *user_data)
on_source_event (SpaNode *node, SpaNodeEvent *event, void *user_data)
{
AppData *data = user_data;
switch (event->type) {
case SPA_EVENT_TYPE_HAVE_OUTPUT:
case SPA_NODE_EVENT_TYPE_HAVE_OUTPUT:
{
SpaOutputInfo info[1] = { 0, };
SpaPortOutputInfo info[1] = { 0, };
SpaResult res;
SpaBuffer *b;
void *sdata, *ddata;
@ -181,7 +181,7 @@ on_source_event (SpaNode *node, SpaEvent *event, void *user_data)
spa_node_port_reuse_buffer (data->source, 0, info->buffer_id);
break;
}
case SPA_EVENT_TYPE_ADD_POLL:
case SPA_NODE_EVENT_TYPE_ADD_POLL:
{
SpaPollItem *poll = event->data;
@ -402,11 +402,11 @@ static void
run_async_source (AppData *data)
{
SpaResult res;
SpaCommand cmd;
SpaNodeCommand cmd;
bool done = false;
int err;
cmd.type = SPA_COMMAND_START;
cmd.type = SPA_NODE_COMMAND_START;
if ((res = spa_node_send_command (data->source, &cmd)) < 0)
printf ("got error %d\n", res);
@ -439,7 +439,7 @@ run_async_source (AppData *data)
pthread_join (data->thread, NULL);
}
cmd.type = SPA_COMMAND_PAUSE;
cmd.type = SPA_NODE_COMMAND_PAUSE;
if ((res = spa_node_send_command (data->source, &cmd)) < 0)
printf ("got error %d\n", res);
}