git-svn-id: svn+ssh://jackaudio.org/trunk/jack@946 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.109.0
| @@ -15,7 +15,7 @@ dnl changes are made | |||
| dnl --- | |||
| JACK_MAJOR_VERSION=0 | |||
| JACK_MINOR_VERSION=102 | |||
| JACK_MICRO_VERSION=0 | |||
| JACK_MICRO_VERSION=1 | |||
| dnl --- | |||
| dnl HOWTO: updating the jack protocol version | |||
| @@ -127,14 +127,10 @@ alsa_driver_check_card_type (alsa_driver_t *driver) | |||
| if ((err = snd_ctl_open (&driver->ctl_handle, ctl_name, 0)) < 0) { | |||
| jack_error ("control open \"%s\" (%s)", ctl_name, | |||
| snd_strerror(err)); | |||
| return -1; | |||
| } | |||
| if ((err = snd_ctl_card_info(driver->ctl_handle, card_info)) < 0) { | |||
| } else if ((err = snd_ctl_card_info(driver->ctl_handle, card_info)) < 0) { | |||
| jack_error ("control hardware info \"%s\" (%s)", | |||
| driver->alsa_name_playback, snd_strerror (err)); | |||
| snd_ctl_close (driver->ctl_handle); | |||
| return -1; | |||
| } | |||
| driver->alsa_driver = strdup(snd_ctl_card_info_get_driver (card_info)); | |||
| @@ -7,6 +7,7 @@ | |||
| #include <config.h> | |||
| #include <jack/jack.h> | |||
| #include <jack/port.h> | |||
| char * my_name; | |||
| @@ -29,6 +30,7 @@ show_usage (void) | |||
| fprintf (stderr, " -L, --latency Display total latency in frames at each port\n"); | |||
| fprintf (stderr, " -p, --properties Display port properties. Output may include:\n" | |||
| " input|output, can-monitor, physical, terminal\n\n"); | |||
| fprintf (stderr, " -t, --type Display port type\n"); | |||
| fprintf (stderr, " -h, --help Display this help message\n"); | |||
| fprintf (stderr, " --version Output version information and exit\n\n"); | |||
| fprintf (stderr, "For more information see http://jackit.sourceforge.net/\n"); | |||
| @@ -45,6 +47,7 @@ main (int argc, char *argv[]) | |||
| int show_port_latency = 0; | |||
| int show_total_latency = 0; | |||
| int show_properties = 0; | |||
| int show_type = 0; | |||
| int c; | |||
| int option_index; | |||
| @@ -53,6 +56,7 @@ main (int argc, char *argv[]) | |||
| { "port-latency", 0, 0, 'l' }, | |||
| { "total-latency", 0, 0, 'L' }, | |||
| { "properties", 0, 0, 'p' }, | |||
| { "type", 0, 0, 't' }, | |||
| { "help", 0, 0, 'h' }, | |||
| { "version", 0, 0, 'v' }, | |||
| { 0, 0, 0, 0 } | |||
| @@ -65,7 +69,7 @@ main (int argc, char *argv[]) | |||
| my_name ++; | |||
| } | |||
| while ((c = getopt_long (argc, argv, "clLphv", long_options, &option_index)) >= 0) { | |||
| while ((c = getopt_long (argc, argv, "clLphvt", long_options, &option_index)) >= 0) { | |||
| switch (c) { | |||
| case 'c': | |||
| show_con = 1; | |||
| @@ -79,6 +83,9 @@ main (int argc, char *argv[]) | |||
| case 'p': | |||
| show_properties = 1; | |||
| break; | |||
| case 't': | |||
| show_type = 1; | |||
| break; | |||
| case 'h': | |||
| show_usage (); | |||
| return 1; | |||
| @@ -114,6 +121,9 @@ main (int argc, char *argv[]) | |||
| for (i = 0; ports[i]; ++i) { | |||
| printf ("%s\n", ports[i]); | |||
| jack_port_t *port = jack_port_by_name (client, ports[i]); | |||
| if (show_con) { | |||
| if ((connections = jack_port_get_all_connections (client, jack_port_by_name(client, ports[i]))) != 0) { | |||
| for (j = 0; connections[j]; j++) { | |||
| @@ -123,21 +133,18 @@ main (int argc, char *argv[]) | |||
| } | |||
| } | |||
| if (show_port_latency) { | |||
| jack_port_t *port = jack_port_by_name (client, ports[i]); | |||
| if (port) { | |||
| printf (" port latency = %" PRIu32 " frames\n", | |||
| jack_port_get_latency (port)); | |||
| } | |||
| } | |||
| if (show_total_latency) { | |||
| jack_port_t *port = jack_port_by_name (client, ports[i]); | |||
| if (port) { | |||
| printf (" total latency = %" PRIu32 " frames\n", | |||
| jack_port_get_total_latency (client, port)); | |||
| } | |||
| } | |||
| if (show_properties) { | |||
| jack_port_t *port = jack_port_by_name (client, ports[i]); | |||
| if (port) { | |||
| int flags = jack_port_flags (port); | |||
| printf (" properties: "); | |||
| @@ -159,6 +166,13 @@ main (int argc, char *argv[]) | |||
| putc ('\n', stdout); | |||
| } | |||
| } | |||
| if (show_type) { | |||
| if (port) { | |||
| putc ('\t', stdout); | |||
| fputs (port->type_info->type_name, stdout); | |||
| putc ('\n', stdout); | |||
| } | |||
| } | |||
| } | |||
| jack_client_close (client); | |||
| exit (0); | |||
| @@ -418,7 +418,7 @@ extern char *jack_tmpdir; | |||
| extern char *jack_user_dir (void); | |||
| extern char *jack_server_dir (const char *server_name); | |||
| extern char *jack_server_dir (const char *server_name, char *server_dir); | |||
| extern void *jack_zero_filled_buffer; | |||
| @@ -30,7 +30,7 @@ | |||
| #define JACK_PORT_TYPE_SIZE 32 | |||
| /* The relatively low value of this constant reflects the fact that | |||
| * JACK currently only knows about *1* port type. (March 2003) | |||
| * JACK currently only knows about *2* port types. (May 2006) | |||
| * | |||
| * Further, the 4 covers: | |||
| * - a single non-negotiated audio format | |||
| @@ -198,6 +198,7 @@ static int | |||
| make_socket_subdirectories (const char *server_name) | |||
| { | |||
| struct stat statbuf; | |||
| char server_dir[PATH_MAX+1] = ""; | |||
| /* check tmpdir directory */ | |||
| if (stat (jack_tmpdir, &statbuf)) { | |||
| @@ -218,7 +219,7 @@ make_socket_subdirectories (const char *server_name) | |||
| } | |||
| /* create server_name subdirectory */ | |||
| if (make_directory (jack_server_dir (server_name)) < 0) { | |||
| if (make_directory (jack_server_dir (server_name, server_dir)) < 0) { | |||
| return -1; | |||
| } | |||
| @@ -230,6 +231,7 @@ make_sockets (const char *server_name, int fd[2]) | |||
| { | |||
| struct sockaddr_un addr; | |||
| int i; | |||
| char server_dir[PATH_MAX+1] = ""; | |||
| if (make_socket_subdirectories (server_name) < 0) { | |||
| return -1; | |||
| @@ -246,7 +248,7 @@ make_sockets (const char *server_name, int fd[2]) | |||
| addr.sun_family = AF_UNIX; | |||
| for (i = 0; i < 999; i++) { | |||
| snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, | |||
| "%s/jack_%d", jack_server_dir (server_name), i); | |||
| "%s/jack_%d", jack_server_dir (server_name, server_dir), i); | |||
| if (access (addr.sun_path, F_OK) != 0) { | |||
| break; | |||
| } | |||
| @@ -284,7 +286,7 @@ make_sockets (const char *server_name, int fd[2]) | |||
| addr.sun_family = AF_UNIX; | |||
| for (i = 0; i < 999; i++) { | |||
| snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, | |||
| "%s/jack_ack_%d", jack_server_dir (server_name), i); | |||
| "%s/jack_ack_%d", jack_server_dir (server_name, server_dir), i); | |||
| if (access (addr.sun_path, F_OK) != 0) { | |||
| break; | |||
| } | |||
| @@ -1531,6 +1533,7 @@ jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock, | |||
| { | |||
| jack_engine_t *engine; | |||
| unsigned int i; | |||
| char server_dir[PATH_MAX+1] = ""; | |||
| #ifdef USE_CAPABILITIES | |||
| uid_t uid = getuid (); | |||
| @@ -1738,7 +1741,7 @@ jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock, | |||
| snprintf (engine->fifo_prefix, sizeof (engine->fifo_prefix), | |||
| "%s/jack-ack-fifo-%d", | |||
| jack_server_dir (engine->server_name), getpid ()); | |||
| jack_server_dir (engine->server_name, server_dir), getpid ()); | |||
| (void) jack_get_fifo_fd (engine, 0); | |||
| @@ -282,7 +282,7 @@ jack_drivers_get_descriptor (JSList * drivers, const char * sofile) | |||
| } | |||
| } | |||
| strncpy (descriptor->file, filename, PATH_MAX); | |||
| snprintf (descriptor->file, sizeof(descriptor->file), "%s", filename); | |||
| free (filename); | |||
| return descriptor; | |||
| @@ -401,7 +401,8 @@ jack_cleanup_files (const char *server_name) | |||
| { | |||
| DIR *dir; | |||
| struct dirent *dirent; | |||
| char *dir_name = jack_server_dir (server_name); | |||
| char dir_name[PATH_MAX+1] = ""; | |||
| jack_server_dir (server_name, dir_name); | |||
| /* On termination, we remove all files that jackd creates so | |||
| * subsequent attempts to start jackd will not believe that an | |||
| @@ -427,7 +428,7 @@ jack_cleanup_files (const char *server_name) | |||
| /* unlink all the files in this directory, they are mine */ | |||
| while ((dirent = readdir (dir)) != NULL) { | |||
| char fullpath[PATH_MAX]; | |||
| char fullpath[PATH_MAX+1]; | |||
| if ((strcmp (dirent->d_name, ".") == 0) | |||
| || (strcmp (dirent->d_name, "..") == 0)) { | |||
| @@ -528,6 +528,8 @@ server_connect (const char *server_name) | |||
| struct sockaddr_un addr; | |||
| int which = 0; | |||
| char server_dir[PATH_MAX+1] = ""; | |||
| if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { | |||
| jack_error ("cannot create client socket (%s)", | |||
| strerror (errno)); | |||
| @@ -539,7 +541,7 @@ server_connect (const char *server_name) | |||
| addr.sun_family = AF_UNIX; | |||
| snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_%d", | |||
| jack_server_dir (server_name), which); | |||
| jack_server_dir (server_name, server_dir) , which); | |||
| if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { | |||
| close (fd); | |||
| @@ -557,6 +559,8 @@ server_event_connect (jack_client_t *client, const char *server_name) | |||
| jack_client_connect_ack_request_t req; | |||
| jack_client_connect_ack_result_t res; | |||
| char server_dir[PATH_MAX+1] = ""; | |||
| if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { | |||
| jack_error ("cannot create client event socket (%s)", | |||
| strerror (errno)); | |||
| @@ -565,7 +569,7 @@ server_event_connect (jack_client_t *client, const char *server_name) | |||
| addr.sun_family = AF_UNIX; | |||
| snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_ack_0", | |||
| jack_server_dir (server_name)); | |||
| jack_server_dir (server_name,server_dir)); | |||
| if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { | |||
| jack_error ("cannot connect to jack server for events", | |||
| @@ -1117,7 +1121,7 @@ char *jack_tmpdir = DEFAULT_TMP_DIR; | |||
| char * | |||
| jack_user_dir (void) | |||
| { | |||
| static char user_dir[PATH_MAX] = ""; | |||
| static char user_dir[PATH_MAX+1] = ""; | |||
| /* format the path name on the first call */ | |||
| if (user_dir[0] == '\0') { | |||
| @@ -1130,15 +1134,13 @@ jack_user_dir (void) | |||
| /* returns the name of the per-server subdirectory of jack_user_dir() */ | |||
| char * | |||
| jack_server_dir (const char *server_name) | |||
| jack_server_dir (const char *server_name, char *server_dir) | |||
| { | |||
| static char server_dir[PATH_MAX] = ""; | |||
| /* format the path name into the suppled server_dir char array, | |||
| * assuming that server_dir is at least as large as PATH_MAX+1 */ | |||
| /* format the path name on the first call */ | |||
| if (server_dir[0] == '\0') { | |||
| snprintf (server_dir, sizeof (server_dir), "%s/%s", | |||
| jack_user_dir (), server_name); | |||
| } | |||
| snprintf (server_dir, PATH_MAX+1, "%s/%s", | |||
| jack_user_dir (), server_name); | |||
| return server_dir; | |||
| } | |||