Commit ce43cf5f authored by George Kiagiadakis's avatar George Kiagiadakis

refactoring around the registries

* make the registries available as dynamic interfaces of the core
* improve a bit the C API of WpObject & WpInterfaceImpl
parent 87d60a80
......@@ -6,91 +6,20 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "plugin-registry.h"
#include "core-interfaces.h"
#include "plugin.h"
typedef struct {
gsize block_size;
GType gtype;
const WpPluginMetadata *metadata;
WpPlugin *instance;
} PluginData;
/* WpPluginRegistry */
struct _WpPluginRegistry
{
GObject parent;
GList *plugins;
GStringChunk *metadata_strings;
};
G_DEFINE_TYPE (WpPluginRegistry, wp_plugin_registry, G_TYPE_OBJECT);
static void
wp_plugin_registry_init (WpPluginRegistry * self)
{
self->metadata_strings = g_string_chunk_new (200);
}
static void
wp_plugin_registry_dispose (GObject * object)
{
WpPluginRegistry *self = WP_PLUGIN_REGISTRY (object);
GList *list;
PluginData *plugin_data;
for (list = self->plugins; list != NULL; list = g_list_next (list)) {
plugin_data = list->data;
g_clear_object (&plugin_data->instance);
}
G_OBJECT_CLASS (wp_plugin_registry_parent_class)->dispose (object);
}
static void
plugin_data_free (PluginData *data)
{
g_slice_free1 (data->block_size, data);
}
static void
wp_plugin_registry_finalize (GObject * object)
{
WpPluginRegistry *self = WP_PLUGIN_REGISTRY (object);
g_list_free_full (self->plugins, (GDestroyNotify) plugin_data_free);
g_string_chunk_free (self->metadata_strings);
G_OBJECT_CLASS (wp_plugin_registry_parent_class)->finalize (object);
}
G_DEFINE_INTERFACE (WpPluginRegistry, wp_plugin_registry, WP_TYPE_INTERFACE_IMPL)
static void
wp_plugin_registry_class_init (WpPluginRegistryClass * klass)
wp_plugin_registry_default_init (WpPluginRegistryInterface * iface)
{
GObjectClass *object_class = (GObjectClass *) klass;
object_class->dispose = wp_plugin_registry_dispose;
object_class->finalize = wp_plugin_registry_finalize;
}
/**
* wp_plugin_registry_new: (constructor)
*
* Create a new registry.
*/
WpPluginRegistry *
wp_plugin_registry_new (void)
{
return g_object_new (wp_plugin_registry_get_type (), NULL);
}
static gint
compare_ranks (const WpPluginMetadata * a, const WpPluginMetadata * b)
{
return (gint) b->rank - (gint) a->rank;
}
/**
* wp_plugin_registry_register_with_metadata: (skip)
* wp_plugin_registry_register_static: (skip)
* @plugin_type: the #GType of the #WpPlugin subclass
* @metadata: the metadata
* @metadata_size: the sizeof (@metadata), to allow ABI-compatible future
......@@ -101,16 +30,16 @@ compare_ranks (const WpPluginMetadata * a, const WpPluginMetadata * b)
* Avoid using it directly.
*/
void
wp_plugin_registry_register_with_metadata (WpPluginRegistry * self,
wp_plugin_registry_register_static (WpPluginRegistry * self,
GType plugin_type,
const WpPluginMetadata * metadata,
gsize metadata_size)
{
PluginData *data;
WpPluginRegistryInterface *iface = WP_PLUGIN_REGISTRY_GET_IFACE (self);
g_return_if_fail (WP_IS_PLUGIN_REGISTRY (self));
g_return_if_fail (metadata_size == sizeof (WpPluginMetadata));
g_return_if_fail (g_type_is_a (plugin_type, wp_plugin_get_type ()));
g_return_if_fail (iface->register_plugin != NULL);
g_return_if_fail (g_type_is_a (plugin_type, WP_TYPE_PLUGIN));
g_return_if_fail (metadata->name != NULL);
g_return_if_fail (metadata->description != NULL);
g_return_if_fail (metadata->author != NULL);
......@@ -118,14 +47,8 @@ wp_plugin_registry_register_with_metadata (WpPluginRegistry * self,
g_return_if_fail (metadata->version != NULL);
g_return_if_fail (metadata->origin != NULL);
data = g_slice_alloc (sizeof (PluginData));
data->block_size = sizeof (PluginData);
data->gtype = plugin_type;
data->metadata = metadata;
data->instance = NULL;
self->plugins = g_list_insert_sorted (self->plugins, data,
(GCompareFunc) compare_ranks);
WP_PLUGIN_REGISTRY_GET_IFACE (self)->register_plugin (self, plugin_type,
metadata, metadata_size, TRUE);
}
/**
......@@ -155,11 +78,12 @@ wp_plugin_registry_register (WpPluginRegistry * self,
const gchar *version,
const gchar *origin)
{
PluginData *data;
WpPluginMetadata *metadata;
WpPluginRegistryInterface *iface = WP_PLUGIN_REGISTRY_GET_IFACE (self);
WpPluginMetadata metadata = {0};
g_return_if_fail (WP_IS_PLUGIN_REGISTRY (self));
g_return_if_fail (g_type_is_a (plugin_type, wp_plugin_get_type ()));
g_return_if_fail (iface->register_plugin != NULL);
g_return_if_fail (g_type_is_a (plugin_type, WP_TYPE_PLUGIN));
g_return_if_fail (name != NULL);
g_return_if_fail (description != NULL);
g_return_if_fail (author != NULL);
......@@ -167,61 +91,59 @@ wp_plugin_registry_register (WpPluginRegistry * self,
g_return_if_fail (version != NULL);
g_return_if_fail (origin != NULL);
data = g_slice_alloc (sizeof (PluginData) + sizeof (WpPluginMetadata));
data->block_size = sizeof (PluginData) + sizeof (WpPluginMetadata);
data->gtype = plugin_type;
metadata = (WpPluginMetadata *) ((guint8 *) data) + sizeof (PluginData);
metadata->rank = rank;
metadata->name = g_string_chunk_insert (self->metadata_strings, name);
metadata->description = g_string_chunk_insert (self->metadata_strings,
description);
metadata->author = g_string_chunk_insert (self->metadata_strings, author);
metadata->license = g_string_chunk_insert (self->metadata_strings, license);
metadata->version = g_string_chunk_insert (self->metadata_strings, version);
metadata->origin = g_string_chunk_insert (self->metadata_strings, origin);
data->metadata = metadata;
data->instance = NULL;
self->plugins = g_list_insert_sorted (self->plugins, data,
(GCompareFunc) compare_ranks);
metadata.rank = rank;
metadata.name = name;
metadata.description = description;
metadata.author = author;
metadata.license = license;
metadata.version = version;
metadata.origin = origin;
WP_PLUGIN_REGISTRY_GET_IFACE (self)->register_plugin (self, plugin_type,
&metadata, sizeof (metadata), FALSE);
}
static inline void
make_plugin (WpPluginRegistry * self, PluginData * plugin_data)
/* WpProxyRegistry */
G_DEFINE_INTERFACE (WpProxyRegistry, wp_proxy_registry, WP_TYPE_INTERFACE_IMPL)
static void
wp_proxy_registry_default_init (WpProxyRegistryInterface * iface)
{
plugin_data->instance = g_object_new (plugin_data->gtype,
"registry", self, "metadata", plugin_data->metadata, NULL);
}
/**
* WpPluginFunc: (skip)
* wp_proxy_registry_get_proxy: (method)
* @self: the registry
* @global_id: the ID of the pw_global that is represented by the proxy
*
* Returns: (transfer full): the #WpProxy that represents the global with
* @global_id
*/
WpProxy *
wp_proxy_registry_get_proxy (WpProxyRegistry * self, guint32 global_id)
{
WpProxyRegistryInterface * iface = WP_PROXY_REGISTRY_GET_IFACE (self);
g_return_val_if_fail (WP_IS_PROXY_REGISTRY (self), NULL);
g_return_val_if_fail (iface->get_proxy != NULL, NULL);
return iface->get_proxy (self, global_id);
}
/**
* wp_plugin_registry_invoke_internal: (skip)
* wp_proxy_registry_get_pw_registry_proxy: (skip)
* @self: the registry
* @func: a vfunc invocation function of #WpPlugin
* @data: data to pass to @func
*
* Used internally only.
* Returns: the underlying `pw_registry_proxy`
*/
gboolean
wp_plugin_registry_invoke_internal (WpPluginRegistry * self, WpPluginFunc func,
gpointer data)
struct pw_registry_proxy *
wp_proxy_registry_get_pw_registry_proxy (WpProxyRegistry * self)
{
GList *list;
PluginData *plugin_data;
for (list = self->plugins; list != NULL; list = g_list_next (list)) {
plugin_data = list->data;
if (!plugin_data->instance)
make_plugin (self, plugin_data);
WpProxyRegistryInterface * iface = WP_PROXY_REGISTRY_GET_IFACE (self);
if (func (plugin_data->instance, data))
return TRUE;
}
g_return_val_if_fail (WP_IS_PROXY_REGISTRY (self), NULL);
g_return_val_if_fail (iface->get_pw_registry_proxy != NULL, NULL);
return FALSE;
return iface->get_pw_registry_proxy (self);
}
/* WirePlumber
*
* Copyright © 2019 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef __WP_CORE_INTERFACES_H__
#define __WP_CORE_INTERFACES_H__
#include "interface-impl.h"
G_BEGIN_DECLS
/* WpPluginRegistry */
#define WP_TYPE_PLUGIN_REGISTRY (wp_plugin_registry_get_type ())
G_DECLARE_INTERFACE (WpPluginRegistry, wp_plugin_registry, WP, PLUGIN_REGISTRY, WpInterfaceImpl)
typedef struct _WpPluginMetadata WpPluginMetadata;
struct _WpPluginRegistryInterface
{
GTypeInterface parent;
void (*register_plugin) (WpPluginRegistry * self,
GType plugin_type,
const WpPluginMetadata * metadata,
gsize metadata_size,
gboolean static_data);
};
void wp_plugin_registry_register_static (WpPluginRegistry * self,
GType plugin_type,
const WpPluginMetadata * metadata,
gsize metadata_size);
void wp_plugin_registry_register (WpPluginRegistry * self,
GType plugin_type,
guint16 rank,
const gchar *name,
const gchar *description,
const gchar *author,
const gchar *license,
const gchar *version,
const gchar *origin);
/* WpProxyRegistry */
struct pw_registry_proxy;
typedef struct _WpProxy WpProxy;
#define WP_TYPE_PROXY_REGISTRY (wp_proxy_registry_get_type ())
G_DECLARE_INTERFACE (WpProxyRegistry, wp_proxy_registry, WP, PROXY_REGISTRY, WpInterfaceImpl)
struct _WpProxyRegistryInterface
{
GTypeInterface parent;
WpProxy * (*get_proxy) (WpProxyRegistry * self, guint32 global_id);
struct pw_registry_proxy * (*get_pw_registry_proxy) (WpProxyRegistry * self);
};
WpProxy * wp_proxy_registry_get_proxy (WpProxyRegistry * self,
guint32 global_id);
struct pw_registry_proxy * wp_proxy_registry_get_pw_registry_proxy (
WpProxyRegistry * self);
G_END_DECLS
#endif
......@@ -10,7 +10,7 @@
#include "object.h"
typedef struct {
GObject *object;
WpObject *object;
} WpInterfaceImplPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (WpInterfaceImpl, wp_interface_impl, G_TYPE_OBJECT);
......@@ -44,7 +44,7 @@ wp_interface_impl_class_init (WpInterfaceImplClass * klass)
* @object: (nullable) (transfer none): the implementor
*/
void
wp_interface_impl_set_object (WpInterfaceImpl * self, GObject * object)
wp_interface_impl_set_object (WpInterfaceImpl * self, WpObject * object)
{
WpInterfaceImplPrivate *priv = wp_interface_impl_get_instance_private (self);
......@@ -60,7 +60,7 @@ wp_interface_impl_set_object (WpInterfaceImpl * self, GObject * object)
*
* Returns: (nullable) (transfer none): the object implementing this interface
*/
GObject *
WpObject *
wp_interface_impl_get_object (WpInterfaceImpl * self)
{
WpInterfaceImplPrivate *priv = wp_interface_impl_get_instance_private (self);
......@@ -75,9 +75,10 @@ wp_interface_impl_get_object (WpInterfaceImpl * self)
* @self: the interface implementation instance
* @interface: an interface type
*
* Returns: (nullable) (transfer full): the object implementing @interface
* Returns: (type GObject*) (nullable) (transfer full): the object
* implementing @interface
*/
GObject *
gpointer
wp_interface_impl_get_sibling (WpInterfaceImpl * self, GType interface)
{
WpInterfaceImplPrivate *priv = wp_interface_impl_get_instance_private (self);
......@@ -89,7 +90,7 @@ wp_interface_impl_get_sibling (WpInterfaceImpl * self, GType interface)
if (g_type_is_a (G_TYPE_FROM_INSTANCE (self), interface)) {
iface = G_OBJECT (g_object_ref (self));
} else if (priv->object) {
iface = wp_object_get_interface (WP_OBJECT (priv->object), interface);
iface = wp_object_get_interface (priv->object, interface);
}
return iface;
......
......@@ -13,6 +13,9 @@
G_BEGIN_DECLS
typedef struct _WpObject WpObject;
#define WP_TYPE_INTERFACE_IMPL (wp_interface_impl_get_type ())
G_DECLARE_DERIVABLE_TYPE (WpInterfaceImpl, wp_interface_impl, WP, INTERFACE_IMPL, GObject)
struct _WpInterfaceImplClass
......@@ -30,9 +33,9 @@ struct _WpInterfaceImplClass
GType *(*get_prerequisites) (WpInterfaceImpl * self, guint * n_prerequisites);
};
void wp_interface_impl_set_object (WpInterfaceImpl * self, GObject * object);
GObject * wp_interface_impl_get_object (WpInterfaceImpl * self);
GObject * wp_interface_impl_get_sibling (WpInterfaceImpl * self,
void wp_interface_impl_set_object (WpInterfaceImpl * self, WpObject * object);
WpObject * wp_interface_impl_get_object (WpInterfaceImpl * self);
gpointer wp_interface_impl_get_sibling (WpInterfaceImpl * self,
GType interface);
GType * wp_interface_impl_get_prerequisites (WpInterfaceImpl * self,
guint * n_prerequisites);
......
wp_lib_sources = [
'core-interfaces.c',
'error.c',
'interface-impl.c',
'object.c',
'plugin-registry.c',
'plugin.c',
'proxy-registry.c',
'proxy.c',
]
wp_lib_headers = [
'core-interfaces.h',
'error.h',
'interface-impl.h',
'object.h',
'plugin-registry.h',
'plugin.h',
'proxy-registry.h',
'proxy.h',
]
......
......@@ -7,6 +7,7 @@
*/
#include "object.h"
#include "interface-impl.h"
#include "error.h"
typedef struct {
......@@ -80,9 +81,10 @@ wp_object_implements_interface (WpObject * self, GType interface)
* @self: the object
* @interface: an interface type
*
* Returns: (nullable) (transfer full): the object implementing @interface
* Returns: (type GObject*) (nullable) (transfer full): the object
* implementing @interface
*/
GObject *
gpointer
wp_object_get_interface (WpObject * self, GType interface)
{
WpObjectPrivate *priv = wp_object_get_instance_private (self);
......@@ -121,13 +123,13 @@ wp_object_list_interfaces (WpObject * self, guint * n_interfaces)
/**
* wp_object_attach_interface_impl: (method)
* @self: the object
* @impl: (transfer none): the interface implementation
* @impl: (type WpInterfaceImpl*) (transfer none): the interface implementation
* @error: (out): a GError to return on failure
*
* Returns: TRUE one success, FALSE on error
*/
gboolean
wp_object_attach_interface_impl (WpObject * self, WpInterfaceImpl * impl,
wp_object_attach_interface_impl (WpObject * self, gpointer impl,
GError ** error)
{
WpObjectPrivate *priv = wp_object_get_instance_private (self);
......@@ -171,6 +173,6 @@ wp_object_attach_interface_impl (WpObject * self, WpInterfaceImpl * impl,
g_object_ref (impl);
g_array_append_val (priv->iface_objects, impl);
g_array_append_vals (priv->iface_types, new_ifaces, n_new_ifaces);
wp_interface_impl_set_object (impl, G_OBJECT (self));
wp_interface_impl_set_object (WP_INTERFACE_IMPL (impl), self);
return TRUE;
}
......@@ -9,10 +9,11 @@
#ifndef __WP_OBJECT_H__
#define __WP_OBJECT_H__
#include "interface-impl.h"
#include <glib-object.h>
G_BEGIN_DECLS
#define WP_TYPE_OBJECT (wp_object_get_type ())
G_DECLARE_DERIVABLE_TYPE (WpObject, wp_object, WP, OBJECT, GObject)
struct _WpObjectClass
......@@ -21,11 +22,11 @@ struct _WpObjectClass
};
gboolean wp_object_implements_interface (WpObject * self, GType interface);
GObject * wp_object_get_interface (WpObject * self, GType interface);
gpointer wp_object_get_interface (WpObject * self, GType interface);
GType * wp_object_list_interfaces (WpObject * self, guint * n_interfaces);
gboolean wp_object_attach_interface_impl (WpObject * self,
WpInterfaceImpl * impl, GError ** error);
gboolean wp_object_attach_interface_impl (WpObject * self, gpointer impl,
GError ** error);
G_END_DECLS
......
......@@ -11,9 +11,7 @@
#include "object.h"
#include "proxy.h"
#include "plugin-registry.h"
#include <gmodule.h>
#include "core-interfaces.h"
G_BEGIN_DECLS
......@@ -66,6 +64,7 @@ struct _WpPluginMetadata
const gchar *origin;
};
#define WP_TYPE_PLUGIN (wp_plugin_get_type ())
G_DECLARE_DERIVABLE_TYPE (WpPlugin, wp_plugin, WP, PLUGIN, GObject)
struct _WpPluginClass
......
/* WirePlumber
*
* Copyright © 2019 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef __WP_PROXY_REGISTRY_H__
#define __WP_PROXY_REGISTRY_H__
#include <glib-object.h>
G_BEGIN_DECLS
struct pw_remote;
struct pw_registry_proxy;
typedef struct _WpProxy WpProxy;
G_DECLARE_FINAL_TYPE (WpProxyRegistry, wp_proxy_registry, WP, PROXY_REGISTRY, GObject)
WpProxyRegistry * wp_proxy_registry_new (struct pw_remote * remote);
WpProxy * wp_proxy_registry_get_proxy (WpProxyRegistry * self,
guint32 global_id);
struct pw_remote * wp_proxy_registry_get_pw_remote (WpProxyRegistry * self);
struct pw_registry_proxy * wp_proxy_registry_get_pw_registry_proxy (
WpProxyRegistry * self);
G_END_DECLS
#endif
......@@ -10,12 +10,13 @@
#define __WP_PROXY_H__
#include "object.h"
#include "proxy-registry.h"
#include "core-interfaces.h"
G_BEGIN_DECLS
struct pw_proxy;
#define WP_TYPE_PROXY (wp_proxy_get_type ())
G_DECLARE_FINAL_TYPE (WpProxy, wp_proxy, WP, PROXY, WpObject)
guint32 wp_proxy_get_id (WpProxy * self);
......
......@@ -9,11 +9,10 @@
#include "core.h"
#include "loop-source.h"
#include "module-loader.h"
#include "plugin-registry-impl.h"
#include "proxy-registry-impl.h"
#include "utils.h"
#include <wp/plugin-registry.h>
#include <wp/proxy-registry.h>
#include <pipewire/pipewire.h>
#include <glib-unix.h>
#include <gio/gio.h>
......@@ -32,13 +31,11 @@ struct _WpCore
struct spa_hook remote_listener;
WpModuleLoader *module_loader;
WpPluginRegistry *plugin_registry;
WpProxyRegistry *proxy_registry;
GError *exit_error;
};
G_DEFINE_TYPE (WpCore, wp_core, G_TYPE_OBJECT);
G_DEFINE_TYPE (WpCore, wp_core, WP_TYPE_OBJECT);
static gboolean
signal_handler (gpointer data)
......@@ -83,6 +80,7 @@ static gboolean
wp_core_parse_commands_file (WpCore * self, GInputStream * stream,
GError ** error)
{
g_autoptr (WpPluginRegistry) plugin_registry = NULL;
gchar buffer[4096];
gssize bytes_read;
gchar *cur, *linestart, *saveptr;
......@@ -90,6 +88,9 @@ wp_core_parse_commands_file (WpCore * self, GInputStream * stream,
gint lineno = 1;
gboolean eof = FALSE;
plugin_registry = wp_object_get_interface (WP_OBJECT (self),
WP_TYPE_PLUGIN_REGISTRY);
linestart = cur = buffer;
do {
......@@ -126,7 +127,7 @@ wp_core_parse_commands_file (WpCore * self, GInputStream * stream,
"expected ABI and MODULE at line %i", lineno);
return FALSE;
} else if (!wp_module_loader_load (self->module_loader,
self->plugin_registry, abi, module, error)) {
plugin_registry, abi, module, error)) {
return FALSE;
}
} else {
......@@ -195,6 +196,9 @@ wp_core_load_commands_file (WpCore * self)
static void
wp_core_init (WpCore * self)
{
WpPluginRegistryImpl *plugin_registry;
WpProxyRegistryImpl *proxy_registry;
self->loop = g_main_loop_new (NULL, FALSE);
self->source = wp_loop_source_new ();
g_source_attach (self->source, NULL);
......@@ -206,22 +210,38 @@ wp_core_init (WpCore * self)
self);
self->module_loader = wp_module_loader_new ();
self->proxy_registry = wp_proxy_registry_new (self->remote);
self->plugin_registry = wp_plugin_registry_new ();
proxy_registry = wp_proxy_registry_impl_new (self->remote);
wp_object_attach_interface_impl (WP_OBJECT (self), proxy_registry, NULL);
plugin_registry = wp_plugin_registry_impl_new ();
wp_object_attach_interface_impl (WP_OBJECT (self), plugin_registry, NULL);
}
static void
wp_core_finalize (GObject * obj)
wp_core_dispose (GObject * obj)
{
WpCore *self = WP_CORE (obj);
g_autoptr (WpPluginRegistry) plugin_registry = NULL;
g_autoptr (WpProxyRegistry) proxy_registry = NULL;
/* ensure all proxies and plugins are unrefed,
* so that the registries can be disposed */
g_object_run_dispose (G_OBJECT (self->plugin_registry));
g_object_run_dispose (G_OBJECT (self->proxy_registry));
g_clear_object (&self->plugin_registry);
g_clear_object (&self->proxy_registry);
plugin_registry = wp_object_get_interface (WP_OBJECT (self),
WP_TYPE_PLUGIN_REGISTRY);
wp_plugin_registry_impl_unload (WP_PLUGIN_REGISTRY_IMPL (plugin_registry));
proxy_registry = wp_object_get_interface (WP_OBJECT (self),
WP_TYPE_PROXY_REGISTRY);
wp_proxy_registry_impl_unload (WP_PROXY_REGISTRY_IMPL (proxy_registry));
}
static void
wp_core_finalize (GObject * obj)
{
WpCore *self = WP_CORE (obj);
g_clear_object (&self->module_loader);
spa_hook_remove (&self->remote_listener);
......@@ -242,6 +262,7 @@ wp_core_class_init (WpCoreClass * klass)
{
GObjectClass * object_class = (GObjectClass *) klass;
object_class->dispose = wp_core_dispose;
object_class->finalize = wp_core_finalize;
}
......
......@@ -9,11 +9,11 @@
#ifndef __WIREPLUMBER_CORE_H__
#define __WIREPLUMBER_CORE_H__
#include <glib-object.h>
#include <wp/object.h>
G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (WpCore, wp_core, WP, CORE, GObject);
G_DECLARE_FINAL_TYPE (WpCore, wp_core, WP, CORE, WpObject);
WpCore * wp_core_get_instance (void);
void wp_core_run (WpCore * self, GError ** error);
......
......@@ -3,6 +3,8 @@ wp_sources = [
'loop-source.c',
'main.c',
'module-loader.c',
'plugin-registry-impl.c',
'proxy-registry-impl.c',
'utils.c',
]
......
......@@ -10,6 +10,7 @@
#include "utils.h"
#include <wp/plugin.h>
#include <gmodule.h>
struct _WpModuleLoader
{
......
......@@ -10,7 +10,7 @@
#define __WIREPLUMBER_MODULE_LOADER_H__
#include <glib-object.h>
#include <wp/plugin-registry.h>
#include <wp/core-interfaces.h>
G_BEGIN_DECLS
......
/* WirePlumber
*
* Copyright © 2019 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "plugin-registry-impl.h"
#include <wp/plugin.h>
typedef struct {
gsize block_size;
GType gtype;
const WpPluginMetadata *metadata;
WpPlugin *instance;
} PluginData;
struct _WpPluginRegistryImpl
{
WpInterfaceImpl parent;
GList *plugins;
GStringChunk *metadata_strings;
};
static void wp_plugin_registry_impl_iface_init (WpPluginRegistryInterface * iface);
G_DEFINE_TYPE_WITH_CODE (WpPluginRegistryImpl, wp_plugin_registry_impl, WP_TYPE_INTERFACE_IMPL,
G_IMPLEMENT_INTERFACE (WP_TYPE_PLUGIN_REGISTRY, wp_plugin_registry_impl_iface_init);)
static void