diff --git a/docs/rst/lua_api/lua_local_module_api.rst b/docs/rst/lua_api/lua_local_module_api.rst index c7f122f5..8390bb1a 100644 --- a/docs/rst/lua_api/lua_local_module_api.rst +++ b/docs/rst/lua_api/lua_local_module_api.rst @@ -11,7 +11,7 @@ dropped, the module is unloaded. Constructors ~~~~~~~~~~~~ -.. function:: LocalModule(name, arguments, properties, [load_args_from_file]) +.. function:: LocalModule(name, arguments, properties) Loads the named module with the provided arguments and properties (either of which can be ``nil``). @@ -21,7 +21,6 @@ Constructors module arguments :param table properties: can be ``nil`` or a table that can be :ref:`converted ` to :c:struct:`WpProperties` - :param load_args_from_file: (since 0.4.15) optional. if true, arguments param is treated as a file path to load args from :returns: a new LocalModule :rtype: LocalModule (:c:struct:`WpImplModule`) :since: 0.4.2 diff --git a/lib/wp/module.c b/lib/wp/module.c index ba56141a..11a000c9 100644 --- a/lib/wp/module.c +++ b/lib/wp/module.c @@ -10,10 +10,6 @@ #include "log.h" #include -#include -#include -#include -#include WP_DEFINE_LOCAL_LOG_TOPIC ("wp-module") @@ -265,63 +261,3 @@ wp_impl_module_load (WpCore * core, const gchar * name, return module; } - -/*! - * \brief Loads a PipeWire module with arguments from file into the WirePlumber process - * - * \ingroup wpimplmodule - * \since 0.4.15 - * \param core (transfer none): The WirePlumber core - * \param name (transfer none): the name of the module to load - * \param filename (transfer none): filename to be used as arguments - * \param properties (nullable) (transfer none): additional properties to be - * provided to the module - * \returns (nullable) (transfer full): the WpImplModule for the module that - * was loaded on success, %NULL on failure. - */ -WpImplModule * -wp_impl_module_load_file (WpCore * core, const gchar * name, - const gchar * filename, WpProperties * properties) -{ - char *config = ""; - int fd = open(filename, O_RDONLY); - if (fd < 0) { - g_warning("Failed to open config file %s: %m", filename); - return NULL; - } - - struct stat stats; - int err = fstat(fd, &stats); - if (err < 0) { - g_warning("Failed to stat config file %s: %m", filename); - close(fd); - return NULL; - } - - config = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (config == MAP_FAILED){ - g_warning("Failed to mmap config file %s: %m", filename); - close(fd); - return NULL; - } - close(fd); - - WpImplModule *module = WP_IMPL_MODULE ( - g_object_new (WP_TYPE_IMPL_MODULE, - "core", core, - "name", name, - "arguments", config, - "properties", properties, - NULL) - ); - - munmap(config, stats.st_size); - - if (!module->pw_impl_module) { - /* Module loading failed, free and return */ - g_object_unref (module); - return NULL; - } - - return module; -} diff --git a/lib/wp/module.h b/lib/wp/module.h index 88ca1265..6abf1a4e 100644 --- a/lib/wp/module.h +++ b/lib/wp/module.h @@ -29,9 +29,6 @@ G_DECLARE_FINAL_TYPE (WpImplModule, wp_impl_module, WP, IMPL_MODULE, GObject); WP_API WpImplModule * wp_impl_module_load (WpCore * core, const gchar * name, const gchar * arguments, WpProperties * properties); -WP_API -WpImplModule * wp_impl_module_load_file (WpCore * core, const gchar * name, - const gchar * filename, WpProperties * properties); G_END_DECLS diff --git a/modules/module-lua-scripting/api/api.c b/modules/module-lua-scripting/api/api.c index 86adfdc5..64bc7e00 100644 --- a/modules/module-lua-scripting/api/api.c +++ b/modules/module-lua-scripting/api/api.c @@ -6,7 +6,6 @@ * SPDX-License-Identifier: MIT */ -#include "lua.h" #include #include #include @@ -1537,20 +1536,8 @@ impl_module_new (lua_State *L) properties = wplua_table_to_properties (L, 3); } - bool load_file = false; // Load args as file path - if (lua_type (L, 4) != LUA_TNONE && lua_type (L, 4) != LUA_TNIL) { - luaL_checktype (L, 4, LUA_TBOOLEAN); - load_file = lua_toboolean(L, 4); - } - - WpImplModule *m = NULL; - if (load_file) { - m = wp_impl_module_load_file (get_wp_export_core (L), - name, args, properties); - } else { - m = wp_impl_module_load (get_wp_export_core (L), - name, args, properties); - } + WpImplModule *m = wp_impl_module_load (get_wp_export_core (L), + name, args, properties); if (m) { wplua_pushobject (L, m);