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"
|
2019-09-09 16:56:08 +03:00
|
|
|
#include "exported.h"
|
2019-11-13 15:44:23 +02:00
|
|
|
#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);
|
|
|
|
|
|
2019-09-09 16:56:08 +03:00
|
|
|
/* exported */
|
|
|
|
|
|
|
|
|
|
void wp_exported_notify_export_done (WpExported * self, GError * error);
|
|
|
|
|
|
2019-11-13 15:44:23 +02:00
|
|
|
/* 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);
|
|
|
|
|
|
2019-12-03 12:24:05 +02:00
|
|
|
/* spa props */
|
|
|
|
|
|
|
|
|
|
struct spa_pod;
|
|
|
|
|
struct spa_pod_builder;
|
|
|
|
|
|
|
|
|
|
typedef struct _WpSpaProps WpSpaProps;
|
|
|
|
|
struct _WpSpaProps
|
|
|
|
|
{
|
|
|
|
|
GList *entries;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void wp_spa_props_clear (WpSpaProps * self);
|
|
|
|
|
|
|
|
|
|
void wp_spa_props_register_pod (WpSpaProps * self,
|
|
|
|
|
guint32 id, const gchar *name, const struct spa_pod *type);
|
|
|
|
|
gint wp_spa_props_register_from_prop_info (WpSpaProps * self,
|
|
|
|
|
const struct spa_pod * prop_info);
|
|
|
|
|
|
|
|
|
|
const struct spa_pod * wp_spa_props_get_stored (WpSpaProps * self, guint32 id);
|
|
|
|
|
|
|
|
|
|
gint wp_spa_props_store_pod (WpSpaProps * self, guint32 id,
|
|
|
|
|
const struct spa_pod * value);
|
|
|
|
|
gint wp_spa_props_store_from_props (WpSpaProps * self,
|
|
|
|
|
const struct spa_pod * props, GArray * changed_ids);
|
|
|
|
|
|
|
|
|
|
GPtrArray * wp_spa_props_build_all_pods (WpSpaProps * self,
|
|
|
|
|
struct spa_pod_builder * b);
|
|
|
|
|
struct spa_pod * wp_spa_props_build_update (WpSpaProps * self, guint32 id,
|
|
|
|
|
const struct spa_pod * value, struct spa_pod_builder * b);
|
|
|
|
|
|
|
|
|
|
const struct spa_pod * wp_spa_props_build_pod_valist (gchar * buffer,
|
|
|
|
|
gsize size, va_list args);
|
|
|
|
|
|
|
|
|
|
static inline const struct spa_pod *
|
|
|
|
|
wp_spa_props_build_pod (gchar * buffer, gsize size, ...)
|
|
|
|
|
{
|
|
|
|
|
const struct spa_pod *ret;
|
|
|
|
|
va_list args;
|
|
|
|
|
va_start (args, size);
|
|
|
|
|
ret = wp_spa_props_build_pod_valist (buffer, size, args);
|
|
|
|
|
va_end (args);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define wp_spa_props_register(self, id, name, ...) \
|
|
|
|
|
({ \
|
|
|
|
|
gchar b[512]; \
|
|
|
|
|
wp_spa_props_register_pod (self, id, name, \
|
|
|
|
|
wp_spa_props_build_pod (b, sizeof (b), ##__VA_ARGS__, NULL)); \
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
#define wp_spa_props_store(self, id, ...) \
|
|
|
|
|
({ \
|
|
|
|
|
gchar b[512]; \
|
|
|
|
|
wp_spa_props_store_pod (self, id, \
|
|
|
|
|
wp_spa_props_build_pod (b, sizeof (b), ##__VA_ARGS__, NULL)); \
|
|
|
|
|
})
|
|
|
|
|
|
2019-11-07 20:44:55 +02:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
|
|
#endif
|