Browse Source

Define metadata APIs on libjackserver too

Signed-off-by: falkTX <falktx@falktx.com>
pull/854/merge
falkTX 11 months ago
parent
commit
171ec33b58
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
8 changed files with 137 additions and 123 deletions
  1. +120
    -0
      common/JackAPI.cpp
  2. +1
    -0
      common/JackGlobals.h
  3. +5
    -0
      common/JackInternalClient.cpp
  4. +0
    -119
      common/JackLibAPI.cpp
  5. +0
    -1
      common/JackLibClient.cpp
  6. +1
    -3
      common/JackLibClient.h
  7. +7
    -0
      common/JackServer.cpp
  8. +3
    -0
      common/JackServer.h

+ 120
- 0
common/JackAPI.cpp View File

@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackGlobals.h"
#include "JackTime.h"
#include "JackPortType.h"
#include "JackMetadata.h"
#include <math.h>

using namespace Jack;
@@ -277,6 +278,16 @@ extern "C"
LIB_EXPORT void jack_uuid_unparse(jack_uuid_t, char buf[JACK_UUID_STRING_SIZE]);
LIB_EXPORT int jack_uuid_empty(jack_uuid_t);

LIB_EXPORT int jack_set_property(jack_client_t*, jack_uuid_t subject, const char* key, const char* value, const char* type);
LIB_EXPORT int jack_get_property(jack_uuid_t subject, const char* key, char** value, char** type);
LIB_EXPORT void jack_free_description(jack_description_t* desc, int free_description_itself);
LIB_EXPORT int jack_get_properties(jack_uuid_t subject, jack_description_t* desc);
LIB_EXPORT int jack_get_all_properties(jack_description_t** descs);
LIB_EXPORT int jack_remove_property(jack_client_t* client, jack_uuid_t subject, const char* key);
LIB_EXPORT int jack_remove_properties(jack_client_t* client, jack_uuid_t subject);
LIB_EXPORT int jack_remove_all_properties(jack_client_t* client);
LIB_EXPORT int jack_set_property_change_callback(jack_client_t* client, JackPropertyChangeCallback callback, void* arg);

#ifdef __cplusplus
}
#endif
@@ -2140,3 +2151,112 @@ LIB_EXPORT int jack_uuid_empty(jack_uuid_t u)
{
return u == JACK_UUID_EMPTY_INITIALIZER;
}

// Metadata API

LIB_EXPORT int jack_set_property(jack_client_t* ext_client, jack_uuid_t subject, const char* key, const char* value, const char* type)
{
JackGlobals::CheckContext("jack_set_property");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_set_property ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_set_property called with a NULL client");
return -1;
} else {
JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->SetProperty(client, subject, key, value, type) : -1);
}
}

LIB_EXPORT int jack_get_property(jack_uuid_t subject, const char* key, char** value, char** type)
{
JackGlobals::CheckContext("jack_get_property");

JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->GetProperty(subject, key, value, type) : -1);
}

LIB_EXPORT void jack_free_description(jack_description_t* desc, int free_actual_description_too)
{
JackGlobals::CheckContext("jack_free_description");

JackMetadata* metadata = GetMetadata();
if (metadata)
metadata->FreeDescription(desc, free_actual_description_too);
}

LIB_EXPORT int jack_get_properties(jack_uuid_t subject, jack_description_t* desc)
{
JackGlobals::CheckContext("jack_get_properties");

JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->GetProperties(subject, desc) : -1);
}

LIB_EXPORT int jack_get_all_properties(jack_description_t** descriptions)
{
JackGlobals::CheckContext("jack_get_all_properties");

JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->GetAllProperties(descriptions) : -1);
}

LIB_EXPORT int jack_remove_property(jack_client_t* ext_client, jack_uuid_t subject, const char* key)
{
JackGlobals::CheckContext("jack_remove_property");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_remove_property ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_remove_property called with a NULL client");
return -1;
} else {
JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->RemoveProperty(client, subject, key) : -1);
}
}

LIB_EXPORT int jack_remove_properties(jack_client_t* ext_client, jack_uuid_t subject)
{
JackGlobals::CheckContext("jack_remove_properties");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_remove_properties ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_remove_properties called with a NULL client");
return -1;
} else {
JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->RemoveProperties(client, subject) : -1);
}
}

