mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
node: add flags to port_use_buffer
Remove the CAN_USE_BUFFERS flag, it is redundant. We can know this because of the IO params and buffer params. Add flags to the port_use_buffer call. We also want this call to replace port_alloc_buffer. Together with a new result event we can ask the node to (a)synchronously fill up the buffer data for us. This is part of a plan to let remote nodes provide buffer data.
This commit is contained in:
parent
b314547702
commit
8590ac158b
33 changed files with 153 additions and 122 deletions
|
|
@ -394,11 +394,11 @@ static int negotiate_formats(struct data *data)
|
|||
|
||||
init_buffer(data, data->source_buffers, data->source_buffer, 1, BUFFER_SIZE);
|
||||
if ((res =
|
||||
spa_node_port_use_buffers(data->sink, SPA_DIRECTION_INPUT, 0, data->source_buffers,
|
||||
spa_node_port_use_buffers(data->sink, SPA_DIRECTION_INPUT, 0, 0, data->source_buffers,
|
||||
1)) < 0)
|
||||
return res;
|
||||
if ((res =
|
||||
spa_node_port_use_buffers(data->source, SPA_DIRECTION_OUTPUT, 0, data->source_buffers,
|
||||
spa_node_port_use_buffers(data->source, SPA_DIRECTION_OUTPUT, 0, 0, data->source_buffers,
|
||||
1)) < 0)
|
||||
return res;
|
||||
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ static int negotiate_formats(struct data *data)
|
|||
if ((res = sdl_alloc_buffers(data)) < 0)
|
||||
return res;
|
||||
|
||||
if ((res = spa_node_port_use_buffers(data->source, SPA_DIRECTION_OUTPUT, 0, data->bp,
|
||||
if ((res = spa_node_port_use_buffers(data->source, SPA_DIRECTION_OUTPUT, 0, 0, data->bp,
|
||||
data->n_buffers)) < 0) {
|
||||
printf("can't allocate buffers: %s\n", spa_strerror(res));
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -87,20 +87,19 @@ struct spa_port_info {
|
|||
#define SPA_PORT_FLAG_REMOVABLE (1u<<0) /**< port can be removed */
|
||||
#define SPA_PORT_FLAG_OPTIONAL (1u<<1) /**< processing on port is optional */
|
||||
#define SPA_PORT_FLAG_CAN_ALLOC_BUFFERS (1u<<2) /**< the port can allocate buffer data */
|
||||
#define SPA_PORT_FLAG_CAN_USE_BUFFERS (1u<<3) /**< the port can use a provided buffer */
|
||||
#define SPA_PORT_FLAG_IN_PLACE (1u<<4) /**< the port can process data in-place and
|
||||
#define SPA_PORT_FLAG_IN_PLACE (1u<<3) /**< the port can process data in-place and
|
||||
* will need a writable input buffer */
|
||||
#define SPA_PORT_FLAG_NO_REF (1u<<5) /**< the port does not keep a ref on the buffer.
|
||||
#define SPA_PORT_FLAG_NO_REF (1u<<4) /**< the port does not keep a ref on the buffer.
|
||||
* This means the node will always completely
|
||||
* consume the input buffer and it will be
|
||||
* recycled after process. */
|
||||
#define SPA_PORT_FLAG_LIVE (1u<<6) /**< output buffers from this port are
|
||||
#define SPA_PORT_FLAG_LIVE (1u<<5) /**< output buffers from this port are
|
||||
* timestamped against a live clock. */
|
||||
#define SPA_PORT_FLAG_PHYSICAL (1u<<7) /**< connects to some device */
|
||||
#define SPA_PORT_FLAG_TERMINAL (1u<<8) /**< data was not created from this port
|
||||
#define SPA_PORT_FLAG_PHYSICAL (1u<<6) /**< connects to some device */
|
||||
#define SPA_PORT_FLAG_TERMINAL (1u<<7) /**< data was not created from this port
|
||||
* or will not be made available on another
|
||||
* port */
|
||||
#define SPA_PORT_FLAG_DYNAMIC_DATA (1u<<9) /**< data pointer on buffers can be changed.
|
||||
#define SPA_PORT_FLAG_DYNAMIC_DATA (1u<<8) /**< data pointer on buffers can be changed.
|
||||
* Only the buffer data marked as DYNAMIC
|
||||
* can be changed. */
|
||||
uint64_t flags; /**< port flags */
|
||||
|
|
@ -114,13 +113,14 @@ struct spa_port_info {
|
|||
|
||||
#define SPA_RESULT_TYPE_NODE_ERROR 1
|
||||
#define SPA_RESULT_TYPE_NODE_PARAMS 2
|
||||
#define SPA_RESULT_TYPE_NODE_BUFFERS 3
|
||||
|
||||
/** an error result */
|
||||
struct spa_result_node_error {
|
||||
const char *message;
|
||||
};
|
||||
|
||||
/** the result of enum_param. */
|
||||
/** the result of enum_params or port_enum_params. */
|
||||
struct spa_result_node_params {
|
||||
uint32_t id; /**< id of parameter */
|
||||
uint32_t index; /**< index of parameter */
|
||||
|
|
@ -128,6 +128,12 @@ struct spa_result_node_params {
|
|||
struct spa_pod *param; /**< the result param */
|
||||
};
|
||||
|
||||
/** the result of use_buffers. */
|
||||
struct spa_result_node_buffers {
|
||||
uint32_t n_buffers;
|
||||
struct spa_buffer **buffers;
|
||||
};
|
||||
|
||||
#define SPA_NODE_EVENT_INFO 0
|
||||
#define SPA_NODE_EVENT_PORT_INFO 1
|
||||
#define SPA_NODE_EVENT_RESULT 2
|
||||
|
|
@ -220,10 +226,16 @@ struct spa_node_callbacks {
|
|||
|
||||
|
||||
/** flags that can be passed to set_param and port_set_param functions */
|
||||
#define SPA_NODE_PARAM_FLAG_TEST_ONLY (1 << 0) /* just check if the param is accepted */
|
||||
#define SPA_NODE_PARAM_FLAG_FIXATE (1 << 1) /* fixate the non-optional unset fields */
|
||||
#define SPA_NODE_PARAM_FLAG_NEAREST (1 << 2) /* allow set fields to be rounded to the
|
||||
* nearest allowed field value. */
|
||||
#define SPA_NODE_PARAM_FLAG_TEST_ONLY (1 << 0) /**< Just check if the param is accepted */
|
||||
#define SPA_NODE_PARAM_FLAG_FIXATE (1 << 1) /**< Fixate the non-optional unset fields */
|
||||
#define SPA_NODE_PARAM_FLAG_NEAREST (1 << 2) /**< Allow set fields to be rounded to the
|
||||
* nearest allowed field value. */
|
||||
|
||||
/** flags to pass to the use_buffers functions */
|
||||
#define SPA_NODE_BUFFERS_FLAG_ALLOC (1 << 0) /**< Allocate memory for the buffers. This flag
|
||||
* is ignored when the port does not have the
|
||||
* SPA_PORT_FLAG_CAN_ALLOC_BUFFERS set. */
|
||||
|
||||
|
||||
#define SPA_NODE_METHOD_ADD_LISTENER 0
|
||||
#define SPA_NODE_METHOD_SET_CALLBACKS 1
|
||||
|
|
@ -520,11 +532,15 @@ struct spa_node_methods {
|
|||
* Passing NULL as \a buffers will remove the reference that the port has
|
||||
* on the buffers.
|
||||
*
|
||||
* The function will emit the result event of type SPA_RESULT_TYPE_NODE_BUFFERS
|
||||
* with the final allocation of the buffers.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* \param node an spa_node
|
||||
* \param object an object implementing the interface
|
||||
* \param direction an spa_direction
|
||||
* \param port_id a port id
|
||||
* \param flags extra flags
|
||||
* \param buffers an array of buffer pointers
|
||||
* \param n_buffers number of elements in \a buffers
|
||||
* \return 0 on success
|
||||
|
|
@ -532,6 +548,7 @@ struct spa_node_methods {
|
|||
int (*port_use_buffers) (void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers);
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -506,8 +506,9 @@ impl_node_port_set_param(void *object,
|
|||
|
||||
static int
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id, struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct state *this = object;
|
||||
uint32_t i;
|
||||
|
|
@ -756,8 +757,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->port_info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
this->port_info = SPA_PORT_INFO_INIT();
|
||||
this->port_info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_LIVE |
|
||||
this->port_info.flags = SPA_PORT_FLAG_LIVE |
|
||||
SPA_PORT_FLAG_PHYSICAL |
|
||||
SPA_PORT_FLAG_TERMINAL;
|
||||
this->port_params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -521,8 +521,9 @@ impl_node_port_set_param(void *object,
|
|||
|
||||
static int
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id, struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct state *this = object;
|
||||
int res;
|
||||
|
|
@ -779,8 +780,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->port_info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
this->port_info = SPA_PORT_INFO_INIT();
|
||||
this->port_info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_LIVE |
|
||||
this->port_info.flags = SPA_PORT_FLAG_LIVE |
|
||||
SPA_PORT_FLAG_PHYSICAL |
|
||||
SPA_PORT_FLAG_TERMINAL;
|
||||
this->port_params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -649,7 +649,7 @@ static int negotiate_buffers(struct impl *this)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(this->convert,
|
||||
SPA_DIRECTION_REVERSE(this->direction), 0,
|
||||
SPA_DIRECTION_REVERSE(this->direction), 0, 0,
|
||||
this->buffers, this->n_buffers)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
|
@ -663,7 +663,7 @@ static int negotiate_buffers(struct impl *this)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(this->slave,
|
||||
this->direction, 0,
|
||||
this->direction, 0, 0,
|
||||
this->buffers, this->n_buffers)) < 0) {
|
||||
return res;
|
||||
}
|
||||
|
|
@ -730,6 +730,7 @@ static int
|
|||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -742,7 +743,7 @@ impl_node_port_use_buffers(void *object,
|
|||
port_id++;
|
||||
|
||||
if ((res = spa_node_port_use_buffers(this->target,
|
||||
direction, port_id, buffers, n_buffers)) < 0)
|
||||
direction, port_id, flags, buffers, n_buffers)) < 0)
|
||||
return res;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(link->out_node,
|
||||
SPA_DIRECTION_OUTPUT, link->out_port,
|
||||
SPA_DIRECTION_OUTPUT, link->out_port, 0,
|
||||
link->buffers, link->n_buffers)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
|
@ -357,7 +357,7 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(link->in_node,
|
||||
SPA_DIRECTION_INPUT, link->in_port,
|
||||
SPA_DIRECTION_INPUT, link->in_port, 0,
|
||||
link->buffers, link->n_buffers)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
|
@ -799,6 +799,7 @@ static int
|
|||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -814,7 +815,7 @@ impl_node_port_use_buffers(void *object,
|
|||
target = this->fmt[direction];
|
||||
|
||||
if ((res = spa_node_port_use_buffers(target,
|
||||
direction, port_id, buffers, n_buffers)) < 0)
|
||||
direction, port_id, flags, buffers, n_buffers)) < 0)
|
||||
return res;
|
||||
|
||||
if (buffers && this->buffers_set[SPA_DIRECTION_REVERSE(direction)]) {
|
||||
|
|
|
|||
|
|
@ -688,10 +688,9 @@ impl_node_port_set_param(void *object,
|
|||
|
||||
static int
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
|
@ -1028,8 +1027,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
@ -1045,8 +1043,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF |
|
||||
port->info.flags = SPA_PORT_FLAG_NO_REF |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -639,6 +639,7 @@ static int
|
|||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -935,8 +936,7 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
|||
spa_list_init(&port->queue);
|
||||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF |
|
||||
port->info.flags = SPA_PORT_FLAG_NO_REF |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -166,8 +166,7 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
|||
SPA_PORT_CHANGE_MASK_PROPS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF |
|
||||
port->info.flags = SPA_PORT_FLAG_NO_REF |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
@ -736,6 +735,7 @@ static int
|
|||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -1101,8 +1101,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -568,6 +568,7 @@ static int
|
|||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -953,7 +954,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
port->info.flags = 0;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
@ -969,8 +970,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -158,8 +158,7 @@ static int init_port(struct impl *this, enum spa_direction direction,
|
|||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->info_props_items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit float mono audio");
|
||||
port->info_props_items[1] = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_CHANNEL, port->position);
|
||||
port->info_props = SPA_DICT_INIT(port->info_props_items, 2);
|
||||
|
|
@ -706,6 +705,7 @@ static int
|
|||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -1017,8 +1017,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->direction = SPA_DIRECTION_INPUT;
|
||||
port->id = 0;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_NO_REF |
|
||||
port->info.flags = SPA_PORT_FLAG_NO_REF |
|
||||
SPA_PORT_FLAG_DYNAMIC_DATA;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -1166,7 +1166,7 @@ static int port_set_format(struct impl *this, struct port *port,
|
|||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
if (port->have_format) {
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS | SPA_PORT_FLAG_LIVE;
|
||||
port->info.flags = SPA_PORT_FLAG_LIVE;
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_RATE;
|
||||
port->info.rate = SPA_FRACTION(1, port->current_format.info.raw.rate);
|
||||
port->params[3] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_READWRITE);
|
||||
|
|
@ -1207,8 +1207,9 @@ impl_node_port_set_param(void *object,
|
|||
|
||||
static int
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id, struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
|
@ -1474,7 +1475,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
|
||||
port->info.flags = 0;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -817,7 +817,7 @@ static int port_set_format(struct impl *this, struct port *port,
|
|||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
if (port->have_format) {
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS | SPA_PORT_FLAG_LIVE;
|
||||
port->info.flags = SPA_PORT_FLAG_LIVE;
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_RATE;
|
||||
port->info.rate = SPA_FRACTION(1, port->current_format.info.raw.rate);
|
||||
port->params[3] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_READWRITE);
|
||||
|
|
@ -859,8 +859,9 @@ impl_node_port_set_param(void *object,
|
|||
|
||||
static int
|
||||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id, struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
|
|
@ -1163,8 +1164,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->info = SPA_PORT_INFO_INIT();
|
||||
port->info.change_mask = SPA_PORT_CHANGE_MASK_FLAGS;
|
||||
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_LIVE |
|
||||
port->info.flags = SPA_PORT_FLAG_LIVE |
|
||||
SPA_PORT_FLAG_TERMINAL;
|
||||
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -678,6 +678,7 @@ static int impl_node_port_set_param(void *object,
|
|||
static int impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -925,7 +925,6 @@ static int spa_v4l2_set_format(struct impl *this, struct spa_video_info *format,
|
|||
port->fmt = fmt;
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_FLAGS | SPA_PORT_CHANGE_MASK_RATE;
|
||||
port->info.flags = (port->export_buf ? SPA_PORT_FLAG_CAN_ALLOC_BUFFERS : 0) |
|
||||
SPA_PORT_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_FLAG_LIVE |
|
||||
SPA_PORT_FLAG_PHYSICAL |
|
||||
SPA_PORT_FLAG_TERMINAL;
|
||||
|
|
|
|||
|
|
@ -652,7 +652,7 @@ static int negotiate_buffers(struct impl *this)
|
|||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(this->convert,
|
||||
SPA_DIRECTION_REVERSE(this->direction), 0,
|
||||
SPA_DIRECTION_REVERSE(this->direction), 0, 0,
|
||||
this->buffers, this->n_buffers)) < 0)
|
||||
return res;
|
||||
}
|
||||
|
|
@ -665,7 +665,7 @@ static int negotiate_buffers(struct impl *this)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if ((res = spa_node_port_use_buffers(this->slave,
|
||||
if ((res = spa_node_port_use_buffers(this->slave, 0,
|
||||
this->direction, 0,
|
||||
this->buffers, this->n_buffers)) < 0) {
|
||||
return res;
|
||||
|
|
@ -733,6 +733,7 @@ static int
|
|||
impl_node_port_use_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
|
|
@ -745,7 +746,7 @@ impl_node_port_use_buffers(void *object,
|
|||
port_id++;
|
||||
|
||||
if ((res = spa_node_port_use_buffers(this->target,
|
||||
direction, port_id, buffers, n_buffers)) < 0)
|
||||
direction, port_id, flags, buffers, n_buffers)) < 0)
|
||||
return res;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue