diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-12 21:53:27 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-12 21:53:27 +0000 |
commit | 8f0a937d016e2e55f09d30836ace8e76cc952cd7 (patch) | |
tree | 8cc085c27613bf5b531caaa9f6b2d94770d1b314 | |
parent | b76635a8fd57adab6064b090736bae14af49624c (diff) |
add run-time tests for weak-linked symbols from JACK (e.g. functions added to the API since 0.116.2) so that we can avoid using them if running on a platform with an older version of JACK
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6075 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/audioengine.cc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 9c7789eb06..497ebe069b 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -48,6 +48,19 @@ AudioEngine* AudioEngine::_instance = 0; #define GET_PRIVATE_JACK_POINTER(j) jack_client_t* _priv_jack = (jack_client_t*) (j); if (!_priv_jack) { return; } #define GET_PRIVATE_JACK_POINTER_RET(j,r) jack_client_t* _priv_jack = (jack_client_t*) (j); if (!_priv_jack) { return r; } +typedef void (*_JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg); + +static void (*on_info_shutdown)(jack_client_t*, _JackInfoShutdownCallback, void *); +extern void jack_on_info_shutdown (jack_client_t*, _JackInfoShutdownCallback, void *) __attribute__((weak_import)); + +static void check_jack_symbols () __attribute__((constructor)); + +void check_jack_symbols () +{ + /* use weak linking to see if we really have various late-model JACK function */ + on_info_shutdown = jack_on_info_shutdown; +} + static void ardour_jack_error (const char* msg) { @@ -141,11 +154,12 @@ AudioEngine::start () _processed_frames = 0; last_monitor_check = 0; -#ifdef HAVE_JACK_ON_INFO_SHUTDOWN - jack_on_info_shutdown (_priv_jack, halted_info, this); -#else - jack_on_shutdown (_priv_jack, halted, this); -#endif + if (on_info_shutdown) { + on_info_shutdown (_priv_jack, halted_info, this); + } else { + jack_on_shutdown (_priv_jack, halted, this); + } + jack_set_graph_order_callback (_priv_jack, _graph_order_callback, this); jack_set_thread_init_callback (_priv_jack, _thread_init_callback, this); jack_set_process_callback (_priv_jack, _process_callback, this); |