summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuerra Mattia <mguerra@de.adit-jv.com>2017-09-29 10:51:32 +0200
committerJens Lorenz <jlorenz@de.adit-jv.com>2017-09-29 11:42:01 +0200
commit4090fe1d40c978d8c8cbc6a156dbfa664305163e (patch)
treed72aa2ef57170b74221c137b258eeead5b8378c7
parentc7f1fd1a0b14686d06043be27f0ac03265aac16f (diff)
downloadaudiomanager-4090fe1d40c978d8c8cbc6a156dbfa664305163e.tar.gz
AMCore: remodel ctor Sender in Command and Routing
Moving plugin opening to a separate function, this gets rid of a memory writer behavior on ARM64 platforms, otherwise leading to a this pointer of lambda functions severely corrupted (only when compiling optimizations are enabled). Signed-off-by: Guerra Mattia <mguerra@de.adit-jv.com>
-rw-r--r--AudioManagerCore/include/CAmCommandSender.h2
-rw-r--r--AudioManagerCore/include/CAmRoutingSender.h1
-rw-r--r--AudioManagerCore/src/CAmCommandSender.cpp203
-rw-r--r--AudioManagerCore/src/CAmRoutingSender.cpp256
4 files changed, 238 insertions, 224 deletions
diff --git a/AudioManagerCore/include/CAmCommandSender.h b/AudioManagerCore/include/CAmCommandSender.h
index 2f7daec..c9f8fb6 100644
--- a/AudioManagerCore/include/CAmCommandSender.h
+++ b/AudioManagerCore/include/CAmCommandSender.h
@@ -81,7 +81,7 @@ public:
friend class IAmCommandBackdoor; //this is to get access to the loaded plugins and be able to exchange the interfaces
#endif
private:
-
+ void loadPlugins(const std::vector<std::string>& listOfPluginDirectories);
void unloadLibraries(void); //!< unload the shared libraries
std::vector<IAmCommandSend*> mListInterfaces; //!< list of all interfaces
std::vector<void*> mListLibraryHandles; //!< list of all library handles. This information is used to unload the plugins correctly.
diff --git a/AudioManagerCore/include/CAmRoutingSender.h b/AudioManagerCore/include/CAmRoutingSender.h
index 8d8a063..e14dd6d 100644
--- a/AudioManagerCore/include/CAmRoutingSender.h
+++ b/AudioManagerCore/include/CAmRoutingSender.h
@@ -306,6 +306,7 @@ private:
}
};
+ void loadPlugins(const std::vector<std::string>& listOfPluginDirectories);
am_Handle_s createHandle(std::shared_ptr<handleDataBase> handleData, const am_Handle_e type); //!< creates a handle
void unloadLibraries(void); //!< unloads all loaded plugins
diff --git a/AudioManagerCore/src/CAmCommandSender.cpp b/AudioManagerCore/src/CAmCommandSender.cpp
index 6626bdb..ded3247 100644
--- a/AudioManagerCore/src/CAmCommandSender.cpp
+++ b/AudioManagerCore/src/CAmCommandSender.cpp
@@ -59,6 +59,100 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
mCommandReceiver(),
mSerializer(iSocketHandler)
{
+ loadPlugins(listOfPluginDirectories);
+
+ dboNewMainConnection = [&](const am_MainConnectionType_s& mainConnection) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbNewMainConnection, mainConnection);
+ };
+ dboRemovedMainConnection = [&](const am_mainConnectionID_t mainConnection) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbRemovedMainConnection, mainConnection);
+ };
+ dboNewSink = [&](const am_Sink_s& sink) {
+ if (sink.visible)
+ {
+ am_SinkType_s s;
+ s.availability = sink.available;
+ s.muteState = sink.muteState;
+ s.name = sink.name;
+ s.sinkClassID = sink.sinkClassID;
+ s.sinkID = sink.sinkID;
+ s.volume = sink.mainVolume;
+ typedef void(CAmCommandSender::*TMeth)(am::am_SinkType_s);
+ mSerializer.asyncCall<CAmCommandSender, TMeth, am::am_SinkType_s>(this, &CAmCommandSender::cbNewSink, s);
+ }
+ };
+ dboNewSource = [&](const am_Source_s& source) {
+ if (source.visible)
+ {
+ am_SourceType_s s;
+ s.availability = source.available;
+ s.name = source.name;
+ s.sourceClassID = source.sourceClassID;
+ s.sourceID = source.sourceID;
+ typedef void(CAmCommandSender::*TMeth)(am::am_SourceType_s);
+ mSerializer.asyncCall<CAmCommandSender, TMeth, am::am_SourceType_s>(this, &CAmCommandSender::cbNewSource, s);
+ }
+ };
+
+ dboRemovedSink = [&](const am_sinkID_t sinkID, const bool visible) {
+ if (visible)
+ mSerializer.asyncCall(this, &CAmCommandSender::cbRemovedSink, sinkID);
+ };
+ dboRemovedSource = [&](const am_sourceID_t sourceID, const bool visible) {
+ if (visible)
+ mSerializer.asyncCall(this, &CAmCommandSender::cbRemovedSource, sourceID);
+ };
+ dboNumberOfSinkClassesChanged = [&]() {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbNumberOfSinkClassesChanged);
+ };
+ dboNumberOfSourceClassesChanged = [&]() {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbNumberOfSourceClassesChanged);
+ };
+ dboMainConnectionStateChanged = [&](const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbMainConnectionStateChanged, connectionID, connectionState);
+ };
+ dboMainSinkSoundPropertyChanged = [&](const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbMainSinkSoundPropertyChanged, sinkID, SoundProperty);
+ };
+ dboMainSourceSoundPropertyChanged = [&](const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbMainSourceSoundPropertyChanged, sourceID, SoundProperty);
+ };
+ dboSinkAvailabilityChanged = [&](const am_sinkID_t sinkID, const am_Availability_s & availability) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbSinkAvailabilityChanged, sinkID, availability);
+ };
+ dboSourceAvailabilityChanged = [&](const am_sourceID_t sourceID, const am_Availability_s & availability) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbSourceAvailabilityChanged, sourceID, availability);
+ };
+ dboVolumeChanged = [&](const am_sinkID_t sinkID, const am_mainVolume_t volume) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbVolumeChanged, sinkID, volume);
+ };
+ dboSinkMuteStateChanged = [&](const am_sinkID_t sinkID, const am_MuteState_e muteState) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbSinkMuteStateChanged, sinkID, muteState);
+ };
+ dboSystemPropertyChanged = [&](const am_SystemProperty_s& SystemProperty) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbSystemPropertyChanged, SystemProperty);
+ };
+ dboTimingInformationChanged = [&](const am_mainConnectionID_t mainConnection, const am_timeSync_t time) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbTimingInformationChanged, mainConnection, time);
+ };
+ dboSinkUpdated = [&](const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties, const bool visible) {
+ if (visible)
+ mSerializer.asyncCall(this, &CAmCommandSender::cbSinkUpdated, sinkID, sinkClassID, listMainSoundProperties);
+ };
+ dboSourceUpdated = [&](const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties, const bool visible) {
+ if (visible)
+ mSerializer.asyncCall(this, &CAmCommandSender::cbSinkUpdated, sourceID, sourceClassID, listMainSoundProperties);
+ };
+ dboSinkMainNotificationConfigurationChanged = [&](const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbSinkMainNotificationConfigurationChanged, sinkID, mainNotificationConfiguration);
+ };
+ dboSourceMainNotificationConfigurationChanged = [&](const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbSourceMainNotificationConfigurationChanged, sourceID, mainNotificationConfiguration);
+ };
+}
+
+void CAmCommandSender::loadPlugins(const std::vector<std::string>& listOfPluginDirectories)
+{
if (listOfPluginDirectories.empty())
{
logError(__METHOD_NAME__,"List of commandplugins is empty");
@@ -93,16 +187,18 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1));
// Handle cases where readdir() could not determine the file type
- if (entryType == DT_UNKNOWN) {
- struct stat buf;
+ if (entryType == DT_UNKNOWN)
+ {
+ struct stat buf;
- if (stat(fullName.c_str(), &buf)) {
- logInfo(__METHOD_NAME__,"Failed to stat file: ", entryName, errno);
- continue;
- }
+ if (stat(fullName.c_str(), &buf))
+ {
+ logInfo(__METHOD_NAME__,"Failed to stat file: ", entryName, errno);
+ continue;
+ }
- regularFile = S_ISREG(buf.st_mode);
- }
+ regularFile = S_ISREG(buf.st_mode);
+ }
if (regularFile && sharedLibExtension)
{
@@ -147,8 +243,6 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
std::istringstream(version.substr(2, 1)) >> minorVersion;
std::istringstream(cVersion.substr(0, 1)) >> cMajorVersion;
std::istringstream(cVersion.substr(2, 1)) >> cMinorVersion;
-
-
if (majorVersion < cMajorVersion || ((majorVersion == cMajorVersion) && (minorVersion > cMinorVersion)))
{
@@ -161,95 +255,6 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
mListLibraryHandles.push_back(tempLibHandle);
mListLibraryNames.push_back(iter->c_str());
}
-
- dboNewMainConnection = [&](const am_MainConnectionType_s& mainConnection) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbNewMainConnection, mainConnection);
- };
- dboRemovedMainConnection = [&](const am_mainConnectionID_t mainConnection) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbRemovedMainConnection, mainConnection);
- };
- dboNewSink = [&](const am_Sink_s& sink) {
- if (sink.visible)
- {
- am_SinkType_s s;
- s.availability = sink.available;
- s.muteState = sink.muteState;
- s.name = sink.name;
- s.sinkClassID = sink.sinkClassID;
- s.sinkID = sink.sinkID;
- s.volume = sink.mainVolume;
- typedef void(CAmCommandSender::*TMeth)(am::am_SinkType_s) ;
- mSerializer.asyncCall<CAmCommandSender, TMeth, am::am_SinkType_s>(this, &CAmCommandSender::cbNewSink, s);
- }
- };
- dboNewSource = [&](const am_Source_s& source) {
- if (source.visible)
- {
- am_SourceType_s s;
- s.availability = source.available;
- s.name = source.name;
- s.sourceClassID = source.sourceClassID;
- s.sourceID = source.sourceID;
- typedef void(CAmCommandSender::*TMeth)(am::am_SourceType_s) ;
- mSerializer.asyncCall<CAmCommandSender, TMeth, am::am_SourceType_s>(this, &CAmCommandSender::cbNewSource, s);
- }
- };
-
- dboRemovedSink = [&](const am_sinkID_t sinkID, const bool visible) {
- if (visible)
- mSerializer.asyncCall(this, &CAmCommandSender::cbRemovedSink, sinkID);
- };
- dboRemovedSource = [&](const am_sourceID_t sourceID, const bool visible) {
- if (visible)
- mSerializer.asyncCall(this, &CAmCommandSender::cbRemovedSource, sourceID);
- };
- dboNumberOfSinkClassesChanged = [&]() {
- mSerializer.asyncCall(this, &CAmCommandSender::cbNumberOfSinkClassesChanged);
- };
- dboNumberOfSourceClassesChanged = [&]() {
- mSerializer.asyncCall(this, &CAmCommandSender::cbNumberOfSourceClassesChanged);
- };
- dboMainConnectionStateChanged = [&](const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbMainConnectionStateChanged, connectionID, connectionState);
- };
- dboMainSinkSoundPropertyChanged = [&](const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbMainSinkSoundPropertyChanged, sinkID, SoundProperty);
- };
- dboMainSourceSoundPropertyChanged = [&](const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbMainSourceSoundPropertyChanged, sourceID, SoundProperty);
- };
- dboSinkAvailabilityChanged = [&](const am_sinkID_t sinkID, const am_Availability_s & availability) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbSinkAvailabilityChanged, sinkID, availability);
- };
- dboSourceAvailabilityChanged = [&](const am_sourceID_t sourceID, const am_Availability_s & availability) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbSourceAvailabilityChanged, sourceID, availability);
- };
- dboVolumeChanged = [&](const am_sinkID_t sinkID, const am_mainVolume_t volume) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbVolumeChanged, sinkID, volume);
- };
- dboSinkMuteStateChanged = [&](const am_sinkID_t sinkID, const am_MuteState_e muteState) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbSinkMuteStateChanged, sinkID, muteState);
- };
- dboSystemPropertyChanged = [&](const am_SystemProperty_s& SystemProperty) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbSystemPropertyChanged, SystemProperty);
- };
- dboTimingInformationChanged = [&](const am_mainConnectionID_t mainConnection, const am_timeSync_t time) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbTimingInformationChanged, mainConnection, time);
- };
- dboSinkUpdated = [&](const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties, const bool visible) {
- if (visible)
- mSerializer.asyncCall(this, &CAmCommandSender::cbSinkUpdated, sinkID, sinkClassID, listMainSoundProperties);
- };
- dboSourceUpdated = [&](const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties, const bool visible) {
- if (visible)
- mSerializer.asyncCall(this, &CAmCommandSender::cbSinkUpdated, sourceID, sourceClassID, listMainSoundProperties);
- };
- dboSinkMainNotificationConfigurationChanged = [&](const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbSinkMainNotificationConfigurationChanged, sinkID, mainNotificationConfiguration);
- };
- dboSourceMainNotificationConfigurationChanged = [&](const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration) {
- mSerializer.asyncCall(this, &CAmCommandSender::cbSourceMainNotificationConfigurationChanged, sourceID, mainNotificationConfiguration);
- };
}
CAmCommandSender::~CAmCommandSender()
diff --git a/AudioManagerCore/src/CAmRoutingSender.cpp b/AudioManagerCore/src/CAmRoutingSender.cpp
index 9cc013d..603d7b3 100644
--- a/AudioManagerCore/src/CAmRoutingSender.cpp
+++ b/AudioManagerCore/src/CAmRoutingSender.cpp
@@ -59,146 +59,154 @@ CAmRoutingSender::CAmRoutingSender(
mpRoutingReceiver(), //
mpDatabaseHandler(databaseHandler) {
- if (listOfPluginDirectories.empty()) {
- logError(__METHOD_NAME__,"List of routingplugins is empty");
- }
-
- std::vector<std::string> sharedLibraryNameList;
- std::vector<std::string>::const_iterator dirIter = listOfPluginDirectories.begin();
- std::vector<std::string>::const_iterator dirIterEnd = listOfPluginDirectories.end();
-
- // search communicator plugins in configured directories
- for (; dirIter < dirIterEnd; ++dirIter)
- {
- const char* directoryName = dirIter->c_str();
- logInfo(__METHOD_NAME__,"Searching for HookPlugins in", directoryName);
- DIR *directory = opendir(directoryName);
-
- if (!directory)
- {
- logError(__METHOD_NAME__,"Error opening directory: ", directoryName);
- continue;
- }
-
- // iterate content of directory
- struct dirent *itemInDirectory = 0;
- while ((itemInDirectory = readdir(directory)))
- {
- unsigned char entryType = itemInDirectory->d_type;
- std::string entryName = itemInDirectory->d_name;
- std::string fullName = *dirIter + "/" + entryName;
-
- bool regularFile = (entryType == DT_REG || entryType == DT_LNK);
- bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1));
+ loadPlugins(listOfPluginDirectories);
+
+ dboNewSink = [&](const am_Sink_s& sink) {
+ addSinkLookup(sink);
+ };
+ dboNewSource = [&](const am_Source_s& source) {
+ addSourceLookup(source);
+ };
+ dboNewDomain = [&](const am_Domain_s& domain) {
+ addDomainLookup(domain);
+ };
+ //todo: newGateway implement something
+ //todo: newConverter implement something
+ dboNewCrossfader = [&](const am_Crossfader_s& crossfader) {
+ addCrossfaderLookup(crossfader);
+ };
+ dboRemovedSink = [&](const am_sinkID_t sinkID, const bool visible) {
+ removeSinkLookup(sinkID);
+ };
+ dboRemovedSource = [&](const am_sourceID_t sourceID, const bool visible) {
+ removeSourceLookup(sourceID);
+ };
+ dboRemoveDomain = [&](const am_domainID_t domainID) {
+ removeDomainLookup(domainID);
+ };
+ //todo: removeGateway implement something
+ //todo: removeConverter implement something
+ dboRemoveCrossfader = [&](const am_crossfaderID_t crossfaderID) {
+ removeCrossfaderLookup(crossfaderID);
+ };
+}
- // Handle cases where readdir() could not determine the file type
- if (entryType == DT_UNKNOWN) {
- struct stat buf;
+void CAmRoutingSender::loadPlugins(const std::vector<std::string>& listOfPluginDirectories)
+{
+ if (listOfPluginDirectories.empty())
+ {
+ logError(__METHOD_NAME__,"List of routingplugins is empty");
+ }
- if (stat(fullName.c_str(), &buf)) {
- logInfo(__METHOD_NAME__,"Failed to stat file: ", entryName, errno);
- continue;
- }
+ std::vector<std::string> sharedLibraryNameList;
+ std::vector<std::string>::const_iterator dirIter = listOfPluginDirectories.begin();
+ std::vector<std::string>::const_iterator dirIterEnd = listOfPluginDirectories.end();
- regularFile = S_ISREG(buf.st_mode);
- }
+ // search communicator plugins in configured directories
+ for (; dirIter < dirIterEnd; ++dirIter)
+ {
+ const char* directoryName = dirIter->c_str();
+ logInfo(__METHOD_NAME__,"Searching for HookPlugins in", directoryName);
+ DIR *directory = opendir(directoryName);
- if (regularFile && sharedLibExtension)
- {
- logInfo(__METHOD_NAME__,"adding file: ", entryName);
- std::string name(directoryName);
- sharedLibraryNameList.push_back(name + "/" + entryName);
- }
- else
- {
- logInfo(__METHOD_NAME__, "plugin search ignoring file :", entryName);
- }
- }
+ if (!directory)
+ {
+ logError(__METHOD_NAME__,"Error opening directory: ", directoryName);
+ continue;
+ }
- closedir(directory);
- }
+ // iterate content of directory
+ struct dirent *itemInDirectory = 0;
+ while ((itemInDirectory = readdir(directory)))
+ {
+ unsigned char entryType = itemInDirectory->d_type;
+ std::string entryName = itemInDirectory->d_name;
+ std::string fullName = *dirIter + "/" + entryName;
+
+ bool regularFile = (entryType == DT_REG || entryType == DT_LNK);
+ bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1));
+
+ // Handle cases where readdir() could not determine the file type
+ if (entryType == DT_UNKNOWN)
+ {
+ struct stat buf;
+
+ if (stat(fullName.c_str(), &buf))
+ {
+ logInfo(__METHOD_NAME__,"Failed to stat file: ", entryName, errno);
+ continue;
+ }
+
+ regularFile = S_ISREG(buf.st_mode);
+ }
+
+ if (regularFile && sharedLibExtension)
+ {
+ logInfo(__METHOD_NAME__,"adding file: ", entryName);
+ std::string name(directoryName);
+ sharedLibraryNameList.push_back(name + "/" + entryName);
+ }
+ else
+ {
+ logInfo(__METHOD_NAME__, "plugin search ignoring file :", entryName);
+ }
+ }
- // iterate all communicator plugins and start them
- std::vector<std::string>::iterator iter = sharedLibraryNameList.begin();
- std::vector<std::string>::iterator iterEnd = sharedLibraryNameList.end();
+ closedir(directory);
+ }
- for (; iter != iterEnd; ++iter)
- {
- logInfo(__METHOD_NAME__,"try loading: ", *iter);
+ // iterate all communicator plugins and start them
+ std::vector<std::string>::iterator iter = sharedLibraryNameList.begin();
+ std::vector<std::string>::iterator iterEnd = sharedLibraryNameList.end();
- IAmRoutingSend* (*createFunc)();
- void* tempLibHandle = NULL;
- createFunc = getCreateFunction<IAmRoutingSend*()>(*iter, tempLibHandle);
+ for (; iter != iterEnd; ++iter)
+ {
+ logInfo(__METHOD_NAME__,"try loading: ", *iter);
- if (!createFunc)
- {
- logError(__METHOD_NAME__,"Entry point of RoutingPlugin not found");
- continue;
- }
+ IAmRoutingSend* (*createFunc)();
+ void* tempLibHandle = NULL;
+ createFunc = getCreateFunction<IAmRoutingSend*()>(*iter, tempLibHandle);
- IAmRoutingSend* router = createFunc();
+ if (!createFunc)
+ {
+ logError(__METHOD_NAME__,"Entry point of RoutingPlugin not found");
+ continue;
+ }
- if (!router)
- {
- logError(__METHOD_NAME__,"initialization of plugin ",*iter,"failed. Entry Function not callable");
- dlclose(tempLibHandle);
- continue;
- }
+ IAmRoutingSend* router = createFunc();
- InterfaceNamePairs routerInterface;
- routerInterface.routingInterface = router;
+ if (!router)
+ {
+ logError(__METHOD_NAME__,"initialization of plugin ",*iter,"failed. Entry Function not callable");
+ dlclose(tempLibHandle);
+ continue;
+ }
- //check libversion
- std::string version, cVersion(RoutingVersion);
- router->getInterfaceVersion(version);
- uint16_t minorVersion, majorVersion, cMinorVersion, cMajorVersion;
- std::istringstream(version.substr(0, 1)) >> majorVersion;
- std::istringstream(version.substr(2, 1)) >> minorVersion;
- std::istringstream(cVersion.substr(0, 1)) >> cMajorVersion;
- std::istringstream(cVersion.substr(2, 1)) >> cMinorVersion;
+ InterfaceNamePairs routerInterface;
+ routerInterface.routingInterface = router;
- if (majorVersion < cMajorVersion || ((majorVersion == cMajorVersion) && (minorVersion > cMinorVersion)))
- {
- logError(__METHOD_NAME__,"Routing initialization failed. Version of Interface to old");
- dlclose(tempLibHandle);
- continue;
- }
+ //check libversion
+ std::string version, cVersion(RoutingVersion);
+ router->getInterfaceVersion(version);
+ uint16_t minorVersion, majorVersion, cMinorVersion, cMajorVersion;
+ std::istringstream(version.substr(0, 1)) >> majorVersion;
+ std::istringstream(version.substr(2, 1)) >> minorVersion;
+ std::istringstream(cVersion.substr(0, 1)) >> cMajorVersion;
+ std::istringstream(cVersion.substr(2, 1)) >> cMinorVersion;
- //here, the busname is saved together with the interface. Later The domains will register with the name and sinks, sources etc with the domain....
- router->returnBusName(routerInterface.busName);
- assert(!routerInterface.busName.empty());
- mListInterfaces.push_back(routerInterface);
- mListLibraryHandles.push_back(tempLibHandle);
- }
+ if (majorVersion < cMajorVersion || ((majorVersion == cMajorVersion) && (minorVersion > cMinorVersion)))
+ {
+ logError(__METHOD_NAME__,"Routing initialization failed. Version of Interface to old");
+ dlclose(tempLibHandle);
+ continue;
+ }
- dboNewSink = [&](const am_Sink_s& sink) {
- addSinkLookup(sink);
- };
- dboNewSource = [&](const am_Source_s& source) {
- addSourceLookup(source);
- };
- dboNewDomain = [&](const am_Domain_s& domain) {
- addDomainLookup(domain);
- };
- //todo: newGateway implement something
- //todo: newConverter implement something
- dboNewCrossfader = [&](const am_Crossfader_s& crossfader) {
- addCrossfaderLookup(crossfader);
- };
- dboRemovedSink = [&](const am_sinkID_t sinkID, const bool visible) {
- removeSinkLookup(sinkID);
- };
- dboRemovedSource = [&](const am_sourceID_t sourceID, const bool visible) {
- removeSourceLookup(sourceID);
- };
- dboRemoveDomain = [&](const am_domainID_t domainID) {
- removeDomainLookup(domainID);
- };
- //todo: removeGateway implement something
- //todo: removeConverter implement something
- dboRemoveCrossfader = [&](const am_crossfaderID_t crossfaderID) {
- removeCrossfaderLookup(crossfaderID);
- };
+ //here, the busname is saved together with the interface. Later The domains will register with the name and sinks, sources etc with the domain....
+ router->returnBusName(routerInterface.busName);
+ assert(!routerInterface.busName.empty());
+ mListInterfaces.push_back(routerInterface);
+ mListLibraryHandles.push_back(tempLibHandle);
+ }
}
CAmRoutingSender::~CAmRoutingSender()