
* 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
98 lines
3.4 KiB
C
98 lines
3.4 KiB
C
/* WirePlumber
|
|
*
|
|
* Copyright © 2019 Collabora Ltd.
|
|
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#ifndef __WIREPLUMBER_ENDPOINT_H__
|
|
#define __WIREPLUMBER_ENDPOINT_H__
|
|
|
|
#include <gio/gio.h>
|
|
|
|
#include "core.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
static const guint32 WP_STREAM_ID_NONE = 0xffffffff;
|
|
static const guint32 WP_CONTROL_ID_NONE = 0xffffffff;
|
|
|
|
#define WP_TYPE_ENDPOINT (wp_endpoint_get_type ())
|
|
G_DECLARE_DERIVABLE_TYPE (WpEndpoint, wp_endpoint, WP, ENDPOINT, GObject)
|
|
|
|
#define WP_TYPE_ENDPOINT_LINK (wp_endpoint_link_get_type ())
|
|
G_DECLARE_DERIVABLE_TYPE (WpEndpointLink, wp_endpoint_link, WP, ENDPOINT_LINK, GObject)
|
|
|
|
struct _WpEndpointClass
|
|
{
|
|
GObjectClass parent_class;
|
|
|
|
GVariant * (*get_control_value) (WpEndpoint * self, guint32 control_id);
|
|
gboolean (*set_control_value) (WpEndpoint * self, guint32 control_id,
|
|
GVariant * value);
|
|
|
|
gboolean (*prepare_link) (WpEndpoint * self, guint32 stream_id,
|
|
WpEndpointLink * link, GVariant ** properties, GError ** error);
|
|
void (*release_link) (WpEndpoint * self, WpEndpointLink * link);
|
|
|
|
const gchar * (*get_endpoint_link_factory) (WpEndpoint * self);
|
|
};
|
|
|
|
WpEndpoint * wp_endpoint_new_finish (GObject *initable, GAsyncResult *res,
|
|
GError **error);
|
|
void wp_endpoint_register (WpEndpoint * self);
|
|
void wp_endpoint_unregister (WpEndpoint * self);
|
|
|
|
WpCore *wp_endpoint_get_core (WpEndpoint * self);
|
|
const gchar * wp_endpoint_get_name (WpEndpoint * self);
|
|
const gchar * wp_endpoint_get_media_class (WpEndpoint * self);
|
|
guint wp_endpoint_get_direction (WpEndpoint * self);
|
|
guint64 wp_endpoint_get_creation_time (WpEndpoint * self);
|
|
|
|
void wp_endpoint_register_stream (WpEndpoint * self, GVariant * stream);
|
|
GVariant * wp_endpoint_get_stream (WpEndpoint * self, guint32 stream_id);
|
|
GVariant * wp_endpoint_list_streams (WpEndpoint * self);
|
|
guint32 wp_endpoint_find_stream (WpEndpoint * self, const gchar * name);
|
|
|
|
void wp_endpoint_register_control (WpEndpoint * self, GVariant * control);
|
|
GVariant * wp_endpoint_get_control (WpEndpoint * self, guint32 control_id);
|
|
GVariant * wp_endpoint_list_controls (WpEndpoint * self);
|
|
guint32 wp_endpoint_find_control (WpEndpoint * self, guint32 stream_id,
|
|
const gchar * name);
|
|
|
|
GVariant * wp_endpoint_get_control_value (WpEndpoint * self,
|
|
guint32 control_id);
|
|
gboolean wp_endpoint_set_control_value (WpEndpoint * self, guint32 control_id,
|
|
GVariant * value);
|
|
void wp_endpoint_notify_control_value (WpEndpoint * self, guint32 control_id);
|
|
|
|
gboolean wp_endpoint_is_linked (WpEndpoint * self);
|
|
GPtrArray * wp_endpoint_get_links (WpEndpoint * self);
|
|
void wp_endpoint_unlink (WpEndpoint * self);
|
|
|
|
struct _WpEndpointLinkClass
|
|
{
|
|
GObjectClass parent_class;
|
|
|
|
gboolean (*create) (WpEndpointLink * self, GVariant * src_data,
|
|
GVariant * sink_data, GError ** error);
|
|
void (*destroy) (WpEndpointLink * self);
|
|
};
|
|
|
|
WpEndpoint * wp_endpoint_link_get_source_endpoint (WpEndpointLink * self);
|
|
guint32 wp_endpoint_link_get_source_stream (WpEndpointLink * self);
|
|
WpEndpoint * wp_endpoint_link_get_sink_endpoint (WpEndpointLink * self);
|
|
guint32 wp_endpoint_link_get_sink_stream (WpEndpointLink * self);
|
|
|
|
void wp_endpoint_link_new (WpCore * core, WpEndpoint * src,
|
|
guint32 src_stream, WpEndpoint * sink, guint32 sink_stream,
|
|
GAsyncReadyCallback ready, gpointer data);
|
|
WpEndpointLink * wp_endpoint_link_new_finish (GObject *initable,
|
|
GAsyncResult *res, GError **error);
|
|
void wp_endpoint_link_destroy (WpEndpointLink * self);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif
|