Commit bc26ff05 authored by Stéphane Letz's avatar Stéphane Letz
Browse files

Merge pull request #136 from falkTX/master

Implement new jack_port_rename API
parents 7f2ceecf b906558e
......@@ -36,11 +36,16 @@ Matt Flax
Lars-Peter Clausen
Alexandru Tofan
Kim Jeong Yeon
Filipe Coelho
---------------------------
Jackdmp changes log
---------------------------
2015-07-19 Filipe Coelho <falktx@gmail.com>
* Implement new jack_port_rename API
2014-07-20 Stephane Letz <letz@grame.fr>
* Version 1.9.11 started.
......
......@@ -159,6 +159,7 @@ extern "C"
LIB_EXPORT int jack_recompute_total_latencies(jack_client_t*);
LIB_EXPORT int jack_port_set_name(jack_port_t *port, const char* port_name);
LIB_EXPORT int jack_port_rename(jack_client_t *client, jack_port_t *port, const char* port_name);
LIB_EXPORT int jack_port_set_alias(jack_port_t *port, const char* alias);
LIB_EXPORT int jack_port_unset_alias(jack_port_t *port, const char* alias);
LIB_EXPORT int jack_port_get_aliases(const jack_port_t *port, char* const aliases[2]);
......@@ -635,24 +636,37 @@ LIB_EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client)
LIB_EXPORT int jack_port_set_name(jack_port_t* port, const char* name)
{
JackGlobals::CheckContext("jack_port_set_name");
jack_error("jack_port_set_name: deprecated");
// Find a valid client
jack_client_t* client = NULL;
for (int i = 0; i < CLIENT_NUM; i++) {
if ((client = (jack_client_t*)JackGlobals::fClientTable[i])) {
break;
}
}
return (client) ? jack_port_rename(client, port, name) : -1;
}
LIB_EXPORT int jack_port_rename(jack_client_t* ext_client, jack_port_t* port, const char* name)
{
JackGlobals::CheckContext("jack_port_rename");
JackClient* client = (JackClient*)ext_client;
uintptr_t port_aux = (uintptr_t)port;
jack_port_id_t myport = (jack_port_id_t)port_aux;
if (!CheckPort(myport)) {
jack_error("jack_port_set_name called with an incorrect port %ld", myport);
if (client == NULL) {
jack_error("jack_port_rename called with a NULL client");
return -1;
} else if (!CheckPort(myport)) {
jack_error("jack_port_rename called with an incorrect port %ld", myport);
return -1;
} else if (name == NULL) {
jack_error("jack_port_set_name called with a NULL port name");
jack_error("jack_port_rename called with a NULL port name");
return -1;
} else {
JackClient* client = NULL;
for (int i = 0; i < CLIENT_NUM; i++) {
// Find a valid client
if ((client = JackGlobals::fClientTable[i])) {
break;
}
}
return (client) ? client->PortRename(myport, name) : -1;
client->PortRename(myport, name);
}
}
......
......@@ -207,6 +207,7 @@ DECL_VOID_FUNCTION(jack_port_set_latency_range, (jack_port_t *port, jack_latency
DECL_FUNCTION(int, jack_recompute_total_latencies, (jack_client_t* client),(client));
DECL_FUNCTION(int, jack_port_set_name, (jack_port_t *port, const char *port_name), (port, port_name));
DECL_FUNCTION(int, jack_port_rename, (jack_client_t *client, jack_port_t *port, const char *port_name), (client, port, port_name));
DECL_FUNCTION(int, jack_port_set_alias, (jack_port_t *port, const char *alias), (port, alias));
DECL_FUNCTION(int, jack_port_unset_alias, (jack_port_t *port, const char *alias), (port, alias));
DECL_FUNCTION(int, jack_port_get_aliases, (const jack_port_t *port, char* const aliases[2]), (port,aliases));
......
......@@ -887,13 +887,28 @@ int jack_port_tie (jack_port_t *src, jack_port_t *dst) JACK_OPTIONAL_WEAK_DEPREC
int jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
/**
* \bold THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED IN
* NEW JACK CLIENTS
*
* Modify a port's short name. May be called at any time. If the
* resulting full name (including the @a "client_name:" prefix) is
* longer than jack_port_name_size(), it will be truncated.
*
* @return 0 on success, otherwise a non-zero error code.
*/
int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
/**
* Modify a port's short name. May NOT be called from a callback handling a server event.
* If the resulting full name (including the @a "client_name:" prefix) is
* longer than jack_port_name_size(), it will be truncated.
*
* @return 0 on success, otherwise a non-zero error code.
*
* This differs from jack_port_set_name() by triggering PortRename notifications to
* clients that have registered a port rename handler.
*/
int jack_port_rename (jack_client_t* client, jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT;
/**
* Set @a alias as an alias for @a port. May be called at any time.
......
......@@ -403,10 +403,8 @@ typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int
* @param port the port that has been renamed
* @param new_name the new name
* @param arg pointer to a client supplied structure
*
* @return zero on success, non-zero on error
*/
typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg);
typedef void (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void *arg);
/**
* Prototype for the client supplied function that is called
......
......@@ -186,11 +186,10 @@ void Jack_Client_Registration_Callback(const char* name, int val, void *arg)
client_register--;
}
int Jack_Port_Rename_Callback(jack_port_id_t port, const char* old_name, const char* new_name, void *arg)
void Jack_Port_Rename_Callback(jack_port_id_t port, const char* old_name, const char* new_name, void *arg)
{
Log("Rename callback has been successfully called with old_name '%s' and new_name '%s'. (msg from callback)\n", old_name, new_name);
port_rename_clbk = 1;
return 0;
}
int Jack_Update_Buffer_Size(jack_nframes_t nframes, void *arg)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment