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:
@@ -37,13 +37,9 @@ get_wp_core (lua_State *L)
|
||||
static WpCore *
|
||||
get_wp_export_core (lua_State *L)
|
||||
{
|
||||
WpCore *core = NULL;
|
||||
lua_pushliteral (L, "wireplumber_export_core");
|
||||
lua_gettable (L, LUA_REGISTRYINDEX);
|
||||
if (wplua_isobject (L, -1, WP_TYPE_CORE))
|
||||
core = wplua_toobject (L, -1);
|
||||
lua_pop (L, 1);
|
||||
return core ? core : get_wp_core(L);
|
||||
WpCore *core = get_wp_core (L);
|
||||
g_autoptr (WpCore) export_core = wp_core_get_export_core (core);
|
||||
return export_core ? export_core : core;
|
||||
}
|
||||
|
||||
/* GLib */
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user