mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
Work on sink
Remove _remove from properties, we can do the same with set of a NULL value. Add signals to the stream API to manage the buffers. Wrap those buffers in a GstBuffer in the pinossrc and pinossink elements and pool them in a bufferpool. Remove SPA_EVENT_TYPE_PULL_INPUT, we can do the same with NEED_INPUT and by using a ringbuffer. Do more complete allocation of buffers in the link. Use the buffer allocator if none of the nodes can allocate. Follow the node state to trigger negotiation and allocation. Remove offset and size when refering to buffers, we want to always deal with the complete buffer and use a ringbuffer for ranges or change the offset/size in the buffer data when needed. Serialize port_info structures as part of the port_update Print both the enum number and the name when debuging properties or formats.
This commit is contained in:
parent
a03352353f
commit
ca7d08c406
45 changed files with 1614 additions and 570 deletions
|
|
@ -159,20 +159,15 @@ on_sink_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
PinosSpaAlsaSinkPrivate *priv = this->priv;
|
||||
|
||||
switch (event->type) {
|
||||
case SPA_EVENT_TYPE_PULL_INPUT:
|
||||
case SPA_EVENT_TYPE_NEED_INPUT:
|
||||
{
|
||||
SpaInputInfo iinfo;
|
||||
SpaResult res;
|
||||
PinosRingbufferArea areas[2];
|
||||
uint8_t *data;
|
||||
size_t size, towrite, total;
|
||||
SpaEventPullInput *pi;
|
||||
|
||||
pi = event->data;
|
||||
|
||||
g_debug ("pull ringbuffer %zd", pi->size);
|
||||
|
||||
size = pi->size;
|
||||
size = 0;
|
||||
data = NULL;
|
||||
|
||||
pinos_ringbuffer_get_read_areas (priv->ringbuffer, areas);
|
||||
|
|
@ -194,8 +189,6 @@ on_sink_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
iinfo.port_id = event->port_id;
|
||||
iinfo.flags = SPA_INPUT_FLAG_NONE;
|
||||
iinfo.buffer_id = 0;
|
||||
iinfo.offset = 0;
|
||||
iinfo.size = total;
|
||||
|
||||
g_debug ("push sink %d", iinfo.buffer_id);
|
||||
if ((res = spa_node_port_push_input (node, 1, &iinfo)) < 0)
|
||||
|
|
@ -223,7 +216,13 @@ on_sink_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SPA_EVENT_TYPE_STATE_CHANGE:
|
||||
{
|
||||
SpaEventStateChange *sc = event->data;
|
||||
|
||||
pinos_node_update_node_state (PINOS_NODE (this), sc->state);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
g_debug ("got event %d", event->type);
|
||||
break;
|
||||
|
|
@ -244,7 +243,7 @@ setup_node (PinosSpaAlsaSink *this)
|
|||
g_debug ("got get_props error %d", res);
|
||||
|
||||
value.type = SPA_PROP_TYPE_STRING;
|
||||
value.value = "hw:0";
|
||||
value.value = "hw:1";
|
||||
value.size = strlen (value.value)+1;
|
||||
spa_props_set_prop (props, spa_props_index_for_name (props, "device"), &value);
|
||||
|
||||
|
|
@ -376,7 +375,7 @@ on_received_buffer (PinosPort *port,
|
|||
PinosSpaAlsaSink *this = user_data;
|
||||
PinosSpaAlsaSinkPrivate *priv = this->priv;
|
||||
unsigned int i;
|
||||
SpaBuffer *buffer = NULL;
|
||||
SpaBuffer *buffer = port->buffers[buffer_id];
|
||||
|
||||
for (i = 0; i < buffer->n_datas; i++) {
|
||||
SpaData *d = SPA_BUFFER_DATAS (buffer);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ on_source_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
PinosSpaV4l2SourcePrivate *priv = this->priv;
|
||||
|
||||
switch (event->type) {
|
||||
case SPA_EVENT_TYPE_CAN_PULL_OUTPUT:
|
||||
case SPA_EVENT_TYPE_HAVE_OUTPUT:
|
||||
{
|
||||
SpaOutputInfo info[1] = { 0, };
|
||||
SpaResult res;
|
||||
|
|
@ -188,6 +188,13 @@ on_source_event (SpaNode *node, SpaEvent *event, void *user_data)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SPA_EVENT_TYPE_STATE_CHANGE:
|
||||
{
|
||||
SpaEventStateChange *sc = event->data;
|
||||
|
||||
pinos_node_update_node_state (PINOS_NODE (this), sc->state);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
g_debug ("got event %d", event->type);
|
||||
break;
|
||||
|
|
@ -208,7 +215,7 @@ setup_node (PinosSpaV4l2Source *this)
|
|||
g_debug ("got get_props error %d", res);
|
||||
|
||||
value.type = SPA_PROP_TYPE_STRING;
|
||||
value.value = "/dev/video0";
|
||||
value.value = "/dev/video1";
|
||||
value.size = strlen (value.value)+1;
|
||||
spa_props_set_prop (props, spa_props_index_for_name (props, "device"), &value);
|
||||
|
||||
|
|
@ -363,9 +370,7 @@ on_received_event (PinosPort *port, SpaEvent *event, GError **error, gpointer us
|
|||
|
||||
if ((res = spa_node_port_reuse_buffer (node->node,
|
||||
event->port_id,
|
||||
rb->buffer_id,
|
||||
rb->offset,
|
||||
rb->size)) < 0)
|
||||
rb->buffer_id)) < 0)
|
||||
g_warning ("client-node %p: error reuse buffer: %d", node, res);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue