mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:17:40 +02:00
Merge pull request #10804 from jherico/fix_deps_3
Remove dependency between codec plugins and UI
This commit is contained in:
commit
f1fe4ed7cc
11 changed files with 58 additions and 29 deletions
|
@ -11,7 +11,7 @@ endif ()
|
||||||
link_hifi_libraries(
|
link_hifi_libraries(
|
||||||
audio avatars octree gpu model fbx entities
|
audio avatars octree gpu model fbx entities
|
||||||
networking animation recording shared script-engine embedded-webserver
|
networking animation recording shared script-engine embedded-webserver
|
||||||
controllers physics plugins
|
physics plugins
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|
|
@ -166,19 +166,6 @@ void AudioMixer::handleMuteEnvironmentPacket(QSharedPointer<ReceivedMessage> mes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayPluginList getDisplayPlugins() {
|
|
||||||
DisplayPluginList result;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
InputPluginList getInputPlugins() {
|
|
||||||
InputPluginList result;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// must be here to satisfy a reference in PluginManager::saveSettings()
|
|
||||||
void saveInputPluginSettings(const InputPluginList& plugins) {}
|
|
||||||
|
|
||||||
const std::pair<QString, CodecPluginPointer> AudioMixer::negotiateCodec(std::vector<QString> codecs) {
|
const std::pair<QString, CodecPluginPointer> AudioMixer::negotiateCodec(std::vector<QString> codecs) {
|
||||||
QString selectedCodecName;
|
QString selectedCodecName;
|
||||||
CodecPluginPointer selectedCodec;
|
CodecPluginPointer selectedCodec;
|
||||||
|
|
|
@ -441,6 +441,11 @@ static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement";
|
||||||
static const QString STATE_GROUNDED = "Grounded";
|
static const QString STATE_GROUNDED = "Grounded";
|
||||||
static const QString STATE_NAV_FOCUSED = "NavigationFocused";
|
static const QString STATE_NAV_FOCUSED = "NavigationFocused";
|
||||||
|
|
||||||
|
// Statically provided display and input plugins
|
||||||
|
extern DisplayPluginList getDisplayPlugins();
|
||||||
|
extern InputPluginList getInputPlugins();
|
||||||
|
extern void saveInputPluginSettings(const InputPluginList& plugins);
|
||||||
|
|
||||||
bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
const char** constArgv = const_cast<const char**>(argv);
|
const char** constArgv = const_cast<const char**>(argv);
|
||||||
|
|
||||||
|
@ -480,6 +485,11 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
|
|
||||||
Setting::init();
|
Setting::init();
|
||||||
|
|
||||||
|
// Tell the plugin manager about our statically linked plugins
|
||||||
|
PluginManager::setInputPluginProvider([] { return getInputPlugins(); });
|
||||||
|
PluginManager::setDisplayPluginProvider([] { return getDisplayPlugins(); });
|
||||||
|
PluginManager::setInputPluginSettingsPersister([](const InputPluginList& plugins) { saveInputPluginSettings(plugins); });
|
||||||
|
|
||||||
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
||||||
steamClient->init();
|
steamClient->init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
enum class PluginType {
|
enum class PluginType {
|
||||||
DISPLAY_PLUGIN,
|
DISPLAY_PLUGIN,
|
||||||
|
@ -26,8 +27,12 @@ class PluginManager;
|
||||||
|
|
||||||
using DisplayPluginPointer = std::shared_ptr<DisplayPlugin>;
|
using DisplayPluginPointer = std::shared_ptr<DisplayPlugin>;
|
||||||
using DisplayPluginList = std::vector<DisplayPluginPointer>;
|
using DisplayPluginList = std::vector<DisplayPluginPointer>;
|
||||||
|
using DisplayPluginProvider = std::function<DisplayPluginList()>;
|
||||||
using InputPluginPointer = std::shared_ptr<InputPlugin>;
|
using InputPluginPointer = std::shared_ptr<InputPlugin>;
|
||||||
using InputPluginList = std::vector<InputPluginPointer>;
|
using InputPluginList = std::vector<InputPluginPointer>;
|
||||||
|
using InputPluginProvider = std::function<InputPluginList()>;
|
||||||
using CodecPluginPointer = std::shared_ptr<CodecPlugin>;
|
using CodecPluginPointer = std::shared_ptr<CodecPlugin>;
|
||||||
using CodecPluginList = std::vector<CodecPluginPointer>;
|
using CodecPluginList = std::vector<CodecPluginPointer>;
|
||||||
|
using CodecPluginProvider = std::function<CodecPluginList()>;
|
||||||
using SteamClientPluginPointer = std::shared_ptr<SteamClientPlugin>;
|
using SteamClientPluginPointer = std::shared_ptr<SteamClientPlugin>;
|
||||||
|
using InputPluginSettingsPersister = std::function<void(const InputPluginList&)>;
|
||||||
|
|
|
@ -23,6 +23,26 @@
|
||||||
#include "InputPlugin.h"
|
#include "InputPlugin.h"
|
||||||
#include "PluginLogging.h"
|
#include "PluginLogging.h"
|
||||||
|
|
||||||
|
DisplayPluginProvider PluginManager::_displayPluginProvider = []()->DisplayPluginList { return {}; };
|
||||||
|
InputPluginProvider PluginManager::_inputPluginProvider = []()->InputPluginList { return {}; };
|
||||||
|
CodecPluginProvider PluginManager::_codecPluginProvider = []()->CodecPluginList { return {}; };
|
||||||
|
InputPluginSettingsPersister PluginManager::_inputSettingsPersister = [](const InputPluginList& list) {};
|
||||||
|
|
||||||
|
void PluginManager::setDisplayPluginProvider(const DisplayPluginProvider& provider) {
|
||||||
|
_displayPluginProvider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginManager::setInputPluginProvider(const InputPluginProvider& provider) {
|
||||||
|
_inputPluginProvider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginManager::setCodecPluginProvider(const CodecPluginProvider& provider) {
|
||||||
|
_codecPluginProvider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginManager::setInputPluginSettingsPersister(const InputPluginSettingsPersister& persister) {
|
||||||
|
_inputSettingsPersister = persister;
|
||||||
|
}
|
||||||
|
|
||||||
PluginManager* PluginManager::getInstance() {
|
PluginManager* PluginManager::getInstance() {
|
||||||
static PluginManager _manager;
|
static PluginManager _manager;
|
||||||
|
@ -117,12 +137,12 @@ const LoaderList& getLoadedPlugins() {
|
||||||
PluginManager::PluginManager() {
|
PluginManager::PluginManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern CodecPluginList getCodecPlugins();
|
|
||||||
|
|
||||||
const CodecPluginList& PluginManager::getCodecPlugins() {
|
const CodecPluginList& PluginManager::getCodecPlugins() {
|
||||||
static CodecPluginList codecPlugins;
|
static CodecPluginList codecPlugins;
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [&] {
|
std::call_once(once, [&] {
|
||||||
|
codecPlugins = _codecPluginProvider();
|
||||||
|
|
||||||
// Now grab the dynamic plugins
|
// Now grab the dynamic plugins
|
||||||
for (auto loader : getLoadedPlugins()) {
|
for (auto loader : getLoadedPlugins()) {
|
||||||
CodecProvider* codecProvider = qobject_cast<CodecProvider*>(loader->instance());
|
CodecProvider* codecProvider = qobject_cast<CodecProvider*>(loader->instance());
|
||||||
|
@ -163,11 +183,6 @@ const SteamClientPluginPointer PluginManager::getSteamClientPlugin() {
|
||||||
|
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef Q_OS_ANDROID
|
||||||
|
|
||||||
// TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class
|
|
||||||
extern DisplayPluginList getDisplayPlugins();
|
|
||||||
extern InputPluginList getInputPlugins();
|
|
||||||
|
|
||||||
extern void saveInputPluginSettings(const InputPluginList& plugins);
|
|
||||||
static DisplayPluginList displayPlugins;
|
static DisplayPluginList displayPlugins;
|
||||||
|
|
||||||
const DisplayPluginList& PluginManager::getDisplayPlugins() {
|
const DisplayPluginList& PluginManager::getDisplayPlugins() {
|
||||||
|
@ -183,7 +198,7 @@ const DisplayPluginList& PluginManager::getDisplayPlugins() {
|
||||||
|
|
||||||
std::call_once(once, [&] {
|
std::call_once(once, [&] {
|
||||||
// Grab the built in plugins
|
// Grab the built in plugins
|
||||||
displayPlugins = ::getDisplayPlugins();
|
displayPlugins = _displayPluginProvider();
|
||||||
|
|
||||||
|
|
||||||
// Now grab the dynamic plugins
|
// Now grab the dynamic plugins
|
||||||
|
@ -229,7 +244,7 @@ const InputPluginList& PluginManager::getInputPlugins() {
|
||||||
};
|
};
|
||||||
|
|
||||||
std::call_once(once, [&] {
|
std::call_once(once, [&] {
|
||||||
inputPlugins = ::getInputPlugins();
|
inputPlugins = _inputPluginProvider();
|
||||||
|
|
||||||
// Now grab the dynamic plugins
|
// Now grab the dynamic plugins
|
||||||
for (auto loader : getLoadedPlugins()) {
|
for (auto loader : getLoadedPlugins()) {
|
||||||
|
@ -288,7 +303,7 @@ void PluginManager::disableInputs(const QStringList& inputs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginManager::saveSettings() {
|
void PluginManager::saveSettings() {
|
||||||
saveInputPluginSettings(getInputPlugins());
|
_inputSettingsPersister(getInputPlugins());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginManager::shutdown() {
|
void PluginManager::shutdown() {
|
||||||
|
|
|
@ -31,6 +31,18 @@ public:
|
||||||
void setContainer(PluginContainer* container) { _container = container; }
|
void setContainer(PluginContainer* container) { _container = container; }
|
||||||
|
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
|
// Application that have statically linked plugins can expose them to the plugin manager with these function
|
||||||
|
static void setDisplayPluginProvider(const DisplayPluginProvider& provider);
|
||||||
|
static void setInputPluginProvider(const InputPluginProvider& provider);
|
||||||
|
static void setCodecPluginProvider(const CodecPluginProvider& provider);
|
||||||
|
static void setInputPluginSettingsPersister(const InputPluginSettingsPersister& persister);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static DisplayPluginProvider _displayPluginProvider;
|
||||||
|
static InputPluginProvider _inputPluginProvider;
|
||||||
|
static CodecPluginProvider _codecPluginProvider;
|
||||||
|
static InputPluginSettingsPersister _inputSettingsPersister;
|
||||||
|
|
||||||
PluginContainer* _container { nullptr };
|
PluginContainer* _container { nullptr };
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
set(TARGET_NAME hifiCodec)
|
set(TARGET_NAME hifiCodec)
|
||||||
setup_hifi_client_server_plugin()
|
setup_hifi_client_server_plugin()
|
||||||
link_hifi_libraries(audio plugins input-plugins display-plugins)
|
link_hifi_libraries(audio plugins)
|
||||||
add_dependency_external_projects(hifiAudioCodec)
|
add_dependency_external_projects(hifiAudioCodec)
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS})
|
||||||
target_link_libraries(${TARGET_NAME} ${HIFIAUDIOCODEC_LIBRARIES})
|
target_link_libraries(${TARGET_NAME} ${HIFIAUDIOCODEC_LIBRARIES})
|
||||||
|
|
|
@ -10,7 +10,7 @@ if (APPLE OR WIN32)
|
||||||
|
|
||||||
set(TARGET_NAME hifiNeuron)
|
set(TARGET_NAME hifiNeuron)
|
||||||
setup_hifi_plugin(Script Qml Widgets)
|
setup_hifi_plugin(Script Qml Widgets)
|
||||||
link_hifi_libraries(shared controllers ui plugins input-plugins display-plugins)
|
link_hifi_libraries(shared controllers ui plugins input-plugins)
|
||||||
target_neuron()
|
target_neuron()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
|
|
||||||
set(TARGET_NAME hifiSdl2)
|
set(TARGET_NAME hifiSdl2)
|
||||||
setup_hifi_plugin(Script Qml Widgets)
|
setup_hifi_plugin(Script Qml Widgets)
|
||||||
link_hifi_libraries(shared controllers ui plugins input-plugins script-engine display-plugins)
|
link_hifi_libraries(shared controllers ui plugins input-plugins script-engine)
|
||||||
target_sdl2()
|
target_sdl2()
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
set(TARGET_NAME hifiSixense)
|
set(TARGET_NAME hifiSixense)
|
||||||
setup_hifi_plugin(Script Qml Widgets)
|
setup_hifi_plugin(Script Qml Widgets)
|
||||||
link_hifi_libraries(shared controllers ui plugins ui-plugins input-plugins display-plugins)
|
link_hifi_libraries(shared controllers ui plugins ui-plugins input-plugins)
|
||||||
target_sixense()
|
target_sixense()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
|
|
||||||
set(TARGET_NAME pcmCodec)
|
set(TARGET_NAME pcmCodec)
|
||||||
setup_hifi_client_server_plugin()
|
setup_hifi_client_server_plugin()
|
||||||
link_hifi_libraries(shared plugins input-plugins display-plugins)
|
link_hifi_libraries(shared plugins)
|
||||||
install_beside_console()
|
install_beside_console()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue