core: load components internally and refactor main to just activate it

+ move the export-core creation and media-session check to be built-in components
+ add WpCore API to find the export core
This commit is contained in:
George Kiagiadakis
2023-06-21 19:35:23 +03:00
parent 6bab78bf3f
commit 840a2304b4
8 changed files with 262 additions and 260 deletions

View File

@@ -102,7 +102,6 @@ wp_lua_scripting_plugin_enable (WpPlugin * plugin, WpTransition * transition)
{
WpLuaScriptingPlugin * self = WP_LUA_SCRIPTING_PLUGIN (plugin);
g_autoptr (WpCore) core = wp_object_get_core (WP_OBJECT (plugin));
WpCore *export_core;
/* init lua engine */
self->L = wplua_new ();
@@ -111,14 +110,6 @@ wp_lua_scripting_plugin_enable (WpPlugin * plugin, WpTransition * transition)
lua_pushlightuserdata (self->L, core);
lua_settable (self->L, LUA_REGISTRYINDEX);
/* initialize secondary connection to pipewire */
export_core = g_object_get_data (G_OBJECT (core), "wireplumber.export-core");
if (export_core) {
lua_pushliteral (self->L, "wireplumber_export_core");
wplua_pushobject (self->L, g_object_ref (export_core));
lua_settable (self->L, LUA_REGISTRYINDEX);
}
wp_lua_scripting_api_init (self->L);
wp_lua_scripting_enable_package_searcher (self->L);
wplua_enable_sandbox (self->L, WP_LUA_SANDBOX_ISOLATE_ENV);