daemon: save connections of stopped apps. #100

This commit is contained in:
Nedko Arnaudov 2010-08-30 04:14:25 +03:00
parent dd822c7476
commit e06f5b73dd
3 changed files with 50 additions and 3 deletions

View File

@ -29,6 +29,7 @@
#include "graph.h"
#include "../dbus/error.h"
#include "../dbus_constants.h"
#include "virtualizer.h"
struct ladish_graph_port
{
@ -2170,7 +2171,7 @@ ladish_graph_iterate_nodes(
{
client_ptr = list_entry(client_node_ptr, struct ladish_graph_client, siblings);
if (skip_hidden && client_ptr->hidden)
if (skip_hidden && client_ptr->hidden && !ladish_client_has_app(client_ptr->client))
{
continue;
}
@ -2205,7 +2206,7 @@ ladish_graph_iterate_nodes(
{
port_ptr = list_entry(port_node_ptr, struct ladish_graph_port, siblings_client);
if (skip_hidden && port_ptr->hidden)
if (skip_hidden && port_ptr->hidden && !ladish_client_has_app(port_ptr->client_ptr->client))
{
continue;
}
@ -2237,6 +2238,19 @@ ladish_graph_iterate_nodes(
return true;
}
static bool is_system_client(ladish_client_handle client)
{
uuid_t uuid;
ladish_client_get_uuid(client, uuid);
return ladish_virtualizer_is_system_client(uuid);
}
#define is_port_interesting(port_ptr) ( \
ladish_client_has_app(port_ptr->client_ptr->client) || \
ladish_port_is_link(port_ptr->port) || \
is_system_client(port_ptr->client_ptr->client) \
)
bool
ladish_graph_iterate_connections(
ladish_graph_handle graph_handle,
@ -2256,7 +2270,10 @@ ladish_graph_iterate_connections(
{
connection_ptr = list_entry(node_ptr, struct ladish_graph_connection, siblings);
if (skip_hidden && connection_ptr->hidden)
if (skip_hidden &&
connection_ptr->hidden &&
(!is_port_interesting(connection_ptr->port1_ptr) ||
!is_port_interesting(connection_ptr->port2_ptr)))
{
continue;
}

View File

@ -457,6 +457,8 @@ port_appeared(
bool is_a2j;
uuid_t jclient_uuid;
uuid_t vclient_uuid;
bool has_app;
uuid_t app_uuid;
char * alsa_client_name;
char * alsa_port_name;
char * a2j_fake_jack_port_name = NULL;
@ -484,6 +486,8 @@ port_appeared(
goto exit;
}
has_app = ladish_client_get_app(jack_client, app_uuid);
/* find the virtual graph that owns the app that owns the client that owns the appeared port */
vgraph = ladish_client_get_vgraph(jack_client);
if (vgraph == NULL)
@ -707,6 +711,11 @@ port_appeared(
ladish_client_interlink(vclient, jack_client);
if (has_app)
{
ladish_client_set_app(vclient, app_uuid);
}
if (!ladish_graph_add_client(vgraph, vclient, jack_client_name, false))
{
log_error("ladish_graph_add_client() failed to add client '%s' to virtual graph", jack_client_name);
@ -1254,3 +1263,20 @@ ladish_virtualizer_rename_app(
}
}
#undef vgraph
bool
ladish_virtualizer_is_system_client(
uuid_t uuid)
{
if (uuid_compare(uuid, g_system_capture_uuid) == 0)
{
return true;
}
if (uuid_compare(uuid, g_system_playback_uuid) == 0)
{
return true;
}
return false;
}

View File

@ -67,6 +67,10 @@ ladish_virtualizer_rename_app(
const char * old_name,
const char * new_app_name);
bool
ladish_virtualizer_is_system_client(
uuid_t uuid);
void
ladish_virtualizer_destroy(
ladish_virtualizer_handle handle);