Add port direction again

simplify port numbering again by using 0->max_ports for bot input ports
and output ports. This means we need to tall what direction the port is.
Add port_info serialize functions
Copy metadata and data when we are not sharing buffers.
Make pinossink work again.
This commit is contained in:
Wim Taymans 2016-10-03 19:43:42 +02:00
parent b208e8b690
commit d828073bb8
26 changed files with 1104 additions and 648 deletions

View file

@ -86,6 +86,8 @@ struct _SpaXvSink {
};
#define CHECK_PORT(this,d,p) ((d) == SPA_DIRECTION_OUTPUT && (p) == 0)
#include "xv-utils.c"
enum {
@ -258,6 +260,7 @@ spa_xv_sink_node_get_port_ids (SpaNode *node,
static SpaResult
spa_xv_sink_node_add_port (SpaNode *node,
SpaDirection direction,
uint32_t port_id)
{
return SPA_RESULT_NOT_IMPLEMENTED;
@ -265,6 +268,7 @@ spa_xv_sink_node_add_port (SpaNode *node,
static SpaResult
spa_xv_sink_node_remove_port (SpaNode *node,
SpaDirection direction,
uint32_t port_id)
{
return SPA_RESULT_NOT_IMPLEMENTED;
@ -272,6 +276,7 @@ spa_xv_sink_node_remove_port (SpaNode *node,
static SpaResult
spa_xv_sink_node_port_enum_formats (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaFormat **format,
const SpaFormat *filter,
@ -285,7 +290,7 @@ spa_xv_sink_node_port_enum_formats (SpaNode *node,
this = (SpaXvSink *) node->handle;
if (port_id != 0)
if (!CHECK_PORT (this, direction, port_id))
return SPA_RESULT_INVALID_PORT;
index = (*state == NULL ? 0 : *(int*)state);
@ -307,6 +312,7 @@ spa_xv_sink_node_port_enum_formats (SpaNode *node,
static SpaResult
spa_xv_sink_node_port_set_format (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaPortFormatFlags flags,
const SpaFormat *format)
@ -321,7 +327,7 @@ spa_xv_sink_node_port_set_format (SpaNode *node,
this = (SpaXvSink *) node->handle;
if (port_id != 0)
if (!CHECK_PORT (this, direction, port_id))
return SPA_RESULT_INVALID_PORT;
if (format == NULL) {
@ -355,6 +361,7 @@ spa_xv_sink_node_port_set_format (SpaNode *node,
static SpaResult
spa_xv_sink_node_port_get_format (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
const SpaFormat **format)
{
@ -365,7 +372,7 @@ spa_xv_sink_node_port_get_format (SpaNode *node,
this = (SpaXvSink *) node->handle;
if (port_id != 0)
if (!CHECK_PORT (this, direction, port_id))
return SPA_RESULT_INVALID_PORT;
if (this->current_format == NULL)
@ -378,6 +385,7 @@ spa_xv_sink_node_port_get_format (SpaNode *node,
static SpaResult
spa_xv_sink_node_port_get_info (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
const SpaPortInfo **info)
{
@ -388,7 +396,7 @@ spa_xv_sink_node_port_get_info (SpaNode *node,
this = (SpaXvSink *) node->handle;
if (port_id != 0)
if (!CHECK_PORT (this, direction, port_id))
return SPA_RESULT_INVALID_PORT;
*info = &this->info;
@ -397,15 +405,17 @@ spa_xv_sink_node_port_get_info (SpaNode *node,
}
static SpaResult
spa_xv_sink_node_port_get_props (SpaNode *node,
uint32_t port_id,
SpaProps **props)
spa_xv_sink_node_port_get_props (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaProps **props)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_xv_sink_node_port_set_props (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
const SpaProps *props)
{
@ -414,6 +424,7 @@ spa_xv_sink_node_port_set_props (SpaNode *node,
static SpaResult
spa_xv_sink_node_port_use_buffers (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaBuffer **buffers,
uint32_t n_buffers)
@ -423,6 +434,7 @@ spa_xv_sink_node_port_use_buffers (SpaNode *node,
static SpaResult
spa_xv_sink_node_port_alloc_buffers (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaAllocParam **params,
uint32_t n_params,
@ -432,16 +444,9 @@ spa_xv_sink_node_port_alloc_buffers (SpaNode *node,
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_xv_sink_node_port_reuse_buffer (SpaNode *node,
uint32_t port_id,
uint32_t buffer_id)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_xv_sink_node_port_get_status (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
const SpaPortStatus **status)
{
@ -452,7 +457,7 @@ spa_xv_sink_node_port_get_status (SpaNode *node,
this = (SpaXvSink *) node->handle;
if (port_id != 0)
if (!CHECK_PORT (this, direction, port_id))
return SPA_RESULT_INVALID_PORT;
*status = &this->status;
@ -476,8 +481,17 @@ spa_xv_sink_node_port_pull_output (SpaNode *node,
return SPA_RESULT_INVALID_PORT;
}
static SpaResult
spa_xv_sink_node_port_reuse_buffer (SpaNode *node,
uint32_t port_id,
uint32_t buffer_id)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_xv_sink_node_port_push_event (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaNodeEvent *event)
{
@ -505,10 +519,10 @@ static const SpaNode xvsink_node = {
spa_xv_sink_node_port_set_props,
spa_xv_sink_node_port_use_buffers,
spa_xv_sink_node_port_alloc_buffers,
spa_xv_sink_node_port_reuse_buffer,
spa_xv_sink_node_port_get_status,
spa_xv_sink_node_port_push_input,
spa_xv_sink_node_port_pull_output,
spa_xv_sink_node_port_reuse_buffer,
spa_xv_sink_node_port_push_event,
};