LIB_EXPORT int jack_remove_all_properties(jack_client_t* ext_client)
{
JackGlobals::CheckContext("jack_remove_all_properties");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_remove_all_properties ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_remove_all_properties called with a NULL client");
return -1;
} else {
JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->RemoveAllProperties(client) : -1);
}
}

LIB_EXPORT int jack_set_property_change_callback(jack_client_t* ext_client, JackPropertyChangeCallback callback, void* arg)
{
JackGlobals::CheckContext("jack_set_property_change_callback");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_set_property_change_callback ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_set_property_change_callback called with a NULL client");
return -1;
} else {
return client->SetPropertyChangeCallback(callback, arg);
}
}

+ 1
- 0
common/JackGlobals.h View File

@@ -59,6 +59,7 @@ struct JackGlobals {
extern SERVER_EXPORT JackGraphManager* GetGraphManager();
extern SERVER_EXPORT JackEngineControl* GetEngineControl();
extern SERVER_EXPORT JackSynchro* GetSynchroTable();
extern SERVER_EXPORT JackMetadata* GetMetadata();

} // end of namespace



+ 5
- 0
common/JackInternalClient.cpp View File

@@ -53,6 +53,11 @@ SERVER_EXPORT JackSynchro* GetSynchroTable()
return JackServerGlobals::fInstance->GetSynchroTable();
}

SERVER_EXPORT JackMetadata* GetMetadata()
{
return JackServerGlobals::fInstance->GetMetadata();
}

JackInternalClient::JackInternalClient(JackServer* server, JackSynchro* table): JackClient(table)
{
fChannel = new JackInternalClientChannel(server);


+ 0
- 119
common/JackLibAPI.cpp View File

@@ -47,16 +47,6 @@ extern "C"
LIB_EXPORT int jack_client_close (jack_client_t *client);
LIB_EXPORT int jack_get_client_pid (const char *name);

LIB_EXPORT int jack_set_property(jack_client_t*, jack_uuid_t subject, const char* key, const char* value, const char* type);
LIB_EXPORT int jack_get_property(jack_uuid_t subject, const char* key, char** value, char** type);
LIB_EXPORT void jack_free_description(jack_description_t* desc, int free_description_itself);
LIB_EXPORT int jack_get_properties(jack_uuid_t subject, jack_description_t* desc);
LIB_EXPORT int jack_get_all_properties(jack_description_t** descs);
LIB_EXPORT int jack_remove_property(jack_client_t* client, jack_uuid_t subject, const char* key);
LIB_EXPORT int jack_remove_properties(jack_client_t* client, jack_uuid_t subject);
LIB_EXPORT int jack_remove_all_properties(jack_client_t* client);
LIB_EXPORT int jack_set_property_change_callback(jack_client_t* client, JackPropertyChangeCallback callback, void* arg);

#ifdef __cplusplus
}
#endif
@@ -222,112 +212,3 @@ LIB_EXPORT int jack_get_client_pid(const char *name)
jack_error("jack_get_client_pid : not implemented on library side");
return 0;
}

// Metadata API

LIB_EXPORT int jack_set_property(jack_client_t* ext_client, jack_uuid_t subject, const char* key, const char* value, const char* type)
{
JackGlobals::CheckContext("jack_set_property");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_set_property ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_set_property called with a NULL client");
return -1;
} else {
JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->SetProperty(client, subject, key, value, type) : -1);
}
}

LIB_EXPORT int jack_get_property(jack_uuid_t subject, const char* key, char** value, char** type)
{
JackGlobals::CheckContext("jack_get_property");

JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->GetProperty(subject, key, value, type) : -1);
}

LIB_EXPORT void jack_free_description(jack_description_t* desc, int free_actual_description_too)
{
JackGlobals::CheckContext("jack_free_description");

JackMetadata* metadata = GetMetadata();
if (metadata)
metadata->FreeDescription(desc, free_actual_description_too);
}

LIB_EXPORT int jack_get_properties(jack_uuid_t subject, jack_description_t* desc)
{
JackGlobals::CheckContext("jack_get_properties");

JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->GetProperties(subject, desc) : -1);
}

LIB_EXPORT int jack_get_all_properties(jack_description_t** descriptions)
{
JackGlobals::CheckContext("jack_get_all_properties");

JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->GetAllProperties(descriptions) : -1);
}

