Skip to content
Snippets Groups Projects
Commit 19f10a81 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

core: implement an interface to retrieve the pw_core & pw_remote

parent 4fcdb931
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,35 @@
#include "plugin.h"
#include "session.h"
/* WpPipewireObjects */
G_DEFINE_INTERFACE (WpPipewireObjects, wp_pipewire_objects, G_TYPE_OBJECT)
static void
wp_pipewire_objects_default_init (WpPipewireObjectsInterface * iface)
{
}
struct pw_core * wp_pipewire_objects_get_pw_core (WpPipewireObjects * self)
{
WpPipewireObjectsInterface *iface = WP_PIPEWIRE_OBJECTS_GET_IFACE (self);
g_return_val_if_fail (WP_IS_PIPEWIRE_OBJECTS (self), NULL);
g_return_val_if_fail (iface->get_pw_core, NULL);
return iface->get_pw_core (self);
}
struct pw_remote * wp_pipewire_objects_get_pw_remote (WpPipewireObjects * self)
{
WpPipewireObjectsInterface *iface = WP_PIPEWIRE_OBJECTS_GET_IFACE (self);
g_return_val_if_fail (WP_IS_PIPEWIRE_OBJECTS (self), NULL);
g_return_val_if_fail (iface->get_pw_remote, NULL);
return iface->get_pw_remote (self);
}
/* WpPluginRegistry */
G_DEFINE_INTERFACE (WpPluginRegistry, wp_plugin_registry, WP_TYPE_INTERFACE_IMPL)
......
......@@ -13,6 +13,25 @@
G_BEGIN_DECLS
/* WpPipewireObjects */
struct pw_core;
struct pw_remote;
#define WP_TYPE_PIPEWIRE_OBJECTS (wp_pipewire_objects_get_type ())
G_DECLARE_INTERFACE (WpPipewireObjects, wp_pipewire_objects, WP, PIPEWIRE_OBJECTS, GObject)
struct _WpPipewireObjectsInterface
{
GTypeInterface parent;
struct pw_core * (*get_pw_core) (WpPipewireObjects * self);
struct pw_remote * (*get_pw_remote) (WpPipewireObjects * self);
};
struct pw_core * wp_pipewire_objects_get_pw_core (WpPipewireObjects * self);
struct pw_remote * wp_pipewire_objects_get_pw_remote (WpPipewireObjects * self);
/* WpPluginRegistry */
#define WP_TYPE_PLUGIN_REGISTRY (wp_plugin_registry_get_type ())
......
......@@ -36,7 +36,11 @@ struct _WpCore
GError *exit_error;
};
G_DEFINE_TYPE (WpCore, wp_core, WP_TYPE_OBJECT);
static void wp_core_pw_objects_init (WpPipewireObjectsInterface * iface);
G_DEFINE_TYPE_WITH_CODE (WpCore, wp_core, WP_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (WP_TYPE_PIPEWIRE_OBJECTS, wp_core_pw_objects_init);
)
static gboolean
signal_handler (gpointer data)
......@@ -271,6 +275,25 @@ wp_core_class_init (WpCoreClass * klass)
object_class->finalize = wp_core_finalize;
}
static struct pw_core *
wp_core_get_pw_core (WpPipewireObjects *pwobj)
{
return WP_CORE (pwobj)->core;
}
static struct pw_remote *
wp_core_get_pw_remote (WpPipewireObjects *pwobj)
{
return WP_CORE (pwobj)->remote;
}
static void
wp_core_pw_objects_init (WpPipewireObjectsInterface * iface)
{
iface->get_pw_core = wp_core_get_pw_core;
iface->get_pw_remote = wp_core_get_pw_remote;
}
WpCore *
wp_core_get_instance (void)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment