mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
node: remove node state
Remove the node state. The state of the node is based on the state of the ports, which can be derived directly from calling the port methods. Track this state in the Port instead. Add a mixer module that puts a mixer in from of audio sinks. This allows multiple clients to play on one sink (still has some bugs). do some fixes in the mixer and the scheduler to make this work.
This commit is contained in:
parent
28389e05f3
commit
d3682067fa
30 changed files with 618 additions and 509 deletions
|
|
@ -55,7 +55,7 @@ typedef struct {
|
|||
|
||||
SpaVolumeBuffer buffers[MAX_BUFFERS];
|
||||
uint32_t n_buffers;
|
||||
void *io;
|
||||
SpaPortIO *io;
|
||||
|
||||
SpaList empty;
|
||||
} SpaVolumePort;
|
||||
|
|
@ -113,6 +113,8 @@ struct _SpaVolume {
|
|||
|
||||
SpaVolumePort in_ports[1];
|
||||
SpaVolumePort out_ports[1];
|
||||
|
||||
bool started;
|
||||
};
|
||||
|
||||
#define CHECK_IN_PORT(this,d,p) ((d) == SPA_DIRECTION_INPUT && (p) == 0)
|
||||
|
|
@ -129,12 +131,6 @@ reset_volume_props (SpaVolumeProps *props)
|
|||
props->mute = DEFAULT_MUTE;
|
||||
}
|
||||
|
||||
static void
|
||||
update_state (SpaVolume *this, SpaNodeState state)
|
||||
{
|
||||
this->node.state = state;
|
||||
}
|
||||
|
||||
#define PROP(f,key,type,...) \
|
||||
SPA_POD_PROP (f,key,0,type,1,__VA_ARGS__)
|
||||
#define PROP_MM(f,key,type,...) \
|
||||
|
|
@ -203,10 +199,10 @@ spa_volume_node_send_command (SpaNode *node,
|
|||
this = SPA_CONTAINER_OF (node, SpaVolume, node);
|
||||
|
||||
if (SPA_COMMAND_TYPE (command) == this->type.command_node.Start) {
|
||||
update_state (this, SPA_NODE_STATE_STREAMING);
|
||||
this->started = true;
|
||||
}
|
||||
else if (SPA_COMMAND_TYPE (command) == this->type.command_node.Pause) {
|
||||
update_state (this, SPA_NODE_STATE_PAUSED);
|
||||
this->started = false;
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
|
|
@ -410,10 +406,7 @@ spa_volume_node_port_set_format (SpaNode *node,
|
|||
port->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
port->info.extra = NULL;
|
||||
update_state (this, SPA_NODE_STATE_READY);
|
||||
}
|
||||
else
|
||||
update_state (this, SPA_NODE_STATE_CONFIGURE);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -535,11 +528,6 @@ spa_volume_node_port_use_buffers (SpaNode *node,
|
|||
}
|
||||
port->n_buffers = n_buffers;
|
||||
|
||||
if (port->n_buffers > 0) {
|
||||
update_state (this, SPA_NODE_STATE_PAUSED);
|
||||
} else {
|
||||
update_state (this, SPA_NODE_STATE_READY);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -747,7 +735,6 @@ spa_volume_node_process_output (SpaNode *node)
|
|||
static const SpaNode volume_node = {
|
||||
sizeof (SpaNode),
|
||||
NULL,
|
||||
SPA_NODE_STATE_INIT,
|
||||
spa_volume_node_get_props,
|
||||
spa_volume_node_set_props,
|
||||
spa_volume_node_send_command,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue