Ejemplo n.º 1
0
jack_port_t *
jack_port_by_name_int (jack_client_t *client, const char *port_name, int* free)
{
	JSList *node;
	for (node = client->ports; node; node = jack_slist_next (node)) {
		if (jack_port_name_equals(((jack_port_t *) node->data)->shared, port_name)) {
			*free = FALSE;
			return (jack_port_t *) node->data;
		}
	}

	unsigned long i, limit;
	jack_port_shared_t *port;

	limit = client->engine->port_max;
	port = &client->engine->ports[0];

	for (i = 0; i < limit; i++) {
		if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
			*free = TRUE;
			return jack_port_new (client, port[i].id,
					      client->engine);
		}
	}

	return NULL;
}
Ejemplo n.º 2
0
int
jack_port_connected_to (const jack_port_t *port, const char *portname)
{
	JSList *node;
	int ret = FALSE;

	/* XXX this really requires a cross-process lock
	   so that ports/connections cannot go away
	   while we are checking for them. that's hard,
	   and has a non-trivial performance impact
	   for jackd.
	*/  

	pthread_mutex_lock (&((jack_port_t *) port)->connection_lock);

	for (node = port->connections; node; node = jack_slist_next (node)) {
		jack_port_t *other_port = (jack_port_t *) node->data;
		
		if (jack_port_name_equals (other_port->shared, portname)) {
			ret = TRUE;
			break;
		}
	}

	pthread_mutex_unlock (&((jack_port_t *) port)->connection_lock);
	return ret;
}
Ejemplo n.º 3
0
jack_port_t *
jack_port_by_name_int (jack_client_t *client, const char *port_name)
{
	unsigned long i, limit;
	jack_port_shared_t *port;
	
	limit = client->engine->port_max;
	port = &client->engine->ports[0];
	
	for (i = 0; i < limit; i++) {
		if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
			return jack_port_new (client, port[i].id,
					      client->engine);
		}
	}

	return NULL;
}
Ejemplo n.º 4
0
jack_port_t *
jack_port_by_name (jack_client_t *client,  const char *port_name)
{
	JSList *node;
	jack_port_t* port;
	for (node = client->ports_ext; node; node = jack_slist_next (node)) {
		port = node->data;
		if (jack_port_name_equals (port->shared, port_name)) {
			/* Found port, return the cached structure. */
			return port;
		}
	}
	
	/* Otherwise allocate a new port structure, keep it in the
	 * ports_ext list for later use. */
	port = jack_port_by_name_int (client, port_name);
	if (port != NULL)
		client->ports_ext =
			jack_slist_prepend (client->ports_ext, port);
	return port;
}