- replaced use of g_snprinf with snprintf (snprintf is a standard POSIX/ANSI-C routine so there's no need to use glib here) - removed all dependencies to glib from source code and makefiles - added documentation of JACK versioning to configure.in - incremented JACK version to 0.40.0 git-svn-id: svn+ssh://jackaudio.org/trunk/jack@256 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.109.0
| @@ -21,7 +21,7 @@ SUBDIRS = jack libjack jackd drivers example-clients $(DOC_DIR) | |||
| DIST_SUBDIRS = jack libjack jackd drivers example-clients doc | |||
| pkgconfigdir = $(libdir)/pkgconfig | |||
| pkgconfig_DATA = jack.pc jack-glib2.pc | |||
| pkgconfig_DATA = jack.pc | |||
| rpm: dist | |||
| rpm -ta $(distdir).tar.gz | |||
| @@ -3,10 +3,29 @@ AC_INIT(jackd/jackd.c) | |||
| AC_CONFIG_AUX_DIR(.) | |||
| dnl --- | |||
| dnl HOWTO: updating the JACK version number | |||
| dnl | |||
| dnl major version = ask on jackit-devel :) | |||
| dnl minor version = incremented when any of the public or internal | |||
| dnl interfaces are changed | |||
| dnl micro version = incremented when implementation-only | |||
| dnl changes are made | |||
| dnl --- | |||
| JACK_MAJOR_VERSION=0 | |||
| JACK_MINOR_VERSION=39 | |||
| JACK_MINOR_VERSION=40 | |||
| JACK_MICRO_VERSION=0 | |||
| dnl --- | |||
| dnl HOWTO: updating the libjack interface version | |||
| dnl | |||
| dnl current = incremented whenever the public libjack API is changed | |||
| dnl revision = incremented when the libjack implementation is changed | |||
| dnl age = current libjack is both source and binary compatible with | |||
| dnl libjack interfaces current,current-1,...,current-age | |||
| dnl | |||
| dnl Note! see libtool documentation for detailed documentation | |||
| dnl --- | |||
| JACK_API_CURRENT=0 | |||
| JACK_API_REVISION=4 | |||
| JACK_API_AGE=0 | |||
| @@ -125,26 +144,7 @@ fi | |||
| AC_SUBST(HTML_DIR) | |||
| # jack depends on alsa 0.9 and glib. some example apps depend on libsndfile and fltk. | |||
| AM_PATH_GLIB(1.0.0, | |||
| [:], | |||
| [AC_MSG_ERROR([*** JACK requires GLib, but it does not appear to be installed])] | |||
| ) | |||
| # check for the presence of glib2 and build libjack-glib2 | |||
| PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.0.0, | |||
| [ | |||
| HAVE_GLIB2="true" | |||
| ], | |||
| [ | |||
| HAVE_GLIB2="false" | |||
| ]) | |||
| AC_SUBST(GLIB2_LIBS) | |||
| AC_SUBST(GLIB2_CFLAGS) | |||
| # jack depends on alsa 0.9. some example apps depend on libsndfile and fltk. | |||
| AC_CHECK_LIB(asound,snd_pcm_drop, | |||
| [ | |||
| @@ -202,11 +202,9 @@ AM_CONDITIONAL(USE_CAPABILITIES, $USE_CAPABILITIES) | |||
| AM_CONDITIONAL(STRIPPED_JACKD, $STRIPPED_JACKD) | |||
| AM_CONDITIONAL(HAVE_ALSA, $HAVE_ALSA) | |||
| AM_CONDITIONAL(HAVE_SOLARIS, $HAVE_SOLARIS) | |||
| AM_CONDITIONAL(HAVE_GLIB2, $HAVE_GLIB2) | |||
| AC_OUTPUT( | |||
| Makefile | |||
| jack-glib2.pc | |||
| jack.pc | |||
| jack.spec | |||
| jack/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| MAINTAINERCLEANFILES=Makefile.in | |||
| AM_CFLAGS = $(JACK_CFLAGS) $(GLIB_CFLAGS) | |||
| AM_CFLAGS = $(JACK_CFLAGS) | |||
| plugindir = $(ADDON_DIR) | |||
| @@ -9,4 +9,4 @@ plugin_LTLIBRARIES = jack_alsa.la | |||
| jack_alsa_la_LDFLAGS = -module | |||
| jack_alsa_la_SOURCES = alsa_driver.c generic_hw.c memops.c \ | |||
| hammerfall.c ice1712.c | |||
| jack_alsa_la_LIBADD = $(ALSA_LIBS) $(GLIB_LIBS) | |||
| jack_alsa_la_LIBADD = $(ALSA_LIBS) | |||
| @@ -24,7 +24,6 @@ | |||
| #include <unistd.h> | |||
| #include <stdlib.h> | |||
| #include <errno.h> | |||
| #include <glib.h> | |||
| #include <stdarg.h> | |||
| #include <getopt.h> | |||
| @@ -1005,7 +1004,7 @@ alsa_driver_process (alsa_driver_t *driver, jack_nframes_t nframes) | |||
| snd_pcm_uframes_t capture_offset = 0; | |||
| snd_pcm_uframes_t playback_offset = 0; | |||
| channel_t chn; | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_engine_t *engine = driver->engine; | |||
| static int cnt = 0; | |||
| @@ -1069,11 +1068,11 @@ alsa_driver_process (alsa_driver_t *driver, jack_nframes_t nframes) | |||
| channel_t chn; | |||
| jack_port_t *port; | |||
| GSList *node; | |||
| JSList *node; | |||
| int ret; | |||
| if (driver->capture_handle) { | |||
| for (chn = 0, node = driver->capture_ports; node; node = g_slist_next (node), chn++) { | |||
| for (chn = 0, node = driver->capture_ports; node; node = jack_slist_next (node), chn++) { | |||
| port = (jack_port_t *) node->data; | |||
| @@ -1102,7 +1101,7 @@ alsa_driver_process (alsa_driver_t *driver, jack_nframes_t nframes) | |||
| if (driver->playback_handle) { | |||
| /* now move data from ports to channels */ | |||
| for (chn = 0, node = driver->playback_ports; node; node = g_slist_next (node), chn++) { | |||
| for (chn = 0, node = driver->playback_ports; node; node = jack_slist_next (node), chn++) { | |||
| jack_default_audio_sample_t *buf; | |||
| jack_port_t *port = (jack_port_t *) node->data; | |||
| @@ -1124,7 +1123,7 @@ alsa_driver_process (alsa_driver_t *driver, jack_nframes_t nframes) | |||
| driver->input_monitor_mask = 0; | |||
| for (chn = 0, node = driver->capture_ports; node; node = g_slist_next (node), chn++) { | |||
| for (chn = 0, node = driver->capture_ports; node; node = jack_slist_next (node), chn++) { | |||
| if (((jack_port_t *) node->data)->shared->monitor_requests) { | |||
| driver->input_monitor_mask |= (1<<chn); | |||
| } | |||
| @@ -1208,7 +1207,7 @@ alsa_driver_attach (alsa_driver_t *driver, jack_engine_t *engine) | |||
| jack_port_set_latency (port, driver->frames_per_cycle); | |||
| driver->capture_ports = g_slist_append (driver->capture_ports, port); | |||
| driver->capture_ports = jack_slist_append (driver->capture_ports, port); | |||
| } | |||
| port_flags = JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal; | |||
| @@ -1226,7 +1225,7 @@ alsa_driver_attach (alsa_driver_t *driver, jack_engine_t *engine) | |||
| jack_port_set_latency (port, driver->frames_per_cycle * driver->nfragments); | |||
| driver->playback_ports = g_slist_append (driver->playback_ports, port); | |||
| driver->playback_ports = jack_slist_append (driver->playback_ports, port); | |||
| } | |||
| jack_activate (driver->client); | |||
| @@ -1236,24 +1235,24 @@ static void | |||
| alsa_driver_detach (alsa_driver_t *driver, jack_engine_t *engine) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| if (driver->engine == 0) { | |||
| return; | |||
| } | |||
| for (node = driver->capture_ports; node; node = g_slist_next (node)) { | |||
| for (node = driver->capture_ports; node; node = jack_slist_next (node)) { | |||
| jack_port_unregister (driver->client, ((jack_port_t *) node->data)); | |||
| } | |||
| g_slist_free (driver->capture_ports); | |||
| jack_slist_free (driver->capture_ports); | |||
| driver->capture_ports = 0; | |||
| for (node = driver->playback_ports; node; node = g_slist_next (node)) { | |||
| for (node = driver->playback_ports; node; node = jack_slist_next (node)) { | |||
| jack_port_unregister (driver->client, ((jack_port_t *) node->data)); | |||
| } | |||
| g_slist_free (driver->playback_ports); | |||
| jack_slist_free (driver->playback_ports); | |||
| driver->playback_ports = 0; | |||
| driver->engine = 0; | |||
| @@ -1310,12 +1309,12 @@ static void | |||
| alsa_driver_delete (alsa_driver_t *driver) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| for (node = driver->clock_sync_listeners; node; node = g_slist_next (node)) { | |||
| for (node = driver->clock_sync_listeners; node; node = jack_slist_next (node)) { | |||
| free (node->data); | |||
| } | |||
| g_slist_free (driver->clock_sync_listeners); | |||
| jack_slist_free (driver->clock_sync_listeners); | |||
| if (driver->capture_handle) { | |||
| snd_pcm_close (driver->capture_handle); | |||
| @@ -1516,7 +1515,7 @@ alsa_driver_listen_for_clock_sync_status (alsa_driver_t *driver, | |||
| csl->id = driver->next_clock_sync_listener_id++; | |||
| pthread_mutex_lock (&driver->clock_sync_lock); | |||
| driver->clock_sync_listeners = g_slist_prepend (driver->clock_sync_listeners, csl); | |||
| driver->clock_sync_listeners = jack_slist_prepend (driver->clock_sync_listeners, csl); | |||
| pthread_mutex_unlock (&driver->clock_sync_lock); | |||
| return csl->id; | |||
| } | |||
| @@ -1525,14 +1524,14 @@ int | |||
| alsa_driver_stop_listening_to_clock_sync_status (alsa_driver_t *driver, int which) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| int ret = -1; | |||
| pthread_mutex_lock (&driver->clock_sync_lock); | |||
| for (node = driver->clock_sync_listeners; node; node = g_slist_next (node)) { | |||
| for (node = driver->clock_sync_listeners; node; node = jack_slist_next (node)) { | |||
| if (((ClockSyncListener *) node->data)->id == which) { | |||
| driver->clock_sync_listeners = g_slist_remove_link (driver->clock_sync_listeners, node); | |||
| driver->clock_sync_listeners = jack_slist_remove_link (driver->clock_sync_listeners, node); | |||
| free (node->data); | |||
| g_slist_free_1 (node); | |||
| jack_slist_free_1 (node); | |||
| ret = 0; | |||
| break; | |||
| } | |||
| @@ -1544,10 +1543,10 @@ alsa_driver_stop_listening_to_clock_sync_status (alsa_driver_t *driver, int whic | |||
| void | |||
| alsa_driver_clock_sync_notify (alsa_driver_t *driver, channel_t chn, ClockSyncStatus status) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| pthread_mutex_lock (&driver->clock_sync_lock); | |||
| for (node = driver->clock_sync_listeners; node; node = g_slist_next (node)) { | |||
| for (node = driver->clock_sync_listeners; node; node = jack_slist_next (node)) { | |||
| ClockSyncListener *csl = (ClockSyncListener *) node->data; | |||
| csl->function (chn, status, csl->arg); | |||
| } | |||
| @@ -22,6 +22,7 @@ | |||
| #include <jack/alsa_driver.h> | |||
| #include <jack/hammerfall.h> | |||
| #include <jack/error.h> | |||
| #include <jack/internal.h> | |||
| static void | |||
| set_control_id (snd_ctl_elem_id_t *ctl, const char *name) | |||
| @@ -1,6 +1,6 @@ | |||
| MAINTAINERCLEANFILES=Makefile.in | |||
| AM_CFLAGS = $(JACK_CFLAGS) $(GLIB_CFLAGS) | |||
| AM_CFLAGS = $(JACK_CFLAGS) | |||
| plugindir = $(ADDON_DIR) | |||
| @@ -8,4 +8,4 @@ plugin_LTLIBRARIES = jack_solaris.la | |||
| jack_solaris_la_LDFLAGS = -module | |||
| jack_solaris_la_SOURCES = solaris_driver.c | |||
| jack_solaris_la_LIBADD = $(GLIB_LIBS) -lm | |||
| jack_solaris_la_LIBADD = -lm | |||
| @@ -24,7 +24,6 @@ | |||
| #include <unistd.h> | |||
| #include <stdlib.h> | |||
| #include <errno.h> | |||
| #include <glib.h> | |||
| #include <stdarg.h> | |||
| #include <jack/solaris_driver.h> | |||
| @@ -35,7 +35,7 @@ bin_PROGRAMS = jack_simple_client \ | |||
| jack_lsp \ | |||
| $(FLTK_CLIENT) $(JACKREC) | |||
| AM_CFLAGS = -I.. $(JACK_CFLAGS) $(GLIB_CFLAGS) | |||
| AM_CFLAGS = -I.. $(JACK_CFLAGS) | |||
| AM_CXXFLAGS = -I.. $(JACK_CFLAGS) | |||
| jack_simple_client_SOURCES = simple_client.c | |||
| @@ -2,9 +2,9 @@ | |||
| #include <errno.h> | |||
| #include <unistd.h> | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| #include <jack/jack.h> | |||
| #include <glib.h> | |||
| #include <jack/port.h> | |||
| #include <jack/cycles.h> | |||
| @@ -27,10 +27,10 @@ | |||
| #include <unistd.h> | |||
| #include <sndfile.h> | |||
| #include <pthread.h> | |||
| #include <glib.h> | |||
| #include <getopt.h> | |||
| #include <jack/jack.h> | |||
| #include <jack/jslist.h> | |||
| typedef struct _thread_info { | |||
| pthread_t thread_id; | |||
| @@ -73,8 +73,8 @@ sample_buffer_new (jack_nframes_t nframes, unsigned int nchans) | |||
| return buf; | |||
| } | |||
| GSList *pending_writes = NULL; | |||
| GSList *free_buffers = NULL; | |||
| JSList *pending_writes = NULL; | |||
| JSList *free_buffers = NULL; | |||
| sample_buffer_t * | |||
| get_free_buffer (jack_nframes_t nframes, unsigned int nchans) | |||
| @@ -85,7 +85,7 @@ get_free_buffer (jack_nframes_t nframes, unsigned int nchans) | |||
| buf = sample_buffer_new (nframes, nchans); | |||
| } else { | |||
| buf = (sample_buffer_t *) free_buffers->data; | |||
| free_buffers = g_slist_next (free_buffers); | |||
| free_buffers = jack_slist_next (free_buffers); | |||
| } | |||
| return buf; | |||
| @@ -101,7 +101,7 @@ get_write_buffer () | |||
| } | |||
| buf = (sample_buffer_t *) pending_writes->data; | |||
| pending_writes = g_slist_next (pending_writes); | |||
| pending_writes = jack_slist_next (pending_writes); | |||
| return buf; | |||
| } | |||
| @@ -109,13 +109,13 @@ get_write_buffer () | |||
| void | |||
| put_write_buffer (sample_buffer_t *buf) | |||
| { | |||
| pending_writes = g_slist_append (pending_writes, buf); | |||
| pending_writes = jack_slist_append (pending_writes, buf); | |||
| } | |||
| void | |||
| put_free_buffer (sample_buffer_t *buf) | |||
| { | |||
| free_buffers = g_slist_prepend (free_buffers, buf); | |||
| free_buffers = jack_slist_prepend (free_buffers, buf); | |||
| } | |||
| void * | |||
| @@ -23,7 +23,6 @@ | |||
| #include <math.h> | |||
| #include <jack/jack.h> | |||
| #include <jack/transport.h> | |||
| #include <glib.h> | |||
| #include <getopt.h> | |||
| #include <string.h> | |||
| @@ -1,11 +0,0 @@ | |||
| prefix=@prefix@ | |||
| exec_prefix=@exec_prefix@ | |||
| libdir=@libdir@ | |||
| includedir=@includedir@ | |||
| Name: jack-glib2 | |||
| Description: the Jack Audio Connection Kit: a low-latency synchronous callback-based media server | |||
| Requires: glib-2.0 >= 2.0.0 | |||
| Version: @JACK_VERSION@ | |||
| Libs: -L${libdir} -ljack-glib2 -lglib-2.0 -lpthread -ldl | |||
| Cflags: -I${includedir} | |||
| @@ -5,7 +5,6 @@ includedir=@includedir@ | |||
| Name: jack | |||
| Description: the Jack Audio Connection Kit: a low-latency synchronous callback-based media server | |||
| Requires: glib >= 1.0.0 | |||
| Version: @JACK_VERSION@ | |||
| Libs: -L${libdir} -ljack -lglib -lpthread -ldl | |||
| Libs: -L${libdir} -ljack -lpthread -ldl | |||
| Cflags: -I${includedir} | |||
| @@ -21,4 +21,6 @@ noinst_HEADERS = \ | |||
| memops.h \ | |||
| pool.h \ | |||
| port.h \ | |||
| start.h | |||
| start.h \ | |||
| jslist.h | |||
| @@ -91,8 +91,8 @@ typedef struct { | |||
| ClockSyncStatus *clock_sync_data; | |||
| struct _jack_engine *engine; | |||
| jack_client_t *client; | |||
| GSList *capture_ports; | |||
| GSList *playback_ports; | |||
| JSList *capture_ports; | |||
| JSList *playback_ports; | |||
| unsigned long input_monitor_mask; | |||
| @@ -109,7 +109,7 @@ typedef struct { | |||
| dither_state_t *dither_state; | |||
| SampleClockMode clock_mode; | |||
| GSList *clock_sync_listeners; | |||
| JSList *clock_sync_listeners; | |||
| pthread_mutex_t clock_sync_lock; | |||
| unsigned long next_clock_sync_listener_id; | |||
| char has_clock_sync_reporting : 1; | |||
| @@ -21,7 +21,6 @@ | |||
| #ifndef __jack_driver_h__ | |||
| #define __jack_driver_h__ | |||
| #include <glib.h> | |||
| #include <pthread.h> | |||
| #include <jack/types.h> | |||
| #include <jack/port.h> | |||
| @@ -52,18 +52,18 @@ struct _jack_engine { | |||
| /* these lists are protected by `buffer_lock' */ | |||
| GSList *port_segments; | |||
| GSList *port_buffer_freelist; | |||
| JSList *port_segments; | |||
| JSList *port_buffer_freelist; | |||
| /* these lists are all protected by `client_lock' */ | |||
| GSList *clients; | |||
| GSList *clients_waiting; | |||
| GSList *connections; | |||
| JSList *clients; | |||
| JSList *clients_waiting; | |||
| JSList *connections; | |||
| struct _jack_port_internal *internal_ports; | |||
| GSList *port_types; /* holds ptrs to jack_port_type_info_t */ | |||
| JSList *port_types; /* holds ptrs to jack_port_type_info_t */ | |||
| int fds[2]; | |||
| jack_client_id_t next_client_id; | |||
| @@ -28,7 +28,6 @@ | |||
| #include <sys/types.h> | |||
| #include <sys/time.h> | |||
| #include <pthread.h> | |||
| #include <glib.h> | |||
| #include <jack/jack.h> | |||
| #include <jack/types.h> | |||
| @@ -43,6 +42,14 @@ | |||
| #define DEBUG(format,args...) | |||
| #endif | |||
| #ifndef FALSE | |||
| #define FALSE (0) | |||
| #endif | |||
| #ifndef TRUE | |||
| #define TRUE (!FALSE) | |||
| #endif | |||
| typedef struct _jack_engine jack_engine_t; | |||
| typedef void * dlhandle; | |||
| @@ -0,0 +1,302 @@ | |||
| /* | |||
| Based on gslist.c from glib-1.2.9 (LGPL). | |||
| Adaption to JACK, Copyright (C) 2002 Kai Vehmanen. | |||
| - replaced use of gtypes with normal ANSI C types | |||
| - glib's memery allocation routines replaced with | |||
| malloc/free calls | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU Lesser General Public License as published by | |||
| the Free Software Foundation; either version 2.1 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU Lesser General Public License for more details. | |||
| You should have received a copy of the GNU Lesser General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| $Id$ | |||
| */ | |||
| #ifndef __jack_jslist_h__ | |||
| #define __jack_jslist_h__ | |||
| typedef struct _JSList JSList; | |||
| typedef int (*JCompareFunc) (void* a, | |||
| void* b); | |||
| struct _JSList | |||
| { | |||
| void *data; | |||
| JSList *next; | |||
| }; | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_alloc (void) | |||
| { | |||
| JSList *new_list; | |||
| new_list = malloc(sizeof(JSList)); | |||
| new_list->data = NULL; | |||
| new_list->next = NULL; | |||
| return new_list; | |||
| } | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_prepend (JSList *list, | |||
| void *data) | |||
| { | |||
| JSList *new_list; | |||
| new_list = malloc(sizeof(JSList)); | |||
| new_list->data = data; | |||
| new_list->next = list; | |||
| return new_list; | |||
| } | |||
| #define jack_slist_next(slist) ((slist) ? (((JSList *)(slist))->next) : NULL) | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_last (JSList *list) | |||
| { | |||
| if (list) | |||
| { | |||
| while (list->next) | |||
| list = list->next; | |||
| } | |||
| return list; | |||
| } | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_remove_link (JSList *list, | |||
| JSList *link) | |||
| { | |||
| JSList *tmp; | |||
| JSList *prev; | |||
| prev = NULL; | |||
| tmp = list; | |||
| while (tmp) | |||
| { | |||
| if (tmp == link) | |||
| { | |||
| if (prev) | |||
| prev->next = tmp->next; | |||
| if (list == tmp) | |||
| list = list->next; | |||
| tmp->next = NULL; | |||
| break; | |||
| } | |||
| prev = tmp; | |||
| tmp = tmp->next; | |||
| } | |||
| return list; | |||
| } | |||
| static __inline__ | |||
| void | |||
| jack_slist_free (JSList *list) | |||
| { | |||
| while (list) | |||
| { | |||
| JSList *next = list->next; | |||
| free(list); | |||
| list = next; | |||
| } | |||
| } | |||
| static __inline__ | |||
| void | |||
| jack_slist_free_1 (JSList *list) | |||
| { | |||
| if (list) | |||
| { | |||
| free(list); | |||
| } | |||
| } | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_remove (JSList *list, | |||
| void *data) | |||
| { | |||
| JSList *tmp; | |||
| JSList *prev; | |||
| prev = NULL; | |||
| tmp = list; | |||
| while (tmp) | |||
| { | |||
| if (tmp->data == data) | |||
| { | |||
| if (prev) | |||
| prev->next = tmp->next; | |||
| if (list == tmp) | |||
| list = list->next; | |||
| tmp->next = NULL; | |||
| jack_slist_free (tmp); | |||
| break; | |||
| } | |||
| prev = tmp; | |||
| tmp = tmp->next; | |||
| } | |||
| return list; | |||
| } | |||
| static __inline__ | |||
| unsigned int | |||
| jack_slist_length (JSList *list) | |||
| { | |||
| unsigned int length; | |||
| length = 0; | |||
| while (list) | |||
| { | |||
| length++; | |||
| list = list->next; | |||
| } | |||
| return length; | |||
| } | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_find (JSList *list, | |||
| void *data) | |||
| { | |||
| while (list) | |||
| { | |||
| if (list->data == data) | |||
| break; | |||
| list = list->next; | |||
| } | |||
| return list; | |||
| } | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_copy (JSList *list) | |||
| { | |||
| JSList *new_list = NULL; | |||
| if (list) | |||
| { | |||
| JSList *last; | |||
| new_list = jack_slist_alloc (); | |||
| new_list->data = list->data; | |||
| last = new_list; | |||
| list = list->next; | |||
| while (list) | |||
| { | |||
| last->next = jack_slist_alloc (); | |||
| last = last->next; | |||
| last->data = list->data; | |||
| list = list->next; | |||
| } | |||
| } | |||
| return new_list; | |||
| } | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_append (JSList *list, | |||
| void *data) | |||
| { | |||
| JSList *new_list; | |||
| JSList *last; | |||
| new_list = jack_slist_alloc (); | |||
| new_list->data = data; | |||
| if (list) | |||
| { | |||
| last = jack_slist_last (list); | |||
| last->next = new_list; | |||
| return list; | |||
| } | |||
| else | |||
| return new_list; | |||
| } | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_sort_merge (JSList *l1, | |||
| JSList *l2, | |||
| JCompareFunc compare_func) | |||
| { | |||
| JSList list, *l; | |||
| l=&list; | |||
| while (l1 && l2) | |||
| { | |||
| if (compare_func(l1->data,l2->data) < 0) | |||
| { | |||
| l=l->next=l1; | |||
| l1=l1->next; | |||
| } | |||
| else | |||
| { | |||
| l=l->next=l2; | |||
| l2=l2->next; | |||
| } | |||
| } | |||
| l->next= l1 ? l1 : l2; | |||
| return list.next; | |||
| } | |||
| static __inline__ | |||
| JSList* | |||
| jack_slist_sort (JSList *list, | |||
| JCompareFunc compare_func) | |||
| { | |||
| JSList *l1, *l2; | |||
| if (!list) | |||
| return NULL; | |||
| if (!list->next) | |||
| return list; | |||
| l1 = list; | |||
| l2 = list->next; | |||
| while ((l2 = l2->next) != NULL) | |||
| { | |||
| if ((l2 = l2->next) == NULL) | |||
| break; | |||
| l1=l1->next; | |||
| } | |||
| l2 = l1->next; | |||
| l1->next = NULL; | |||
| return jack_slist_sort_merge (jack_slist_sort (list, compare_func), | |||
| jack_slist_sort (l2, compare_func), | |||
| compare_func); | |||
| } | |||
| #endif /* __jack_jslist_h__ */ | |||
| @@ -23,6 +23,7 @@ | |||
| #include <pthread.h> | |||
| #include <jack/types.h> | |||
| #include <jack/jslist.h> | |||
| #define JACK_PORT_NAME_SIZE 32 | |||
| #define JACK_PORT_TYPE_SIZE 32 | |||
| @@ -88,7 +89,7 @@ struct _jack_port { | |||
| char *client_segment_base; | |||
| struct _jack_port_shared *shared; | |||
| pthread_mutex_t connection_lock; | |||
| GSList *connections; | |||
| JSList *connections; | |||
| }; | |||
| /* inline would be cleaner, but it needs to be fast even in non-optimized | |||
| @@ -103,7 +104,7 @@ struct _jack_port { | |||
| typedef struct _jack_port_internal { | |||
| struct _jack_port_shared *shared; | |||
| GSList *connections; | |||
| JSList *connections; | |||
| void *buffer_info; | |||
| } jack_port_internal_t; | |||
| @@ -10,10 +10,10 @@ endif | |||
| bin_PROGRAMS = jackd $(CAP_PROGS) | |||
| AM_CFLAGS = $(JACK_CFLAGS) -DJACKD_LOCATION=\"$(bindir)/jackd\" $(GLIB_CFLAGS) | |||
| AM_CFLAGS = $(JACK_CFLAGS) -DJACKD_LOCATION=\"$(bindir)/jackd\" | |||
| jackd_SOURCES = jackd.c engine.c | |||
| jackd_LDADD = ../libjack/libjack.la -lm -ldl -lpthread $(GLIB_LIBS) $(CAP_LIBS) | |||
| jackd_LDADD = ../libjack/libjack.la -lm -ldl -lpthread $(CAP_LIBS) | |||
| noinst_HEADERS = jack_md5.h md5.h md5_loc.h | |||
| @@ -76,8 +76,8 @@ typedef struct _jack_client_internal { | |||
| int event_fd; | |||
| int subgraph_start_fd; | |||
| int subgraph_wait_fd; | |||
| GSList *ports; /* protected by engine->client_lock */ | |||
| GSList *fed_by; /* protected by engine->client_lock */ | |||
| JSList *ports; /* protected by engine->client_lock */ | |||
| JSList *fed_by; /* protected by engine->client_lock */ | |||
| int shm_id; | |||
| int shm_key; | |||
| unsigned long execution_order; | |||
| @@ -136,15 +136,15 @@ jack_client_is_inprocess (jack_client_internal_t *client) | |||
| return (client->control->type == ClientDynamic) || (client->control->type == ClientDriver); | |||
| } | |||
| #define jack_lock_graph(engine) G_STMT_START{ \ | |||
| #define jack_lock_graph(engine) do { \ | |||
| DEBUG ("acquiring graph lock"); \ | |||
| pthread_mutex_lock (&engine->client_lock); \ | |||
| }G_STMT_END | |||
| } while(0) | |||
| #define jack_unlock_graph(engine) G_STMT_START{ \ | |||
| #define jack_unlock_graph(engine) do { \ | |||
| DEBUG ("releasing graph lock"); \ | |||
| pthread_mutex_unlock (&engine->client_lock); \ | |||
| }G_STMT_END | |||
| } while(0) | |||
| static inline void | |||
| jack_engine_reset_rolling_usecs (jack_engine_t *engine) | |||
| @@ -354,7 +354,7 @@ jack_add_port_segment (jack_engine_t *engine, unsigned long nports) | |||
| si->shm_key = key; | |||
| si->address = addr; | |||
| engine->port_segments = g_slist_prepend (engine->port_segments, si); | |||
| engine->port_segments = jack_slist_prepend (engine->port_segments, si); | |||
| engine->port_segment_key = key; /* XXX fix me */ | |||
| engine->port_segment_address = addr; /* XXX fix me */ | |||
| @@ -373,7 +373,7 @@ jack_add_port_segment (jack_engine_t *engine, unsigned long nports) | |||
| /* we append because we want the list to be in memory-address order */ | |||
| engine->port_buffer_freelist = g_slist_append (engine->port_buffer_freelist, bi); | |||
| engine->port_buffer_freelist = jack_slist_append (engine->port_buffer_freelist, bi); | |||
| offset += step; | |||
| } | |||
| @@ -383,7 +383,7 @@ jack_add_port_segment (jack_engine_t *engine, unsigned long nports) | |||
| if (engine->silent_buffer == NULL) { | |||
| engine->silent_buffer = (jack_port_buffer_info_t *) engine->port_buffer_freelist->data; | |||
| engine->port_buffer_freelist = g_slist_remove_link (engine->port_buffer_freelist, engine->port_buffer_freelist); | |||
| engine->port_buffer_freelist = jack_slist_remove_link (engine->port_buffer_freelist, engine->port_buffer_freelist); | |||
| memset (engine->port_segment_address + engine->silent_buffer->offset, 0, | |||
| sizeof (jack_default_audio_sample_t) * engine->control->buffer_size); | |||
| @@ -437,7 +437,7 @@ jack_process (jack_engine_t *engine, jack_nframes_t nframes) | |||
| { | |||
| jack_client_internal_t *client; | |||
| jack_client_control_t *ctl; | |||
| GSList *node; | |||
| JSList *node; | |||
| char c; | |||
| int status; | |||
| float delayed_usecs; | |||
| @@ -445,7 +445,7 @@ jack_process (jack_engine_t *engine, jack_nframes_t nframes) | |||
| engine->process_errors = 0; | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| ctl = ((jack_client_internal_t *) node->data)->control; | |||
| ctl->state = NotTriggered; | |||
| ctl->nframes = nframes; | |||
| @@ -458,7 +458,7 @@ jack_process (jack_engine_t *engine, jack_nframes_t nframes) | |||
| DEBUG ("considering client %s for processing", client->control->name); | |||
| if (!client->control->active || client->control->dead) { | |||
| node = g_slist_next (node); | |||
| node = jack_slist_next (node); | |||
| continue; | |||
| } | |||
| @@ -491,7 +491,7 @@ jack_process (jack_engine_t *engine, jack_nframes_t nframes) | |||
| ctl->state = Finished; | |||
| } | |||
| node = g_slist_next (node); | |||
| node = jack_slist_next (node); | |||
| } else { | |||
| @@ -574,7 +574,7 @@ jack_process (jack_engine_t *engine, jack_nframes_t nframes) | |||
| if (jack_client_is_inprocess (((jack_client_internal_t *) node->data))) { | |||
| break; | |||
| } | |||
| node = g_slist_next (node); | |||
| node = jack_slist_next (node); | |||
| } | |||
| } | |||
| @@ -588,7 +588,7 @@ jack_engine_post_process (jack_engine_t *engine) | |||
| { | |||
| jack_client_control_t *ctl; | |||
| jack_client_internal_t *client; | |||
| GSList *node; | |||
| JSList *node; | |||
| int need_remove = FALSE; | |||
| jack_lock_graph (engine); | |||
| @@ -600,7 +600,7 @@ jack_engine_post_process (jack_engine_t *engine) | |||
| /* find any clients that need removal due to timeouts, etc. */ | |||
| for (node = engine->clients; node; node = g_slist_next (node) ) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node) ) { | |||
| client = (jack_client_internal_t *) node->data; | |||
| ctl = client->control; | |||
| @@ -616,14 +616,14 @@ jack_engine_post_process (jack_engine_t *engine) | |||
| if (need_remove) { | |||
| GSList *tmp; | |||
| JSList *tmp; | |||
| int need_sort = FALSE; | |||
| /* remove all dead clients */ | |||
| for (node = engine->clients; node; ) { | |||
| tmp = g_slist_next (node); | |||
| tmp = jack_slist_next (node); | |||
| client = (jack_client_internal_t *) node->data; | |||
| @@ -709,7 +709,7 @@ static int | |||
| handle_new_client (jack_engine_t *engine, int client_fd) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_client_internal_t *client = NULL; | |||
| jack_client_connect_request_t req; | |||
| jack_client_connect_result_t res; | |||
| @@ -721,7 +721,7 @@ handle_new_client (jack_engine_t *engine, int client_fd) | |||
| res.status = 0; | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| client = (jack_client_internal_t *) node->data; | |||
| if (strncmp(req.name, (char*)client->control->name, sizeof(req.name)) == 0) { | |||
| @@ -774,7 +774,7 @@ handle_new_client (jack_engine_t *engine, int client_fd) | |||
| jack_lock_graph (engine); | |||
| engine->clients = g_slist_prepend (engine->clients, client); | |||
| engine->clients = jack_slist_prepend (engine->clients, client); | |||
| jack_engine_reset_rolling_usecs (engine); | |||
| @@ -912,12 +912,12 @@ static int | |||
| jack_set_client_capabilities (jack_engine_t *engine, jack_client_id_t id) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| int ret = -1; | |||
| jack_lock_graph (engine); | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| jack_client_internal_t *client = (jack_client_internal_t *) node->data; | |||
| @@ -953,12 +953,12 @@ jack_client_activate (jack_engine_t *engine, jack_client_id_t id) | |||
| { | |||
| jack_client_internal_t *client; | |||
| GSList *node; | |||
| JSList *node; | |||
| int ret = -1; | |||
| jack_lock_graph (engine); | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| if (((jack_client_internal_t *) node->data)->control->id == id) { | |||
| @@ -1008,19 +1008,19 @@ static void | |||
| jack_client_disconnect (jack_engine_t *engine, jack_client_internal_t *client) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_port_internal_t *port; | |||
| /* call tree **** MUST HOLD *** engine->client_lock */ | |||
| for (node = client->ports; node; node = g_slist_next (node)) { | |||
| for (node = client->ports; node; node = jack_slist_next (node)) { | |||
| port = (jack_port_internal_t *) node->data; | |||
| jack_port_clear_connections (engine, port); | |||
| jack_port_release (engine, port); | |||
| } | |||
| g_slist_free (client->ports); | |||
| g_slist_free (client->fed_by); | |||
| jack_slist_free (client->ports); | |||
| jack_slist_free (client->fed_by); | |||
| client->fed_by = 0; | |||
| client->ports = 0; | |||
| } | |||
| @@ -1029,18 +1029,18 @@ static int | |||
| jack_client_deactivate (jack_engine_t *engine, jack_client_id_t id) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| int ret = -1; | |||
| jack_lock_graph (engine); | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| jack_client_internal_t *client = (jack_client_internal_t *) node->data; | |||
| if (client->control->id == id) { | |||
| GSList *portnode; | |||
| JSList *portnode; | |||
| jack_port_internal_t *port; | |||
| if (client == engine->timebase_client) { | |||
| @@ -1051,7 +1051,7 @@ jack_client_deactivate (jack_engine_t *engine, jack_client_id_t id) | |||
| engine->control->pending_time.transport_state = JackTransportStopped; | |||
| } | |||
| for (portnode = client->ports; portnode; portnode = g_slist_next (portnode)) { | |||
| for (portnode = client->ports; portnode; portnode = jack_slist_next (portnode)) { | |||
| port = (jack_port_internal_t *) portnode->data; | |||
| jack_port_clear_connections (engine, port); | |||
| } | |||
| @@ -1086,11 +1086,11 @@ static int | |||
| handle_client_jack_error (jack_engine_t *engine, int fd) | |||
| { | |||
| jack_client_internal_t *client = 0; | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_lock_graph (engine); | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| if (((jack_client_internal_t *) node->data)->request_fd == fd) { | |||
| client = (jack_client_internal_t *) node->data; | |||
| client->error++; | |||
| @@ -1109,12 +1109,12 @@ handle_client_request (jack_engine_t *engine, int fd) | |||
| jack_request_t req; | |||
| jack_client_internal_t *client = 0; | |||
| int reply_fd; | |||
| GSList *node; | |||
| JSList *node; | |||
| int might_reorder = FALSE; | |||
| jack_lock_graph (engine); | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| if (((jack_client_internal_t *) node->data)->request_fd == fd) { | |||
| client = (jack_client_internal_t *) node->data; | |||
| break; | |||
| @@ -1545,13 +1545,13 @@ jack_start_watchdog (jack_engine_t *engine) | |||
| static void | |||
| jack_engine_notify_clients_about_delay (jack_engine_t *engine) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_event_t event; | |||
| event.type = XRun; | |||
| jack_lock_graph (engine); | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| jack_deliver_event (engine, (jack_client_internal_t *) node->data, &event); | |||
| } | |||
| jack_unlock_graph (engine); | |||
| @@ -1859,10 +1859,10 @@ jack_client_internal_new (jack_engine_t *engine, int fd, jack_client_connect_req | |||
| static void | |||
| jack_port_clear_connections (jack_engine_t *engine, jack_port_internal_t *port) | |||
| { | |||
| GSList *node, *next; | |||
| JSList *node, *next; | |||
| for (node = port->connections; node; ) { | |||
| next = g_slist_next (node); | |||
| next = jack_slist_next (node); | |||
| jack_port_disconnect_internal (engine, | |||
| ((jack_connection_internal_t *) node->data)->source, | |||
| ((jack_connection_internal_t *) node->data)->destination, | |||
| @@ -1870,14 +1870,14 @@ jack_port_clear_connections (jack_engine_t *engine, jack_port_internal_t *port) | |||
| node = next; | |||
| } | |||
| g_slist_free (port->connections); | |||
| jack_slist_free (port->connections); | |||
| port->connections = 0; | |||
| } | |||
| static void | |||
| jack_remove_client (jack_engine_t *engine, jack_client_internal_t *client) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| int i; | |||
| @@ -1906,10 +1906,10 @@ jack_remove_client (jack_engine_t *engine, jack_client_internal_t *client) | |||
| close (client->event_fd); | |||
| close (client->request_fd); | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| if (((jack_client_internal_t *) node->data)->control->id == client->control->id) { | |||
| engine->clients = g_slist_remove_link (engine->clients, node); | |||
| g_slist_free_1 (node); | |||
| engine->clients = jack_slist_remove_link (engine->clients, node); | |||
| jack_slist_free_1 (node); | |||
| break; | |||
| } | |||
| } | |||
| @@ -1951,11 +1951,11 @@ jack_client_by_name (jack_engine_t *engine, const char *name) | |||
| { | |||
| jack_client_internal_t *client = NULL; | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_lock_graph (engine); | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| if (strcmp ((const char *) ((jack_client_internal_t *) node->data)->control->name, name) == 0) { | |||
| client = (jack_client_internal_t *) node->data; | |||
| break; | |||
| @@ -1971,11 +1971,11 @@ jack_client_internal_by_id (jack_engine_t *engine, jack_client_id_t id) | |||
| { | |||
| jack_client_internal_t *client = NULL; | |||
| GSList *node; | |||
| JSList *node; | |||
| /* call tree ***MUST HOLD*** engine->client_lock */ | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| if (((jack_client_internal_t *) node->data)->control->id == id) { | |||
| client = (jack_client_internal_t *) node->data; | |||
| break; | |||
| @@ -2065,7 +2065,7 @@ jack_deliver_event (jack_engine_t *engine, jack_client_internal_t *client, jack_ | |||
| int | |||
| jack_rechain_graph (jack_engine_t *engine) | |||
| { | |||
| GSList *node, *next; | |||
| JSList *node, *next; | |||
| unsigned long n; | |||
| int err = 0; | |||
| jack_client_internal_t *client, *subgraph_client, *next_client; | |||
| @@ -2083,7 +2083,7 @@ jack_rechain_graph (jack_engine_t *engine) | |||
| for (n = 0, node = engine->clients, next = NULL; node; node = next) { | |||
| next = g_slist_next (node); | |||
| next = jack_slist_next (node); | |||
| if (((jack_client_internal_t *) node->data)->control->active) { | |||
| @@ -2095,7 +2095,7 @@ jack_rechain_graph (jack_engine_t *engine) | |||
| if (((jack_client_internal_t *) next->data)->control->active) { | |||
| break; | |||
| } | |||
| next = g_slist_next (next); | |||
| next = jack_slist_next (next); | |||
| }; | |||
| if (next == NULL) { | |||
| @@ -2193,20 +2193,20 @@ jack_trace_terminal (jack_client_internal_t *c1, jack_client_internal_t *rbase) | |||
| modified as we progress ... | |||
| */ | |||
| GSList *existing; | |||
| GSList *node; | |||
| JSList *existing; | |||
| JSList *node; | |||
| if (c1->fed_by == NULL) { | |||
| return; | |||
| } | |||
| existing = g_slist_copy (c1->fed_by); | |||
| existing = jack_slist_copy (c1->fed_by); | |||
| /* for each route that feeds c1, recurse, marking it as feeding | |||
| rbase as well. | |||
| */ | |||
| for (node = existing; node; node = g_slist_next (node)) { | |||
| for (node = existing; node; node = jack_slist_next (node)) { | |||
| c2 = (jack_client_internal_t *) node->data; | |||
| @@ -2217,15 +2217,15 @@ jack_trace_terminal (jack_client_internal_t *c1, jack_client_internal_t *rbase) | |||
| if (c2 != rbase && c2 != c1) { | |||
| if (g_slist_find (rbase->fed_by, c2) == NULL) { | |||
| rbase->fed_by = g_slist_prepend (rbase->fed_by, c2); | |||
| if (jack_slist_find (rbase->fed_by, c2) == NULL) { | |||
| rbase->fed_by = jack_slist_prepend (rbase->fed_by, c2); | |||
| } | |||
| /* FIXME: if c2->fed_by is not up-to-date, we may end up | |||
| recursing infinitely (kaiv) | |||
| */ | |||
| if (g_slist_find (c2->fed_by, c1) == NULL) { | |||
| if (jack_slist_find (c2->fed_by, c1) == NULL) { | |||
| /* now recurse, so that we can mark base as being fed by | |||
| all routes that feed c2 | |||
| */ | |||
| @@ -2234,16 +2234,16 @@ jack_trace_terminal (jack_client_internal_t *c1, jack_client_internal_t *rbase) | |||
| } | |||
| } | |||
| g_slist_free (existing); | |||
| jack_slist_free (existing); | |||
| } | |||
| static int | |||
| jack_client_sort (jack_client_internal_t *a, jack_client_internal_t *b) | |||
| { | |||
| if (g_slist_find (a->fed_by, b)) { | |||
| if (jack_slist_find (a->fed_by, b)) { | |||
| if (g_slist_find (b->fed_by, a)) { | |||
| if (jack_slist_find (b->fed_by, a)) { | |||
| /* feedback loop: if `a' is the driver | |||
| client, let that execute first. | |||
| @@ -2258,9 +2258,9 @@ jack_client_sort (jack_client_internal_t *a, jack_client_internal_t *b) | |||
| /* a comes after b */ | |||
| return 1; | |||
| } else if (g_slist_find (b->fed_by, a)) { | |||
| } else if (jack_slist_find (b->fed_by, a)) { | |||
| if (g_slist_find (a->fed_by, b)) { | |||
| if (jack_slist_find (a->fed_by, b)) { | |||
| /* feedback loop: if `b' is the driver | |||
| client, let that execute first. | |||
| @@ -2283,18 +2283,18 @@ jack_client_sort (jack_client_internal_t *a, jack_client_internal_t *b) | |||
| static int | |||
| jack_client_feeds (jack_client_internal_t *might, jack_client_internal_t *target) | |||
| { | |||
| GSList *pnode, *cnode; | |||
| JSList *pnode, *cnode; | |||
| /* Check every port of `might' for an outbound connection to `target' | |||
| */ | |||
| for (pnode = might->ports; pnode; pnode = g_slist_next (pnode)) { | |||
| for (pnode = might->ports; pnode; pnode = jack_slist_next (pnode)) { | |||
| jack_port_internal_t *port; | |||
| port = (jack_port_internal_t *) pnode->data; | |||
| for (cnode = port->connections; cnode; cnode = g_slist_next (cnode)) { | |||
| for (cnode = port->connections; cnode; cnode = jack_slist_next (cnode)) { | |||
| jack_connection_internal_t *c; | |||
| @@ -2313,7 +2313,7 @@ jack_client_feeds (jack_client_internal_t *might, jack_client_internal_t *target | |||
| static jack_nframes_t | |||
| jack_get_port_total_latency (jack_engine_t *engine, jack_port_internal_t *port, int hop_count) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_nframes_t latency; | |||
| jack_nframes_t max_latency = 0; | |||
| @@ -2329,7 +2329,7 @@ jack_get_port_total_latency (jack_engine_t *engine, jack_port_internal_t *port, | |||
| return latency; | |||
| } | |||
| for (node = port->connections; node; node = g_slist_next (node)) { | |||
| for (node = port->connections; node; node = jack_slist_next (node)) { | |||
| jack_nframes_t this_latency; | |||
| jack_connection_internal_t *connection; | |||
| @@ -2405,35 +2405,35 @@ jack_compute_all_port_total_latencies (jack_engine_t *engine) | |||
| static void | |||
| jack_sort_graph (jack_engine_t *engine) | |||
| { | |||
| GSList *node, *onode; | |||
| JSList *node, *onode; | |||
| jack_client_internal_t *client; | |||
| jack_client_internal_t *oclient; | |||
| /* called, obviously, must hold engine->client_lock */ | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| client = (jack_client_internal_t *) node->data; | |||
| g_slist_free (client->fed_by); | |||
| jack_slist_free (client->fed_by); | |||
| client->fed_by = 0; | |||
| for (onode = engine->clients; onode; onode = g_slist_next (onode)) { | |||
| for (onode = engine->clients; onode; onode = jack_slist_next (onode)) { | |||
| oclient = (jack_client_internal_t *) onode->data; | |||
| if (jack_client_feeds (oclient, client)) { | |||
| client->fed_by = g_slist_prepend (client->fed_by, oclient); | |||
| client->fed_by = jack_slist_prepend (client->fed_by, oclient); | |||
| } | |||
| } | |||
| } | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| jack_trace_terminal ((jack_client_internal_t *) node->data, | |||
| (jack_client_internal_t *) node->data); | |||
| } | |||
| engine->clients = g_slist_sort (engine->clients, (GCompareFunc) jack_client_sort); | |||
| engine->clients = jack_slist_sort (engine->clients, (JCompareFunc) jack_client_sort); | |||
| jack_compute_all_port_total_latencies (engine); | |||
| @@ -2445,7 +2445,7 @@ jack_sort_graph (jack_engine_t *engine) | |||
| */ | |||
| void jack_dump_configuration(jack_engine_t *engine, int take_lock) | |||
| { | |||
| GSList *clientnode, *portnode, *connectionnode; | |||
| JSList *clientnode, *portnode, *connectionnode; | |||
| jack_client_internal_t *client; | |||
| jack_client_control_t *ctl; | |||
| jack_port_internal_t *port; | |||
| @@ -2458,7 +2458,7 @@ void jack_dump_configuration(jack_engine_t *engine, int take_lock) | |||
| jack_lock_graph (engine); | |||
| } | |||
| for (n = 0, clientnode = engine->clients; clientnode; clientnode = g_slist_next (clientnode)) { | |||
| for (n = 0, clientnode = engine->clients; clientnode; clientnode = jack_slist_next (clientnode)) { | |||
| client = (jack_client_internal_t *) clientnode->data; | |||
| ctl = client->control; | |||
| @@ -2467,18 +2467,18 @@ void jack_dump_configuration(jack_engine_t *engine, int take_lock) | |||
| ctl->name, | |||
| ctl->type, | |||
| ctl->process ? "yes" : "no", | |||
| g_slist_length(client->fed_by), | |||
| jack_slist_length(client->fed_by), | |||
| client->subgraph_start_fd, | |||
| client->subgraph_wait_fd); | |||
| for(m = 0, portnode = client->ports; portnode; portnode = g_slist_next (portnode)) { | |||
| for(m = 0, portnode = client->ports; portnode; portnode = jack_slist_next (portnode)) { | |||
| port = (jack_port_internal_t *) portnode->data; | |||
| fprintf(stderr, "\t port #%d: %s\n", ++m, port->shared->name); | |||
| for(o = 0, connectionnode = port->connections; | |||
| connectionnode; | |||
| connectionnode = g_slist_next (connectionnode)) { | |||
| connectionnode = jack_slist_next (connectionnode)) { | |||
| connection = (jack_connection_internal_t *) connectionnode->data; | |||
| fprintf(stderr, "\t\t connection #%d: %s %s\n", | |||
| @@ -2567,8 +2567,8 @@ jack_port_do_connect (jack_engine_t *engine, | |||
| dstport->shared->name); | |||
| } | |||
| dstport->connections = g_slist_prepend (dstport->connections, connection); | |||
| srcport->connections = g_slist_prepend (srcport->connections, connection); | |||
| dstport->connections = jack_slist_prepend (dstport->connections, connection); | |||
| srcport->connections = jack_slist_prepend (srcport->connections, connection); | |||
| jack_sort_graph (engine); | |||
| @@ -2589,14 +2589,14 @@ jack_port_disconnect_internal (jack_engine_t *engine, | |||
| int sort_graph) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_connection_internal_t *connect; | |||
| int ret = -1; | |||
| jack_port_id_t src_id, dst_id; | |||
| /* call tree **** MUST HOLD **** engine->client_lock. */ | |||
| for (node = srcport->connections; node; node = g_slist_next (node)) { | |||
| for (node = srcport->connections; node; node = jack_slist_next (node)) { | |||
| connect = (jack_connection_internal_t *) node->data; | |||
| @@ -2608,8 +2608,8 @@ jack_port_disconnect_internal (jack_engine_t *engine, | |||
| dstport->shared->name); | |||
| } | |||
| srcport->connections = g_slist_remove (srcport->connections, connect); | |||
| dstport->connections = g_slist_remove (dstport->connections, connect); | |||
| srcport->connections = jack_slist_remove (srcport->connections, connect); | |||
| dstport->connections = jack_slist_remove (dstport->connections, connect); | |||
| src_id = srcport->shared->id; | |||
| dst_id = dstport->shared->id; | |||
| @@ -2820,7 +2820,7 @@ jack_port_release (jack_engine_t *engine, jack_port_internal_t *port) | |||
| if (port->buffer_info) { | |||
| pthread_mutex_lock (&engine->buffer_lock); | |||
| engine->port_buffer_freelist = g_slist_prepend (engine->port_buffer_freelist, port->buffer_info); | |||
| engine->port_buffer_freelist = jack_slist_prepend (engine->port_buffer_freelist, port->buffer_info); | |||
| port->buffer_info = NULL; | |||
| pthread_mutex_unlock (&engine->buffer_lock); | |||
| } | |||
| @@ -2892,7 +2892,7 @@ jack_port_do_register (jack_engine_t *engine, jack_request_t *req) | |||
| } | |||
| jack_lock_graph (engine); | |||
| client->ports = g_slist_prepend (client->ports, port); | |||
| client->ports = jack_slist_prepend (client->ports, port); | |||
| jack_port_registration_notify (engine, port_id, TRUE); | |||
| jack_unlock_graph (engine); | |||
| @@ -2936,7 +2936,7 @@ jack_port_do_unregister (jack_engine_t *engine, jack_request_t *req) | |||
| jack_port_clear_connections (engine, port); | |||
| jack_port_release (engine, &engine->internal_ports[req->x.port_info.port_id]); | |||
| client->ports = g_slist_remove (client->ports, port); | |||
| client->ports = jack_slist_remove (client->ports, port); | |||
| jack_port_registration_notify (engine, req->x.port_info.port_id, FALSE); | |||
| jack_unlock_graph (engine); | |||
| @@ -2949,12 +2949,12 @@ jack_port_registration_notify (jack_engine_t *engine, jack_port_id_t port_id, in | |||
| { | |||
| jack_event_t event; | |||
| jack_client_internal_t *client; | |||
| GSList *node; | |||
| JSList *node; | |||
| event.type = (yn ? PortRegistered : PortUnregistered); | |||
| event.x.port_id = port_id; | |||
| for (node = engine->clients; node; node = g_slist_next (node)) { | |||
| for (node = engine->clients; node; node = jack_slist_next (node)) { | |||
| client = (jack_client_internal_t *) node->data; | |||
| @@ -2974,7 +2974,7 @@ jack_port_registration_notify (jack_engine_t *engine, jack_port_id_t port_id, in | |||
| int | |||
| jack_port_assign_buffer (jack_engine_t *engine, jack_port_internal_t *port) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_port_segment_info_t *psi = 0; | |||
| jack_port_buffer_info_t *bi; | |||
| @@ -2995,7 +2995,7 @@ jack_port_assign_buffer (jack_engine_t *engine, jack_port_internal_t *port) | |||
| bi = (jack_port_buffer_info_t *) engine->port_buffer_freelist->data; | |||
| for (node = engine->port_segments; node; node = g_slist_next (node)) { | |||
| for (node = engine->port_segments; node; node = jack_slist_next (node)) { | |||
| psi = (jack_port_segment_info_t *) node->data; | |||
| @@ -3016,7 +3016,7 @@ jack_port_assign_buffer (jack_engine_t *engine, jack_port_internal_t *port) | |||
| } | |||
| if (port->shared->shm_key >= 0) { | |||
| engine->port_buffer_freelist = g_slist_remove (engine->port_buffer_freelist, bi); | |||
| engine->port_buffer_freelist = jack_slist_remove (engine->port_buffer_freelist, bi); | |||
| } else { | |||
| jack_error ("port segment info for 0x%x:%d not found!", bi->shm_key, bi->offset); | |||
| @@ -1,25 +1,14 @@ | |||
| MAINTAINERCLEANFILES = Makefile.in | |||
| if HAVE_GLIB2 | |||
| LIBJACK_GLIB2 = libjack-glib2.la | |||
| endif | |||
| SOURCE_FILES = client.c pool.c driver.c | |||
| lib_LTLIBRARIES = libjack.la $(LIBJACK_GLIB2) | |||
| lib_LTLIBRARIES = libjack.la | |||
| AM_CFLAGS = $(JACK_CFLAGS) | |||
| AM_CXXFLAGS = $(JACK_CFLAGS) | |||
| libjack_la_CFLAGS = $(GLIB_CFLAGS) $(AM_CFLAGS) | |||
| libjack_glib2_la_CFLAGS = $(GLIB2_CFLAGS) $(AM_CFLAGS) | |||
| libjack_la_CFLAGS = $(AM_CFLAGS) | |||
| libjack_la_SOURCES = $(SOURCE_FILES) | |||
| libjack_la_LIBADD = $(GLIB_LIBS) -lm -lpthread | |||
| libjack_la_LIBADD = -lm -lpthread | |||
| libjack_la_LDFLAGS = -export-dynamic -version-info @JACK_SO_VERSION@ | |||
| libjack_glib2_la_SOURCES = $(SOURCE_FILES) | |||
| libjack_glib2_la_LIBADD = $(GLIB2_LIBS) -lm -lpthread | |||
| libjack_glib2_la_LDFLAGS = -export-dynamic -version-info @JACK_SO_VERSION@ | |||
| @@ -41,6 +41,7 @@ | |||
| #include <jack/pool.h> | |||
| #include <jack/error.h> | |||
| #include <jack/cycles.h> | |||
| #include <jack/jslist.h> | |||
| char *jack_temp_dir = "/tmp"; | |||
| @@ -71,8 +72,8 @@ struct _jack_client { | |||
| int pollmax; | |||
| int graph_next_fd; | |||
| int request_fd; | |||
| GSList *port_segments; | |||
| GSList *ports; | |||
| JSList *port_segments; | |||
| JSList *ports; | |||
| pthread_t thread; | |||
| char fifo_prefix[PATH_MAX+1]; | |||
| void (*on_shutdown)(void *arg); | |||
| @@ -140,9 +141,9 @@ jack_port_by_id (jack_client_t *client, jack_port_id_t id) | |||
| if (client->engine->ports[id].in_use) | |||
| return jack_port_new (client, id, client->engine); | |||
| */ | |||
| GSList *node; | |||
| JSList *node; | |||
| for (node = client->ports; node; node = g_slist_next (node)) { | |||
| for (node = client->ports; node; node = jack_slist_next (node)) { | |||
| if (((jack_port_t *) node->data)->shared->id == id) { | |||
| return (jack_port_t *) node->data; | |||
| } | |||
| @@ -173,7 +174,7 @@ static void | |||
| jack_client_invalidate_port_buffers (jack_client_t *client) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_port_t *port; | |||
| /* This releases all local memory owned by input ports | |||
| @@ -182,7 +183,7 @@ jack_client_invalidate_port_buffers (jack_client_t *client) | |||
| buffer on the next call (if there is one). | |||
| */ | |||
| for (node = client->ports; node; node = g_slist_next (node)) { | |||
| for (node = client->ports; node; node = jack_slist_next (node)) { | |||
| port = (jack_port_t *) node->data; | |||
| if (port->shared->flags & JackPortIsInput) { | |||
| @@ -201,14 +202,14 @@ jack_client_handle_port_connection (jack_client_t *client, jack_event_t *event) | |||
| { | |||
| jack_port_t *control_port; | |||
| jack_port_t *other; | |||
| GSList *node; | |||
| JSList *node; | |||
| switch (event->type) { | |||
| case PortConnected: | |||
| other = jack_port_new (client, event->y.other_id, client->engine); | |||
| control_port = jack_port_by_id (client, event->x.self_id); | |||
| pthread_mutex_lock (&control_port->connection_lock); | |||
| control_port->connections = g_slist_prepend (control_port->connections, other); | |||
| control_port->connections = jack_slist_prepend (control_port->connections, (void*)other); | |||
| pthread_mutex_unlock (&control_port->connection_lock); | |||
| break; | |||
| @@ -217,13 +218,13 @@ jack_client_handle_port_connection (jack_client_t *client, jack_event_t *event) | |||
| pthread_mutex_lock (&control_port->connection_lock); | |||
| for (node = control_port->connections; node; node = g_slist_next (node)) { | |||
| for (node = control_port->connections; node; node = jack_slist_next (node)) { | |||
| other = (jack_port_t *) node->data; | |||
| if (other->shared->id == event->y.other_id) { | |||
| control_port->connections = g_slist_remove_link (control_port->connections, node); | |||
| g_slist_free_1 (node); | |||
| control_port->connections = jack_slist_remove_link (control_port->connections, node); | |||
| jack_slist_free_1 (node); | |||
| free (other); | |||
| break; | |||
| } | |||
| @@ -300,7 +301,7 @@ server_connect (int which) | |||
| } | |||
| addr.sun_family = AF_UNIX; | |||
| g_snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_%d", jack_temp_dir, which); | |||
| snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_%d", jack_temp_dir, which); | |||
| if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { | |||
| jack_error ("cannot connect to jack server", strerror (errno)); | |||
| @@ -326,7 +327,7 @@ server_event_connect (jack_client_t *client) | |||
| } | |||
| addr.sun_family = AF_UNIX; | |||
| g_snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_ack_0", jack_temp_dir); | |||
| snprintf (addr.sun_path, sizeof (addr.sun_path) - 1, "%s/jack_ack_0", jack_temp_dir); | |||
| if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { | |||
| jack_error ("cannot connect to jack server for events", strerror (errno)); | |||
| @@ -447,7 +448,7 @@ jack_client_new (const char *client_name) | |||
| jack_zero_filled_buffer = si->address; | |||
| } | |||
| client->port_segments = g_slist_prepend (client->port_segments, si); | |||
| client->port_segments = jack_slist_prepend (client->port_segments, si); | |||
| /* attach the engine control/info block */ | |||
| @@ -937,7 +938,7 @@ int | |||
| jack_client_close (jack_client_t *client) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| void *status; | |||
| /* stop the thread that communicates with the jack server */ | |||
| @@ -948,16 +949,16 @@ jack_client_close (jack_client_t *client) | |||
| shmdt ((char *) client->control); | |||
| shmdt (client->engine); | |||
| for (node = client->port_segments; node; node = g_slist_next (node)) { | |||
| for (node = client->port_segments; node; node = jack_slist_next (node)) { | |||
| shmdt (((jack_port_segment_info_t *) node->data)->address); | |||
| free (node->data); | |||
| } | |||
| g_slist_free (client->port_segments); | |||
| jack_slist_free (client->port_segments); | |||
| for (node = client->ports; node; node = g_slist_next (node)) { | |||
| for (node = client->ports; node; node = jack_slist_next (node)) { | |||
| free (node->data); | |||
| } | |||
| g_slist_free (client->ports); | |||
| jack_slist_free (client->ports); | |||
| if (client->graph_wait_fd) { | |||
| close (client->graph_wait_fd); | |||
| @@ -1080,7 +1081,7 @@ jack_driver_become_client (const char *client_name) | |||
| jack_zero_filled_buffer = si->address; | |||
| } | |||
| client->port_segments = g_slist_prepend (client->port_segments, si); | |||
| client->port_segments = jack_slist_prepend (client->port_segments, si); | |||
| /* allow the engine to act on the client's behalf | |||
| when dealing with in-process clients. | |||
| @@ -1110,7 +1111,7 @@ jack_port_new (jack_client_t *client, jack_port_id_t port_id, jack_control_t *co | |||
| jack_port_t *port; | |||
| jack_port_shared_t *shared; | |||
| jack_port_segment_info_t *si; | |||
| GSList *node; | |||
| JSList *node; | |||
| shared = &control->ports[port_id]; | |||
| @@ -1124,7 +1125,7 @@ jack_port_new (jack_client_t *client, jack_port_id_t port_id, jack_control_t *co | |||
| si = NULL; | |||
| for (node = client->port_segments; node; node = g_slist_next (node)) { | |||
| for (node = client->port_segments; node; node = jack_slist_next (node)) { | |||
| si = (jack_port_segment_info_t *) node->data; | |||
| @@ -1208,7 +1209,7 @@ jack_port_register (jack_client_t *client, | |||
| memcpy (&port->shared->type_info, type_info, sizeof (jack_port_type_info_t)); | |||
| client->ports = g_slist_prepend (client->ports, port); | |||
| client->ports = jack_slist_prepend (client->ports, port); | |||
| return port; | |||
| } | |||
| @@ -1367,7 +1368,7 @@ void * | |||
| jack_port_get_buffer (jack_port_t *port, jack_nframes_t nframes) | |||
| { | |||
| GSList *node, *next; | |||
| JSList *node, *next; | |||
| /* Output port. The buffer was assigned by the engine | |||
| when the port was registered. | |||
| @@ -1396,7 +1397,7 @@ jack_port_get_buffer (jack_port_t *port, jack_nframes_t nframes) | |||
| return jack_zero_filled_buffer; | |||
| } | |||
| if ((next = g_slist_next (node)) == NULL) { | |||
| if ((next = jack_slist_next (node)) == NULL) { | |||
| /* one connection: use zero-copy mode - just pass | |||
| the buffer of the connected (output) port. | |||
| @@ -1584,14 +1585,14 @@ jack_port_request_monitor (jack_port_t *port, int onoff) | |||
| if ((port->shared->flags & JackPortIsOutput) == 0) { | |||
| GSList *node; | |||
| JSList *node; | |||
| /* this port is for input, so recurse over each of the | |||
| connected ports. | |||
| */ | |||
| pthread_mutex_lock (&port->connection_lock); | |||
| for (node = port->connections; node; node = g_slist_next (node)) { | |||
| for (node = port->connections; node; node = jack_slist_next (node)) { | |||
| /* drop the lock because if there is a feedback loop, | |||
| we will deadlock. XXX much worse things will | |||
| @@ -1822,7 +1823,7 @@ jack_port_unlock (jack_client_t *client, jack_port_t *port) | |||
| static void | |||
| jack_audio_port_mixdown (jack_port_t *port, jack_nframes_t nframes) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| jack_port_t *input; | |||
| jack_nframes_t n; | |||
| jack_default_audio_sample_t *buffer; | |||
| @@ -1844,7 +1845,7 @@ jack_audio_port_mixdown (jack_port_t *port, jack_nframes_t nframes) | |||
| memcpy (buffer, jack_port_buffer (input), sizeof (jack_default_audio_sample_t) * nframes); | |||
| for (node = g_slist_next (node); node; node = g_slist_next (node)) { | |||
| for (node = jack_slist_next (node); node; node = jack_slist_next (node)) { | |||
| input = (jack_port_t *) node->data; | |||
| @@ -1862,7 +1863,7 @@ const char ** | |||
| jack_port_get_connections (const jack_port_t *port) | |||
| { | |||
| const char **ret; | |||
| GSList *node; | |||
| JSList *node; | |||
| unsigned int n; | |||
| pthread_mutex_lock (&((jack_port_t *) port)->connection_lock); | |||
| @@ -1872,9 +1873,9 @@ jack_port_get_connections (const jack_port_t *port) | |||
| return NULL; | |||
| } | |||
| ret = (const char **) malloc (sizeof (char *) * (g_slist_length (port->connections) + 1)); | |||
| ret = (const char **) malloc (sizeof (char *) * (jack_slist_length (port->connections) + 1)); | |||
| for (n = 0, node = port->connections; node; node = g_slist_next (node), n++) { | |||
| for (n = 0, node = port->connections; node; node = jack_slist_next (node), n++) { | |||
| ret[n] = ((jack_port_t *) node->data)->shared->name; | |||
| } | |||
| @@ -1894,12 +1895,12 @@ jack_port_connected (const jack_port_t *port) | |||
| int | |||
| jack_port_connected_to (const jack_port_t *port, const char *portname) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| int ret = FALSE; | |||
| pthread_mutex_lock (&((jack_port_t *) port)->connection_lock); | |||
| for (node = port->connections; node; node = g_slist_next (node)) { | |||
| for (node = port->connections; node; node = jack_slist_next (node)) { | |||
| jack_port_t *other_port = (jack_port_t *) node->data; | |||
| if (strcmp (other_port->shared->name, portname) == 0) { | |||
| @@ -1915,12 +1916,12 @@ jack_port_connected_to (const jack_port_t *port, const char *portname) | |||
| int | |||
| jack_port_connected_to_port (const jack_port_t *port, const jack_port_t *other_port) | |||
| { | |||
| GSList *node; | |||
| JSList *node; | |||
| int ret = FALSE; | |||
| pthread_mutex_lock (&((jack_port_t *) port)->connection_lock); | |||
| for (node = port->connections; node; node = g_slist_next (node)) { | |||
| for (node = port->connections; node; node = jack_slist_next (node)) { | |||
| jack_port_t *this_port = (jack_port_t *) node->data; | |||