From 7783f087bcdbf5fff778ca5e6d925a8891b44b65 Mon Sep 17 00:00:00 2001 From: joq Date: Fri, 22 Aug 2003 19:10:47 +0000 Subject: [PATCH] [0.78.3] ignore old-style timebase masters git-svn-id: svn+ssh://jackaudio.org/trunk/jack@460 0c269be4-1314-0410-8aa9-9f06e86f4224 --- configure.in | 2 +- doc/transport.dox | 31 ++++++++++++++++++------------- jack/internal.h | 2 +- jack/jack.h | 14 ++++++-------- jack/transport.h | 13 +++---------- jackd/engine.c | 1 - jackd/transengine.c | 4 ++-- libjack/transclient.c | 19 +++++++++++++++++-- 8 files changed, 48 insertions(+), 38 deletions(-) diff --git a/configure.in b/configure.in index 8aa2bb9..31f9049 100644 --- a/configure.in +++ b/configure.in @@ -14,7 +14,7 @@ dnl changes are made dnl --- JACK_MAJOR_VERSION=0 JACK_MINOR_VERSION=78 -JACK_MICRO_VERSION=2 +JACK_MICRO_VERSION=3 dnl --- dnl HOWTO: updating the jack protocal version diff --git a/doc/transport.dox b/doc/transport.dox index 737fb31..957b831 100644 --- a/doc/transport.dox +++ b/doc/transport.dox @@ -41,7 +41,7 @@ are in - We want a way for clients with heavyweight state to sync up when the user presses "play", before the transport starts rolling. - - We need to provide for ongoing binary compatibility as the + - We want to provide for ongoing binary compatibility as the transport design evolves. @@ -52,7 +52,8 @@ The former transport master role has been divided into two layers: - @ref timebase - counting beats, frames, etc. on every cycle. - @ref transportcontrol - start, stop and reposition the playback. -Existing clients continue to work in compatibility mode. +Existing transport clients continue to work in compatibility mode. +But, old-style timebase masters will no longer control the transport. @subsection timebase Timebase Master @@ -171,7 +172,6 @@ will enter the ::JackTransportStarting state and begin invoking their @image html fsm.png "Transport State Transition Diagram" -@image latex fsm.png "Transport State Transition Diagram" @subsection transportclients Transport Clients @@ -191,27 +191,35 @@ cycle and the state returned is valid for the entire cycle. @subsection compatibility Compatibility -We want to support the existing functions in compatibility mode as -deprecated interfaces for a while. The main reasons are: +During the transition period we will support the old-style interfaces +in compatibility mode as deprecated interfaces. This compatibility is +not 100%, there are limitations. + +The main reasons for doing this are: - facilitate testing with clients that already have transport support - provide a clean migration path, so application developers are not discouraged from supporting the transport interface - - inter-operate with ardour 0.9 beta. -So, these interfaces continue to be supported (but deprecated): +These deprecated interfaces continue to work: @code typedef struct jack_transport_info_t; - void jack_set_transport_info (jack_client_t *client, - jack_transport_info_t *tinfo); void jack_get_transport_info (jack_client_t *client, jack_transport_info_t *tinfo); - int jack_engine_takeover_timebase (jack_client_t *); @endcode +Unfortunately, the old-style timebase master interface cannot coexist +cleanly with such new features as jack_transport_locate() and +slow-sync clients. So, these interfaces are only present as stubs: + +@code + void jack_set_transport_info (jack_client_t *client, + jack_transport_info_t *tinfo); + int jack_engine_takeover_timebase (jack_client_t *); +@endcode For compatibility with future changes, it would be good to avoid structures entirely. Nevertheless, the jack_position_t structure @@ -238,7 +246,4 @@ will probably not be included in JACK release 1.0. are addressed there's no reason to retain those two SMPTE fields in the jack_position_t structure. - looping -- unless we get feedback that this is really required - - internal timebase master or slow-sync clients - - probably a good idea - - haven't studied it */ diff --git a/jack/internal.h b/jack/internal.h index 31424bf..9ae5137 100644 --- a/jack/internal.h +++ b/jack/internal.h @@ -103,6 +103,7 @@ typedef struct { jack_position_t pending_time; /* position for next cycle */ jack_position_t request_time; /* latest requested position */ jack_unique_t prev_request; /* previous request unique ID */ + volatile int seq_number; /* unique ID sequence number */ int new_pos; /* new position this cycle */ unsigned long sync_clients; /* number of is_slowsync clients */ unsigned long sync_remain; /* number of them with sync_poll */ @@ -119,7 +120,6 @@ typedef struct { float cpu_load; unsigned long port_max; int engine_ok; - jack_engine_t *engine; unsigned long n_port_types; jack_port_type_info_t port_types[JACK_MAX_PORT_TYPES]; jack_port_shared_t ports[0]; diff --git a/jack/jack.h b/jack/jack.h index 0536f14..4a4f2fb 100644 --- a/jack/jack.h +++ b/jack/jack.h @@ -536,16 +536,14 @@ jack_port_t *jack_port_by_name (jack_client_t *, const char *portname); jack_port_t *jack_port_by_id (const jack_client_t *client, jack_port_id_t id); /** - * If a client is told (by the user) to become the timebase for the - * entire system, it calls this function. If it returns zero, then the - * client has the responsibility to call jack_set_transport_info() at - * the end of its process callback. + * Old-style interface to become the timebase for the entire JACK + * subsystem. * - * @deprecated This function is only for compatibility with earlier - * transport implementations. Instead, see and use - * jack_set_timebase_callback(). + * @deprecated This function still exists for compatibility with the + * earlier transport interface, but it does nothing. Instead, see + * and use jack_set_timebase_callback(). * - * @return 0 on success, otherwise a non-zero error code + * @return ENOSYS, function not implemented. */ int jack_engine_takeover_timebase (jack_client_t *); diff --git a/jack/transport.h b/jack/transport.h index 8944240..5b8b3be 100644 --- a/jack/transport.h +++ b/jack/transport.h @@ -387,16 +387,9 @@ void jack_get_transport_info (jack_client_t *client, /** * Set the transport info structure (deprecated). * - * @param client the JACK client structure. - * @param tinfo used to return a new transport info structure used - * for the next process cycle. The "valid" field must say which - * fields contain valid data. - * - * @deprecated This is for compatibility with the earlier transport - * interface. Define a ::JackTimebaseCallback, instead. - * - * @pre Caller must be the current timebase master. Must be called - * from the process thread. + * @deprecated This function still exists for compatibility with the + * earlier transport interface, but it does nothing. Instead, define + * a ::JackTimebaseCallback. */ void jack_set_transport_info (jack_client_t *client, jack_transport_info_t *tinfo); diff --git a/jackd/engine.c b/jackd/engine.c index 8666b15..64f0850 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -1740,7 +1740,6 @@ jack_engine_new (int realtime, int rtpriority, int verbose, int client_timeout) jack_register_shm (engine->control_shm_name, addr, shmid); engine->control = (jack_control_t *) addr; - engine->control->engine = engine; /* setup port type information from builtins. buffer space is allocated whenever we call jack_set_buffer_size() diff --git a/jackd/transengine.c b/jackd/transengine.c index 83f5ac7..0beea0d 100644 --- a/jackd/transengine.c +++ b/jackd/transengine.c @@ -234,6 +234,7 @@ jack_transport_init (jack_engine_t *engine) memset (&ectl->pending_time, 0, sizeof(ectl->pending_time)); memset (&ectl->request_time, 0, sizeof(ectl->request_time)); ectl->prev_request = 0; + ectl->seq_number = 1; /* can't start at 0 */ ectl->new_pos = 0; ectl->sync_remain = 0; ectl->sync_clients = 0; @@ -305,8 +306,7 @@ jack_transport_client_set_sync (jack_engine_t *engine, int ret; jack_client_internal_t *client; - // JOQ: I am assuming the process cycle is serialized with - // respect to this lock... + /* The process cycle runs with this lock. */ jack_lock_graph (engine); client = jack_client_internal_by_id (engine, client_id); diff --git a/libjack/transclient.c b/libjack/transclient.c index 19f3ef9..423209e 100644 --- a/libjack/transclient.c +++ b/libjack/transclient.c @@ -373,9 +373,14 @@ jack_transport_stop (jack_client_t *client) /************* Compatibility with old transport API. *************/ +#define OLD_TIMEBASE_BROKEN + int jack_engine_takeover_timebase (jack_client_t *client) { +#ifdef OLD_TIMEBASE_BROKEN + return ENOSYS; +#else jack_request_t req; req.type = SetTimeBaseClient; @@ -383,6 +388,7 @@ jack_engine_takeover_timebase (jack_client_t *client) req.x.timebase.conditional = 0; return jack_client_deliver_request (client, &req); +#endif /* OLD_TIMEBASE_BROKEN */ } void @@ -416,12 +422,20 @@ jack_get_transport_info (jack_client_t *client, } } -static int first_error = 1; - void jack_set_transport_info (jack_client_t *client, jack_transport_info_t *info) { + static int first_error = 1; + +#ifdef OLD_TIMEBASE_BROKEN + + if (first_error) + jack_error ("jack_set_transport_info() no longer supported."); + first_error = 0; + +#else + jack_control_t *ectl = client->engine; if (!client->control->is_timebase) { /* not timebase master? */ @@ -470,6 +484,7 @@ jack_set_transport_info (jack_client_t *client, ectl->pending_time.ticks_per_beat = info->ticks_per_beat; ectl->pending_time.beats_per_minute = info->beats_per_minute; } +#endif /* OLD_TIMEBASE_BROKEN */ } #endif /* OLD_TRANSPORT */