mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-26 07:00:13 -05:00
cleanups: doc updates
This commit is contained in:
parent
613216613e
commit
82420e483d
8 changed files with 578 additions and 289 deletions
|
|
@ -335,7 +335,7 @@ direct_loop (void *user_data)
|
|||
|
||||
event.refcount = 1;
|
||||
event.notify = NULL;
|
||||
event.type = SPI_EVENT_TYPE_REQUEST_DATA;
|
||||
event.type = SPI_EVENT_TYPE_NEED_INPUT;
|
||||
event.port_id = 0;
|
||||
event.data = buffer;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ typedef struct _SpiALSASink SpiALSASink;
|
|||
|
||||
|
||||
static const char default_device[] = "default";
|
||||
static const uint32_t default_buffer_time = 40000;
|
||||
static const uint32_t default_period_time = 20000;
|
||||
static const uint32_t default_buffer_time = 10000;
|
||||
static const uint32_t default_period_time = 5000;
|
||||
static const bool default_period_event = 0;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -93,9 +93,6 @@ struct _SpiALSASink {
|
|||
|
||||
bool activated;
|
||||
|
||||
SpiEvent *event;
|
||||
SpiEvent last_event;
|
||||
|
||||
SpiEventCallback event_cb;
|
||||
void *user_data;
|
||||
|
||||
|
|
@ -188,6 +185,9 @@ enum_param_info (const SpiParams *params,
|
|||
unsigned int index,
|
||||
const SpiParamInfo **info)
|
||||
{
|
||||
if (params == NULL || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (index >= PARAM_ID_LAST)
|
||||
return SPI_RESULT_ENUM_END;
|
||||
*info = ¶m_info[index];
|
||||
|
|
@ -204,6 +204,9 @@ set_param (SpiParams *params,
|
|||
SpiResult res = SPI_RESULT_OK;
|
||||
SpiALSASinkParams *p = (SpiALSASinkParams *) params;
|
||||
|
||||
if (params == NULL || value == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (id) {
|
||||
case PARAM_ID_DEVICE:
|
||||
CHECK_TYPE (type, SPI_PARAM_TYPE_STRING);
|
||||
|
|
@ -242,6 +245,9 @@ get_param (const SpiParams *params,
|
|||
SpiResult res = SPI_RESULT_OK;
|
||||
SpiALSASinkParams *p = (SpiALSASinkParams *) params;
|
||||
|
||||
if (params == NULL || type == NULL || size == NULL || value == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (id) {
|
||||
case PARAM_ID_DEVICE:
|
||||
*type = SPI_PARAM_TYPE_STRING;
|
||||
|
|
@ -288,6 +294,9 @@ spi_alsa_sink_node_get_params (SpiNode *node,
|
|||
static SpiALSASinkParams p;
|
||||
SpiALSASink *this = (SpiALSASink *) node;
|
||||
|
||||
if (node == NULL || params == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
memcpy (&p, &this->params, sizeof (p));
|
||||
*params = &p.param;
|
||||
|
||||
|
|
@ -304,6 +313,9 @@ spi_alsa_sink_node_set_params (SpiNode *node,
|
|||
size_t size;
|
||||
const void *value;
|
||||
|
||||
if (node == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (params == NULL) {
|
||||
reset_alsa_sink_params (p);
|
||||
return SPI_RESULT_OK;
|
||||
|
|
@ -337,64 +349,61 @@ spi_alsa_sink_node_send_command (SpiNode *node,
|
|||
SpiCommand *command)
|
||||
{
|
||||
SpiALSASink *this = (SpiALSASink *) node;
|
||||
SpiResult res = SPI_RESULT_NOT_IMPLEMENTED;
|
||||
|
||||
if (node == NULL || command == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (command->type) {
|
||||
case SPI_COMMAND_INVALID:
|
||||
res = SPI_RESULT_INVALID_COMMAND;
|
||||
break;
|
||||
return SPI_RESULT_INVALID_COMMAND;
|
||||
|
||||
case SPI_COMMAND_ACTIVATE:
|
||||
if (!this->activated) {
|
||||
spi_alsa_open (this);
|
||||
this->activated = true;
|
||||
}
|
||||
this->last_event.type = SPI_EVENT_TYPE_ACTIVATED;
|
||||
this->last_event.data = NULL;
|
||||
this->last_event.size = 0;
|
||||
this->event = &this->last_event;
|
||||
res = SPI_RESULT_HAVE_EVENT;
|
||||
if (this->event_cb) {
|
||||
SpiEvent event;
|
||||
|
||||
event.refcount = 1;
|
||||
event.notify = NULL;
|
||||
event.type = SPI_EVENT_TYPE_ACTIVATED;
|
||||
event.port_id = -1;
|
||||
event.data = NULL;
|
||||
event.size = 0;
|
||||
|
||||
this->event_cb (node, &event, this->user_data);
|
||||
}
|
||||
break;
|
||||
case SPI_COMMAND_DEACTIVATE:
|
||||
if (this->activated) {
|
||||
spi_alsa_close (this);
|
||||
this->activated = false;
|
||||
}
|
||||
this->last_event.type = SPI_EVENT_TYPE_DEACTIVATED;
|
||||
this->last_event.data = NULL;
|
||||
this->last_event.size = 0;
|
||||
this->event = &this->last_event;
|
||||
res = SPI_RESULT_HAVE_EVENT;
|
||||
if (this->event_cb) {
|
||||
SpiEvent event;
|
||||
|
||||
event.refcount = 1;
|
||||
event.notify = NULL;
|
||||
event.type = SPI_EVENT_TYPE_DEACTIVATED;
|
||||
event.port_id = -1;
|
||||
event.data = NULL;
|
||||
event.size = 0;
|
||||
|
||||
this->event_cb (node, &event, this->user_data);
|
||||
}
|
||||
break;
|
||||
case SPI_COMMAND_START:
|
||||
spi_alsa_start (this);
|
||||
res = SPI_RESULT_OK;
|
||||
break;
|
||||
case SPI_COMMAND_STOP:
|
||||
spi_alsa_stop (this);
|
||||
res = SPI_RESULT_OK;
|
||||
break;
|
||||
case SPI_COMMAND_FLUSH:
|
||||
break;
|
||||
case SPI_COMMAND_DRAIN:
|
||||
break;
|
||||
case SPI_COMMAND_MARKER:
|
||||
break;
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_alsa_sink_node_get_event (SpiNode *node,
|
||||
SpiEvent **event)
|
||||
{
|
||||
SpiALSASink *this = (SpiALSASink *) node;
|
||||
|
||||
if (this->event == NULL)
|
||||
return SPI_RESULT_ERROR;
|
||||
|
||||
*event = this->event;
|
||||
this->event = NULL;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -405,6 +414,9 @@ spi_alsa_sink_node_set_event_callback (SpiNode *node,
|
|||
{
|
||||
SpiALSASink *this = (SpiALSASink *) node;
|
||||
|
||||
if (node == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
this->event_cb = event;
|
||||
this->user_data = user_data;
|
||||
|
||||
|
|
@ -418,10 +430,18 @@ spi_alsa_sink_node_get_n_ports (SpiNode *node,
|
|||
unsigned int *n_output_ports,
|
||||
unsigned int *max_output_ports)
|
||||
{
|
||||
*n_input_ports = 1;
|
||||
*n_output_ports = 0;
|
||||
*max_input_ports = 1;
|
||||
*max_output_ports = 0;
|
||||
if (node == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (n_input_ports)
|
||||
*n_input_ports = 1;
|
||||
if (n_output_ports)
|
||||
*n_output_ports = 0;
|
||||
if (max_input_ports)
|
||||
*max_input_ports = 1;
|
||||
if (max_output_ports)
|
||||
*max_output_ports = 0;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -432,6 +452,9 @@ spi_alsa_sink_node_get_port_ids (SpiNode *node,
|
|||
unsigned int n_output_ports,
|
||||
uint32_t *output_ids)
|
||||
{
|
||||
if (node == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (n_input_ports > 0)
|
||||
input_ids[0] = 0;
|
||||
|
||||
|
|
@ -545,6 +568,9 @@ enum_raw_format_param_info (const SpiParams *params,
|
|||
unsigned int index,
|
||||
const SpiParamInfo **info)
|
||||
{
|
||||
if (params == NULL || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (index >= 5)
|
||||
return SPI_RESULT_ENUM_END;
|
||||
*info = &raw_format_param_info[index];
|
||||
|
|
@ -599,6 +625,9 @@ enum_mpeg_format_param_info (const SpiParams *params,
|
|||
unsigned int index,
|
||||
const SpiParamInfo **info)
|
||||
{
|
||||
if (params == NULL || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (index >= 4)
|
||||
return SPI_RESULT_ENUM_END;
|
||||
*info = &mpeg_format_param_info[index];
|
||||
|
|
@ -618,6 +647,9 @@ set_format_param (SpiParams *params,
|
|||
{
|
||||
SpiALSASinkFormat *f = (SpiALSASinkFormat *) params;
|
||||
|
||||
if (params == NULL || value == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (id) {
|
||||
case SPI_PARAM_ID_FORMAT:
|
||||
CHECK_TYPE (type, SPI_PARAM_TYPE_STRING);
|
||||
|
|
@ -665,6 +697,9 @@ get_format_param (const SpiParams *params,
|
|||
{
|
||||
SpiALSASinkFormat *f = (SpiALSASinkFormat *) params;
|
||||
|
||||
if (params == NULL || type == NULL || size == NULL || value == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (id) {
|
||||
case SPI_PARAM_ID_MEDIA_TYPE:
|
||||
CHECK_UNSET (f->unset_mask, 0);
|
||||
|
|
@ -722,13 +757,16 @@ get_format_param (const SpiParams *params,
|
|||
|
||||
|
||||
static SpiResult
|
||||
spi_alsa_sink_node_enum_port_formats (SpiNode *node,
|
||||
spi_alsa_sink_node_enum_port_formats (SpiNode *node,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpiParams **format)
|
||||
{
|
||||
static SpiALSASinkFormat fmt;
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
|
|
@ -767,11 +805,16 @@ spi_alsa_sink_node_set_port_format (SpiNode *node,
|
|||
SpiParamType type;
|
||||
size_t size;
|
||||
const void *value;
|
||||
SpiALSASinkFormat *fmt = &this->current_format;
|
||||
SpiALSASinkFormat *fmt;
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
fmt = &this->current_format;
|
||||
|
||||
if (format == NULL) {
|
||||
fmt->param.get_param = NULL;
|
||||
this->have_format = 0;
|
||||
|
|
@ -834,6 +877,9 @@ spi_alsa_sink_node_get_port_format (SpiNode *node,
|
|||
{
|
||||
SpiALSASink *this = (SpiALSASink *) node;
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
|
|
@ -850,6 +896,9 @@ spi_alsa_sink_node_get_port_info (SpiNode *node,
|
|||
uint32_t port_id,
|
||||
SpiPortInfo *info)
|
||||
{
|
||||
if (node == NULL || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
|
|
@ -879,6 +928,9 @@ spi_alsa_sink_node_get_port_status (SpiNode *node,
|
|||
uint32_t port_id,
|
||||
SpiPortStatus *status)
|
||||
{
|
||||
if (node == NULL || status == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
|
|
@ -888,34 +940,74 @@ spi_alsa_sink_node_get_port_status (SpiNode *node,
|
|||
}
|
||||
|
||||
static SpiResult
|
||||
spi_alsa_sink_node_send_port_data (SpiNode *node,
|
||||
SpiDataInfo *data)
|
||||
spi_alsa_sink_node_push_port_input (SpiNode *node,
|
||||
unsigned int n_info,
|
||||
SpiInputInfo *info)
|
||||
{
|
||||
SpiALSASink *this = (SpiALSASink *) node;
|
||||
unsigned int i;
|
||||
bool have_error = false, have_enough = false;
|
||||
|
||||
if (data->port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
if (node == NULL || n_info == 0 || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (data->buffer != NULL) {
|
||||
if (!this->have_format)
|
||||
return SPI_RESULT_NO_FORMAT;
|
||||
for (i = 0; i < n_info; i++) {
|
||||
if (info[i].port_id != 0) {
|
||||
info[i].status = SPI_RESULT_INVALID_PORT;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->input_buffer != NULL)
|
||||
return SPI_RESULT_HAVE_ENOUGH_INPUT;
|
||||
if (info[i].buffer != NULL) {
|
||||
if (!this->have_format) {
|
||||
info[i].status = SPI_RESULT_NO_FORMAT;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
this->input_buffer = spi_buffer_ref (data->buffer);
|
||||
if (this->input_buffer != NULL) {
|
||||
info[i].status = SPI_RESULT_HAVE_ENOUGH_INPUT;
|
||||
have_enough = true;
|
||||
continue;
|
||||
}
|
||||
this->input_buffer = spi_buffer_ref (info[i].buffer);
|
||||
}
|
||||
info[i].status = SPI_RESULT_OK;
|
||||
}
|
||||
if (have_error)
|
||||
return SPI_RESULT_ERROR;
|
||||
if (have_enough)
|
||||
return SPI_RESULT_HAVE_ENOUGH_INPUT;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_alsa_sink_node_receive_port_data (SpiNode *node,
|
||||
unsigned int n_data,
|
||||
SpiDataInfo *data)
|
||||
spi_alsa_sink_node_pull_port_output (SpiNode *node,
|
||||
unsigned int n_info,
|
||||
SpiOutputInfo *info)
|
||||
{
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_alsa_sink_node_enum_interface_info (SpiNode *node,
|
||||
unsigned int index,
|
||||
const SpiInterfaceInfo **info)
|
||||
|
||||
{
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_alsa_sink_node_get_interface (SpiNode *node,
|
||||
uint32_t interface_id,
|
||||
void **interface)
|
||||
{
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
SpiNode *
|
||||
spi_alsa_sink_new (void)
|
||||
{
|
||||
|
|
@ -927,7 +1019,6 @@ spi_alsa_sink_new (void)
|
|||
node->get_params = spi_alsa_sink_node_get_params;
|
||||
node->set_params = spi_alsa_sink_node_set_params;
|
||||
node->send_command = spi_alsa_sink_node_send_command;
|
||||
node->get_event = spi_alsa_sink_node_get_event;
|
||||
node->set_event_callback = spi_alsa_sink_node_set_event_callback;
|
||||
node->get_n_ports = spi_alsa_sink_node_get_n_ports;
|
||||
node->get_port_ids = spi_alsa_sink_node_get_port_ids;
|
||||
|
|
@ -940,8 +1031,10 @@ spi_alsa_sink_new (void)
|
|||
node->get_port_params = spi_alsa_sink_node_get_port_params;
|
||||
node->set_port_params = spi_alsa_sink_node_set_port_params;
|
||||
node->get_port_status = spi_alsa_sink_node_get_port_status;
|
||||
node->send_port_data = spi_alsa_sink_node_send_port_data;
|
||||
node->receive_port_data = spi_alsa_sink_node_receive_port_data;
|
||||
node->push_port_input = spi_alsa_sink_node_push_port_input;
|
||||
node->pull_port_output = spi_alsa_sink_node_pull_port_output;
|
||||
node->enum_interface_info = spi_alsa_sink_node_enum_interface_info;
|
||||
node->get_interface = spi_alsa_sink_node_get_interface;
|
||||
|
||||
this = (SpiALSASink *) node;
|
||||
this->params.param.enum_param_info = enum_param_info;
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ struct _SpiAudioTestSrc {
|
|||
SpiAudioTestSrcParams params;
|
||||
SpiAudioTestSrcParams tmp_params;
|
||||
|
||||
SpiEvent *event;
|
||||
SpiEvent last_event;
|
||||
|
||||
SpiEventCallback event_cb;
|
||||
void *user_data;
|
||||
|
||||
|
|
@ -277,58 +274,51 @@ spi_audiotestsrc_node_send_command (SpiNode *node,
|
|||
SpiCommand *command)
|
||||
{
|
||||
SpiAudioTestSrc *this = (SpiAudioTestSrc *) node;
|
||||
SpiResult res = SPI_RESULT_NOT_IMPLEMENTED;
|
||||
|
||||
if (node == NULL || command == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (command->type) {
|
||||
case SPI_COMMAND_INVALID:
|
||||
res = SPI_RESULT_INVALID_COMMAND;
|
||||
break;
|
||||
return SPI_RESULT_INVALID_COMMAND;
|
||||
|
||||
case SPI_COMMAND_ACTIVATE:
|
||||
this->last_event.type = SPI_EVENT_TYPE_ACTIVATED;
|
||||
this->last_event.data = NULL;
|
||||
this->last_event.size = 0;
|
||||
this->event = &this->last_event;
|
||||
res = SPI_RESULT_HAVE_EVENT;
|
||||
if (this->event_cb) {
|
||||
SpiEvent event;
|
||||
|
||||
event.refcount = 1;
|
||||
event.notify = NULL;
|
||||
event.type = SPI_EVENT_TYPE_ACTIVATED;
|
||||
event.port_id = -1;
|
||||
event.data = NULL;
|
||||
event.size = 0;
|
||||
|
||||
this->event_cb (node, &event, this->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPI_COMMAND_DEACTIVATE:
|
||||
this->last_event.type = SPI_EVENT_TYPE_DEACTIVATED;
|
||||
this->last_event.data = NULL;
|
||||
this->last_event.size = 0;
|
||||
this->event = &this->last_event;
|
||||
res = SPI_RESULT_HAVE_EVENT;
|
||||
if (this->event_cb) {
|
||||
SpiEvent event;
|
||||
|
||||
event.refcount = 1;
|
||||
event.notify = NULL;
|
||||
event.type = SPI_EVENT_TYPE_DEACTIVATED;
|
||||
event.port_id = -1;
|
||||
event.data = NULL;
|
||||
event.size = 0;
|
||||
|
||||
this->event_cb (node, &event, this->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPI_COMMAND_START:
|
||||
break;
|
||||
case SPI_COMMAND_STOP:
|
||||
break;
|
||||
case SPI_COMMAND_FLUSH:
|
||||
break;
|
||||
case SPI_COMMAND_DRAIN:
|
||||
break;
|
||||
case SPI_COMMAND_MARKER:
|
||||
break;
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_audiotestsrc_node_get_event (SpiNode *node,
|
||||
SpiEvent **event)
|
||||
{
|
||||
SpiAudioTestSrc *this = (SpiAudioTestSrc *) node;
|
||||
|
||||
if (node == NULL || event == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (this->event == NULL)
|
||||
return SPI_RESULT_ERROR;
|
||||
|
||||
*event = this->event;
|
||||
this->event = NULL;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -790,42 +780,78 @@ spi_audiotestsrc_node_get_port_status (SpiNode *node,
|
|||
}
|
||||
|
||||
static SpiResult
|
||||
spi_audiotestsrc_node_send_port_data (SpiNode *node,
|
||||
SpiDataInfo *data)
|
||||
spi_audiotestsrc_node_push_port_input (SpiNode *node,
|
||||
unsigned int n_info,
|
||||
SpiInputInfo *info)
|
||||
{
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_audiotestsrc_node_receive_port_data (SpiNode *node,
|
||||
unsigned int n_data,
|
||||
SpiDataInfo *data)
|
||||
spi_audiotestsrc_node_pull_port_output (SpiNode *node,
|
||||
unsigned int n_info,
|
||||
SpiOutputInfo *info)
|
||||
{
|
||||
SpiAudioTestSrc *this = (SpiAudioTestSrc *) node;
|
||||
size_t i, size;
|
||||
size_t j, size;
|
||||
uint8_t *ptr;
|
||||
unsigned int i;
|
||||
bool have_error = false;
|
||||
|
||||
if (node == NULL || n_data == 0 || data == NULL)
|
||||
if (node == NULL || n_info == 0 || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (data->port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
for (i = 0; i < n_info; i++) {
|
||||
if (info[i].port_id != 0) {
|
||||
info[i].status = SPI_RESULT_INVALID_PORT;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this->have_format)
|
||||
return SPI_RESULT_NO_FORMAT;
|
||||
if (!this->have_format) {
|
||||
info[i].status = SPI_RESULT_NO_FORMAT;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data->buffer == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
if (info[i].buffer == NULL || info[i].buffer->n_datas == 0) {
|
||||
info[i].status = SPI_RESULT_INVALID_ARGUMENTS;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
ptr = data->buffer->datas[0].data;
|
||||
size = data->buffer->datas[0].size;
|
||||
ptr = info[i].buffer->datas[0].data;
|
||||
size = info[i].buffer->datas[0].size;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
ptr[i] = rand();
|
||||
for (j = 0; j < size; j++)
|
||||
ptr[j] = rand();
|
||||
|
||||
info[i].status = SPI_RESULT_OK;
|
||||
}
|
||||
if (have_error)
|
||||
return SPI_RESULT_ERROR;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_audiotestsrc_node_enum_interface_info (SpiNode *node,
|
||||
unsigned int index,
|
||||
const SpiInterfaceInfo **info)
|
||||
|
||||
{
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_audiotestsrc_node_get_interface (SpiNode *node,
|
||||
uint32_t interface_id,
|
||||
void **interface)
|
||||
{
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
SpiNode *
|
||||
spi_audiotestsrc_new (void)
|
||||
{
|
||||
|
|
@ -837,7 +863,6 @@ spi_audiotestsrc_new (void)
|
|||
node->get_params = spi_audiotestsrc_node_get_params;
|
||||
node->set_params = spi_audiotestsrc_node_set_params;
|
||||
node->send_command = spi_audiotestsrc_node_send_command;
|
||||
node->get_event = spi_audiotestsrc_node_get_event;
|
||||
node->set_event_callback = spi_audiotestsrc_node_set_event_callback;
|
||||
node->get_n_ports = spi_audiotestsrc_node_get_n_ports;
|
||||
node->get_port_ids = spi_audiotestsrc_node_get_port_ids;
|
||||
|
|
@ -850,8 +875,10 @@ spi_audiotestsrc_new (void)
|
|||
node->get_port_params = spi_audiotestsrc_node_get_port_params;
|
||||
node->set_port_params = spi_audiotestsrc_node_set_port_params;
|
||||
node->get_port_status = spi_audiotestsrc_node_get_port_status;
|
||||
node->send_port_data = spi_audiotestsrc_node_send_port_data;
|
||||
node->receive_port_data = spi_audiotestsrc_node_receive_port_data;
|
||||
node->push_port_input = spi_audiotestsrc_node_push_port_input;
|
||||
node->pull_port_output = spi_audiotestsrc_node_pull_port_output;
|
||||
node->enum_interface_info = spi_audiotestsrc_node_enum_interface_info;
|
||||
node->get_interface = spi_audiotestsrc_node_get_interface;
|
||||
|
||||
this = (SpiAudioTestSrc *) node;
|
||||
this->params.param.enum_param_info = enum_param_info;
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ struct _SpiVolume {
|
|||
SpiVolumeParams params;
|
||||
SpiVolumeParams tmp_params;
|
||||
|
||||
SpiEvent *event;
|
||||
SpiEvent last_event;
|
||||
|
||||
SpiEventCallback event_cb;
|
||||
void *user_data;
|
||||
|
||||
|
|
@ -109,9 +106,14 @@ enum_param_info (const SpiParams *params,
|
|||
unsigned int index,
|
||||
const SpiParamInfo **info)
|
||||
{
|
||||
if (params == NULL || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (index >= PARAM_ID_LAST)
|
||||
return SPI_RESULT_ENUM_END;
|
||||
|
||||
*info = ¶m_info[index];
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -235,65 +237,64 @@ spi_volume_node_send_command (SpiNode *node,
|
|||
SpiCommand *command)
|
||||
{
|
||||
SpiVolume *this = (SpiVolume *) node;
|
||||
SpiResult res = SPI_RESULT_NOT_IMPLEMENTED;
|
||||
|
||||
if (node == NULL || command == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (command->type) {
|
||||
case SPI_COMMAND_INVALID:
|
||||
res = SPI_RESULT_INVALID_COMMAND;
|
||||
break;
|
||||
return SPI_RESULT_INVALID_COMMAND;
|
||||
|
||||
case SPI_COMMAND_ACTIVATE:
|
||||
this->last_event.type = SPI_EVENT_TYPE_ACTIVATED;
|
||||
this->last_event.data = NULL;
|
||||
this->last_event.size = 0;
|
||||
this->event = &this->last_event;
|
||||
res = SPI_RESULT_HAVE_EVENT;
|
||||
if (this->event_cb) {
|
||||
SpiEvent event;
|
||||
|
||||
event.refcount = 1;
|
||||
event.notify = NULL;
|
||||
event.type = SPI_EVENT_TYPE_ACTIVATED;
|
||||
event.port_id = -1;
|
||||
event.data = NULL;
|
||||
event.size = 0;
|
||||
|
||||
this->event_cb (node, &event, this->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPI_COMMAND_DEACTIVATE:
|
||||
this->last_event.type = SPI_EVENT_TYPE_DEACTIVATED;
|
||||
this->last_event.data = NULL;
|
||||
this->last_event.size = 0;
|
||||
this->event = &this->last_event;
|
||||
res = SPI_RESULT_HAVE_EVENT;
|
||||
if (this->event_cb) {
|
||||
SpiEvent event;
|
||||
|
||||
event.refcount = 1;
|
||||
event.notify = NULL;
|
||||
event.type = SPI_EVENT_TYPE_DEACTIVATED;
|
||||
event.port_id = -1;
|
||||
event.data = NULL;
|
||||
event.size = 0;
|
||||
|
||||
this->event_cb (node, &event, this->user_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPI_COMMAND_START:
|
||||
break;
|
||||
case SPI_COMMAND_STOP:
|
||||
break;
|
||||
case SPI_COMMAND_FLUSH:
|
||||
break;
|
||||
case SPI_COMMAND_DRAIN:
|
||||
break;
|
||||
case SPI_COMMAND_MARKER:
|
||||
break;
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_volume_node_get_event (SpiNode *node,
|
||||
SpiEvent **event)
|
||||
{
|
||||
SpiVolume *this = (SpiVolume *) node;
|
||||
|
||||
if (this->event == NULL)
|
||||
return SPI_RESULT_ERROR;
|
||||
|
||||
*event = this->event;
|
||||
this->event = NULL;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_volume_node_set_event_callback (SpiNode *node,
|
||||
SpiEventCallback event,
|
||||
void *user_data)
|
||||
spi_volume_node_set_event_callback (SpiNode *node,
|
||||
SpiEventCallback event,
|
||||
void *user_data)
|
||||
{
|
||||
SpiVolume *this = (SpiVolume *) node;
|
||||
|
||||
if (node == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
this->event_cb = event;
|
||||
this->user_data = user_data;
|
||||
|
||||
|
|
@ -329,9 +330,12 @@ spi_volume_node_get_port_ids (SpiNode *node,
|
|||
unsigned int n_output_ports,
|
||||
uint32_t *output_ids)
|
||||
{
|
||||
if (n_input_ports > 0)
|
||||
if (node == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (n_input_ports > 0 && input_ids)
|
||||
input_ids[0] = 0;
|
||||
if (n_output_ports > 0)
|
||||
if (n_output_ports > 0 && output_ids)
|
||||
output_ids[0] = 1;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
|
|
@ -451,9 +455,14 @@ enum_raw_format_param_info (const SpiParams *params,
|
|||
unsigned int index,
|
||||
const SpiParamInfo **info)
|
||||
{
|
||||
if (params == NULL || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (index >= 4)
|
||||
return SPI_RESULT_ENUM_END;
|
||||
|
||||
*info = &raw_format_param_info[index];
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -469,6 +478,9 @@ set_format_param (SpiParams *params,
|
|||
{
|
||||
SpiVolumeFormat *f = (SpiVolumeFormat *) params;
|
||||
|
||||
if (params == NULL || value == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (id) {
|
||||
case SPI_PARAM_ID_FORMAT:
|
||||
CHECK_TYPE (type, SPI_PARAM_TYPE_STRING);
|
||||
|
|
@ -512,6 +524,9 @@ get_format_param (const SpiParams *params,
|
|||
{
|
||||
SpiVolumeFormat *f = (SpiVolumeFormat *) params;
|
||||
|
||||
if (params == NULL || type == NULL || size == NULL || value == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (id) {
|
||||
case SPI_PARAM_ID_MEDIA_TYPE:
|
||||
CHECK_UNSET (f->unset_mask, 0);
|
||||
|
|
@ -558,6 +573,9 @@ spi_volume_node_enum_port_formats (SpiNode *node,
|
|||
{
|
||||
static SpiVolumeFormat fmt;
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
|
|
@ -587,11 +605,16 @@ spi_volume_node_set_port_format (SpiNode *node,
|
|||
SpiParamType type;
|
||||
size_t size;
|
||||
const void *value;
|
||||
SpiVolumeFormat *fmt = &this->current_format;
|
||||
SpiVolumeFormat *fmt;
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
fmt = &this->current_format;
|
||||
|
||||
if (format == NULL) {
|
||||
fmt->param.get_param = NULL;
|
||||
this->have_format = false;
|
||||
|
|
@ -653,6 +676,9 @@ spi_volume_node_get_port_format (SpiNode *node,
|
|||
{
|
||||
SpiVolume *this = (SpiVolume *) node;
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
|
|
@ -669,6 +695,9 @@ spi_volume_node_get_port_info (SpiNode *node,
|
|||
uint32_t port_id,
|
||||
SpiPortInfo *info)
|
||||
{
|
||||
if (node == NULL || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
switch (port_id) {
|
||||
case 0:
|
||||
info->flags = SPI_PORT_INFO_FLAG_CAN_USE_BUFFER |
|
||||
|
|
@ -709,6 +738,9 @@ spi_volume_node_get_port_status (SpiNode *node,
|
|||
SpiVolume *this = (SpiVolume *) node;
|
||||
SpiPortStatusFlags flags = 0;
|
||||
|
||||
if (node == NULL || status == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (!this->have_format)
|
||||
return SPI_RESULT_NO_FORMAT;
|
||||
|
||||
|
|
@ -730,40 +762,62 @@ spi_volume_node_get_port_status (SpiNode *node,
|
|||
}
|
||||
|
||||
static SpiResult
|
||||
spi_volume_node_send_port_data (SpiNode *node,
|
||||
SpiDataInfo *data)
|
||||
spi_volume_node_push_port_input (SpiNode *node,
|
||||
unsigned int n_info,
|
||||
SpiInputInfo *info)
|
||||
{
|
||||
SpiVolume *this = (SpiVolume *) node;
|
||||
SpiBuffer *buffer;
|
||||
SpiEvent *event;
|
||||
unsigned int i;
|
||||
bool have_error = false;
|
||||
bool have_enough = false;
|
||||
|
||||
if (node == NULL || data == NULL)
|
||||
if (node == NULL || n_info == 0 || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (data->port_id != 0)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
event = data->event;
|
||||
buffer = data->buffer;
|
||||
|
||||
if (buffer == NULL && event == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (!this->have_format)
|
||||
return SPI_RESULT_NO_FORMAT;
|
||||
|
||||
if (buffer) {
|
||||
if (this->input_buffer != NULL)
|
||||
return SPI_RESULT_HAVE_ENOUGH_INPUT;
|
||||
|
||||
this->input_buffer = spi_buffer_ref (buffer);
|
||||
}
|
||||
if (event) {
|
||||
switch (event->type) {
|
||||
default:
|
||||
break;
|
||||
for (i = 0; i < n_info; i++) {
|
||||
if (info[i].port_id != 0) {
|
||||
info[i].status = SPI_RESULT_INVALID_PORT;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
event = info[i].event;
|
||||
buffer = info[i].buffer;
|
||||
|
||||
if (buffer == NULL && event == NULL) {
|
||||
info[i].status = SPI_RESULT_INVALID_ARGUMENTS;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (buffer) {
|
||||
if (!this->have_format) {
|
||||
info[i].status = SPI_RESULT_NO_FORMAT;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->input_buffer != NULL) {
|
||||
info[i].status = SPI_RESULT_HAVE_ENOUGH_INPUT;
|
||||
have_enough = true;
|
||||
continue;
|
||||
}
|
||||
this->input_buffer = spi_buffer_ref (buffer);
|
||||
}
|
||||
if (event) {
|
||||
switch (event->type) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
info[i].status = SPI_RESULT_OK;
|
||||
}
|
||||
if (have_error)
|
||||
return SPI_RESULT_ERROR;
|
||||
if (have_enough)
|
||||
return SPI_RESULT_HAVE_ENOUGH_INPUT;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
|
@ -771,9 +825,9 @@ spi_volume_node_send_port_data (SpiNode *node,
|
|||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
static SpiResult
|
||||
spi_volume_node_receive_port_data (SpiNode *node,
|
||||
unsigned int n_data,
|
||||
SpiDataInfo *data)
|
||||
spi_volume_node_pull_port_output (SpiNode *node,
|
||||
unsigned int n_info,
|
||||
SpiOutputInfo *info)
|
||||
{
|
||||
SpiVolume *this = (SpiVolume *) node;
|
||||
unsigned int si, di, i, n_samples, n_bytes, soff, doff ;
|
||||
|
|
@ -782,10 +836,10 @@ spi_volume_node_receive_port_data (SpiNode *node,
|
|||
uint16_t *src, *dst;
|
||||
double volume;
|
||||
|
||||
if (node == NULL || n_data == 0 || data == NULL)
|
||||
if (node == NULL || n_info == 0 || info == NULL)
|
||||
return SPI_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (data->port_id != 1)
|
||||
if (info->port_id != 1)
|
||||
return SPI_RESULT_INVALID_PORT;
|
||||
|
||||
if (!this->have_format)
|
||||
|
|
@ -797,7 +851,7 @@ spi_volume_node_receive_port_data (SpiNode *node,
|
|||
volume = this->params.volume;
|
||||
|
||||
sbuf = this->input_buffer;
|
||||
dbuf = data->buffer ? data->buffer : this->input_buffer;
|
||||
dbuf = info->buffer ? info->buffer : this->input_buffer;
|
||||
|
||||
si = di = 0;
|
||||
soff = doff = 0;
|
||||
|
|
@ -843,11 +897,28 @@ spi_volume_node_receive_port_data (SpiNode *node,
|
|||
spi_buffer_unref (sbuf);
|
||||
|
||||
this->input_buffer = NULL;
|
||||
data->buffer = dbuf;
|
||||
info->buffer = dbuf;
|
||||
|
||||
return SPI_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_volume_node_enum_interface_info (SpiNode *node,
|
||||
unsigned int index,
|
||||
const SpiInterfaceInfo **info)
|
||||
|
||||
{
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static SpiResult
|
||||
spi_volume_node_get_interface (SpiNode *node,
|
||||
uint32_t interface_id,
|
||||
void **interface)
|
||||
{
|
||||
return SPI_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
SpiNode *
|
||||
spi_volume_new (void)
|
||||
{
|
||||
|
|
@ -859,7 +930,6 @@ spi_volume_new (void)
|
|||
node->get_params = spi_volume_node_get_params;
|
||||
node->set_params = spi_volume_node_set_params;
|
||||
node->send_command = spi_volume_node_send_command;
|
||||
node->get_event = spi_volume_node_get_event;
|
||||
node->set_event_callback = spi_volume_node_set_event_callback;
|
||||
node->get_n_ports = spi_volume_node_get_n_ports;
|
||||
node->get_port_ids = spi_volume_node_get_port_ids;
|
||||
|
|
@ -872,8 +942,10 @@ spi_volume_new (void)
|
|||
node->get_port_params = spi_volume_node_get_port_params;
|
||||
node->set_port_params = spi_volume_node_set_port_params;
|
||||
node->get_port_status = spi_volume_node_get_port_status;
|
||||
node->send_port_data = spi_volume_node_send_port_data;
|
||||
node->receive_port_data = spi_volume_node_receive_port_data;
|
||||
node->push_port_input = spi_volume_node_push_port_input;
|
||||
node->pull_port_output = spi_volume_node_pull_port_output;
|
||||
node->enum_interface_info = spi_volume_node_enum_interface_info;
|
||||
node->get_interface = spi_volume_node_get_interface;
|
||||
|
||||
this = (SpiVolume *) node;
|
||||
this->params.param.enum_param_info = enum_param_info;
|
||||
|
|
|
|||
|
|
@ -176,11 +176,6 @@ inspect_node (SpiNode *node)
|
|||
printf ("got params %p\n", params);
|
||||
}
|
||||
|
||||
static void
|
||||
set_params (AppData *data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
set_format (AppData *data)
|
||||
{
|
||||
|
|
@ -210,49 +205,6 @@ set_format (AppData *data)
|
|||
printf ("set format failed: %d\n", res);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_event (SpiNode *node)
|
||||
{
|
||||
SpiEvent *event;
|
||||
SpiResult res;
|
||||
|
||||
if ((res = node->get_event (node, &event)) < 0)
|
||||
printf ("got result %d\n", res);
|
||||
|
||||
switch (event->type) {
|
||||
case SPI_EVENT_TYPE_INVALID:
|
||||
printf ("got invalid notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_ACTIVATED:
|
||||
printf ("got activated notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_DEACTIVATED:
|
||||
printf ("got deactivated notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_HAVE_OUTPUT:
|
||||
printf ("got have-output notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_NEED_INPUT:
|
||||
printf ("got need-input notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_REQUEST_DATA:
|
||||
printf ("got request-data notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_DRAINED:
|
||||
printf ("got drained notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_MARKER:
|
||||
printf ("got marker notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_ERROR:
|
||||
printf ("got error notify\n");
|
||||
break;
|
||||
case SPI_EVENT_TYPE_BUFFERING:
|
||||
printf ("got noffering notify\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct _MyBuffer MyBuffer;
|
||||
|
||||
struct _MyBuffer {
|
||||
|
|
@ -411,27 +363,34 @@ on_event (SpiNode *node, SpiEvent *event, void *user_data)
|
|||
AppData *data = user_data;
|
||||
|
||||
switch (event->type) {
|
||||
case SPI_EVENT_TYPE_REQUEST_DATA:
|
||||
case SPI_EVENT_TYPE_NEED_INPUT:
|
||||
{
|
||||
SpiBuffer *buf;
|
||||
SpiDataInfo info;
|
||||
SpiInputInfo iinfo;
|
||||
SpiOutputInfo oinfo;
|
||||
SpiResult res;
|
||||
|
||||
buf = event->data;
|
||||
|
||||
info.port_id = event->port_id;
|
||||
info.flags = SPI_DATA_FLAG_NONE;
|
||||
info.buffer = buf;
|
||||
info.event = NULL;
|
||||
oinfo.port_id = event->port_id;
|
||||
oinfo.flags = SPI_OUTPUT_FLAG_NONE;
|
||||
oinfo.buffer = buf;
|
||||
oinfo.event = NULL;
|
||||
|
||||
if ((res = data->src->receive_port_data (data->src, 1, &info)) < 0)
|
||||
if ((res = data->src->pull_port_output (data->src, 1, &oinfo)) < 0)
|
||||
printf ("got error %d\n", res);
|
||||
|
||||
if ((res = data->sink->send_port_data (data->sink, &info)) < 0)
|
||||
iinfo.port_id = 0;
|
||||
iinfo.flags = SPI_INPUT_FLAG_NONE;
|
||||
iinfo.buffer = oinfo.buffer;
|
||||
iinfo.event = oinfo.event;
|
||||
|
||||
if ((res = data->sink->push_port_input (data->sink, 1, &iinfo)) < 0)
|
||||
printf ("got error %d\n", res);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf ("got event %d\n", event->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -444,8 +403,6 @@ run_async_sink (AppData *data)
|
|||
|
||||
set_format (data);
|
||||
|
||||
data->sink->set_event_callback (data->sink, on_event, data);
|
||||
|
||||
cmd.type = SPI_COMMAND_START;
|
||||
if ((res = data->sink->send_command (data->sink, &cmd)) < 0)
|
||||
printf ("got error %d\n", res);
|
||||
|
|
@ -480,6 +437,8 @@ setup_sink (AppData *data)
|
|||
|
||||
data->sink = spi_alsa_sink_new ();
|
||||
|
||||
data->sink->set_event_callback (data->sink, on_event, data);
|
||||
|
||||
if ((res = data->sink->get_params (data->sink, ¶ms)) < 0)
|
||||
printf ("got get_params error %d\n", res);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue