
* rework how global objects are stored in the core * rework how users get notified about global objects and proxies of remote global objects The purpose of this change is to have a class that can manage objects that are registered in the core or signalled through the registry. This object can declare interest on certain types of global objects and only keep & signal those objects that it is interested in. Additionally, it can prepare proxy features and asynchronously deliver an 'objects-changed' signal, which is basically telling us that the list of objects has changed. This is useful to simplify port proxies management in WpAudioStream. Now the stream object can declare that it is interested in ports that have "node.id" == X and the object manager will only maintain a list of those. Additionally, it will emit the 'objects-changed' signal when the list of ports is complete, so there is no reason to do complex operations and core syncs in the WpAudioStream class in order to figure out when the list of ports is ready. As a side effect, this also reduces resource management. Now we don't construct a WpProxy for every global that pipewire reports; we only construct proxies when there is interest in them! Another interesting side effect is that we can now register an object manager at any point in time and get immediately notified about remote globals that already exist. i.e. when you register an object manager that is interested in nodes, it will be immediately notified about all the existing nodes in the graph. This is useful to avoid race conditions between connecting the signal and objects beting created in pipewire
76 lines
2.1 KiB
C
76 lines
2.1 KiB
C
/* WirePlumber
|
|
*
|
|
* Copyright © 2019 Collabora Ltd.
|
|
* @author Julian Bouzas <julian.bouzas@collabora.com>
|
|
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#ifndef __WIREPLUMBER_PROXY_H__
|
|
#define __WIREPLUMBER_PROXY_H__
|
|
|
|
#include <gio/gio.h>
|
|
|
|
#include "properties.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
struct pw_proxy;
|
|
typedef struct _WpCore WpCore;
|
|
|
|
typedef enum { /*< flags >*/
|
|
WP_PROXY_FEATURE_PW_PROXY = (1 << 0),
|
|
WP_PROXY_FEATURE_INFO = (1 << 1),
|
|
|
|
WP_PROXY_FEATURE_LAST = (1 << 5), /*< skip >*/
|
|
} WpProxyFeatures;
|
|
|
|
#define WP_TYPE_PROXY (wp_proxy_get_type ())
|
|
G_DECLARE_DERIVABLE_TYPE (WpProxy, wp_proxy, WP, PROXY, GObject)
|
|
|
|
/* The proxy base class */
|
|
struct _WpProxyClass
|
|
{
|
|
GObjectClass parent_class;
|
|
|
|
void (*augment) (WpProxy *self, WpProxyFeatures features);
|
|
|
|
void (*pw_proxy_created) (WpProxy * self, struct pw_proxy * proxy);
|
|
void (*pw_proxy_destroyed) (WpProxy * self);
|
|
};
|
|
|
|
WpProxy * wp_proxy_new_wrap (WpCore * core,
|
|
struct pw_proxy * proxy, guint32 type, guint32 version);
|
|
|
|
void wp_proxy_augment (WpProxy *self,
|
|
WpProxyFeatures wanted_features, GCancellable * cancellable,
|
|
GAsyncReadyCallback callback, gpointer user_data);
|
|
gboolean wp_proxy_augment_finish (WpProxy * self, GAsyncResult * res,
|
|
GError ** error);
|
|
|
|
WpProxyFeatures wp_proxy_get_features (WpProxy * self);
|
|
|
|
WpCore * wp_proxy_get_core (WpProxy * self);
|
|
|
|
gboolean wp_proxy_is_global (WpProxy * self);
|
|
guint32 wp_proxy_get_global_id (WpProxy * self);
|
|
guint32 wp_proxy_get_global_permissions (WpProxy * self);
|
|
WpProperties * wp_proxy_get_global_properties (WpProxy * self);
|
|
|
|
guint32 wp_proxy_get_interface_type (WpProxy * self);
|
|
const gchar * wp_proxy_get_interface_name (WpProxy * self);
|
|
GQuark wp_proxy_get_interface_quark (WpProxy * self);
|
|
guint32 wp_proxy_get_interface_version (WpProxy * self);
|
|
|
|
struct pw_proxy * wp_proxy_get_pw_proxy (WpProxy * self);
|
|
|
|
void wp_proxy_sync (WpProxy * self, GCancellable * cancellable,
|
|
GAsyncReadyCallback callback, gpointer user_data);
|
|
gboolean wp_proxy_sync_finish (WpProxy * self, GAsyncResult * res,
|
|
GError ** error);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif
|