lua: remove the ability to specify spa_libs in the lua config
This is not useful, we can do this on the pipewire-style config files
This commit is contained in:
@@ -8,55 +8,6 @@
|
||||
|
||||
#include <wp/wp.h>
|
||||
#include <wplua/wplua.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
static gboolean
|
||||
add_spa_libs (lua_State *L, WpCore * core, GError ** error)
|
||||
{
|
||||
lua_getglobal (L, "SANDBOX_COMMON_ENV");
|
||||
|
||||
switch (lua_getfield (L, -1, "spa_libs")) {
|
||||
case LUA_TTABLE:
|
||||
break;
|
||||
case LUA_TNIL:
|
||||
wp_debug ("no spa_libs specified");
|
||||
goto done;
|
||||
default:
|
||||
g_set_error (error, WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_INVALID_ARGUMENT,
|
||||
"Expected 'spa_libs' to be a table");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lua_pushnil (L);
|
||||
while (lua_next (L, -2)) {
|
||||
if (lua_type (L, -2) != LUA_TSTRING ||
|
||||
lua_type (L, -1) != LUA_TSTRING) {
|
||||
g_set_error (error, WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_INVALID_ARGUMENT,
|
||||
"'spa_libs' must be a table with string keys and string values");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const gchar *regex = lua_tostring (L, -2);
|
||||
const gchar *lib = lua_tostring (L, -1);
|
||||
|
||||
wp_debug ("add spa lib: %s -> %s", regex, lib);
|
||||
|
||||
int ret = pw_context_add_spa_lib (wp_core_get_pw_context (core), regex,
|
||||
lib);
|
||||
if (ret < 0) {
|
||||
g_set_error (error, WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED,
|
||||
"failed to add spa lib ('%s' on '%s'): %s", regex, lib,
|
||||
g_strerror (-ret));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lua_pop (L, 1); /* pop the value */
|
||||
}
|
||||
|
||||
done:
|
||||
lua_pop (L, 2); /* pop spa_libs & SANDBOX_COMMON_ENV */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_components (lua_State *L, WpCore * core, GError ** error)
|
||||
@@ -188,9 +139,6 @@ wp_lua_scripting_load_configuration (const gchar * conf_file,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!add_spa_libs (L, core, error))
|
||||
return FALSE;
|
||||
|
||||
if (!load_components (L, core, error))
|
||||
return FALSE;
|
||||
|
||||
|
@@ -1,15 +1,3 @@
|
||||
-- ["<factory-name regex>"] = "<library-name>"
|
||||
--
|
||||
-- used to find spa factory names. It maps a spa factory name
|
||||
-- regular expression to a library name that should contain that factory.
|
||||
--
|
||||
spa_libs = {
|
||||
["api.alsa.*"] = "alsa/libspa-alsa",
|
||||
["api.v4l2.*"] = "v4l2/libspa-v4l2",
|
||||
["api.bluez5.*"] = "bluez5/libspa-bluez5",
|
||||
["api.libcamera.*"] = "libcamera/libspa-libcamera",
|
||||
}
|
||||
|
||||
components = {}
|
||||
|
||||
function load_module(m)
|
||||
|
Reference in New Issue
Block a user