git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2299 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
| @@ -23,6 +23,7 @@ Fernando Lopez-Lezcano | |||
| 2008-05-21 Stephane Letz <letz@grame.fr> | |||
| * Correct JackEngine::PortUnRegister, JackEngine::ClientCloseAux and JackEngine::ClientDeactivate to correctly send notifications. | |||
| * New jack_get_client_pid API, implemented on server side. | |||
| 2008-05-20 Stephane Letz <letz@grame.fr> | |||
| @@ -36,8 +36,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| namespace Jack | |||
| { | |||
| JackAudioDriver::JackAudioDriver(const char* name, JackEngine* engine, JackSynchro** table) | |||
| : JackDriver(name, engine, table), | |||
| JackAudioDriver::JackAudioDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table) | |||
| : JackDriver(name, alias, engine, table), | |||
| fCaptureChannels(0), | |||
| fPlaybackChannels(0), | |||
| fWithMonitorPorts(false) | |||
| @@ -95,8 +95,8 @@ int JackAudioDriver::Attach() | |||
| jack_log("JackAudioDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate); | |||
| for (i = 0; i < fCaptureChannels; i++) { | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fClientControl->fName, fCaptureDriverName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "system:capture_%d", i + 1); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl->fName, i + 1); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { | |||
| jack_error("driver: cannot register port for %s", name); | |||
| return -1; | |||
| @@ -111,8 +111,8 @@ int JackAudioDriver::Attach() | |||
| port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal; | |||
| for (i = 0; i < fPlaybackChannels; i++) { | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fClientControl->fName, fPlaybackDriverName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "system:playback_%d", i + 1); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl->fName, i + 1); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { | |||
| jack_error("driver: cannot register port for %s", name); | |||
| return -1; | |||
| @@ -127,7 +127,7 @@ int JackAudioDriver::Attach() | |||
| // Monitor ports | |||
| if (fWithMonitorPorts) { | |||
| jack_log("Create monitor port "); | |||
| snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fClientControl->fName, fPlaybackDriverName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fAliasName, fPlaybackDriverName, i + 1); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) { | |||
| jack_error("Cannot register monitor port for %s", name); | |||
| return -1; | |||
| @@ -57,7 +57,7 @@ class EXPORT JackAudioDriver : public JackDriver | |||
| public: | |||
| JackAudioDriver(const char* name, JackEngine* engine, JackSynchro** table); | |||
| JackAudioDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table); | |||
| virtual ~JackAudioDriver(); | |||
| virtual int Process(); | |||
| @@ -73,7 +73,7 @@ class JackClientChannelInterface | |||
| virtual void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result) | |||
| {} | |||
| virtual void ClientOpen(const char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| virtual void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| {} | |||
| virtual void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result) | |||
| {} | |||
| @@ -42,24 +42,25 @@ struct JackClientControl : public JackShmMem | |||
| volatile bool fTransportSync; /* Will be true when slow-sync cb has to be called */ | |||
| volatile bool fTransportTimebase; /* Will be true when timebase cb is called with new_pos on */ | |||
| int fRefNum; | |||
| int fPID; | |||
| bool fActive; | |||
| JackClientControl(const char* name, int refnum) | |||
| JackClientControl(const char* name, int pid, int refnum) | |||
| { | |||
| Init(name, refnum); | |||
| Init(name, pid, refnum); | |||
| } | |||
| JackClientControl(const char* name) | |||
| { | |||
| Init(name, -1); | |||
| Init(name, 0, -1); | |||
| } | |||
| JackClientControl() | |||
| { | |||
| Init("", -1); | |||
| Init("", 0, -1); | |||
| } | |||
| void Init(const char* name, int refnum) | |||
| void Init(const char* name, int pid, int refnum) | |||
| { | |||
| strcpy(fName, name); | |||
| for (int i = 0; i < kMaxNotification; i++) | |||
| @@ -72,6 +73,7 @@ struct JackClientControl : public JackShmMem | |||
| fCallback[kStartFreewheelCallback] = true; | |||
| fCallback[kStopFreewheelCallback] = true; | |||
| fRefNum = refnum; | |||
| fPID = pid; | |||
| fTransportState = JackTransportStopped; | |||
| fTransportSync = false; | |||
| fTransportTimebase = false; | |||
| @@ -58,7 +58,7 @@ class JackDebugClient : public JackClient | |||
| int fIsActivated; | |||
| int fIsDeactivated; | |||
| int fIsClosed; | |||
| char fClientName[JACK_CLIENT_NAME_SIZE]; | |||
| char fClientName[JACK_CLIENT_NAME_SIZE + 1]; | |||
| JackProcessCallback fProcessTimeCallback; | |||
| void* fProcessTimeCallbackArg; | |||
| @@ -39,11 +39,12 @@ using namespace std; | |||
| namespace Jack | |||
| { | |||
| JackDriver::JackDriver(const char* name, JackEngine* engine, JackSynchro** table) | |||
| JackDriver::JackDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table) | |||
| { | |||
| assert(strlen(name) < JACK_CLIENT_NAME_SIZE); | |||
| fSynchroTable = table; | |||
| fClientControl = new JackClientControl(name); | |||
| strcpy(fAliasName, alias); | |||
| fEngine = engine; | |||
| fGraphManager = NULL; | |||
| fLastWaitUst = 0; | |||
| @@ -143,8 +143,9 @@ class EXPORT JackDriver : public JackDriverClient | |||
| protected: | |||
| char fCaptureDriverName[JACK_CLIENT_NAME_SIZE]; | |||
| char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE]; | |||
| char fCaptureDriverName[JACK_CLIENT_NAME_SIZE + 1]; | |||
| char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE + 1]; | |||
| char fAliasName[JACK_CLIENT_NAME_SIZE + 1]; | |||
| jack_nframes_t fCaptureLatency; | |||
| jack_nframes_t fPlaybackLatency; | |||
| jack_time_t fLastWaitUst; | |||
| @@ -159,7 +160,7 @@ class EXPORT JackDriver : public JackDriverClient | |||
| public: | |||
| JackDriver(const char* name, JackEngine* engine, JackSynchro** table); | |||
| JackDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table); | |||
| JackDriver(); | |||
| virtual ~JackDriver(); | |||
| @@ -178,7 +178,7 @@ extern "C" | |||
| if (wait_time == 0) // Not set | |||
| wait_time = (unsigned long)((((float)period_size) / ((float)sample_rate)) * 1000000.0f); | |||
| Jack::JackDriverClientInterface* driver = new Jack::JackThreadedDriver(new Jack::JackDummyDriver("dummy_pcm", engine, table, wait_time)); | |||
| Jack::JackDriverClientInterface* driver = new Jack::JackThreadedDriver(new Jack::JackDummyDriver("system", "dummy_pcm", engine, table, wait_time)); | |||
| if (driver->Open(period_size, sample_rate, 1, 1, capture_ports, playback_ports, monitor, "dummy", "dummy", 0, 0) == 0) { | |||
| return driver; | |||
| } else { | |||
| @@ -38,8 +38,8 @@ class JackDummyDriver : public JackAudioDriver | |||
| public: | |||
| JackDummyDriver(const char* name, JackEngine* engine, JackSynchro** table, unsigned long wait_time) | |||
| : JackAudioDriver(name, engine, table), fWaitTime(wait_time) | |||
| JackDummyDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table, unsigned long wait_time) | |||
| : JackAudioDriver(name, alias, engine, table), fWaitTime(wait_time) | |||
| {} | |||
| virtual ~JackDummyDriver() | |||
| {} | |||
| @@ -447,8 +447,19 @@ bool JackEngine::ClientCheckName(const char* name) | |||
| return false; | |||
| } | |||
| int JackEngine::GetClientPID(const char* name) | |||
| { | |||
| for (int i = 0; i < CLIENT_NUM; i++) { | |||
| JackClientInterface* client = fClientTable[i]; | |||
| if (client && (strcmp(client->GetClientControl()->fName, name) == 0)) | |||
| return client->GetClientControl()->fPID; | |||
| } | |||
| return 0; | |||
| } | |||
| // Used for external clients | |||
| int JackEngine::ClientExternalOpen(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager) | |||
| int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager) | |||
| { | |||
| jack_log("JackEngine::ClientOpen: name = %s ", name); | |||
| @@ -465,7 +476,7 @@ int JackEngine::ClientExternalOpen(const char* name, int* ref, int* shared_engin | |||
| goto error; | |||
| } | |||
| if (client->Open(name, refnum, shared_client) < 0) { | |||
| if (client->Open(name, pid, refnum, shared_client) < 0) { | |||
| jack_error("Cannot open client"); | |||
| goto error; | |||
| } | |||
| @@ -476,12 +487,13 @@ int JackEngine::ClientExternalOpen(const char* name, int* ref, int* shared_engin | |||
| goto error; | |||
| } | |||
| fClientTable[refnum] = client; | |||
| if (NotifyAddClient(client, name, refnum) < 0) { | |||
| jack_error("Cannot notify add client"); | |||
| goto error; | |||
| } | |||
| fClientTable[refnum] = client; | |||
| fGraphManager->InitRefNum(refnum); | |||
| fEngineControl->ResetRollingUsecs(); | |||
| *shared_engine = fEngineControl->GetShmIndex(); | |||
| @@ -490,7 +502,9 @@ int JackEngine::ClientExternalOpen(const char* name, int* ref, int* shared_engin | |||
| return 0; | |||
| error: | |||
| ClientCloseAux(refnum, client, false); | |||
| // Cleanup... | |||
| fSynchroTable[refnum]->Destroy(); | |||
| fClientTable[refnum] = 0; | |||
| client->Close(); | |||
| delete client; | |||
| return -1; | |||
| @@ -504,32 +518,39 @@ int JackEngine::ClientInternalOpen(const char* name, int* ref, JackEngineControl | |||
| int refnum = AllocateRefnum(); | |||
| if (refnum < 0) { | |||
| jack_error("No more refnum available"); | |||
| return -1; | |||
| goto error; | |||
| } | |||
| if (!fSynchroTable[refnum]->Allocate(name, fEngineControl->fServerName, 0)) { | |||
| jack_error("Cannot allocate synchro"); | |||
| return -1; | |||
| goto error; | |||
| } | |||
| if (wait && !fSignal->TimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { | |||
| // Failure if RT thread is not running (problem with the driver...) | |||
| jack_error("Driver is not running"); | |||
| return -1; | |||
| goto error; | |||
| } | |||
| fClientTable[refnum] = client; | |||
| if (NotifyAddClient(client, name, refnum) < 0) { | |||
| jack_error("Cannot notify add client"); | |||
| return -1; | |||
| goto error; | |||
| } | |||
| fClientTable[refnum] = client; | |||
| fGraphManager->InitRefNum(refnum); | |||
| fEngineControl->ResetRollingUsecs(); | |||
| *shared_engine = fEngineControl; | |||
| *shared_manager = fGraphManager; | |||
| *ref = refnum; | |||
| return 0; | |||
| error: | |||
| // Cleanup... | |||
| fSynchroTable[refnum]->Destroy(); | |||
| fClientTable[refnum] = 0; | |||
| return -1; | |||
| } | |||
| // Used for external clients | |||
| @@ -556,9 +577,7 @@ int JackEngine::ClientInternalClose(int refnum, bool wait) | |||
| int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wait) | |||
| { | |||
| jack_log("JackEngine::ClientCloseAux ref = %ld name = %s", | |||
| refnum, | |||
| (client->GetClientControl()) ? client->GetClientControl()->fName : "No name"); | |||
| jack_log("JackEngine::ClientCloseAux ref = %ld", refnum); | |||
| // Unregister all ports ==> notifications are sent | |||
| jack_int_t ports[PORT_NUM_FOR_CLIENT]; | |||
| @@ -588,8 +607,7 @@ int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wai | |||
| } | |||
| // Notify running clients | |||
| if (client->GetClientControl()) // When called in error cases, client may not be completely allocated | |||
| NotifyRemoveClient(client->GetClientControl()->fName, client->GetClientControl()->fRefNum); | |||
| NotifyRemoveClient(client->GetClientControl()->fName, client->GetClientControl()->fRefNum); | |||
| // Cleanup... | |||
| fSynchroTable[refnum]->Destroy(); | |||
| @@ -80,7 +80,7 @@ class JackEngine | |||
| // Client management | |||
| virtual int ClientCheck(const char* name, char* name_res, int protocol, int options, int* status); | |||
| virtual int ClientExternalOpen(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager); | |||
| virtual int ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager); | |||
| virtual int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait); | |||
| virtual int ClientExternalClose(int refnum); | |||
| @@ -88,7 +88,9 @@ class JackEngine | |||
| virtual int ClientActivate(int refnum, bool state); | |||
| virtual int ClientDeactivate(int refnum); | |||
| virtual int GetClientPID(const char* name); | |||
| // Internal client management | |||
| virtual int GetInternalClientName(int int_ref, char* name_res); | |||
| virtual int InternalClientHandle(const char* client_name, int* status, int* int_ref); | |||
| @@ -44,7 +44,7 @@ int JackExternalClient::ClientNotify(int refnum, const char* name, int notify, i | |||
| return result; | |||
| } | |||
| int JackExternalClient::Open(const char* name, int refnum, int* shared_client) | |||
| int JackExternalClient::Open(const char* name, int pid, int refnum, int* shared_client) | |||
| { | |||
| try { | |||
| @@ -53,7 +53,7 @@ int JackExternalClient::Open(const char* name, int refnum, int* shared_client) | |||
| return -1; | |||
| } | |||
| fClientControl = new JackClientControl(name, refnum); | |||
| fClientControl = new JackClientControl(name, pid, refnum); | |||
| if (!fClientControl) { | |||
| jack_error("Cannot allocate client shared memory segment"); | |||
| return -1; | |||
| @@ -46,7 +46,7 @@ class JackExternalClient : public JackClientInterface | |||
| JackExternalClient(); | |||
| virtual ~JackExternalClient(); | |||
| int Open(const char* name, int refnum, int* shared_client); | |||
| int Open(const char* name, int pid, int refnum, int* shared_client); | |||
| int Close(); | |||
| int ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2); | |||
| @@ -35,7 +35,7 @@ class JackFreewheelDriver : public JackDriver | |||
| public: | |||
| JackFreewheelDriver(const char* name, JackEngine* engine, JackSynchro** table): JackDriver(name, engine, table) | |||
| JackFreewheelDriver(JackEngine* engine, JackSynchro** table): JackDriver("freewheel", "", engine, table) | |||
| {} | |||
| virtual ~JackFreewheelDriver() | |||
| {} | |||
| @@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include "JackEngineControl.h" | |||
| #include "JackClientControl.h" | |||
| #include "JackInternalClientChannel.h" | |||
| #include "JackTools.h" | |||
| #include <assert.h> | |||
| namespace Jack | |||
| @@ -74,7 +75,7 @@ JackInternalClient::~JackInternalClient() | |||
| int JackInternalClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status) | |||
| { | |||
| int result; | |||
| char name_res[JACK_CLIENT_NAME_SIZE]; | |||
| char name_res[JACK_CLIENT_NAME_SIZE + 1]; | |||
| jack_log("JackInternalClient::Open name = %s", name); | |||
| snprintf(fServerName, sizeof(fServerName), server_name); | |||
| @@ -97,7 +98,7 @@ int JackInternalClient::Open(const char* server_name, const char* name, jack_opt | |||
| jack_error("Cannot open client name = %s", name_res); | |||
| goto error; | |||
| } | |||
| SetupDriverSync(false); | |||
| return 0; | |||
| @@ -46,6 +46,7 @@ extern "C" | |||
| jack_options_t options, | |||
| jack_status_t *status, ...); | |||
| EXPORT int jack_client_close (jack_client_t *client); | |||
| EXPORT int jack_get_client_pid (const char *name); | |||
| #ifdef __cplusplus | |||
| } | |||
| @@ -59,7 +60,7 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt | |||
| jack_varargs_t va; /* variable arguments */ | |||
| jack_status_t my_status; | |||
| JackClient* client; | |||
| char client_name[JACK_CLIENT_NAME_SIZE]; | |||
| char client_name[JACK_CLIENT_NAME_SIZE + 1]; | |||
| if (ext_client_name == NULL) { | |||
| jack_error("jack_client_open called with a NULL client_name"); | |||
| @@ -143,4 +144,9 @@ EXPORT int jack_client_close(jack_client_t* ext_client) | |||
| } | |||
| } | |||
| EXPORT int jack_get_client_pid(const char *name) | |||
| { | |||
| jack_error("jack_get_client_pid : not implemented on library side"); | |||
| return 0; | |||
| } | |||
| @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "JackLibGlobals.h" | |||
| #include "JackGlobals.h" | |||
| #include "JackChannel.h" | |||
| #include "JackTools.h" | |||
| namespace Jack | |||
| { | |||
| @@ -50,7 +51,6 @@ JackSynchro** GetSynchroTable() | |||
| return (JackLibGlobals::fGlobals ? JackLibGlobals::fGlobals->fSynchroTable : 0); | |||
| } | |||
| //------------------- | |||
| // Client management | |||
| //------------------- | |||
| @@ -75,7 +75,7 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_options_ | |||
| snprintf(fServerName, sizeof(fServerName), server_name); | |||
| // Open server/client channel | |||
| char name_res[JACK_CLIENT_NAME_SIZE]; | |||
| char name_res[JACK_CLIENT_NAME_SIZE + 1]; | |||
| if (fChannel->Open(server_name, name, name_res, this, options, status) < 0) { | |||
| jack_error("Cannot connect to the server"); | |||
| goto error; | |||
| @@ -88,7 +88,7 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_options_ | |||
| } | |||
| // Require new client | |||
| fChannel->ClientOpen(name_res, &shared_engine, &shared_client, &shared_graph, &result); | |||
| fChannel->ClientOpen(name_res, JackTools::GetPID(), &shared_engine, &shared_client, &shared_graph, &result); | |||
| if (result < 0) { | |||
| jack_error("Cannot open %s client", name_res); | |||
| goto error; | |||
| @@ -62,10 +62,10 @@ class JackLockedEngine : public JackEngine, public JackLockAble | |||
| JackLock lock(this); | |||
| return fEngine->ClientCheck(name, name_res, protocol, options, status); | |||
| } | |||
| int ClientExternalOpen(const char* name, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager) | |||
| int ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager) | |||
| { | |||
| JackLock lock(this); | |||
| return fEngine->ClientExternalOpen(name, ref, shared_engine, shared_client, shared_graph_manager); | |||
| return fEngine->ClientExternalOpen(name, pid, ref, shared_engine, shared_client, shared_graph_manager); | |||
| } | |||
| int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait) | |||
| { | |||
| @@ -195,6 +195,13 @@ class JackLockedEngine : public JackEngine, public JackLockAble | |||
| JackLock lock(this); | |||
| fEngine->NotifyActivate(refnum); | |||
| } | |||
| int GetClientPID(const char* name) | |||
| { | |||
| JackLock lock(this); | |||
| return fEngine->GetClientPID(name); | |||
| } | |||
| }; | |||
| @@ -35,8 +35,8 @@ class JackLoopbackDriver : public JackAudioDriver | |||
| public: | |||
| JackLoopbackDriver(const char* name, JackEngine* engine, JackSynchro** table) | |||
| : JackAudioDriver(name, engine, table) | |||
| JackLoopbackDriver(JackEngine* engine, JackSynchro** table) | |||
| : JackAudioDriver("loopback", "", engine, table) | |||
| {} | |||
| virtual ~JackLoopbackDriver() | |||
| {} | |||
| @@ -192,23 +192,27 @@ struct JackClientCheckResult : public JackResult | |||
| struct JackClientOpenRequest : public JackRequest | |||
| { | |||
| int fPID; | |||
| char fName[JACK_CLIENT_NAME_SIZE + 1]; | |||
| JackClientOpenRequest() | |||
| {} | |||
| JackClientOpenRequest(const char* name): JackRequest(JackRequest::kClientOpen) | |||
| JackClientOpenRequest(const char* name, int pid): JackRequest(JackRequest::kClientOpen) | |||
| { | |||
| snprintf(fName, sizeof(fName), "%s", name); | |||
| fPID = pid; | |||
| } | |||
| int Read(JackChannelTransaction* trans) | |||
| { | |||
| CheckRes(trans->Read(&fPID, sizeof(int))); | |||
| return trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1); | |||
| } | |||
| int Write(JackChannelTransaction* trans) | |||
| { | |||
| CheckRes(JackRequest::Write(trans)); | |||
| CheckRes(trans->Write(&fPID, sizeof(int))); | |||
| return trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1); | |||
| } | |||
| }; | |||
| @@ -50,8 +50,8 @@ JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long pr | |||
| fGraphManager = new JackGraphManager(); | |||
| fEngineControl = new JackEngineControl(sync, temporary, timeout, rt, priority, verbose, server_name); | |||
| fEngine = new JackLockedEngine(new JackEngine(fGraphManager, fSynchroTable, fEngineControl)); | |||
| fFreewheelDriver = new JackThreadedDriver(new JackFreewheelDriver("freewheel", fEngine, fSynchroTable)); | |||
| fLoopbackDriver = new JackLoopbackDriver("loopback", fEngine, fSynchroTable); | |||
| fFreewheelDriver = new JackThreadedDriver(new JackFreewheelDriver(fEngine, fSynchroTable)); | |||
| fLoopbackDriver = new JackLoopbackDriver(fEngine, fSynchroTable); | |||
| fChannel = JackGlobals::MakeServerChannel(); | |||
| fFreewheel = false; | |||
| fLoopback = loopback; | |||
| @@ -303,6 +303,7 @@ JackGraphManager* JackServer::GetGraphManager() | |||
| { | |||
| return fGraphManager; | |||
| } | |||
| } // end of namespace | |||
| @@ -30,6 +30,7 @@ This program is free software; you can redistribute it and/or modify | |||
| #include "JackError.h" | |||
| #include "JackServerLaunch.h" | |||
| #include "JackTools.h" | |||
| #include "JackEngine.h" | |||
| #ifdef WIN32 | |||
| #define EXPORT __declspec(dllexport) | |||
| @@ -49,6 +50,7 @@ extern "C" | |||
| jack_options_t options, | |||
| jack_status_t *status, ...); | |||
| EXPORT int jack_client_close (jack_client_t *client); | |||
| EXPORT int jack_get_client_pid (const char *name); | |||
| #ifdef __cplusplus | |||
| } | |||
| @@ -61,7 +63,7 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt | |||
| jack_varargs_t va; /* variable arguments */ | |||
| jack_status_t my_status; | |||
| JackClient* client; | |||
| char client_name[JACK_CLIENT_NAME_SIZE]; | |||
| char client_name[JACK_CLIENT_NAME_SIZE + 1]; | |||
| if (ext_client_name == NULL) { | |||
| jack_error("jack_client_open called with a NULL client_name"); | |||
| @@ -141,3 +143,10 @@ EXPORT int jack_client_close(jack_client_t* ext_client) | |||
| } | |||
| } | |||
| EXPORT int jack_get_client_pid(const char *name) | |||
| { | |||
| return (JackServer::fInstance != NULL) | |||
| ? JackServer::fInstance->GetEngine()->GetClientPID(name) | |||
| : 0; | |||
| } | |||
| @@ -148,9 +148,9 @@ void JackSocketClientChannel::ClientCheck(const char* name, char* name_res, int | |||
| strcpy(name_res, res.fName); | |||
| } | |||
| void JackSocketClientChannel::ClientOpen(const char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| void JackSocketClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| { | |||
| JackClientOpenRequest req(name); | |||
| JackClientOpenRequest req(name, pid); | |||
| JackClientOpenResult res; | |||
| ServerSyncCall(&req, &res, result); | |||
| *shared_engine = res.fSharedEngine; | |||
| @@ -60,7 +60,7 @@ class JackSocketClientChannel : public JackClientChannelInterface, public JackRu | |||
| int ServerCheck(const char* server_name); | |||
| void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result); | |||
| void ClientOpen(const char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientClose(int refnum, int* result); | |||
| void ClientActivate(int refnum, int state, int* result); | |||
| @@ -89,11 +89,11 @@ void JackSocketServerChannel::ClientCreate() | |||
| } | |||
| } | |||
| void JackSocketServerChannel::ClientAdd(int fd, char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| void JackSocketServerChannel::ClientAdd(int fd, char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| { | |||
| jack_log("JackSocketServerChannel::ClientAdd"); | |||
| int refnum = -1; | |||
| *result = fServer->GetEngine()->ClientExternalOpen(name, &refnum, shared_engine, shared_client, shared_graph); | |||
| *result = fServer->GetEngine()->ClientExternalOpen(name, pid, &refnum, shared_engine, shared_client, shared_graph); | |||
| if (*result == 0) { | |||
| fSocketTable[fd].first = refnum; | |||
| fRebuild = true; | |||
| @@ -167,7 +167,7 @@ bool JackSocketServerChannel::HandleRequest(int fd) | |||
| JackClientOpenRequest req; | |||
| JackClientOpenResult res; | |||
| if (req.Read(socket) == 0) | |||
| ClientAdd(fd, req.fName, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult); | |||
| ClientAdd(fd, req.fName, req.fPID, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult); | |||
| if (res.Write(socket) < 0) | |||
| jack_error("JackRequest::ClientOpen write error name = %s", req.fName); | |||
| break; | |||
| @@ -49,7 +49,7 @@ class JackSocketServerChannel : public JackServerChannelInterface, public JackRu | |||
| void BuildPoolTable(); | |||
| void ClientCreate(); | |||
| void ClientAdd(int fd, char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientAdd(int fd, char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientRemove(int fd, int refnum); | |||
| void ClientKill(int fd); | |||
| @@ -105,6 +105,11 @@ extern "C" | |||
| * name will differ from the @a client_name requested. | |||
| */ | |||
| char * jack_get_client_name (jack_client_t *client); | |||
| /** | |||
| * @return pid of client. If not available, 0 will be returned. | |||
| */ | |||
| int jack_get_client_pid (const char *name); | |||
| /** | |||
| * Load an internal client into the Jack server. | |||
| @@ -2126,8 +2126,8 @@ int JackAlsaDriver::Attach() | |||
| jack_log("JackAudioDriver::Attach fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate); | |||
| for (int i = 0; i < fCaptureChannels; i++) { | |||
| snprintf(alias, sizeof(alias) - 1, "%s:capture_%u", fClientControl->fName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "system:capture_%d", i + 1); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:capture_%u", fAliasName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl->fName, i + 1); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { | |||
| jack_error("driver: cannot register port for %s", name); | |||
| return -1; | |||
| @@ -2142,8 +2142,8 @@ int JackAlsaDriver::Attach() | |||
| port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal; | |||
| for (int i = 0; i < fPlaybackChannels; i++) { | |||
| snprintf(alias, sizeof(alias) - 1, "%s:playback_%u", fClientControl->fName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "system:playback_%d", i + 1); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:playback_%u", fAliasName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl->fName, i + 1); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { | |||
| jack_error("driver: cannot register port for %s", name); | |||
| return -1; | |||
| @@ -2723,7 +2723,7 @@ extern "C" | |||
| playback = TRUE; | |||
| } | |||
| Jack::JackAlsaDriver* alsa_driver = new Jack::JackAlsaDriver("alsa_pcm", engine, table); | |||
| Jack::JackAlsaDriver* alsa_driver = new Jack::JackAlsaDriver("system", "alsa_pcm", engine, table); | |||
| Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(alsa_driver); | |||
| // Special open for ALSA driver... | |||
| if (alsa_driver->Open(frames_per_interrupt, user_nperiods, srate, hw_monitoring, hw_metering, capture, playback, dither, soft_mode, monitor, | |||
| @@ -116,7 +116,7 @@ class JackAlsaDriver : public JackAudioDriver | |||
| public: | |||
| JackAlsaDriver(const char* name, JackEngine* engine, JackSynchro** table): JackAudioDriver(name, engine, table) | |||
| JackAlsaDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table): JackAudioDriver(name, alias, engine, table) | |||
| {} | |||
| virtual ~JackAlsaDriver() | |||
| {} | |||
| @@ -993,7 +993,7 @@ extern "C" | |||
| cmlparams.capture_ports = TRUE; | |||
| } | |||
| Jack::JackFFADODriver* ffado_driver = new Jack::JackFFADODriver("firewire_pcm", engine, table); | |||
| Jack::JackFFADODriver* ffado_driver = new Jack::JackFFADODriver("system", "firewire_pcm", engine, table); | |||
| Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(ffado_driver); | |||
| // Special open for FFADO driver... | |||
| if (ffado_driver->Open(&cmlparams) == 0) { | |||
| @@ -62,7 +62,8 @@ class JackFFADODriver : public JackAudioDriver | |||
| public: | |||
| JackFFADODriver(const char* name, JackEngine* engine, JackSynchro** table): JackAudioDriver(name, engine, table) | |||
| JackFFADODriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table) | |||
| : JackAudioDriver(name, alias,engine, table) | |||
| {} | |||
| virtual ~JackFFADODriver() | |||
| {} | |||
| @@ -1141,7 +1141,7 @@ extern "C" | |||
| jack_error("Freebob using Firewire port %d, node %d", cmlparams.port, cmlparams.node_id); | |||
| Jack::JackFreebobDriver* freebob_driver = new Jack::JackFreebobDriver("freebob_pcm", engine, table); | |||
| Jack::JackFreebobDriver* freebob_driver = new Jack::JackFreebobDriver("system", "freebob_pcm", engine, table); | |||
| Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(freebob_driver); | |||
| // Special open for FreeBoB driver... | |||
| if (freebob_driver->Open(&cmlparams) == 0) { | |||
| @@ -69,7 +69,8 @@ class JackFreebobDriver : public JackAudioDriver | |||
| public: | |||
| JackFreebobDriver(const char* name, JackEngine* engine, JackSynchro** table): JackAudioDriver(name, engine, table) | |||
| JackFreebobDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table) | |||
| :JackAudioDriver(name, alias, engine, table) | |||
| {} | |||
| virtual ~JackFreebobDriver() | |||
| {} | |||
| @@ -419,8 +419,8 @@ OSStatus JackCoreAudioDriver::GetTotalChannels(AudioDeviceID device, int* channe | |||
| return err; | |||
| } | |||
| JackCoreAudioDriver::JackCoreAudioDriver(const char* name, JackEngine* engine, JackSynchro** table) | |||
| : JackAudioDriver(name, engine, table), fJackInputData(NULL), fDriverOutputData(NULL), fState(false), fIOUsage(1.f) | |||
| JackCoreAudioDriver::JackCoreAudioDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table) | |||
| : JackAudioDriver(name, alias, engine, table), fJackInputData(NULL), fDriverOutputData(NULL), fState(false), fIOUsage(1.f) | |||
| {} | |||
| JackCoreAudioDriver::~JackCoreAudioDriver() | |||
| @@ -967,12 +967,12 @@ int JackCoreAudioDriver::Attach() | |||
| err = AudioDeviceGetProperty(fDeviceID, i + 1, true, kAudioDevicePropertyChannelName, &size, channel_name); | |||
| if (err != noErr) | |||
| jack_log("AudioDeviceGetProperty kAudioDevicePropertyChannelName error "); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:out_%s%u", fClientControl->fName, fCaptureDriverName, channel_name, i + 1); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:out_%s%u", fAliasName, fCaptureDriverName, channel_name, i + 1); | |||
| } else { | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:out%u", fClientControl->fName, fCaptureDriverName, i + 1); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:out%u", fAliasName, fCaptureDriverName, i + 1); | |||
| } | |||
| snprintf(name, sizeof(name) - 1, "system:capture_%d", i + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl->fName, i + 1); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { | |||
| jack_error("Cannot register port for %s", name); | |||
| @@ -1006,12 +1006,12 @@ int JackCoreAudioDriver::Attach() | |||
| err = AudioDeviceGetProperty(fDeviceID, i + 1, false, kAudioDevicePropertyChannelName, &size, channel_name); | |||
| if (err != noErr) | |||
| jack_log("AudioDeviceGetProperty kAudioDevicePropertyChannelName error "); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:in_%s%u", fClientControl->fName, fPlaybackDriverName, channel_name, i + 1); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:in_%s%u", fAliasName, fPlaybackDriverName, channel_name, i + 1); | |||
| } else { | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:in%u", fClientControl->fName, fPlaybackDriverName, i + 1); | |||
| snprintf(alias, sizeof(alias) - 1, "%s:%s:in%u", fAliasName, fPlaybackDriverName, i + 1); | |||
| } | |||
| snprintf(name, sizeof(name) - 1, "system:playback_%d", i + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl->fName, i + 1); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { | |||
| jack_error("Cannot register port for %s", name); | |||
| @@ -1037,7 +1037,7 @@ int JackCoreAudioDriver::Attach() | |||
| // Monitor ports | |||
| if (fWithMonitorPorts) { | |||
| jack_log("Create monitor port "); | |||
| snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fClientControl->fName, fPlaybackDriverName, i + 1); | |||
| snprintf(name, sizeof(name) - 1, "%s:%s:monitor_%u", fAliasName, fPlaybackDriverName, i + 1); | |||
| if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) { | |||
| jack_error("Cannot register monitor port for %s", name); | |||
| return -1; | |||
| @@ -1336,7 +1336,7 @@ extern "C" | |||
| playback = TRUE; | |||
| } | |||
| Jack::JackCoreAudioDriver* driver = new Jack::JackCoreAudioDriver("coreaudio", engine, table); | |||
| Jack::JackCoreAudioDriver* driver = new Jack::JackCoreAudioDriver("system", "coreaudio", engine, table); | |||
| if (driver->Open(frames_per_interrupt, srate, capture, playback, chan_in, chan_out, monitor, capture_pcm_name, | |||
| playback_pcm_name, systemic_input_latency, systemic_output_latency, async_output_latency) == 0) { | |||
| return driver; | |||
| @@ -143,7 +143,7 @@ class JackCoreAudioDriver : public JackAudioDriver | |||
| public: | |||
| JackCoreAudioDriver(const char* name, JackEngine* engine, JackSynchro** table); | |||
| JackCoreAudioDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table); | |||
| virtual ~JackCoreAudioDriver(); | |||
| int Open(jack_nframes_t frames_per_cycle, | |||
| @@ -40,12 +40,12 @@ rpc_type server_rpc_jack_client_check(mach_port_t private_port, client_name_t na | |||
| return KERN_SUCCESS; | |||
| } | |||
| rpc_type server_rpc_jack_client_open(mach_port_t server_port, client_name_t name, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| rpc_type server_rpc_jack_client_open(mach_port_t server_port, client_name_t name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| { | |||
| jack_log("rpc_jack_client_new %s", name); | |||
| JackMachServerChannel* channel = JackMachServerChannel::fPortTable[server_port]; | |||
| assert(channel); | |||
| channel->ClientOpen((char*)name, private_port, shared_engine, shared_client, shared_graph, result); | |||
| channel->ClientOpen((char*)name, pid, private_port, shared_engine, shared_client, shared_graph, result); | |||
| return KERN_SUCCESS; | |||
| } | |||
| @@ -134,9 +134,9 @@ void JackMachClientChannel::ClientCheck(const char* name, char* name_res, int pr | |||
| } | |||
| } | |||
| void JackMachClientChannel::ClientOpen(const char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| void JackMachClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| { | |||
| kern_return_t res = rpc_jack_client_open(fServerPort.GetPort(), (char*)name, &fPrivatePort, shared_engine, shared_client, shared_graph, result); | |||
| kern_return_t res = rpc_jack_client_open(fServerPort.GetPort(), (char*)name, pid, &fPrivatePort, shared_engine, shared_client, shared_graph, result); | |||
| if (res != KERN_SUCCESS) { | |||
| *result = -1; | |||
| jack_error("JackMachClientChannel::ClientOpen err = %s", mach_error_string(res)); | |||
| @@ -57,7 +57,7 @@ class JackMachClientChannel : public JackClientChannelInterface, public JackRunn | |||
| int ServerCheck(const char* server_name); | |||
| void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result); | |||
| void ClientOpen(const char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientClose(int refnum, int* result); | |||
| void ClientActivate(int refnum, int state, int* result); | |||
| @@ -85,10 +85,10 @@ void JackMachServerChannel::ClientCheck(char* name, char* name_res, int protocol | |||
| *result = GetEngine()->ClientCheck(name, name_res, protocol, options, status); | |||
| } | |||
| void JackMachServerChannel::ClientOpen(char* name, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| void JackMachServerChannel::ClientOpen(char* name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| { | |||
| int refnum = -1; | |||
| *result = GetEngine()->ClientExternalOpen(name, &refnum, shared_engine, shared_client, shared_graph); | |||
| *result = GetEngine()->ClientExternalOpen(name, pid, &refnum, shared_engine, shared_client, shared_graph); | |||
| if (*result == 0) { | |||
| mach_port_t port = fServerPort.AddPort(); | |||
| @@ -59,7 +59,7 @@ class JackMachServerChannel : public JackServerChannelInterface, public JackRunn | |||
| JackServer* GetServer(); | |||
| void ClientCheck(char* name, char* name_res, int protocol, int options, int* status, int* result); | |||
| void ClientOpen(char* name, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientOpen(char* name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientClose(mach_port_t private_port, int refnum); | |||
| void ClientKill(mach_port_t private_port); | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * IDENTIFICATION: | |||
| * stub generated Fri May 16 09:21:55 2008 | |||
| * stub generated Wed May 21 10:43:25 2008 | |||
| * with a MiG generated Tue Feb 19 02:01:43 PST 2008 by root@b75.local | |||
| * OPTIONS: | |||
| */ | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * IDENTIFICATION: | |||
| * stub generated Fri May 16 09:21:55 2008 | |||
| * stub generated Wed May 21 10:43:25 2008 | |||
| * with a MiG generated Tue Feb 19 02:01:43 PST 2008 by root@b75.local | |||
| * OPTIONS: | |||
| */ | |||
| @@ -34,6 +34,7 @@ type objet_data_t = c_string[1024]; | |||
| routine rpc_jack_client_open( | |||
| server_port : mach_port_t; | |||
| client_name : client_name_t; | |||
| pid : int; | |||
| out private_port : mach_port_make_send_t; | |||
| out shared_engine : int; | |||
| out shared_client : int; | |||
| @@ -53,6 +53,7 @@ kern_return_t rpc_jack_client_open | |||
| ( | |||
| mach_port_t server_port, | |||
| client_name_t client_name, | |||
| int pid, | |||
| mach_port_t *private_port, | |||
| int *shared_engine, | |||
| int *shared_client, | |||
| @@ -367,6 +368,7 @@ __END_DECLS | |||
| mach_msg_header_t Head; | |||
| NDR_record_t NDR; | |||
| client_name_t client_name; | |||
| int pid; | |||
| } __Request__rpc_jack_client_open_t; | |||
| #ifdef __MigPackStructs | |||
| #pragma pack() | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * IDENTIFICATION: | |||
| * stub generated Fri May 16 09:21:56 2008 | |||
| * stub generated Wed May 21 10:43:25 2008 | |||
| * with a MiG generated Tue Feb 19 02:01:43 PST 2008 by root@b75.local | |||
| * OPTIONS: | |||
| */ | |||
| @@ -111,6 +111,7 @@ | |||
| mach_msg_header_t Head; | |||
| NDR_record_t NDR; | |||
| client_name_t client_name; | |||
| int pid; | |||
| } __Request__rpc_jack_client_open_t; | |||
| #ifdef __MigPackStructs | |||
| #pragma pack() | |||
| @@ -767,6 +768,26 @@ mig_internal novalue _Xrpc_jack_client_rt_notify | |||
| #endif /* defined(__NDR_convert__*__defined) */ | |||
| #endif /* __NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined */ | |||
| #ifndef __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #if defined(__NDR_convert__int_rep__JackRPCEngine__int__defined) | |||
| #define __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__int_rep__JackRPCEngine__int((int *)(a), f) | |||
| #elif defined(__NDR_convert__int_rep__int__defined) | |||
| #define __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__int_rep__int((int *)(a), f) | |||
| #elif defined(__NDR_convert__int_rep__JackRPCEngine__int32_t__defined) | |||
| #define __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__int_rep__JackRPCEngine__int32_t((int32_t *)(a), f) | |||
| #elif defined(__NDR_convert__int_rep__int32_t__defined) | |||
| #define __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__int_rep__int32_t((int32_t *)(a), f) | |||
| #endif /* defined(__NDR_convert__*__defined) */ | |||
| #endif /* __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined */ | |||
| #ifndef __NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined | |||
| #if defined(__NDR_convert__char_rep__JackRPCEngine__client_name_t__defined) | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined | |||
| @@ -787,6 +808,26 @@ mig_internal novalue _Xrpc_jack_client_rt_notify | |||
| #endif /* defined(__NDR_convert__*__defined) */ | |||
| #endif /* __NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined */ | |||
| #ifndef __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #if defined(__NDR_convert__char_rep__JackRPCEngine__int__defined) | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__char_rep__JackRPCEngine__int((int *)(a), f) | |||
| #elif defined(__NDR_convert__char_rep__int__defined) | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__char_rep__int((int *)(a), f) | |||
| #elif defined(__NDR_convert__char_rep__JackRPCEngine__int32_t__defined) | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__char_rep__JackRPCEngine__int32_t((int32_t *)(a), f) | |||
| #elif defined(__NDR_convert__char_rep__int32_t__defined) | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__char_rep__int32_t((int32_t *)(a), f) | |||
| #endif /* defined(__NDR_convert__*__defined) */ | |||
| #endif /* __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined */ | |||
| #ifndef __NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined | |||
| #if defined(__NDR_convert__float_rep__JackRPCEngine__client_name_t__defined) | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined | |||
| @@ -807,6 +848,26 @@ mig_internal novalue _Xrpc_jack_client_rt_notify | |||
| #endif /* defined(__NDR_convert__*__defined) */ | |||
| #endif /* __NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined */ | |||
| #ifndef __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #if defined(__NDR_convert__float_rep__JackRPCEngine__int__defined) | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__float_rep__JackRPCEngine__int((int *)(a), f) | |||
| #elif defined(__NDR_convert__float_rep__int__defined) | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__float_rep__int((int *)(a), f) | |||
| #elif defined(__NDR_convert__float_rep__JackRPCEngine__int32_t__defined) | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__float_rep__JackRPCEngine__int32_t((int32_t *)(a), f) | |||
| #elif defined(__NDR_convert__float_rep__int32_t__defined) | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined | |||
| #define __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(a, f) \ | |||
| __NDR_convert__float_rep__int32_t((int32_t *)(a), f) | |||
| #endif /* defined(__NDR_convert__*__defined) */ | |||
| #endif /* __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined */ | |||
| mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_open_t(__attribute__((__unused__)) __Request__rpc_jack_client_open_t *In0P) | |||
| { | |||
| @@ -818,27 +879,39 @@ mig_internal kern_return_t __MIG_check__Request__rpc_jack_client_open_t(__attrib | |||
| return MIG_BAD_ARGUMENTS; | |||
| #endif /* __MigTypeCheck */ | |||
| #if defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined) | |||
| #if defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined) || \ | |||
| defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined) | |||
| if (In0P->NDR.int_rep != NDR_record.int_rep) { | |||
| #if defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined) | |||
| __NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name(&In0P->client_name, In0P->NDR.int_rep); | |||
| #endif /* __NDR_convert__int_rep__Request__rpc_jack_client_open_t__client_name__defined */ | |||
| #if defined(__NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined) | |||
| __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid(&In0P->pid, In0P->NDR.int_rep); | |||
| #endif /* __NDR_convert__int_rep__Request__rpc_jack_client_open_t__pid__defined */ | |||
| } | |||
| #endif /* defined(__NDR_convert__int_rep...) */ | |||
| #if defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined) | |||
| #if defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined) || \ | |||
| defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined) | |||
| if (In0P->NDR.char_rep != NDR_record.char_rep) { | |||
| #if defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined) | |||
| __NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name(&In0P->client_name, In0P->NDR.char_rep); | |||
| #endif /* __NDR_convert__char_rep__Request__rpc_jack_client_open_t__client_name__defined */ | |||
| #if defined(__NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined) | |||
| __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid(&In0P->pid, In0P->NDR.char_rep); | |||
| #endif /* __NDR_convert__char_rep__Request__rpc_jack_client_open_t__pid__defined */ | |||
| } | |||
| #endif /* defined(__NDR_convert__char_rep...) */ | |||
| #if defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined) | |||
| #if defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined) || \ | |||
| defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined) | |||
| if (In0P->NDR.float_rep != NDR_record.float_rep) { | |||
| #if defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined) | |||
| __NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name(&In0P->client_name, In0P->NDR.float_rep); | |||
| #endif /* __NDR_convert__float_rep__Request__rpc_jack_client_open_t__client_name__defined */ | |||
| #if defined(__NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined) | |||
| __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid(&In0P->pid, In0P->NDR.float_rep); | |||
| #endif /* __NDR_convert__float_rep__Request__rpc_jack_client_open_t__pid__defined */ | |||
| } | |||
| #endif /* defined(__NDR_convert__float_rep...) */ | |||
| @@ -859,6 +932,7 @@ kern_return_t server_rpc_jack_client_open | |||
| ( | |||
| mach_port_t server_port, | |||
| client_name_t client_name, | |||
| int pid, | |||
| mach_port_t *private_port, | |||
| int *shared_engine, | |||
| int *shared_client, | |||
| @@ -878,6 +952,7 @@ mig_internal novalue _Xrpc_jack_client_open | |||
| mach_msg_header_t Head; | |||
| NDR_record_t NDR; | |||
| client_name_t client_name; | |||
| int pid; | |||
| mach_msg_trailer_t trailer; | |||
| } Request; | |||
| #ifdef __MigPackStructs | |||
| @@ -928,7 +1003,7 @@ mig_internal novalue _Xrpc_jack_client_open | |||
| #endif /* UseStaticTemplates */ | |||
| RetCode = server_rpc_jack_client_open(In0P->Head.msgh_request_port, In0P->client_name, &OutP->private_port.name, &OutP->shared_engine, &OutP->shared_client, &OutP->shared_graph, &OutP->result); | |||
| RetCode = server_rpc_jack_client_open(In0P->Head.msgh_request_port, In0P->client_name, In0P->pid, &OutP->private_port.name, &OutP->shared_engine, &OutP->shared_client, &OutP->shared_graph, &OutP->result); | |||
| if (RetCode != KERN_SUCCESS) { | |||
| MIG_RETURN_ERROR(OutP, RetCode); | |||
| } | |||
| @@ -6198,7 +6273,7 @@ const struct server_JackRPCEngine_subsystem { | |||
| (vm_address_t)0, | |||
| { | |||
| { (mig_impl_routine_t) 0, | |||
| (mig_stub_routine_t) _Xrpc_jack_client_open, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_open_t)}, | |||
| (mig_stub_routine_t) _Xrpc_jack_client_open, 8, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_open_t)}, | |||
| { (mig_impl_routine_t) 0, | |||
| (mig_stub_routine_t) _Xrpc_jack_client_check, 7, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__rpc_jack_client_check_t)}, | |||
| { (mig_impl_routine_t) 0, | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * IDENTIFICATION: | |||
| * stub generated Fri May 16 09:21:56 2008 | |||
| * stub generated Wed May 21 10:43:25 2008 | |||
| * with a MiG generated Tue Feb 19 02:01:43 PST 2008 by root@b75.local | |||
| * OPTIONS: | |||
| */ | |||
| @@ -475,6 +475,7 @@ mig_external kern_return_t rpc_jack_client_open | |||
| ( | |||
| mach_port_t server_port, | |||
| client_name_t client_name, | |||
| int pid, | |||
| mach_port_t *private_port, | |||
| int *shared_engine, | |||
| int *shared_client, | |||
| @@ -490,6 +491,7 @@ mig_external kern_return_t rpc_jack_client_open | |||
| mach_msg_header_t Head; | |||
| NDR_record_t NDR; | |||
| client_name_t client_name; | |||
| int pid; | |||
| } Request; | |||
| #ifdef __MigPackStructs | |||
| #pragma pack() | |||
| @@ -561,6 +563,8 @@ mig_external kern_return_t rpc_jack_client_open | |||
| (void) mig_strncpy(InP->client_name, client_name, 128); | |||
| InP->pid = pid; | |||
| InP->Head.msgh_bits = | |||
| MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); | |||
| /* msgh_size passed as argument */ | |||
| @@ -656,7 +656,7 @@ extern "C" | |||
| playback = TRUE; | |||
| } | |||
| Jack::JackDriverClientInterface* driver = new Jack::JackPortAudioDriver("portaudio", engine, table); | |||
| Jack::JackDriverClientInterface* driver = new Jack::JackPortAudioDriver("system", "portaudio", engine, table); | |||
| if (driver->Open(frames_per_interrupt, srate, capture, playback, chan_in, chan_out, monitor, capture_pcm_name, playback_pcm_name, systemic_input_latency, systemic_output_latency) == 0) { | |||
| return driver; | |||
| } else { | |||
| @@ -53,8 +53,8 @@ class JackPortAudioDriver : public JackAudioDriver | |||
| public: | |||
| JackPortAudioDriver(const char* name, JackEngine* engine, JackSynchro** table) | |||
| : JackAudioDriver(name, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL), | |||
| JackPortAudioDriver(const char* name, const char* alias, JackEngine* engine, JackSynchro** table) | |||
| : JackAudioDriver(name, alias, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL), | |||
| fInputDevice(paNoDevice), fOutputDevice(paNoDevice) | |||
| {} | |||
| @@ -151,9 +151,9 @@ void JackWinNamedPipeClientChannel::ClientCheck(const char* name, char* name_res | |||
| strcpy(name_res, res.fName); | |||
| } | |||
| void JackWinNamedPipeClientChannel::ClientOpen(const char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| void JackWinNamedPipeClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| { | |||
| JackClientOpenRequest req(name); | |||
| JackClientOpenRequest req(name, pid); | |||
| JackClientOpenResult res; | |||
| ServerSyncCall(&req, &res, result); | |||
| *shared_engine = res.fSharedEngine; | |||
| @@ -59,7 +59,7 @@ class JackWinNamedPipeClientChannel : public JackClientChannelInterface, public | |||
| int ServerCheck(const char* server_name); | |||
| void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result); | |||
| void ClientOpen(const char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientClose(int refnum, int* result); | |||
| void ClientActivate(int refnum, int state, int* result); | |||
| @@ -122,7 +122,7 @@ bool JackClientPipeThread::HandleRequest() | |||
| JackClientOpenRequest req; | |||
| JackClientOpenResult res; | |||
| if (req.Read(fPipe) == 0) | |||
| ClientAdd(req.fName, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult); | |||
| ClientAdd(req.fName, req.fPID, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult); | |||
| res.Write(fPipe); | |||
| break; | |||
| } | |||
| @@ -318,11 +318,11 @@ bool JackClientPipeThread::HandleRequest() | |||
| return ret; | |||
| } | |||
| void JackClientPipeThread::ClientAdd(char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| void JackClientPipeThread::ClientAdd(char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
| { | |||
| jack_log("JackClientPipeThread::ClientAdd %s", name); | |||
| fRefNum = -1; | |||
| *result = fServer->GetEngine()->ClientExternalOpen(name, &fRefNum, shared_engine, shared_client, shared_graph); | |||
| *result = fServer->GetEngine()->ClientExternalOpen(name, pid, &fRefNum, shared_engine, shared_client, shared_graph); | |||
| } | |||
| void JackClientPipeThread::ClientRemove() | |||
| @@ -39,7 +39,7 @@ class JackClientPipeThread : public JackRunnableInterface | |||
| JackThread* fThread; | |||
| int fRefNum; | |||
| void ClientAdd(char* name, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientAdd(char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientRemove(); | |||
| void ClientKill(); | |||