mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
v4l2: add support for ParamBegin/End
To keep the device open while we perform a series of param enumerations.
This commit is contained in:
parent
9facfca45b
commit
9f134ee79d
1 changed files with 13 additions and 2 deletions
|
|
@ -304,16 +304,27 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
|||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(command != NULL, -EINVAL);
|
||||
|
||||
port = GET_OUT_PORT(this, 0);
|
||||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
case SPA_NODE_COMMAND_ParamBegin:
|
||||
if ((res = spa_v4l2_open(&port->dev, NULL)) < 0)
|
||||
return res;
|
||||
break;
|
||||
case SPA_NODE_COMMAND_ParamEnd:
|
||||
if (port->have_format)
|
||||
return 0;
|
||||
if ((res = spa_v4l2_close(&port->dev)) < 0)
|
||||
return res;
|
||||
break;
|
||||
case SPA_NODE_COMMAND_Start:
|
||||
{
|
||||
struct port *port = GET_OUT_PORT(this, 0);
|
||||
|
||||
if (!port->have_format) {
|
||||
spa_log_error(this->log, "no format");
|
||||
return -EIO;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue