git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4006 0c269be4-1314-0410-8aa9-9f06e86f4224tags/v1.9.6
@@ -30,7 +30,11 @@ Arnold Krille | |||||
Jackdmp changes log | Jackdmp changes log | ||||
--------------------------- | --------------------------- | ||||
2010-04-016 Stephane Letz <letz@grame.fr> | |||||
2010-05-016 Stephane Letz <letz@grame.fr> | |||||
* Add tests to validate intclient.h API. | |||||
2010-04-16 Stephane Letz <letz@grame.fr> | |||||
* Make jack_connect/jack_disconnect wait for effective port connection/disconnection. | * Make jack_connect/jack_disconnect wait for effective port connection/disconnection. | ||||
@@ -1027,7 +1027,8 @@ int JackClient::InternalClientLoad(const char* client_name, jack_options_t optio | |||||
return 0; | return 0; | ||||
} | } | ||||
int int_ref, result = -1; | |||||
int int_ref = 0; | |||||
int result = -1; | |||||
fChannel->InternalClientLoad(GetClientControl()->fRefNum, client_name, va->load_name, va->load_init, options, (int*)status, &int_ref, &result); | fChannel->InternalClientLoad(GetClientControl()->fRefNum, client_name, va->load_name, va->load_init, options, (int*)status, &int_ref, &result); | ||||
return int_ref; | return int_ref; | ||||
} | } | ||||
@@ -17,9 +17,9 @@ | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <signal.h> | |||||
#include <signal.h> | |||||
#ifndef WIN32 | #ifndef WIN32 | ||||
#include <unistd.h> | |||||
#include <unistd.h> | |||||
#endif | #endif | ||||
#include <getopt.h> | #include <getopt.h> | ||||
#include <jack/jack.h> | #include <jack/jack.h> | ||||
@@ -126,7 +126,7 @@ parse_args (int argc, char *argv[]) | |||||
int | int | ||||
main (int argc, char *argv[]) | main (int argc, char *argv[]) | ||||
{ | { | ||||
jack_status_t status; | |||||
jack_status_t status; | |||||
char* name; | char* name; | ||||
/* parse and validate command arguments */ | /* parse and validate command arguments */ | ||||
@@ -157,8 +157,8 @@ main (int argc, char *argv[]) | |||||
(JackLoadName|JackLoadInit), | (JackLoadName|JackLoadInit), | ||||
&status, load_name, load_init); | &status, load_name, load_init); | ||||
if (status & JackFailure) { | if (status & JackFailure) { | ||||
fprintf (stderr, "could not load %s, status = 0x%2.0x\n", | |||||
load_name, status); | |||||
fprintf (stderr, "could not load %s, intclient = %d status = 0x%2.0x\n", | |||||
load_name, intclient, status); | |||||
return 2; | return 2; | ||||
} | } | ||||
if (status & JackNameNotUnique) { | if (status & JackNameNotUnique) { | ||||
@@ -178,23 +178,23 @@ main (int argc, char *argv[]) | |||||
if (wait_opt) { | if (wait_opt) { | ||||
/* define a signal handler to unload the client, then | /* define a signal handler to unload the client, then | ||||
* wait for it to exit */ | |||||
#ifdef WIN32 | |||||
signal(SIGINT, signal_handler); | |||||
signal(SIGABRT, signal_handler); | |||||
signal(SIGTERM, signal_handler); | |||||
#else | |||||
signal(SIGQUIT, signal_handler); | |||||
signal(SIGTERM, signal_handler); | |||||
signal(SIGHUP, signal_handler); | |||||
signal(SIGINT, signal_handler); | |||||
#endif | |||||
while (1) { | |||||
#ifdef WIN32 | |||||
Sleep(1000); | |||||
* wait for it to exit */ | |||||
#ifdef WIN32 | |||||
signal(SIGINT, signal_handler); | |||||
signal(SIGABRT, signal_handler); | |||||
signal(SIGTERM, signal_handler); | |||||
#else | |||||
signal(SIGQUIT, signal_handler); | |||||
signal(SIGTERM, signal_handler); | |||||
signal(SIGHUP, signal_handler); | |||||
signal(SIGINT, signal_handler); | |||||
#endif | |||||
while (1) { | |||||
#ifdef WIN32 | |||||
Sleep(1000); | |||||
#else | #else | ||||
sleep (1); | |||||
sleep (1); | |||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
@@ -35,6 +35,7 @@ | |||||
#include <assert.h> | #include <assert.h> | ||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include <jack/jack.h> | #include <jack/jack.h> | ||||
#include <jack/intclient.h> | |||||
#include <jack/transport.h> | #include <jack/transport.h> | ||||
@@ -632,7 +633,57 @@ int main (int argc, char *argv[]) | |||||
if (status & JackServerStarted) { | if (status & JackServerStarted) { | ||||
fprintf(stderr, "JACK server started\n"); | fprintf(stderr, "JACK server started\n"); | ||||
} | } | ||||
/** | |||||
* Internal client tests... | |||||
* | |||||
*/ | |||||
jack_intclient_t intclient; | |||||
Log("trying to load the \"inprocess\" server internal client \n"); | |||||
intclient = jack_internal_client_load (client1, "inprocess", | |||||
(jack_options_t)(JackLoadName|JackLoadInit), | |||||
&status, "inprocess", ""); | |||||
if (intclient == 0 || status & JackFailure) { | |||||
printf("!!! ERROR !!! cannot load internal client \"inprocess\" intclient %d status 0x%2.0x !\n", intclient, status); | |||||
} else { | |||||
Log("\"inprocess\" server internal client loaded\n"); | |||||
char* internal_name = jack_get_internal_client_name(client1, intclient); | |||||
if (strcmp(internal_name, "inprocess") == 0) { | |||||
Log("jack_get_internal_client_name returns %s\n", internal_name); | |||||
} else { | |||||
printf("!!! ERROR !!! jack_get_internal_client_name returns incorrect name %s\n", internal_name); | |||||
} | |||||
jack_intclient_t intclient1 = jack_internal_client_handle(client1, "inprocess", &status); | |||||
if (intclient1 == intclient) { | |||||
Log("jack_internal_client_handle returns correct handle\n"); | |||||
} else { | |||||
printf("!!! ERROR !!! jack_internal_client_handle returns incorrect handle %d\n", intclient1); | |||||
} | |||||
// Unload internal client | |||||
status = jack_internal_client_unload (client1, intclient); | |||||
if (status == 0) { | |||||
Log("jack_internal_client_unload done first time returns correct value\n"); | |||||
} else { | |||||
printf("!!! ERROR !!! jack_internal_client_unload returns incorrect value 0x%2.0x\n", status); | |||||
} | |||||
// Unload internal client second time | |||||
status = jack_internal_client_unload (client1, intclient); | |||||
if (status & JackFailure && status & JackNoSuchClient) { | |||||
Log("jack_internal_client_unload done second time returns correct value\n"); | |||||
} else { | |||||
printf("!!! ERROR !!! jack_internal_client_unload returns incorrect value 0x%2.0x\n", status); | |||||
} | |||||
} | |||||
/** | /** | ||||
* try to register another one with the same name... | * try to register another one with the same name... | ||||
* | * | ||||