Component Loader

digraph inheritance { rankdir=LR; GInterface -> WpComponentLoader; }

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)
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 core

  • component – (nullable): the module name or file name

  • type – the type of the component

  • args – (transfer none)(nullable): additional arguments for the component, expected to be a JSON object

  • provides – (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 GCancellable

  • callback – (scope async): the callback to call when the operation is done

  • data – (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.

Parameters:
  • self – the component loader object

  • res – the async result

  • error – (out) (optional): the operation’s error, if it occurred

Returns:

TRUE if the requested component was loaded, FALSE otherwise

WP_TYPE_COMPONENT_LOADER (wp_component_loader_get_type ())

The WpComponentLoader GType.