LIB_EXPORT int jack_remove_property(jack_client_t* ext_client, jack_uuid_t subject, const char* key)
{
JackGlobals::CheckContext("jack_remove_property");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_remove_property ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_remove_property called with a NULL client");
return -1;
} else {
JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->RemoveProperty(client, subject, key) : -1);
}
}

LIB_EXPORT int jack_remove_properties(jack_client_t* ext_client, jack_uuid_t subject)
{
JackGlobals::CheckContext("jack_remove_properties");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_remove_properties ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_remove_properties called with a NULL client");
return -1;
} else {
JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->RemoveProperties(client, subject) : -1);
}
}

LIB_EXPORT int jack_remove_all_properties(jack_client_t* ext_client)
{
JackGlobals::CheckContext("jack_remove_all_properties");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_remove_all_properties ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_remove_all_properties called with a NULL client");
return -1;
} else {
JackMetadata* metadata = GetMetadata();
return (metadata ? metadata->RemoveAllProperties(client) : -1);
}
}

LIB_EXPORT int jack_set_property_change_callback(jack_client_t* ext_client, JackPropertyChangeCallback callback, void* arg)
{
JackGlobals::CheckContext("jack_set_property_change_callback");

JackClient* client = (JackClient*)ext_client;
jack_log("jack_set_property_change_callback ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_set_property_change_callback called with a NULL client");
return -1;
} else {
return client->SetPropertyChangeCallback(callback, arg);
}
}

+ 0
- 1
common/JackLibClient.cpp View File

@@ -51,7 +51,6 @@ JackSynchro* GetSynchroTable()
return (JackLibGlobals::fGlobals ? JackLibGlobals::fGlobals->fSynchroTable : 0);
}

// Used for client-side Metadata API (JackLibAPI.cpp)
JackMetadata* GetMetadata()
{
if (JackLibGlobals::fGlobals) {


+ 1
- 3
common/JackLibClient.h View File

@@ -52,11 +52,9 @@ class JackLibClient : public JackClient
JackGraphManager* GetGraphManager() const;
JackEngineControl* GetEngineControl() const;
JackClientControl* GetClientControl() const;
JackMetadata* GetMetadata() const;
};

// Used for client-side Metadata API (JackLibAPI.cpp)
JackMetadata* GetMetadata();

} // end of namespace

#endif


+ 7
- 0
common/JackServer.cpp View File

@@ -54,6 +54,7 @@ JackServer::JackServer(bool sync, bool temporary, int timeout, bool rt, int prio
jack_info("self-connect-mode is \"%s\"", jack_get_self_connect_mode_description(self_connect_mode));

fGraphManager = JackGraphManager::Allocate(port_max);
fMetadata = new JackMetadata(true);
fEngineControl = new JackEngineControl(sync, temporary, timeout, rt, priority, verbose, clock, server_name);
fEngine = new JackLockedEngine(fGraphManager, GetSynchroTable(), fEngineControl, self_connect_mode);

@@ -76,6 +77,7 @@ JackServer::JackServer(bool sync, bool temporary, int timeout, bool rt, int prio
JackServer::~JackServer()
{
JackGraphManager::Destroy(fGraphManager);
delete fMetadata;
delete fDriverInfo;
delete fThreadedFreewheelDriver;
delete fEngine;
@@ -464,5 +466,10 @@ JackGraphManager* JackServer::GetGraphManager()
return fGraphManager;
}

JackMetadata* JackServer::GetMetadata()
{
return fMetadata;
}

} // end of namespace


+ 3
- 0
common/JackServer.h View File

@@ -38,6 +38,7 @@ class JackDriverClientInterface;
struct JackEngineControl;
class JackLockedEngine;
class JackLoadableInternalClient;
class JackMetadata;

/*!
\brief The Jack server.
@@ -55,6 +56,7 @@ class SERVER_EXPORT JackServer
JackLockedEngine* fEngine;
JackEngineControl* fEngineControl;
JackGraphManager* fGraphManager;
JackMetadata* fMetadata;
JackServerChannel fRequestChannel;
JackConnectionManager fConnectionState;
JackSynchro fSynchroTable[CLIENT_NUM];
@@ -104,6 +106,7 @@ class SERVER_EXPORT JackServer
JackEngineControl* GetEngineControl();
JackSynchro* GetSynchroTable();
JackGraphManager* GetGraphManager();
JackMetadata* GetMetadata();

};



Loading…
Cancel
Save