From bd9b4b3833e20fbc4d0df38425c503a029bc8ada Mon Sep 17 00:00:00 2001 From: Torben Hohn Date: Sat, 21 Nov 2009 01:15:28 +0100 Subject: [PATCH] first port_connect output. --- jack/port.h | 1 + jackd/engine.c | 21 ++++++++++++++++++--- libjack/client.c | 15 +++++++++++++++ libjack/port.c | 1 + 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/jack/port.h b/jack/port.h index 9ee069d..f71e9e9 100644 --- a/jack/port.h +++ b/jack/port.h @@ -113,6 +113,7 @@ typedef struct _jack_port_shared { jack_port_type_id_t ptype_id; /* index into port type array */ jack_shmsize_t offset; /* buffer offset in shm segment */ jack_port_id_t id; /* index into engine port array */ + jack_port_id_t uid; /* index into engine port array */ uint32_t flags; char name[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE]; char alias1[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE]; diff --git a/jackd/engine.c b/jackd/engine.c index bb86b46..9fe06a2 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -2447,6 +2447,19 @@ static jack_client_id_t jack_engine_get_max_uuid( jack_engine_t *engine ) return retval; } +static void jack_client_fixup_uuid (jack_client_internal_t *client ) +{ + JSList *node; + jack_port_t *port; + + for (node = client->ports; node; node = jack_slist_next (node)) { + port = (jack_port_t *) node->data; + + port->shared->uid = client->control->uid; + + } +} + static int jack_do_session_notify (jack_engine_t *engine, jack_request_t *req, int reply_fd ) { @@ -2468,18 +2481,20 @@ jack_do_session_notify (jack_engine_t *engine, jack_request_t *req, int reply_fd jack_client_internal_t* client = (jack_client_internal_t*) node->data; if (client->control->session_cbset) { - if( client->control->uid == 0 ) + if( client->control->uid == 0 ) { client->control->uid=jack_engine_get_max_uuid( engine ) + 1; + jack_client_fixup_uuid( client ); + } reply = jack_deliver_event (engine, client, &event); - if (write (reply_fd, &client->control->uid, sizeof (client->control->uid)) + if (write (reply_fd, (const void *) &client->control->uid, sizeof (client->control->uid)) < (ssize_t) sizeof (client->control->uid)) { jack_error ("cannot write GetPortConnections result " "to client via fd = %d (%s)", reply_fd, strerror (errno)); goto out; } - if (write (reply_fd, client->control->session_command, sizeof (client->control->session_command)) + if (write (reply_fd, (const void *) client->control->session_command, sizeof (client->control->session_command)) < (ssize_t) sizeof (client->control->session_command)) { jack_error ("cannot write GetPortConnections result " "to client via fd = %d (%s)", diff --git a/libjack/client.c b/libjack/client.c index 8ef6451..82b5a4b 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -2550,9 +2550,20 @@ jack_get_ports (jack_client_t *client, regex_t port_regex; regex_t type_regex; int matching; + jack_client_id_t port_uuid_match = 0U; engine = client->engine; + if( port_name_pattern ) { + if((strncmp( "!uuid:", port_name_pattern, sizeof("!uuid:") ) )) { + printf( "%s\n",port_name_pattern+6 ); + port_uuid_match = atoi( port_name_pattern+6); + printf( "port_uuid_match = %u\n", port_uuid_match ); + port_name_pattern = NULL; + } + } + + if (port_name_pattern && port_name_pattern[0]) { regcomp (&port_regex, port_name_pattern, REG_EXTENDED|REG_NOSUB); @@ -2582,6 +2593,10 @@ jack_get_ports (jack_client_t *client, } } + if (matching && port_uuid_match) { + if( psp[i].uid != port_uuid_match ) + matching = 0; + } if (matching && port_name_pattern && port_name_pattern[0]) { if (regexec (&port_regex, psp[i].name, 0, NULL, 0)) { matching = 0; diff --git a/libjack/port.c b/libjack/port.c index bb92b7c..38c2d37 100644 --- a/libjack/port.c +++ b/libjack/port.c @@ -201,6 +201,7 @@ jack_port_new (const jack_client_t *client, jack_port_id_t port_id, port_functions = &jack_builtin_NULL_functions; port->fptr = *port_functions; port->shared->has_mixdown = (port->fptr.mixdown ? TRUE : FALSE); + port->shared->uid = client->control->uid; } /* set up a base address so that port->offset can be used to