Component Loader¶
-
struct
WpComponentLoader
¶ An interface that provides the ability to load components.
Components can be:
WirePlumber modules (libraries that provide WpPlugin and WpSiFactory objects)
Scripts (ex. lua scripts)
The WirePlumber library provides built-in support for loading WirePlumber modules, without a component loader. For other kinds of components, a component loader is meant to be provided in by some WirePlumber module. For Lua scripts specifically, a component loader is provided by the lua scripting module.
-
struct
_WpComponentLoaderInterface
¶ Public Members
-
GTypeInterface
interface
¶
-
gboolean
supports_type)
(WpComponentLoader *self, const gchar *type)¶
-
void
load)
(WpComponentLoader *self, WpCore *core, const gchar *component, const gchar *type, WpSpaJson *args, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer data)¶
-
GObject*
load_finish)
(WpComponentLoader *self, GAsyncResult *res, GError **error)¶
-
GTypeInterface
-
void
wp_core_load_component
(WpCore * self, const gchar * component, const gchar * type, WpSpaJson * args, const gchar * provides, GCancellable * cancellable, GAsyncReadyCallback callback, gpointer data)¶ Loads the specified component on self.
The type will determine which component loader to use. The following types are built-in and will always work without a component loader:
”module” - Loads a WirePlumber module
”array” - Loads multiple components interpreting the args as a JSON array with component definitions, as they would appear in the configuration file. When this type is used, component is ignored and can be NULL
- Parameters
self
: the corecomponent
: (nullable): the module name or file nametype
: the type of the componentargs
: (transfer none)(nullable): additional arguments for the component, expected to be a JSON objectprovides
: (nullable): the name of the feature that this component will provide if it loads successfully; this can be queried later with wp_core_test_feature()cancellable
: (nullable): optional GCancellablecallback
: (scope async): the callback to call when the operation is donedata
: (closure): data to pass to callback
-
gboolean
wp_core_load_component_finish
(WpCore * self, GAsyncResult * res, GError ** error)¶ Finishes the operation started by wp_core_load_component(). This is meant to be called in the callback that was passed to that method.
- Return
TRUE if the requested component was loaded, FALSE otherwise
- Parameters
self
: the component loader objectres
: the async resulterror
: (out) (optional): the operation’s error, if it occurred
-
WP_TYPE_COMPONENT_LOADER
(wp_component_loader_get_type ())¶ The WpComponentLoader GType.