mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
v4l2: we set clock and position on the node now
This commit is contained in:
parent
a4ff7296b2
commit
9a969ac756
2 changed files with 24 additions and 9 deletions
|
|
@ -108,7 +108,6 @@ struct port {
|
||||||
|
|
||||||
struct spa_port_info info;
|
struct spa_port_info info;
|
||||||
struct spa_io_buffers *io;
|
struct spa_io_buffers *io;
|
||||||
struct spa_io_clock *clock;
|
|
||||||
struct spa_io_sequence *control;
|
struct spa_io_sequence *control;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -128,6 +127,9 @@ struct impl {
|
||||||
void *callbacks_data;
|
void *callbacks_data;
|
||||||
|
|
||||||
struct port out_ports[1];
|
struct port out_ports[1];
|
||||||
|
|
||||||
|
struct spa_io_position *position;
|
||||||
|
struct spa_io_clock *clock;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CHECK_PORT(this,direction,port_id) ((direction) == SPA_DIRECTION_OUTPUT && (port_id) == 0)
|
#define CHECK_PORT(this,direction,port_id) ((direction) == SPA_DIRECTION_OUTPUT && (port_id) == 0)
|
||||||
|
|
@ -267,7 +269,23 @@ static int impl_node_set_param(struct spa_node *node,
|
||||||
|
|
||||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||||
{
|
{
|
||||||
return -ENOTSUP;
|
struct impl *this;
|
||||||
|
|
||||||
|
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||||
|
|
||||||
|
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case SPA_IO_Clock:
|
||||||
|
this->clock = data;
|
||||||
|
break;
|
||||||
|
case SPA_IO_Position:
|
||||||
|
this->position = data;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||||
|
|
@ -747,9 +765,6 @@ static int impl_node_port_set_io(struct spa_node *node,
|
||||||
case SPA_IO_Buffers:
|
case SPA_IO_Buffers:
|
||||||
port->io = data;
|
port->io = data;
|
||||||
break;
|
break;
|
||||||
case SPA_IO_Clock:
|
|
||||||
port->clock = data;
|
|
||||||
break;
|
|
||||||
case SPA_IO_Control:
|
case SPA_IO_Control:
|
||||||
port->control = data;
|
port->control = data;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1154,10 +1154,10 @@ static int mmap_read(struct impl *this)
|
||||||
|
|
||||||
pts = SPA_TIMEVAL_TO_TIME(&buf.timestamp);
|
pts = SPA_TIMEVAL_TO_TIME(&buf.timestamp);
|
||||||
|
|
||||||
if (port->clock) {
|
if (this->clock) {
|
||||||
port->clock->nsec = pts;
|
this->clock->nsec = pts;
|
||||||
port->clock->rate = port->rate;
|
this->clock->rate = port->rate;
|
||||||
port->clock->position = buf.sequence;
|
this->clock->position = buf.sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
b = &port->buffers[buf.index];
|
b = &port->buffers[buf.index];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue