2019-11-07 20:44:55 +02:00
|
|
|
/* WirePlumber
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2019 Collabora Ltd.
|
|
|
|
|
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __WIREPLUMBER_PRIVATE_H__
|
|
|
|
|
#define __WIREPLUMBER_PRIVATE_H__
|
|
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
#include "core.h"
|
|
|
|
|
#include "object-manager.h"
|
|
|
|
|
#include "proxy.h"
|
|
|
|
|
|
2019-11-07 20:44:55 +02:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
/* core */
|
|
|
|
|
|
|
|
|
|
struct pw_core_proxy;
|
|
|
|
|
struct pw_registry_proxy;
|
|
|
|
|
|
|
|
|
|
struct pw_core_proxy * wp_core_get_pw_core_proxy (WpCore * self);
|
|
|
|
|
struct pw_registry_proxy * wp_core_get_pw_registry_proxy (WpCore * self);
|
|
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
gpointer wp_core_find_object (WpCore * self, GEqualFunc func,
|
|
|
|
|
gconstpointer data);
|
|
|
|
|
void wp_core_register_object (WpCore * self, gpointer obj);
|
|
|
|
|
void wp_core_remove_object (WpCore * self, gpointer obj);
|
|
|
|
|
|
|
|
|
|
/* global */
|
|
|
|
|
|
|
|
|
|
typedef struct _WpGlobal WpGlobal;
|
|
|
|
|
struct _WpGlobal
|
|
|
|
|
{
|
|
|
|
|
guint32 id;
|
|
|
|
|
guint32 type;
|
|
|
|
|
guint32 version;
|
|
|
|
|
guint32 permissions;
|
|
|
|
|
WpProperties *properties;
|
|
|
|
|
GWeakRef proxy;
|
2019-11-07 20:44:55 +02:00
|
|
|
};
|
|
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
static inline WpGlobal *
|
|
|
|
|
wp_global_new (void)
|
|
|
|
|
{
|
|
|
|
|
WpGlobal *self = g_rc_box_new0 (WpGlobal);
|
|
|
|
|
g_weak_ref_init (&self->proxy, NULL);
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
wp_global_clear (WpGlobal * self)
|
|
|
|
|
{
|
|
|
|
|
g_clear_pointer (&self->properties, wp_properties_unref);
|
|
|
|
|
g_weak_ref_clear (&self->proxy);
|
|
|
|
|
}
|
2019-11-07 20:44:55 +02:00
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
static inline WpGlobal *
|
|
|
|
|
wp_global_ref (WpGlobal * self)
|
|
|
|
|
{
|
|
|
|
|
return g_rc_box_acquire (self);
|
|
|
|
|
}
|
2019-11-07 20:44:55 +02:00
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
static inline void
|
|
|
|
|
wp_global_unref (WpGlobal * self)
|
|
|
|
|
{
|
|
|
|
|
g_rc_box_release_full (self, (GDestroyNotify) wp_global_clear);
|
|
|
|
|
}
|
2019-11-07 20:44:55 +02:00
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WpGlobal, wp_global_unref)
|
2019-11-07 20:44:55 +02:00
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
/* object manager */
|
2019-11-07 20:44:55 +02:00
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
void wp_object_manager_add_global (WpObjectManager * self, WpGlobal * global);
|
|
|
|
|
void wp_object_manager_rm_global (WpObjectManager * self, guint32 id);
|
2019-11-07 20:44:55 +02:00
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
void wp_object_manager_add_object (WpObjectManager * self, GObject * object);
|
|
|
|
|
void wp_object_manager_rm_object (WpObjectManager * self, GObject * object);
|
2019-11-07 20:44:55 +02:00
|
|
|
|
|
|
|
|
/* proxy */
|
|
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
WpProxy * wp_proxy_new_global (WpCore * core, WpGlobal * global);
|
|
|
|
|
|
2019-11-07 20:44:55 +02:00
|
|
|
void wp_proxy_set_feature_ready (WpProxy * self, WpProxyFeatures feature);
|
|
|
|
|
void wp_proxy_augment_error (WpProxy * self, GError * error);
|
|
|
|
|
|
|
|
|
|
void wp_proxy_register_async_task (WpProxy * self, int seq, GTask * task);
|
|
|
|
|
GTask * wp_proxy_find_async_task (WpProxy * self, int seq, gboolean steal);
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
|
|
#endif
|