mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
Remove some events
Remove port added and port removed, we can get that info by inspecting the port ids. Remove data from ringbuffer, we just need the ringbuffer to keep track of the read and write positions. Handle async-complete in the main thread Work on async node initialization Work on using a queue as the link between nodes Make the daemon link things based on the node states Use queue helper in v4l2
This commit is contained in:
parent
68148188fa
commit
1ba10cf848
17 changed files with 366 additions and 273 deletions
|
|
@ -173,14 +173,11 @@ fill_item (ALSAItem *item, struct udev_device *udevice)
|
|||
item->info_items[i].key = "device.product.id";
|
||||
item->info_items[i++].value = str;
|
||||
}
|
||||
str = udev_device_get_property_value (item->udevice, "ID_V4L_PRODUCT");
|
||||
str = udev_device_get_property_value (item->udevice, "ID_MODEL_FROM_DATABASE");
|
||||
if (!(str && *str)) {
|
||||
str = udev_device_get_property_value (item->udevice, "ID_MODEL_FROM_DATABASE");
|
||||
str = udev_device_get_property_value (item->udevice, "ID_MODEL_ENC");
|
||||
if (!(str && *str)) {
|
||||
str = udev_device_get_property_value (item->udevice, "ID_MODEL_ENC");
|
||||
if (!(str && *str)) {
|
||||
str = udev_device_get_property_value (item->udevice, "ID_MODEL");
|
||||
}
|
||||
str = udev_device_get_property_value (item->udevice, "ID_MODEL");
|
||||
}
|
||||
}
|
||||
if (str && *str) {
|
||||
|
|
@ -194,8 +191,8 @@ fill_item (ALSAItem *item, struct udev_device *udevice)
|
|||
item->info_items[i].key = "device.serial";
|
||||
item->info_items[i++].value = str;
|
||||
}
|
||||
if ((str = udev_device_get_property_value (item->udevice, "ID_V4L_CAPABILITIES")) && *str) {
|
||||
item->info_items[i].key = "device.capabilities";
|
||||
if ((str = udev_device_get_property_value (item->udevice, "SOUND_FORM_FACTOR")) && *str) {
|
||||
item->info_items[i].key = "device.form_factor";
|
||||
item->info_items[i++].value = str;
|
||||
}
|
||||
item->info.n_items = i;
|
||||
|
|
|
|||
|
|
@ -338,9 +338,7 @@ static void
|
|||
do_update_port (SpaProxy *this,
|
||||
SpaControlCmdPortUpdate *pu)
|
||||
{
|
||||
SpaNodeEvent event;
|
||||
SpaProxyPort *port;
|
||||
SpaNodeEventPortAdded pa;
|
||||
unsigned int i;
|
||||
|
||||
port = &this->ports[pu->port_id];
|
||||
|
|
@ -369,12 +367,6 @@ do_update_port (SpaProxy *this,
|
|||
this->n_inputs++;
|
||||
else
|
||||
this->n_outputs++;
|
||||
|
||||
event.type = SPA_NODE_EVENT_TYPE_PORT_ADDED;
|
||||
event.size = sizeof (pa);
|
||||
event.data = &pa;
|
||||
pa.port_id = pu->port_id;
|
||||
this->event_cb (&this->node, &event, this->user_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -382,9 +374,7 @@ static void
|
|||
do_uninit_port (SpaProxy *this,
|
||||
uint32_t port_id)
|
||||
{
|
||||
SpaNodeEvent event;
|
||||
SpaProxyPort *port;
|
||||
SpaNodeEventPortRemoved pr;
|
||||
|
||||
fprintf (stderr, "proxy %p: removing port %d\n", this, port_id);
|
||||
port = &this->ports[port_id];
|
||||
|
|
@ -398,12 +388,6 @@ do_uninit_port (SpaProxy *this,
|
|||
if (port->format)
|
||||
spa_format_unref (port->format);
|
||||
port->format = NULL;
|
||||
|
||||
event.type = SPA_NODE_EVENT_TYPE_PORT_REMOVED;
|
||||
event.size = sizeof (pr);
|
||||
event.data = ≺
|
||||
pr.port_id = port_id;
|
||||
this->event_cb (&this->node, &event, this->user_data);
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
|
|
@ -934,8 +918,6 @@ handle_node_event (SpaProxy *this,
|
|||
case SPA_NODE_EVENT_TYPE_INVALID:
|
||||
break;
|
||||
|
||||
case SPA_NODE_EVENT_TYPE_PORT_ADDED:
|
||||
case SPA_NODE_EVENT_TYPE_PORT_REMOVED:
|
||||
case SPA_NODE_EVENT_TYPE_ASYNC_COMPLETE:
|
||||
case SPA_NODE_EVENT_TYPE_HAVE_OUTPUT:
|
||||
case SPA_NODE_EVENT_TYPE_NEED_INPUT:
|
||||
|
|
@ -976,10 +958,6 @@ parse_control (SpaProxy *this,
|
|||
fprintf (stderr, "proxy %p: got unexpected control %d\n", this, cmd);
|
||||
break;
|
||||
|
||||
case SPA_CONTROL_CMD_PORT_REMOVED:
|
||||
fprintf (stderr, "proxy %p: command not implemented %d\n", this, cmd);
|
||||
break;
|
||||
|
||||
case SPA_CONTROL_CMD_NODE_UPDATE:
|
||||
{
|
||||
SpaControlCmdNodeUpdate nu;
|
||||
|
|
@ -1045,12 +1023,11 @@ parse_control (SpaProxy *this,
|
|||
if (spa_control_iter_parse_cmd (&it, &sc) < 0)
|
||||
break;
|
||||
|
||||
fprintf (stderr, "proxy %p: got node state change %d -> %d\n", this, old, sc.state);
|
||||
this->node.state = sc.state;
|
||||
if (old == SPA_NODE_STATE_INIT)
|
||||
send_async_complete (this, 0, SPA_RESULT_OK);
|
||||
|
||||
fprintf (stderr, "proxy %p: got node state change %d\n", this, this->node.state);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <spa/memory.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/debug.h>
|
||||
#include <spa/queue.h>
|
||||
|
||||
typedef struct _SpaV4l2Source SpaV4l2Source;
|
||||
|
||||
|
|
@ -105,8 +106,7 @@ typedef struct {
|
|||
struct v4l2_requestbuffers reqbuf;
|
||||
SpaMemory *alloc_mem;
|
||||
V4l2Buffer *alloc_buffers;
|
||||
V4l2Buffer *ready;
|
||||
uint32_t ready_count;
|
||||
SpaQueue ready;
|
||||
|
||||
SpaPollFd fds[1];
|
||||
SpaPollItem poll;
|
||||
|
|
@ -683,16 +683,13 @@ spa_v4l2_source_node_port_pull_output (SpaNode *node,
|
|||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
if (state->ready_count == 0) {
|
||||
|
||||
SPA_QUEUE_POP_HEAD (&state->ready, V4l2Buffer, next, b);
|
||||
if (b == NULL) {
|
||||
info[i].status = SPA_RESULT_UNEXPECTED;
|
||||
have_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
b = state->ready;
|
||||
state->ready = b->next;
|
||||
state->ready_count--;
|
||||
|
||||
b->outstanding = true;
|
||||
|
||||
info[i].buffer_id = b->outbuf->id;
|
||||
|
|
@ -844,6 +841,8 @@ v4l2_source_init (const SpaHandleFactory *factory,
|
|||
this->props[1].props.prop_info = prop_info;
|
||||
reset_v4l2_source_props (&this->props[1]);
|
||||
|
||||
SPA_QUEUE_INIT (&this->state[0].ready);
|
||||
|
||||
this->state[0].info.flags = SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->state[0].status.flags = SPA_PORT_STATUS_FLAG_NONE;
|
||||
|
||||
|
|
|
|||
|
|
@ -848,9 +848,7 @@ mmap_read (SpaV4l2Source *this)
|
|||
d = SPA_BUFFER_DATAS (b->outbuf);
|
||||
d[0].mem.size = buf.bytesused;
|
||||
|
||||
b->next = state->ready;
|
||||
state->ready = b;
|
||||
state->ready_count++;
|
||||
SPA_QUEUE_PUSH_TAIL (&state->ready, V4l2Buffer, next, b);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue