lib: rename WpEndpoint* to WpBaseEndpoint*

to avoid name clashing with the upcoming WpEndpoint interface
that is going to be the common interface of Wp{Proxy,Exported}Endpoint
This commit is contained in:
George Kiagiadakis 2019-12-09 12:34:06 +02:00
parent b999ecf9d4
commit c0455c981d
27 changed files with 727 additions and 722 deletions

File diff suppressed because it is too large Load diff

108
lib/wp/base-endpoint.h Normal file
View file

@ -0,0 +1,108 @@
/* WirePlumber
*
* Copyright © 2019 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_BASE_ENDPOINT_H__
#define __WIREPLUMBER_BASE_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_BASE_ENDPOINT (wp_base_endpoint_get_type ())
G_DECLARE_DERIVABLE_TYPE (WpBaseEndpoint, wp_base_endpoint,
WP, BASE_ENDPOINT, GObject)
#define WP_TYPE_BASE_ENDPOINT_LINK (wp_base_endpoint_link_get_type ())
G_DECLARE_DERIVABLE_TYPE (WpBaseEndpointLink, wp_base_endpoint_link,
WP, BASE_ENDPOINT_LINK, GObject)
struct _WpBaseEndpointClass
{
GObjectClass parent_class;
WpProperties * (*get_properties) (WpBaseEndpoint * self);
const char * (*get_role) (WpBaseEndpoint * self);
GVariant * (*get_control_value) (WpBaseEndpoint * self, guint32 control_id);
gboolean (*set_control_value) (WpBaseEndpoint * self, guint32 control_id,
GVariant * value);
gboolean (*prepare_link) (WpBaseEndpoint * self, guint32 stream_id,
WpBaseEndpointLink * link, GVariant ** properties, GError ** error);
void (*release_link) (WpBaseEndpoint * self, WpBaseEndpointLink * link);
const gchar * (*get_endpoint_link_factory) (WpBaseEndpoint * self);
};
WpBaseEndpoint * wp_base_endpoint_new_finish (GObject *initable, GAsyncResult *res,
GError **error);
void wp_base_endpoint_register (WpBaseEndpoint * self);
void wp_base_endpoint_unregister (WpBaseEndpoint * self);
WpCore *wp_base_endpoint_get_core (WpBaseEndpoint * self);
const gchar * wp_base_endpoint_get_name (WpBaseEndpoint * self);
const gchar * wp_base_endpoint_get_media_class (WpBaseEndpoint * self);
guint wp_base_endpoint_get_direction (WpBaseEndpoint * self);
guint64 wp_base_endpoint_get_creation_time (WpBaseEndpoint * self);
WpProperties * wp_base_endpoint_get_properties (WpBaseEndpoint * self);
const char * wp_base_endpoint_get_role (WpBaseEndpoint * self);
void wp_base_endpoint_register_stream (WpBaseEndpoint * self, GVariant * stream);
GVariant * wp_base_endpoint_get_stream (WpBaseEndpoint * self, guint32 stream_id);
GVariant * wp_base_endpoint_list_streams (WpBaseEndpoint * self);
guint32 wp_base_endpoint_find_stream (WpBaseEndpoint * self, const gchar * name);
void wp_base_endpoint_register_control (WpBaseEndpoint * self, GVariant * control);
GVariant * wp_base_endpoint_get_control (WpBaseEndpoint * self, guint32 control_id);
GVariant * wp_base_endpoint_list_controls (WpBaseEndpoint * self);
guint32 wp_base_endpoint_find_control (WpBaseEndpoint * self, guint32 stream_id,
const gchar * name);
GVariant * wp_base_endpoint_get_control_value (WpBaseEndpoint * self,
guint32 control_id);
gboolean wp_base_endpoint_set_control_value (WpBaseEndpoint * self,
guint32 control_id, GVariant * value);
void wp_base_endpoint_notify_control_value (WpBaseEndpoint * self,
guint32 control_id);
gboolean wp_base_endpoint_is_linked (WpBaseEndpoint * self);
GPtrArray * wp_base_endpoint_get_links (WpBaseEndpoint * self);
void wp_base_endpoint_unlink (WpBaseEndpoint * self);
struct _WpBaseEndpointLinkClass
{
GObjectClass parent_class;
gboolean (*create) (WpBaseEndpointLink * self, GVariant * src_data,
GVariant * sink_data, GError ** error);
void (*destroy) (WpBaseEndpointLink * self);
};
WpBaseEndpoint * wp_base_endpoint_link_get_source_endpoint (
WpBaseEndpointLink * self);
guint32 wp_base_endpoint_link_get_source_stream (WpBaseEndpointLink * self);
WpBaseEndpoint * wp_base_endpoint_link_get_sink_endpoint (
WpBaseEndpointLink * self);
guint32 wp_base_endpoint_link_get_sink_stream (WpBaseEndpointLink * self);
gboolean wp_base_endpoint_link_is_kept (WpBaseEndpointLink * self);
void wp_base_endpoint_link_new (WpCore * core, WpBaseEndpoint * src,
guint32 src_stream, WpBaseEndpoint * sink, guint32 sink_stream,
gboolean keep, GAsyncReadyCallback ready, gpointer data);
WpBaseEndpointLink * wp_base_endpoint_link_new_finish (GObject *initable,
GAsyncResult *res, GError **error);
void wp_base_endpoint_link_destroy (WpBaseEndpointLink * self);
G_END_DECLS
#endif

View file

@ -1,103 +0,0 @@
/* 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;
WpProperties * (*get_properties) (WpEndpoint * self);
const char * (*get_role) (WpEndpoint * self);
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);
WpProperties * wp_endpoint_get_properties (WpEndpoint * self);
const char * wp_endpoint_get_role (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);
gboolean wp_endpoint_link_is_kept (WpEndpointLink * self);
void wp_endpoint_link_new (WpCore * core, WpEndpoint * src,
guint32 src_stream, WpEndpoint * sink, guint32 sink_stream, gboolean keep,
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

View file

@ -1,7 +1,7 @@
wp_lib_sources = [
'base-endpoint.c',
'configuration.c',
'core.c',
'endpoint.c',
'error.c',
'exported.c',
'factory.c',
@ -20,9 +20,9 @@ wp_lib_sources = [
]
wp_lib_headers = [
'base-endpoint.h',
'configuration.h',
'core.h',
'endpoint.h',
'error.h',
'exported.h',
'factory.h',

View file

@ -59,7 +59,7 @@ wp_policy_manager_class_init (WpPolicyManagerClass *klass)
}
static void
policy_mgr_endpoint_added (WpObjectManager *om, WpEndpoint *ep,
policy_mgr_endpoint_added (WpObjectManager *om, WpBaseEndpoint *ep,
WpPolicyManager *self)
{
GList *l;
@ -74,7 +74,7 @@ policy_mgr_endpoint_added (WpObjectManager *om, WpEndpoint *ep,
}
static void
policy_mgr_endpoint_removed (WpObjectManager *om, WpEndpoint *ep,
policy_mgr_endpoint_removed (WpObjectManager *om, WpBaseEndpoint *ep,
WpPolicyManager *self)
{
GList *l;
@ -109,7 +109,7 @@ wp_policy_manager_get_instance (WpCore *core)
/* install the object manager to listen to added/removed endpoints */
wp_object_manager_add_object_interest (mgr->endpoints_om,
WP_TYPE_ENDPOINT, NULL);
WP_TYPE_BASE_ENDPOINT, NULL);
g_signal_connect_object (mgr->endpoints_om, "object-added",
(GCallback) policy_mgr_endpoint_added, mgr, 0);
g_signal_connect_object (mgr->endpoints_om, "object-removed",
@ -162,7 +162,7 @@ media_class_matches (const gchar * media_class, const gchar * lookup)
* @self: the policy manager
* @media_class: the media class lookup string
*
* Returns: (transfer full) (element-type WpEndpoint*): an array with all the
* Returns: (transfer full) (element-type WpBaseEndpoint*): an array with all the
* endpoints matching the media class lookup string
*/
GPtrArray *
@ -176,8 +176,8 @@ wp_policy_manager_list_endpoints (WpPolicyManager * self,
ret = wp_object_manager_get_objects (self->endpoints_om, 0);
for (i = ret->len; i > 0; i--) {
WpEndpoint *ep = g_ptr_array_index (ret, i-1);
if (!media_class_matches (wp_endpoint_get_media_class (ep), media_class))
WpBaseEndpoint *ep = g_ptr_array_index (ret, i-1);
if (!media_class_matches (wp_base_endpoint_get_media_class (ep), media_class))
g_ptr_array_remove_index_fast (ret, i-1);
}
return ret;
@ -429,14 +429,14 @@ wp_policy_notify_changed (WpPolicy *self)
*
* Returns: (transfer full) (nullable): the found endpoint, or NULL
*/
WpEndpoint *
WpBaseEndpoint *
wp_policy_find_endpoint (WpCore *core, GVariant *props,
guint32 *stream_id)
{
g_autoptr (WpPolicyManager) mgr = NULL;
GList *l;
WpPolicy *p;
WpEndpoint * ret;
WpBaseEndpoint * ret;
g_return_val_if_fail (WP_IS_CORE (core), NULL);
g_return_val_if_fail (g_variant_is_of_type (props, G_VARIANT_TYPE_VARDICT), NULL);

View file

@ -9,7 +9,7 @@
#ifndef __WIREPLUMBER_POLICY_H__
#define __WIREPLUMBER_POLICY_H__
#include "endpoint.h"
#include "base-endpoint.h"
G_BEGIN_DECLS
@ -43,10 +43,10 @@ struct _WpPolicyClass
{
GObjectClass parent_class;
void (*endpoint_added) (WpPolicy *self, WpEndpoint *ep);
void (*endpoint_removed) (WpPolicy *self, WpEndpoint *ep);
void (*endpoint_added) (WpPolicy *self, WpBaseEndpoint *ep);
void (*endpoint_removed) (WpPolicy *self, WpBaseEndpoint *ep);
WpEndpoint * (*find_endpoint) (WpPolicy *self, GVariant *props,
WpBaseEndpoint * (*find_endpoint) (WpPolicy *self, GVariant *props,
guint32 *stream_id);
};
@ -62,7 +62,7 @@ void wp_policy_unregister (WpPolicy *self);
void wp_policy_notify_changed (WpPolicy *self);
WpEndpoint * wp_policy_find_endpoint (WpCore *core, GVariant *props,
WpBaseEndpoint * wp_policy_find_endpoint (WpCore *core, GVariant *props,
guint32 *stream_id);
G_END_DECLS

View file

@ -6,9 +6,9 @@
* SPDX-License-Identifier: MIT
*/
#include "base-endpoint.h"
#include "configuration.h"
#include "core.h"
#include "endpoint.h"
#include "error.h"
#include "exported.h"
#include "factory.h"

View file

@ -23,8 +23,8 @@ struct _WpConfigPolicy
WpConfiguration *config;
gboolean pending_rescan;
WpEndpoint *pending_endpoint;
WpEndpoint *pending_target;
WpBaseEndpoint *pending_endpoint;
WpBaseEndpoint *pending_target;
};
enum {
@ -45,13 +45,13 @@ static void
on_endpoint_link_created (GObject *initable, GAsyncResult *res, gpointer p)
{
WpConfigPolicy *self = p;
g_autoptr (WpEndpointLink) link = NULL;
g_autoptr (WpBaseEndpointLink) link = NULL;
g_autoptr (GError) error = NULL;
g_autoptr (WpEndpoint) src_ep = NULL;
g_autoptr (WpEndpoint) sink_ep = NULL;
g_autoptr (WpBaseEndpoint) src_ep = NULL;
g_autoptr (WpBaseEndpoint) sink_ep = NULL;
/* Get the link */
link = wp_endpoint_link_new_finish(initable, res, &error);
link = wp_base_endpoint_link_new_finish(initable, res, &error);
/* Log linking info */
if (error) {
@ -60,10 +60,10 @@ on_endpoint_link_created (GObject *initable, GAsyncResult *res, gpointer p)
}
g_return_if_fail (link);
src_ep = wp_endpoint_link_get_source_endpoint (link);
sink_ep = wp_endpoint_link_get_sink_endpoint (link);
g_info ("Sucessfully linked '%s' to '%s'\n", wp_endpoint_get_name (src_ep),
wp_endpoint_get_name (sink_ep));
src_ep = wp_base_endpoint_link_get_source_endpoint (link);
sink_ep = wp_base_endpoint_link_get_sink_endpoint (link);
g_info ("Sucessfully linked '%s' to '%s'\n", wp_base_endpoint_get_name (src_ep),
wp_base_endpoint_get_name (sink_ep));
/* Clear the pending target */
g_clear_object (&self->pending_target);
@ -71,7 +71,7 @@ on_endpoint_link_created (GObject *initable, GAsyncResult *res, gpointer p)
/* Emit the done signal */
if (self->pending_endpoint) {
gboolean is_capture =
wp_endpoint_get_direction (self->pending_endpoint) == PW_DIRECTION_INPUT;
wp_base_endpoint_get_direction (self->pending_endpoint) == PW_DIRECTION_INPUT;
if (self->pending_endpoint == (is_capture ? sink_ep : src_ep)) {
g_signal_emit (self, signals[SIGNAL_DONE], 0, self->pending_endpoint, link);
g_clear_object (&self->pending_endpoint);
@ -80,7 +80,7 @@ on_endpoint_link_created (GObject *initable, GAsyncResult *res, gpointer p)
}
static gboolean
wp_config_policy_can_link_stream (WpConfigPolicy *self, WpEndpoint *target,
wp_config_policy_can_link_stream (WpConfigPolicy *self, WpBaseEndpoint *target,
const struct WpParserEndpointLinkData *data, guint32 stream_id)
{
g_autoptr (WpConfigParser) parser = NULL;
@ -91,23 +91,23 @@ wp_config_policy_can_link_stream (WpConfigPolicy *self, WpEndpoint *target,
return TRUE;
/* If the endpoint is not linked, we can link */
if (!wp_endpoint_is_linked (target))
if (!wp_base_endpoint_is_linked (target))
return TRUE;
/* Get the linked stream */
gboolean is_capture = wp_endpoint_get_direction (target) == PW_DIRECTION_INPUT;
GPtrArray *links = wp_endpoint_get_links (target);
WpEndpointLink *l = g_ptr_array_index (links, 0);
gboolean is_capture = wp_base_endpoint_get_direction (target) == PW_DIRECTION_INPUT;
GPtrArray *links = wp_base_endpoint_get_links (target);
WpBaseEndpointLink *l = g_ptr_array_index (links, 0);
guint32 linked_stream = is_capture ?
wp_endpoint_link_get_sink_stream (l) :
wp_endpoint_link_get_source_stream (l);
wp_base_endpoint_link_get_sink_stream (l) :
wp_base_endpoint_link_get_source_stream (l);
/* Check if linked stream is the same as target stream. Last one wins */
if (linked_stream == stream_id)
return TRUE;
/* Get the linked stream name */
g_autoptr (GVariant) s = wp_endpoint_get_stream (target, linked_stream);
g_autoptr (GVariant) s = wp_base_endpoint_get_stream (target, linked_stream);
if (!s)
return TRUE;
const gchar *linked_stream_name;
@ -115,7 +115,7 @@ wp_config_policy_can_link_stream (WpConfigPolicy *self, WpEndpoint *target,
return TRUE;
/* Get the target stream name */
g_autoptr (GVariant) ts = wp_endpoint_get_stream (target, stream_id);
g_autoptr (GVariant) ts = wp_base_endpoint_get_stream (target, stream_id);
if (!ts)
return TRUE;
const gchar *target_stream_name;
@ -154,37 +154,37 @@ wp_config_policy_can_link_stream (WpConfigPolicy *self, WpEndpoint *target,
static gboolean
wp_config_policy_link_endpoint_with_target (WpConfigPolicy *policy,
WpEndpoint *ep, guint32 ep_stream, WpEndpoint *target,
WpBaseEndpoint *ep, guint32 ep_stream, WpBaseEndpoint *target,
guint32 target_stream, const struct WpParserEndpointLinkData *data)
{
WpConfigPolicy *self = WP_CONFIG_POLICY (policy);
g_autoptr (WpCore) core = wp_policy_get_core (WP_POLICY (self));
gboolean is_capture = wp_endpoint_get_direction (ep) == PW_DIRECTION_INPUT;
gboolean is_linked = wp_endpoint_is_linked (ep);
gboolean target_linked = wp_endpoint_is_linked (target);
gboolean is_capture = wp_base_endpoint_get_direction (ep) == PW_DIRECTION_INPUT;
gboolean is_linked = wp_base_endpoint_is_linked (ep);
gboolean target_linked = wp_base_endpoint_is_linked (target);
g_debug ("Trying to link with '%s' to target '%s', ep_capture:%d, "
"ep_linked:%d, target_linked:%d", wp_endpoint_get_name (ep),
wp_endpoint_get_name (target), is_capture, is_linked, target_linked);
"ep_linked:%d, target_linked:%d", wp_base_endpoint_get_name (ep),
wp_base_endpoint_get_name (target), is_capture, is_linked, target_linked);
/* Check if the endpoint is already linked with the proper target */
if (is_linked) {
GPtrArray *links = wp_endpoint_get_links (ep);
WpEndpointLink *l = g_ptr_array_index (links, 0);
g_autoptr (WpEndpoint) src_ep = wp_endpoint_link_get_source_endpoint (l);
g_autoptr (WpEndpoint) sink_ep = wp_endpoint_link_get_sink_endpoint (l);
WpEndpoint *existing_target = is_capture ? src_ep : sink_ep;
GPtrArray *links = wp_base_endpoint_get_links (ep);
WpBaseEndpointLink *l = g_ptr_array_index (links, 0);
g_autoptr (WpBaseEndpoint) src_ep = wp_base_endpoint_link_get_source_endpoint (l);
g_autoptr (WpBaseEndpoint) sink_ep = wp_base_endpoint_link_get_sink_endpoint (l);
WpBaseEndpoint *existing_target = is_capture ? src_ep : sink_ep;
if (existing_target == target) {
/* linked to correct target so do nothing */
g_debug ("Endpoint '%s' is already linked correctly",
wp_endpoint_get_name (ep));
wp_base_endpoint_get_name (ep));
return FALSE;
} else {
/* linked to the wrong target so unlink and continue */
g_debug ("Unlinking endpoint '%s' from its previous target",
wp_endpoint_get_name (ep));
wp_endpoint_link_destroy (l);
wp_base_endpoint_get_name (ep));
wp_base_endpoint_link_destroy (l);
}
}
@ -196,20 +196,20 @@ wp_config_policy_link_endpoint_with_target (WpConfigPolicy *policy,
/* Unlink the target links that are not kept if endpoint is capture */
if (!is_capture && target_linked) {
GPtrArray *links = wp_endpoint_get_links (target);
GPtrArray *links = wp_base_endpoint_get_links (target);
for (guint i = 0; i < links->len; i++) {
WpEndpointLink *l = g_ptr_array_index (links, i);
if (!wp_endpoint_link_is_kept (l))
wp_endpoint_link_destroy (l);
WpBaseEndpointLink *l = g_ptr_array_index (links, i);
if (!wp_base_endpoint_link_is_kept (l))
wp_base_endpoint_link_destroy (l);
}
}
/* Link the client with the target */
if (is_capture) {
wp_endpoint_link_new (core, target, target_stream, ep, ep_stream,
wp_base_endpoint_link_new (core, target, target_stream, ep, ep_stream,
data->el.keep, on_endpoint_link_created, self);
} else {
wp_endpoint_link_new (core, ep, ep_stream, target, target_stream,
wp_base_endpoint_link_new (core, ep, ep_stream, target, target_stream,
data->el.keep, on_endpoint_link_created, self);
}
@ -217,7 +217,7 @@ wp_config_policy_link_endpoint_with_target (WpConfigPolicy *policy,
}
static gboolean
wp_config_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep)
wp_config_policy_handle_endpoint (WpPolicy *policy, WpBaseEndpoint *ep)
{
WpConfigPolicy *self = WP_CONFIG_POLICY (policy);
g_autoptr (WpCore) core = wp_policy_get_core (policy);
@ -225,7 +225,7 @@ wp_config_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep)
const struct WpParserEndpointLinkData *data;
GVariantBuilder b;
GVariant *target_data = NULL;
g_autoptr (WpEndpoint) target = NULL;
g_autoptr (WpBaseEndpoint) target = NULL;
guint32 stream_id;
const char *role = NULL;
gboolean can_link;
@ -243,7 +243,7 @@ wp_config_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep)
g_variant_builder_init (&b, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&b, "{sv}",
"data", g_variant_new_uint64 ((guint64) data));
role = wp_endpoint_get_role (ep);
role = wp_base_endpoint_get_role (ep);
if (role)
g_variant_builder_add (&b, "{sv}", "role", g_variant_new_string (role));
target_data = g_variant_builder_end (&b);
@ -251,7 +251,7 @@ wp_config_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep)
/* Find the target endpoint */
target = wp_policy_find_endpoint (core, target_data, &stream_id);
if (!target) {
g_info ("Target not found for endpoint '%s'", wp_endpoint_get_name (ep));
g_info ("Target not found for endpoint '%s'", wp_base_endpoint_get_name (ep));
return FALSE;
}
@ -259,7 +259,7 @@ wp_config_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep)
can_link = wp_config_policy_can_link_stream (self, target, data, stream_id);
g_debug ("Trying to handle endpoint: %s, role:%s, can_link:%d",
wp_endpoint_get_name (ep), role, can_link);
wp_base_endpoint_get_name (ep), role, can_link);
/* Link the endpoint with its target */
return can_link && wp_config_policy_link_endpoint_with_target (self, ep,
@ -294,7 +294,7 @@ wp_config_policy_get_prioritized_stream (WpPolicy *policy,
return lowest ? lowest->name : NULL;
}
static WpEndpoint *
static WpBaseEndpoint *
wp_config_policy_find_endpoint (WpPolicy *policy, GVariant *props,
guint32 *stream_id)
{
@ -303,7 +303,7 @@ wp_config_policy_find_endpoint (WpPolicy *policy, GVariant *props,
const struct WpParserEndpointLinkData *data = NULL;
g_autoptr (GPtrArray) endpoints = NULL;
guint i;
WpEndpoint *target = NULL;
WpBaseEndpoint *target = NULL;
g_autoptr (WpProxy) proxy = NULL;
g_autoptr (WpProperties) p = NULL;
const char *role = NULL;
@ -339,7 +339,7 @@ wp_config_policy_find_endpoint (WpPolicy *policy, GVariant *props,
g_variant_lookup (props, "role", "&s", &role);
const char *prioritized = wp_config_policy_get_prioritized_stream (policy,
role, data->te.stream, data->te.streams);
*stream_id = prioritized ? wp_endpoint_find_stream (target, prioritized) :
*stream_id = prioritized ? wp_base_endpoint_find_stream (target, prioritized) :
WP_STREAM_ID_NONE;
} else {
*stream_id = WP_STREAM_ID_NONE;
@ -355,7 +355,7 @@ wp_config_policy_sync_rescan (WpCore *core, GAsyncResult *res, gpointer data)
WpConfigPolicy *self = WP_CONFIG_POLICY (data);
g_autoptr (WpPolicyManager) pmgr = wp_policy_manager_get_instance (core);
g_autoptr (GPtrArray) endpoints = NULL;
WpEndpoint *ep;
WpBaseEndpoint *ep;
gboolean handled = FALSE;
/* Handle all endpoints when rescanning */
@ -379,7 +379,7 @@ wp_config_policy_sync_rescan (WpCore *core, GAsyncResult *res, gpointer data)
}
static void
wp_config_policy_rescan (WpConfigPolicy *self, WpEndpoint *ep)
wp_config_policy_rescan (WpConfigPolicy *self, WpBaseEndpoint *ep)
{
if (self->pending_rescan)
return;
@ -387,7 +387,7 @@ wp_config_policy_rescan (WpConfigPolicy *self, WpEndpoint *ep)
/* Check if there is a pending link while a new endpoint is added/removed */
if (self->pending_endpoint) {
g_warning ("Not handling endpoint '%s' beacause of pending link",
wp_endpoint_get_name (ep));
wp_base_endpoint_get_name (ep));
return;
}
@ -402,14 +402,14 @@ wp_config_policy_rescan (WpConfigPolicy *self, WpEndpoint *ep)
}
static void
wp_config_policy_endpoint_added (WpPolicy *policy, WpEndpoint *ep)
wp_config_policy_endpoint_added (WpPolicy *policy, WpBaseEndpoint *ep)
{
WpConfigPolicy *self = WP_CONFIG_POLICY (policy);
wp_config_policy_rescan (self, ep);
}
static void
wp_config_policy_endpoint_removed (WpPolicy *policy, WpEndpoint *ep)
wp_config_policy_endpoint_removed (WpPolicy *policy, WpBaseEndpoint *ep)
{
WpConfigPolicy *self = WP_CONFIG_POLICY (policy);
wp_config_policy_rescan (self, ep);
@ -512,7 +512,7 @@ wp_config_policy_class_init (WpConfigPolicyClass *klass)
/* Signals */
signals[SIGNAL_DONE] = g_signal_new ("done",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
G_TYPE_NONE, 2, WP_TYPE_ENDPOINT, WP_TYPE_ENDPOINT_LINK);
G_TYPE_NONE, 2, WP_TYPE_BASE_ENDPOINT, WP_TYPE_BASE_ENDPOINT_LINK);
}
WpConfigPolicy *

View file

@ -26,7 +26,7 @@ wildcard_match (const char *pattern, const char *str)
}
gboolean
wp_parser_endpoint_link_matches_endpoint_data (WpEndpoint *ep,
wp_parser_endpoint_link_matches_endpoint_data (WpBaseEndpoint *ep,
const struct WpParserEndpointLinkEndpointData *data)
{
g_autoptr (WpProperties) props = NULL;
@ -34,21 +34,21 @@ wp_parser_endpoint_link_matches_endpoint_data (WpEndpoint *ep,
g_return_val_if_fail (ep, FALSE);
g_return_val_if_fail (data, FALSE);
props = wp_endpoint_get_properties (ep);
props = wp_base_endpoint_get_properties (ep);
g_return_val_if_fail (props, FALSE);
/* Name */
if (data->name &&
!wildcard_match (data->name, wp_endpoint_get_name (ep)))
!wildcard_match (data->name, wp_base_endpoint_get_name (ep)))
return FALSE;
/* Media Class */
if (data->media_class &&
g_strcmp0 (wp_endpoint_get_media_class (ep), data->media_class) != 0)
g_strcmp0 (wp_base_endpoint_get_media_class (ep), data->media_class) != 0)
return FALSE;
/* Direction */
if (wp_endpoint_get_direction (ep) != data->direction)
if (wp_base_endpoint_get_direction (ep) != data->direction)
return FALSE;
/* Properties */
@ -286,7 +286,7 @@ static gconstpointer
wp_parser_endpoint_link_get_matched_data (WpConfigParser *parser, gpointer data)
{
WpParserEndpointLink *self = WP_PARSER_ENDPOINT_LINK (parser);
WpEndpoint *ep = WP_ENDPOINT (data);
WpBaseEndpoint *ep = WP_BASE_ENDPOINT (data);
const struct WpParserEndpointLinkData *d = NULL;
/* Find the first data that matches endpoint */

View file

@ -39,7 +39,7 @@ struct WpParserEndpointLinkData {
};
/* Helpers */
gboolean wp_parser_endpoint_link_matches_endpoint_data (WpEndpoint *ep,
gboolean wp_parser_endpoint_link_matches_endpoint_data (WpBaseEndpoint *ep,
const struct WpParserEndpointLinkEndpointData *data);
#define WP_TYPE_PARSER_ENDPOINT_LINK (wp_parser_endpoint_link_get_type ())

View file

@ -9,7 +9,7 @@
/**
* module-pipewire provides basic integration between wireplumber and pipewire.
* It provides the pipewire core and remote, connects to pipewire and provides
* the most primitive implementations of WpEndpoint and WpEndpointLink
* the most primitive implementations of WpBaseEndpoint and WpBaseEndpointLink
*/
#include <wp/wp.h>

View file

@ -7,7 +7,7 @@
*/
/**
* module-pw-audio-softdsp-endpoint provides a WpEndpoint implementation
* module-pw-audio-softdsp-endpoint provides a WpBaseEndpoint implementation
* that wraps an audio device node in pipewire and plugs a DSP node, as well
* as optional merger+volume nodes that are used as entry points for the
* various streams that this endpoint may have
@ -30,7 +30,7 @@
struct _WpPwAudioSoftdspEndpoint
{
WpEndpoint parent;
WpBaseEndpoint parent;
/* Properties */
WpProxyNode *proxy_node;
@ -55,16 +55,16 @@ enum {
PROP_ROLE,
};
static GAsyncInitableIface *wp_endpoint_parent_interface = NULL;
static void wp_endpoint_async_initable_init (gpointer iface,
static GAsyncInitableIface *async_initable_parent_interface = NULL;
static void endpoint_async_initable_init (gpointer iface,
gpointer iface_data);
G_DECLARE_FINAL_TYPE (WpPwAudioSoftdspEndpoint, endpoint,
WP_PW, AUDIO_SOFTDSP_ENDPOINT, WpEndpoint)
WP_PW, AUDIO_SOFTDSP_ENDPOINT, WpBaseEndpoint)
G_DEFINE_TYPE_WITH_CODE (WpPwAudioSoftdspEndpoint, endpoint, WP_TYPE_ENDPOINT,
G_DEFINE_TYPE_WITH_CODE (WpPwAudioSoftdspEndpoint, endpoint, WP_TYPE_BASE_ENDPOINT,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE,
wp_endpoint_async_initable_init))
endpoint_async_initable_init))
typedef GObject* (*WpObjectNewFinishFunc)(GObject *initable, GAsyncResult *res,
GError **error);
@ -93,7 +93,7 @@ object_safe_new_finish(WpPwAudioSoftdspEndpoint * self, GObject *initable,
}
static WpProperties *
endpoint_get_properties (WpEndpoint * ep)
endpoint_get_properties (WpBaseEndpoint * ep)
{
WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (ep);
@ -101,7 +101,7 @@ endpoint_get_properties (WpEndpoint * ep)
}
static const char *
endpoint_get_role (WpEndpoint *ep)
endpoint_get_role (WpBaseEndpoint *ep)
{
WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (ep);
@ -109,8 +109,8 @@ endpoint_get_role (WpEndpoint *ep)
}
static gboolean
endpoint_prepare_link (WpEndpoint * ep, guint32 stream_id,
WpEndpointLink * link, GVariant ** properties, GError ** error)
endpoint_prepare_link (WpBaseEndpoint * ep, guint32 stream_id,
WpBaseEndpointLink * link, GVariant ** properties, GError ** error)
{
WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (ep);
WpAudioStream *stream = NULL;
@ -176,8 +176,8 @@ on_audio_adapter_created(GObject *initable, GAsyncResult *res,
gpointer data)
{
WpPwAudioSoftdspEndpoint *self = data;
enum pw_direction direction = wp_endpoint_get_direction(WP_ENDPOINT(self));
g_autoptr (WpCore) core = wp_endpoint_get_core(WP_ENDPOINT(self));
enum pw_direction direction = wp_base_endpoint_get_direction(WP_BASE_ENDPOINT(self));
g_autoptr (WpCore) core = wp_base_endpoint_get_core(WP_BASE_ENDPOINT(self));
g_autoptr (WpProperties) props = NULL;
const struct spa_audio_info_raw *format;
g_autofree gchar *name = NULL;
@ -220,14 +220,14 @@ on_audio_adapter_created(GObject *initable, GAsyncResult *res,
/* Create the audio converters */
g_variant_iter_init (&iter, self->streams);
for (i = 0; g_variant_iter_next (&iter, "&s", &stream); i++) {
wp_audio_convert_new (WP_ENDPOINT(self), i, stream, direction,
wp_audio_convert_new (WP_BASE_ENDPOINT(self), i, stream, direction,
self->adapter, format, on_audio_convert_created, self);
/* Register the stream */
g_variant_dict_init (&d, NULL);
g_variant_dict_insert (&d, "id", "u", i);
g_variant_dict_insert (&d, "name", "s", stream);
wp_endpoint_register_stream (WP_ENDPOINT (self), g_variant_dict_end (&d));
wp_base_endpoint_register_stream (WP_BASE_ENDPOINT (self), g_variant_dict_end (&d));
}
self->stream_count = i;
}
@ -300,7 +300,7 @@ endpoint_get_property (GObject * object, guint property_id,
}
static GVariant *
endpoint_get_control_value (WpEndpoint * ep, guint32 id)
endpoint_get_control_value (WpBaseEndpoint * ep, guint32 id)
{
WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (ep);
guint stream_id, control_id;
@ -323,7 +323,7 @@ endpoint_get_control_value (WpEndpoint * ep, guint32 id)
}
static gboolean
endpoint_set_control_value (WpEndpoint * ep, guint32 id, GVariant * value)
endpoint_set_control_value (WpBaseEndpoint * ep, guint32 id, GVariant * value)
{
WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (ep);
guint stream_id, control_id;
@ -331,7 +331,7 @@ endpoint_set_control_value (WpEndpoint * ep, guint32 id, GVariant * value)
if (id == CONTROL_SELECTED) {
self->selected = g_variant_get_boolean (value);
wp_endpoint_notify_control_value (ep, CONTROL_SELECTED);
wp_base_endpoint_notify_control_value (ep, CONTROL_SELECTED);
return TRUE;
}
@ -349,19 +349,19 @@ endpoint_set_control_value (WpEndpoint * ep, guint32 id, GVariant * value)
}
static void
wp_endpoint_init_async (GAsyncInitable *initable, int io_priority,
wp_base_endpoint_init_async (GAsyncInitable *initable, int io_priority,
GCancellable *cancellable, GAsyncReadyCallback callback, gpointer data)
{
WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (initable);
enum pw_direction direction = wp_endpoint_get_direction(WP_ENDPOINT(self));
g_autoptr (WpCore) core = wp_endpoint_get_core(WP_ENDPOINT(self));
enum pw_direction direction = wp_base_endpoint_get_direction(WP_BASE_ENDPOINT(self));
g_autoptr (WpCore) core = wp_base_endpoint_get_core(WP_BASE_ENDPOINT(self));
GVariantDict d;
/* Create the async task */
self->init_task = g_task_new (initable, cancellable, callback, data);
/* Create the adapter proxy */
wp_audio_adapter_new (WP_ENDPOINT(self), WP_STREAM_ID_NONE, "master",
wp_audio_adapter_new (WP_BASE_ENDPOINT(self), WP_STREAM_ID_NONE, "master",
direction, self->proxy_node, FALSE, on_audio_adapter_created, self);
/* Register the selected control */
@ -371,23 +371,23 @@ wp_endpoint_init_async (GAsyncInitable *initable, int io_priority,
g_variant_dict_insert (&d, "name", "s", "selected");
g_variant_dict_insert (&d, "type", "s", "b");
g_variant_dict_insert (&d, "default-value", "b", self->selected);
wp_endpoint_register_control (WP_ENDPOINT (self), g_variant_dict_end (&d));
wp_base_endpoint_register_control (WP_BASE_ENDPOINT (self), g_variant_dict_end (&d));
/* Call the parent interface */
wp_endpoint_parent_interface->init_async (initable, io_priority, cancellable,
async_initable_parent_interface->init_async (initable, io_priority, cancellable,
callback, data);
}
static void
wp_endpoint_async_initable_init (gpointer iface, gpointer iface_data)
endpoint_async_initable_init (gpointer iface, gpointer iface_data)
{
GAsyncInitableIface *ai_iface = iface;
/* Set the parent interface */
wp_endpoint_parent_interface = g_type_interface_peek_parent (iface);
async_initable_parent_interface = g_type_interface_peek_parent (iface);
/* Only set the init_async */
ai_iface->init_async = wp_endpoint_init_async;
ai_iface->init_async = wp_base_endpoint_init_async;
}
static void
@ -400,7 +400,7 @@ static void
endpoint_class_init (WpPwAudioSoftdspEndpointClass * klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
WpEndpointClass *endpoint_class = (WpEndpointClass *) klass;
WpBaseEndpointClass *endpoint_class = (WpBaseEndpointClass *) klass;
object_class->finalize = endpoint_finalize;
object_class->set_property = endpoint_set_property;
@ -440,7 +440,7 @@ audio_softdsp_endpoint_factory (WpFactory * factory, GType type, GVariant * prop
g_autoptr (GVariant) streams = NULL;
/* Make sure the type is correct */
g_return_if_fail(type == WP_TYPE_ENDPOINT);
g_return_if_fail(type == WP_TYPE_BASE_ENDPOINT);
/* Get the Core */
core = wp_factory_get_core(factory);

View file

@ -188,7 +188,7 @@ wp_audio_adapter_class_init (WpAudioAdapterClass * klass)
}
void
wp_audio_adapter_new (WpEndpoint *endpoint, guint stream_id,
wp_audio_adapter_new (WpBaseEndpoint *endpoint, guint stream_id,
const char *stream_name, enum pw_direction direction, WpProxyNode *node,
gboolean convert, GAsyncReadyCallback callback, gpointer user_data)
{

View file

@ -22,7 +22,7 @@ struct spa_audio_info_raw format;
G_DECLARE_FINAL_TYPE (WpAudioAdapter, wp_audio_adapter, WP, AUDIO_ADAPTER,
WpAudioStream)
void wp_audio_adapter_new (WpEndpoint *endpoint, guint stream_id,
void wp_audio_adapter_new (WpBaseEndpoint *endpoint, guint stream_id,
const char *stream_name, enum pw_direction direction, WpProxyNode *node,
gboolean convert, GAsyncReadyCallback callback, gpointer user_data);

View file

@ -285,7 +285,7 @@ wp_audio_convert_class_init (WpAudioConvertClass * klass)
}
void
wp_audio_convert_new (WpEndpoint *endpoint, guint stream_id,
wp_audio_convert_new (WpBaseEndpoint *endpoint, guint stream_id,
const char *stream_name, enum pw_direction direction,
WpAudioStream *target, const struct spa_audio_info_raw *format,
GAsyncReadyCallback callback, gpointer user_data)

View file

@ -22,7 +22,7 @@ struct spa_audio_info_raw format;
G_DECLARE_FINAL_TYPE (WpAudioConvert, wp_audio_convert, WP, AUDIO_CONVERT,
WpAudioStream)
void wp_audio_convert_new (WpEndpoint *endpoint, guint stream_id,
void wp_audio_convert_new (WpBaseEndpoint *endpoint, guint stream_id,
const char *stream_name, enum pw_direction direction,
WpAudioStream *target, const struct spa_audio_info_raw *format,
GAsyncReadyCallback callback, gpointer user_data);

View file

@ -100,7 +100,7 @@ audio_stream_event_param (WpProxy *proxy, int seq, uint32_t id,
WpAudioStream *self)
{
WpAudioStreamPrivate *priv = wp_audio_stream_get_instance_private (self);
g_autoptr (WpEndpoint) ep = g_weak_ref_get (&priv->endpoint);
g_autoptr (WpBaseEndpoint) ep = g_weak_ref_get (&priv->endpoint);
switch (id) {
case SPA_PARAM_Props:
@ -116,7 +116,7 @@ audio_stream_event_param (WpProxy *proxy, int seq, uint32_t id,
spa_pod_get_float(&prop->value, &volume);
if (priv->volume != volume) {
priv->volume = volume;
wp_endpoint_notify_control_value (ep,
wp_base_endpoint_notify_control_value (ep,
wp_audio_stream_id_encode (priv->id, CONTROL_VOLUME));
}
break;
@ -124,7 +124,7 @@ audio_stream_event_param (WpProxy *proxy, int seq, uint32_t id,
spa_pod_get_bool(&prop->value, &mute);
if (priv->mute != mute) {
priv->mute = mute;
wp_endpoint_notify_control_value (ep,
wp_base_endpoint_notify_control_value (ep,
wp_audio_stream_id_encode (priv->id, CONTROL_MUTE));
}
break;
@ -291,11 +291,11 @@ wp_audio_stream_init_async (GAsyncInitable *initable, int io_priority,
{
WpAudioStream *self = WP_AUDIO_STREAM(initable);
WpAudioStreamPrivate *priv = wp_audio_stream_get_instance_private (self);
g_autoptr (WpEndpoint) ep = g_weak_ref_get (&priv->endpoint);
g_autoptr (WpBaseEndpoint) ep = g_weak_ref_get (&priv->endpoint);
g_autoptr (WpCore) core = wp_audio_stream_get_core (self);
GVariantDict d;
g_debug ("WpEndpoint:%p init stream %s (%s:%p)", ep, priv->name,
g_debug ("WpBaseEndpoint:%p init stream %s (%s:%p)", ep, priv->name,
G_OBJECT_TYPE_NAME (self), self);
priv->init_task = g_task_new (initable, cancellable, callback, data);
@ -310,7 +310,7 @@ wp_audio_stream_init_async (GAsyncInitable *initable, int io_priority,
g_variant_dict_insert (&d, "type", "s", "d");
g_variant_dict_insert (&d, "range", "(dd)", 0.0, 1.0);
g_variant_dict_insert (&d, "default-value", "d", priv->volume);
wp_endpoint_register_control (ep, g_variant_dict_end (&d));
wp_base_endpoint_register_control (ep, g_variant_dict_end (&d));
/* Register the mute control */
g_variant_dict_init (&d, NULL);
@ -321,7 +321,7 @@ wp_audio_stream_init_async (GAsyncInitable *initable, int io_priority,
g_variant_dict_insert (&d, "name", "s", "mute");
g_variant_dict_insert (&d, "type", "s", "b");
g_variant_dict_insert (&d, "default-value", "b", priv->mute);
wp_endpoint_register_control (ep, g_variant_dict_end (&d));
wp_base_endpoint_register_control (ep, g_variant_dict_end (&d));
g_return_if_fail (priv->proxy);
wp_proxy_augment (WP_PROXY (priv->proxy),
@ -369,7 +369,7 @@ wp_audio_stream_class_init (WpAudioStreamClass * klass)
/* Install the properties */
g_object_class_install_property (object_class, PROP_ENDPOINT,
g_param_spec_object ("endpoint", "endpoint",
"The endpoint this audio stream belongs to", WP_TYPE_ENDPOINT,
"The endpoint this audio stream belongs to", WP_TYPE_BASE_ENDPOINT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_ID,
g_param_spec_uint ("id", "id", "The Id of the audio stream", 0, G_MAXUINT, 0,
@ -548,11 +548,11 @@ WpCore *
wp_audio_stream_get_core (WpAudioStream * self)
{
WpAudioStreamPrivate *priv = wp_audio_stream_get_instance_private (self);
g_autoptr (WpEndpoint) ep = NULL;
g_autoptr (WpBaseEndpoint) ep = NULL;
g_autoptr (WpCore) core = NULL;
ep = g_weak_ref_get (&priv->endpoint);
core = wp_endpoint_get_core (ep);
core = wp_base_endpoint_get_core (ep);
return g_steal_pointer (&core);
}

View file

@ -7,7 +7,7 @@
*/
/**
* The simple endpoint link is an implementation of WpEndpointLink that
* The simple endpoint link is an implementation of WpBaseEndpointLink that
* expects the two linked endpoints to have nodes in the pipewire graph.
* When asked to create a link, it creates pw_link objects that will link
* the ports of the source node to the ports of the sink node.
@ -27,7 +27,7 @@
struct _WpPipewireSimpleEndpointLink
{
WpEndpointLink parent;
WpBaseEndpointLink parent;
/* Props */
GWeakRef core;
@ -53,10 +53,10 @@ static void wp_simple_endpoint_link_async_initable_init (gpointer iface,
gpointer iface_data);
G_DECLARE_FINAL_TYPE (WpPipewireSimpleEndpointLink,
simple_endpoint_link, WP_PIPEWIRE, SIMPLE_ENDPOINT_LINK, WpEndpointLink)
simple_endpoint_link, WP_PIPEWIRE, SIMPLE_ENDPOINT_LINK, WpBaseEndpointLink)
G_DEFINE_TYPE_WITH_CODE (WpPipewireSimpleEndpointLink, simple_endpoint_link,
WP_TYPE_ENDPOINT_LINK,
WP_TYPE_BASE_ENDPOINT_LINK,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE,
wp_simple_endpoint_link_async_initable_init))
@ -189,7 +189,7 @@ create_link_cb (WpProperties *props, gpointer user_data)
}
static gboolean
simple_endpoint_link_create (WpEndpointLink * epl, GVariant * src_data,
simple_endpoint_link_create (WpBaseEndpointLink * epl, GVariant * src_data,
GVariant * sink_data, GError ** error)
{
WpPipewireSimpleEndpointLink *self = WP_PIPEWIRE_SIMPLE_ENDPOINT_LINK(epl);
@ -198,7 +198,7 @@ simple_endpoint_link_create (WpEndpointLink * epl, GVariant * src_data,
}
static void
simple_endpoint_link_destroy (WpEndpointLink * epl)
simple_endpoint_link_destroy (WpBaseEndpointLink * epl)
{
WpPipewireSimpleEndpointLink *self = WP_PIPEWIRE_SIMPLE_ENDPOINT_LINK(epl);
@ -209,7 +209,7 @@ static void
simple_endpoint_link_class_init (WpPipewireSimpleEndpointLinkClass * klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
WpEndpointLinkClass *link_class = (WpEndpointLinkClass *) klass;
WpBaseEndpointLinkClass *link_class = (WpBaseEndpointLinkClass *) klass;
object_class->finalize = simple_endpoint_link_finalize;
object_class->set_property = simple_endpoint_link_set_property;
@ -234,7 +234,7 @@ simple_endpoint_link_factory (WpFactory * factory, GType type,
gboolean keep;
/* Make sure the type is an endpoint link */
g_return_if_fail (type == WP_TYPE_ENDPOINT_LINK);
g_return_if_fail (type == WP_TYPE_BASE_ENDPOINT_LINK);
/* Get the Core */
core = wp_factory_get_core (factory);

View file

@ -28,13 +28,13 @@ static void
on_endpoint_created(GObject *initable, GAsyncResult *res, gpointer d)
{
struct impl *impl = d;
g_autoptr (WpEndpoint) endpoint = NULL;
g_autoptr (WpBaseEndpoint) endpoint = NULL;
g_autoptr (WpProxy) proxy = NULL;
guint global_id = 0;
GError *error = NULL;
/* Get the endpoint */
endpoint = wp_endpoint_new_finish(initable, res, &error);
endpoint = wp_base_endpoint_new_finish(initable, res, &error);
if (error) {
g_warning ("Failed to create alsa endpoint: %s", error->message);
return;
@ -47,7 +47,7 @@ on_endpoint_created(GObject *initable, GAsyncResult *res, gpointer d)
g_debug ("Created alsa endpoint for global id %d", global_id);
/* Register the endpoint and add it to the table */
wp_endpoint_register (endpoint);
wp_base_endpoint_register (endpoint);
g_hash_table_insert (impl->registered_endpoints, GUINT_TO_POINTER(global_id),
g_steal_pointer (&endpoint));
}
@ -123,14 +123,14 @@ on_node_added (WpObjectManager *om, WpProxy *proxy, struct impl *impl)
/* Create the endpoint async */
g_object_get (om, "core", &core, NULL);
wp_factory_make (core, "pw-audio-softdsp-endpoint", WP_TYPE_ENDPOINT,
wp_factory_make (core, "pw-audio-softdsp-endpoint", WP_TYPE_BASE_ENDPOINT,
endpoint_props, on_endpoint_created, impl);
}
static void
on_node_removed (WpObjectManager *om, WpProxy *proxy, struct impl *impl)
{
WpEndpoint *endpoint = NULL;
WpBaseEndpoint *endpoint = NULL;
guint32 id = wp_proxy_get_global_id (proxy);
/* Get the endpoint */
@ -140,7 +140,7 @@ on_node_removed (WpObjectManager *om, WpProxy *proxy, struct impl *impl)
return;
/* Unregister the endpoint and remove it from the table */
wp_endpoint_unregister (endpoint);
wp_base_endpoint_unregister (endpoint);
g_hash_table_remove (impl->registered_endpoints, GUINT_TO_POINTER(id));
}

View file

@ -7,7 +7,7 @@
*/
/**
* module-pw-audio-client provides a WpEndpoint implementation
* module-pw-audio-client provides a WpBaseEndpoint implementation
* that wraps an audio client node in pipewire into an endpoint
*/
@ -24,13 +24,13 @@ static void
on_endpoint_created(GObject *initable, GAsyncResult *res, gpointer d)
{
struct module_data *data = d;
g_autoptr (WpEndpoint) endpoint = NULL;
g_autoptr (WpBaseEndpoint) endpoint = NULL;
g_autoptr (WpProxy) proxy = NULL;
guint global_id = 0;
GError *error = NULL;
/* Get the endpoint */
endpoint = wp_endpoint_new_finish(initable, res, &error);
endpoint = wp_base_endpoint_new_finish(initable, res, &error);
if (error) {
g_warning ("Failed to create client endpoint: %s", error->message);
return;
@ -43,7 +43,7 @@ on_endpoint_created(GObject *initable, GAsyncResult *res, gpointer d)
g_debug ("Created client endpoint for global id %d", global_id);
/* Register the endpoint and add it to the table */
wp_endpoint_register (endpoint);
wp_base_endpoint_register (endpoint);
g_hash_table_insert (data->registered_endpoints, GUINT_TO_POINTER(global_id),
g_steal_pointer (&endpoint));
}
@ -95,7 +95,7 @@ on_node_added (WpObjectManager *om, WpProxy *proxy, gpointer d)
/* Create the endpoint async */
g_object_get (om, "core", &core, NULL);
wp_factory_make (core, "pw-audio-softdsp-endpoint", WP_TYPE_ENDPOINT,
wp_factory_make (core, "pw-audio-softdsp-endpoint", WP_TYPE_BASE_ENDPOINT,
endpoint_props, on_endpoint_created, data);
}
@ -103,7 +103,7 @@ static void
on_node_removed (WpObjectManager *om, WpProxy *proxy, gpointer d)
{
struct module_data *data = d;
WpEndpoint *endpoint = NULL;
WpBaseEndpoint *endpoint = NULL;
guint32 id = wp_proxy_get_global_id (proxy);
/* Get the endpoint */
@ -113,7 +113,7 @@ on_node_removed (WpObjectManager *om, WpProxy *proxy, gpointer d)
return;
/* Unregister the endpoint and remove it from the table */
wp_endpoint_unregister (endpoint);
wp_base_endpoint_unregister (endpoint);
g_hash_table_remove (data->registered_endpoints, GUINT_TO_POINTER(id));
}

View file

@ -114,29 +114,29 @@ playback (TestConfigPolicyFixture *f, gconstpointer data)
{
g_autoptr (WpConfigPolicyContext) ctx = wp_config_policy_context_new (f->core,
"config-policy/config-playback");
g_autoptr (WpEndpointLink) link = NULL;
g_autoptr (WpEndpoint) src = NULL;
g_autoptr (WpEndpoint) sink = NULL;
g_autoptr (WpEndpoint) ep1 = NULL;
g_autoptr (WpEndpoint) ep2 = NULL;
g_autoptr (WpEndpoint) ep3 = NULL;
g_autoptr (WpBaseEndpointLink) link = NULL;
g_autoptr (WpBaseEndpoint) src = NULL;
g_autoptr (WpBaseEndpoint) sink = NULL;
g_autoptr (WpBaseEndpoint) ep1 = NULL;
g_autoptr (WpBaseEndpoint) ep2 = NULL;
g_autoptr (WpBaseEndpoint) ep3 = NULL;
/* Create the device endpoint */
ep1 = wp_config_policy_context_add_endpoint (ctx, "ep1", "Fake/Sink",
PW_DIRECTION_INPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep1);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (ep1));
g_assert_false (wp_base_endpoint_is_linked (ep1));
/* Create the first client endpoint */
ep2 = wp_config_policy_context_add_endpoint (ctx, "ep2", "Stream/Output/Fake",
PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep2);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep2));
g_assert_true (wp_endpoint_is_linked (ep1));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep2));
g_assert_true (wp_base_endpoint_is_linked (ep1));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep2 == src);
g_assert_true (ep1 == sink);
@ -145,15 +145,15 @@ playback (TestConfigPolicyFixture *f, gconstpointer data)
PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep2);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep3));
g_assert_true (wp_endpoint_is_linked (ep1));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep3));
g_assert_true (wp_base_endpoint_is_linked (ep1));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep3 == src);
g_assert_true (ep1 == sink);
/* Make sure ep2 is unlinked after ep3 was linked */
g_assert_false (wp_endpoint_is_linked (ep2));
g_assert_false (wp_base_endpoint_is_linked (ep2));
/* Remove the client endpoints */
wp_config_policy_context_remove_endpoint (ctx, ep2);
@ -165,28 +165,28 @@ capture (TestConfigPolicyFixture *f, gconstpointer data)
{
g_autoptr (WpConfigPolicyContext) ctx = wp_config_policy_context_new (f->core,
"config-policy/config-capture");
g_autoptr (WpEndpointLink) link = NULL;
g_autoptr (WpEndpoint) src = NULL;
g_autoptr (WpEndpoint) sink = NULL;
g_autoptr (WpEndpoint) ep1 = NULL;
g_autoptr (WpEndpoint) ep2 = NULL;
g_autoptr (WpBaseEndpointLink) link = NULL;
g_autoptr (WpBaseEndpoint) src = NULL;
g_autoptr (WpBaseEndpoint) sink = NULL;
g_autoptr (WpBaseEndpoint) ep1 = NULL;
g_autoptr (WpBaseEndpoint) ep2 = NULL;
/* Create the device endpoint */
ep1 = wp_config_policy_context_add_endpoint (ctx, "ep1", "Fake/Source",
PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep1);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (ep1));
g_assert_false (wp_base_endpoint_is_linked (ep1));
/* Create the client endpoint */
ep2 = wp_config_policy_context_add_endpoint (ctx, "ep2", "Stream/Input/Fake",
PW_DIRECTION_INPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep2);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep2));
g_assert_true (wp_endpoint_is_linked (ep1));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep2));
g_assert_true (wp_base_endpoint_is_linked (ep1));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep1 == src);
g_assert_true (ep2 == sink);
@ -199,36 +199,36 @@ playback_capture (TestConfigPolicyFixture *f, gconstpointer data)
{
g_autoptr (WpConfigPolicyContext) ctx = wp_config_policy_context_new (f->core,
"config-policy/config-playback-capture");
g_autoptr (WpEndpointLink) link = NULL;
g_autoptr (WpEndpoint) src = NULL;
g_autoptr (WpEndpoint) sink = NULL;
g_autoptr (WpEndpoint) ep1 = NULL;
g_autoptr (WpEndpoint) ep2 = NULL;
g_autoptr (WpEndpoint) ep3 = NULL;
g_autoptr (WpEndpoint) ep4 = NULL;
g_autoptr (WpBaseEndpointLink) link = NULL;
g_autoptr (WpBaseEndpoint) src = NULL;
g_autoptr (WpBaseEndpoint) sink = NULL;
g_autoptr (WpBaseEndpoint) ep1 = NULL;
g_autoptr (WpBaseEndpoint) ep2 = NULL;
g_autoptr (WpBaseEndpoint) ep3 = NULL;
g_autoptr (WpBaseEndpoint) ep4 = NULL;
/* Create the device endpoints */
ep1 = wp_config_policy_context_add_endpoint (ctx, "ep1", "Fake/Sink",
PW_DIRECTION_INPUT, NULL, NULL, 0, NULL);
g_assert_nonnull (ep1);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (ep1));
g_assert_false (wp_base_endpoint_is_linked (ep1));
ep2 = wp_config_policy_context_add_endpoint (ctx, "ep2", "Fake/Source",
PW_DIRECTION_OUTPUT, NULL, NULL, 0, NULL);
g_assert_nonnull (ep2);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (ep2));
g_assert_false (wp_base_endpoint_is_linked (ep2));
/* Create the playback client endpoint */
ep3 = wp_config_policy_context_add_endpoint (ctx, "ep3", "Stream/Output/Fake",
PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep3);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep3));
g_assert_true (wp_endpoint_is_linked (ep1));
g_assert_false (wp_endpoint_is_linked (ep2));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep3));
g_assert_true (wp_base_endpoint_is_linked (ep1));
g_assert_false (wp_base_endpoint_is_linked (ep2));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep3 == src);
g_assert_true (ep1 == sink);
@ -237,12 +237,12 @@ playback_capture (TestConfigPolicyFixture *f, gconstpointer data)
PW_DIRECTION_INPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep4);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep4));
g_assert_true (wp_endpoint_is_linked (ep2));
g_assert_true (wp_endpoint_is_linked (ep3));
g_assert_true (wp_endpoint_is_linked (ep1));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep4));
g_assert_true (wp_base_endpoint_is_linked (ep2));
g_assert_true (wp_base_endpoint_is_linked (ep3));
g_assert_true (wp_base_endpoint_is_linked (ep1));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep2 == src);
g_assert_true (ep4 == sink);
@ -256,22 +256,22 @@ playback_priority (TestConfigPolicyFixture *f, gconstpointer data)
{
g_autoptr (WpConfigPolicyContext) ctx = wp_config_policy_context_new (f->core,
"config-policy/config-playback-priority");
g_autoptr (WpEndpointLink) link = NULL;
g_autoptr (WpEndpoint) src = NULL;
g_autoptr (WpEndpoint) sink = NULL;
g_autoptr (WpEndpoint) dev = NULL;
g_autoptr (WpEndpoint) ep1 = NULL;
g_autoptr (WpEndpoint) ep2 = NULL;
g_autoptr (WpEndpoint) ep3 = NULL;
g_autoptr (WpEndpoint) ep4 = NULL;
g_autoptr (WpEndpoint) ep5 = NULL;
g_autoptr (WpBaseEndpointLink) link = NULL;
g_autoptr (WpBaseEndpoint) src = NULL;
g_autoptr (WpBaseEndpoint) sink = NULL;
g_autoptr (WpBaseEndpoint) dev = NULL;
g_autoptr (WpBaseEndpoint) ep1 = NULL;
g_autoptr (WpBaseEndpoint) ep2 = NULL;
g_autoptr (WpBaseEndpoint) ep3 = NULL;
g_autoptr (WpBaseEndpoint) ep4 = NULL;
g_autoptr (WpBaseEndpoint) ep5 = NULL;
/* Create the device endpoint with 4 streams */
dev = wp_config_policy_context_add_endpoint (ctx, "dev", "Fake/Sink",
PW_DIRECTION_INPUT, NULL, NULL, 4, NULL);
g_assert_nonnull (dev);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (dev));
g_assert_false (wp_base_endpoint_is_linked (dev));
/* Create the client endpoint for steam 2 (priority 50) and make sure it
* is linked */
@ -279,10 +279,10 @@ playback_priority (TestConfigPolicyFixture *f, gconstpointer data)
"Stream/Output/Fake", PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep2);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep2));
g_assert_true (wp_endpoint_is_linked (dev));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep2));
g_assert_true (wp_base_endpoint_is_linked (dev));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep2 == src);
g_assert_true (dev == sink);
@ -292,9 +292,9 @@ playback_priority (TestConfigPolicyFixture *f, gconstpointer data)
"Stream/Output/Fake", PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep1);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (ep1));
g_assert_true (wp_endpoint_is_linked (ep2));
g_assert_true (wp_endpoint_is_linked (dev));
g_assert_false (wp_base_endpoint_is_linked (ep1));
g_assert_true (wp_base_endpoint_is_linked (ep2));
g_assert_true (wp_base_endpoint_is_linked (dev));
/* Create the client endpoint for steam 3 (priority 75) and make sure it
* is linked */
@ -302,12 +302,12 @@ playback_priority (TestConfigPolicyFixture *f, gconstpointer data)
"Stream/Output/Fake", PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep3);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep3));
g_assert_true (wp_endpoint_is_linked (dev));
g_assert_false (wp_endpoint_is_linked (ep1));
g_assert_false (wp_endpoint_is_linked (ep2));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep3));
g_assert_true (wp_base_endpoint_is_linked (dev));
g_assert_false (wp_base_endpoint_is_linked (ep1));
g_assert_false (wp_base_endpoint_is_linked (ep2));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep3 == src);
g_assert_true (dev == sink);
@ -321,7 +321,7 @@ playback_priority (TestConfigPolicyFixture *f, gconstpointer data)
"Stream/Output/Fake", PW_DIRECTION_OUTPUT, NULL, "1", 0, &link);
g_assert_nonnull (ep4);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (ep4));
g_assert_false (wp_base_endpoint_is_linked (ep4));
/* Create the client endpoint with role "3" (priority 75) and make sure it
* is linked (last one wins) */
@ -329,12 +329,12 @@ playback_priority (TestConfigPolicyFixture *f, gconstpointer data)
"Stream/Output/Fake", PW_DIRECTION_OUTPUT, NULL, "3", 0, &link);
g_assert_nonnull (ep5);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep5));
g_assert_true (wp_endpoint_is_linked (dev));
g_assert_false (wp_endpoint_is_linked (ep4));
g_assert_false (wp_endpoint_is_linked (ep3));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep5));
g_assert_true (wp_base_endpoint_is_linked (dev));
g_assert_false (wp_base_endpoint_is_linked (ep4));
g_assert_false (wp_base_endpoint_is_linked (ep3));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep5 == src);
g_assert_true (dev == sink);
@ -349,29 +349,29 @@ playback_keep (TestConfigPolicyFixture *f, gconstpointer data)
{
g_autoptr (WpConfigPolicyContext) ctx = wp_config_policy_context_new (f->core,
"config-policy/config-playback-keep");
g_autoptr (WpEndpointLink) link = NULL;
g_autoptr (WpEndpoint) src = NULL;
g_autoptr (WpEndpoint) sink = NULL;
g_autoptr (WpEndpoint) ep1 = NULL;
g_autoptr (WpEndpoint) ep2 = NULL;
g_autoptr (WpEndpoint) ep3 = NULL;
g_autoptr (WpBaseEndpointLink) link = NULL;
g_autoptr (WpBaseEndpoint) src = NULL;
g_autoptr (WpBaseEndpoint) sink = NULL;
g_autoptr (WpBaseEndpoint) ep1 = NULL;
g_autoptr (WpBaseEndpoint) ep2 = NULL;
g_autoptr (WpBaseEndpoint) ep3 = NULL;
/* Create the device endpoint */
ep1 = wp_config_policy_context_add_endpoint (ctx, "ep1", "Fake/Sink",
PW_DIRECTION_INPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep1);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (ep1));
g_assert_false (wp_base_endpoint_is_linked (ep1));
/* Create the first client endpoint */
ep2 = wp_config_policy_context_add_endpoint (ctx, "ep2", "Stream/Output/Fake",
PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep2);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep2));
g_assert_true (wp_endpoint_is_linked (ep1));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep2));
g_assert_true (wp_base_endpoint_is_linked (ep1));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep2 == src);
g_assert_true (ep1 == sink);
@ -380,15 +380,15 @@ playback_keep (TestConfigPolicyFixture *f, gconstpointer data)
PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep2);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep3));
g_assert_true (wp_endpoint_is_linked (ep1));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep3));
g_assert_true (wp_base_endpoint_is_linked (ep1));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep3 == src);
g_assert_true (ep1 == sink);
/* Make sure ep2 is still linked after ep3 was linked */
g_assert_true (wp_endpoint_is_linked (ep2));
g_assert_true (wp_base_endpoint_is_linked (ep2));
/* Remove the client endpoints */
wp_config_policy_context_remove_endpoint (ctx, ep2);
@ -400,20 +400,20 @@ playback_role (TestConfigPolicyFixture *f, gconstpointer data)
{
g_autoptr (WpConfigPolicyContext) ctx = wp_config_policy_context_new (f->core,
"config-policy/config-playback-role");
g_autoptr (WpEndpointLink) link = NULL;
g_autoptr (WpEndpoint) src = NULL;
g_autoptr (WpEndpoint) sink = NULL;
g_autoptr (WpEndpoint) dev = NULL;
g_autoptr (WpEndpoint) ep1 = NULL;
g_autoptr (WpEndpoint) ep2 = NULL;
g_autoptr (WpEndpoint) ep3 = NULL;
g_autoptr (WpBaseEndpointLink) link = NULL;
g_autoptr (WpBaseEndpoint) src = NULL;
g_autoptr (WpBaseEndpoint) sink = NULL;
g_autoptr (WpBaseEndpoint) dev = NULL;
g_autoptr (WpBaseEndpoint) ep1 = NULL;
g_autoptr (WpBaseEndpoint) ep2 = NULL;
g_autoptr (WpBaseEndpoint) ep3 = NULL;
/* Create the device with 2 roles: "0" with id 0, and "1" with id 1 */
dev = wp_config_policy_context_add_endpoint (ctx, "dev", "Fake/Sink",
PW_DIRECTION_INPUT, NULL, NULL, 2, &link);
g_assert_nonnull (dev);
g_assert_null (link);
g_assert_false (wp_endpoint_is_linked (dev));
g_assert_false (wp_base_endpoint_is_linked (dev));
/* Create the first client endpoint with role "0" and make sure the role
* defined in the configuration file which is "1" is used */
@ -421,15 +421,15 @@ playback_role (TestConfigPolicyFixture *f, gconstpointer data)
PW_DIRECTION_OUTPUT, NULL, "0", 0, &link);
g_assert_nonnull (ep1);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep1));
g_assert_true (wp_endpoint_is_linked (dev));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep1));
g_assert_true (wp_base_endpoint_is_linked (dev));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep1 == src);
g_assert_true (dev == sink);
g_assert_true (
WP_STREAM_ID_NONE == wp_endpoint_link_get_source_stream (link));
g_assert_true (1 == wp_endpoint_link_get_sink_stream (link));
WP_STREAM_ID_NONE == wp_base_endpoint_link_get_source_stream (link));
g_assert_true (1 == wp_base_endpoint_link_get_sink_stream (link));
wp_config_policy_context_remove_endpoint (ctx, ep1);
/* Create the second client endpoint with role "1" and make sure it uses it
@ -438,15 +438,15 @@ playback_role (TestConfigPolicyFixture *f, gconstpointer data)
PW_DIRECTION_OUTPUT, NULL, "1", 0, &link);
g_assert_nonnull (ep2);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep2));
g_assert_true (wp_endpoint_is_linked (dev));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep2));
g_assert_true (wp_base_endpoint_is_linked (dev));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep2 == src);
g_assert_true (dev == sink);
g_assert_true (
WP_STREAM_ID_NONE == wp_endpoint_link_get_source_stream (link));
g_assert_true (1 == wp_endpoint_link_get_sink_stream (link));
WP_STREAM_ID_NONE == wp_base_endpoint_link_get_source_stream (link));
g_assert_true (1 == wp_base_endpoint_link_get_sink_stream (link));
wp_config_policy_context_remove_endpoint (ctx, ep2);
/* Create the third client endpoint without role and make sure it uses the
@ -456,15 +456,15 @@ playback_role (TestConfigPolicyFixture *f, gconstpointer data)
PW_DIRECTION_OUTPUT, NULL, NULL, 0, &link);
g_assert_nonnull (ep3);
g_assert_nonnull (link);
g_assert_true (wp_endpoint_is_linked (ep3));
g_assert_true (wp_endpoint_is_linked (dev));
src = wp_endpoint_link_get_source_endpoint (link);
sink = wp_endpoint_link_get_sink_endpoint (link);
g_assert_true (wp_base_endpoint_is_linked (ep3));
g_assert_true (wp_base_endpoint_is_linked (dev));
src = wp_base_endpoint_link_get_source_endpoint (link);
sink = wp_base_endpoint_link_get_sink_endpoint (link);
g_assert_true (ep3 == src);
g_assert_true (dev == sink);
g_assert_true (
WP_STREAM_ID_NONE == wp_endpoint_link_get_source_stream (link));
g_assert_true (0 == wp_endpoint_link_get_sink_stream (link));
WP_STREAM_ID_NONE == wp_base_endpoint_link_get_source_stream (link));
g_assert_true (0 == wp_base_endpoint_link_get_sink_stream (link));
wp_config_policy_context_remove_endpoint (ctx, ep3);
}

View file

@ -24,8 +24,8 @@ struct _WpConfigPolicyContext
GMutex mutex;
GCond cond;
WpEndpoint *endpoint;
WpEndpointLink *link;
WpBaseEndpoint *endpoint;
WpBaseEndpointLink *link;
};
enum {
@ -36,8 +36,8 @@ enum {
G_DEFINE_TYPE (WpConfigPolicyContext, wp_config_policy_context, G_TYPE_OBJECT);
static WpEndpoint *
wait_for_endpoint (WpConfigPolicyContext *self, WpEndpointLink **link)
static WpBaseEndpoint *
wait_for_endpoint (WpConfigPolicyContext *self, WpBaseEndpointLink **link)
{
g_mutex_lock (&self->mutex);
@ -46,7 +46,7 @@ wait_for_endpoint (WpConfigPolicyContext *self, WpEndpointLink **link)
g_cond_wait (&self->cond, &self->mutex);
/* Set endpoint to a local value and clear global value */
WpEndpoint *endpoint = g_object_ref (self->endpoint);
WpBaseEndpoint *endpoint = g_object_ref (self->endpoint);
g_clear_object (&self->endpoint);
/* Set link to a local value and clear global value */
@ -60,7 +60,7 @@ wait_for_endpoint (WpConfigPolicyContext *self, WpEndpointLink **link)
}
static void
on_done (WpConfigPolicy *cp, WpEndpoint *ep, WpEndpointLink *link,
on_done (WpConfigPolicy *cp, WpBaseEndpoint *ep, WpBaseEndpointLink *link,
WpConfigPolicyContext *self)
{
if (!ep)
@ -83,8 +83,8 @@ wp_config_policy_context_constructed (GObject *object)
g_return_if_fail (core);
/* Register the endpoint link fake factory */
wp_factory_new (core, WP_ENDPOINT_LINK_FAKE_FACTORY_NAME,
wp_endpoint_link_fake_factory);
wp_factory_new (core, WP_FAKE_ENDPOINT_LINK_FACTORY_NAME,
wp_fake_endpoint_link_factory);
/* Set the configuration path */
g_autoptr (WpConfiguration) config = wp_configuration_get_instance (core);
@ -192,26 +192,26 @@ wp_config_policy_context_new (WpCore *core, const char *config_path)
static void
on_endpoint_created (GObject *initable, GAsyncResult *res, gpointer d)
{
g_autoptr (WpEndpoint) ep = NULL;
g_autoptr (WpBaseEndpoint) ep = NULL;
GError *error = NULL;
ep = wp_endpoint_new_finish (initable, res, &error);
ep = wp_base_endpoint_new_finish (initable, res, &error);
g_return_if_fail (!error);
g_return_if_fail (ep);
/* Register the endpoint */
wp_endpoint_register (ep);
wp_base_endpoint_register (ep);
}
WpEndpoint *
WpBaseEndpoint *
wp_config_policy_context_add_endpoint (WpConfigPolicyContext *self,
const char *name, const char *media_class, guint direction,
WpProperties *props, const char *role, guint streams, WpEndpointLink **link)
WpProperties *props, const char *role, guint streams, WpBaseEndpointLink **link)
{
g_autoptr (WpCore) core = g_weak_ref_get (&self->core);
g_return_val_if_fail (core, NULL);
wp_endpoint_fake_new_async (core, name, media_class, direction, props, role,
wp_fake_endpoint_new_async (core, name, media_class, direction, props, role,
streams, on_endpoint_created, self);
return wait_for_endpoint (self, link);
@ -219,11 +219,11 @@ wp_config_policy_context_add_endpoint (WpConfigPolicyContext *self,
void
wp_config_policy_context_remove_endpoint (WpConfigPolicyContext *self,
WpEndpoint *ep)
WpBaseEndpoint *ep)
{
g_return_if_fail (ep);
wp_endpoint_unregister (ep);
wp_base_endpoint_unregister (ep);
wait_for_endpoint (self, NULL);
}

View file

@ -20,12 +20,12 @@ G_DECLARE_FINAL_TYPE (WpConfigPolicyContext, wp_config_policy_context, WP,
WpConfigPolicyContext *wp_config_policy_context_new (WpCore *core,
const char *config_path);
WpEndpoint *wp_config_policy_context_add_endpoint (WpConfigPolicyContext *self,
WpBaseEndpoint *wp_config_policy_context_add_endpoint (WpConfigPolicyContext *self,
const char *name, const char *media_class, guint direction,
WpProperties *props, const char *role, guint streams,
WpEndpointLink **link);
WpBaseEndpointLink **link);
void wp_config_policy_context_remove_endpoint (WpConfigPolicyContext *self,
WpEndpoint *ep);
WpBaseEndpoint *ep);
G_END_DECLS

View file

@ -11,9 +11,9 @@
#include "endpoint-fake.h"
#include "endpoint-link-fake.h"
struct _WpEndpointFake
struct _WpFakeEndpoint
{
WpEndpoint parent;
WpBaseEndpoint parent;
GTask *init_task;
guint id;
@ -30,45 +30,45 @@ enum {
PROP_STREAMS,
};
static GAsyncInitableIface *wp_endpoint_fake_parent_interface = NULL;
static void wp_endpoint_fake_async_initable_init (gpointer iface,
static GAsyncInitableIface *wp_fake_endpoint_parent_interface = NULL;
static void wp_fake_endpoint_async_initable_init (gpointer iface,
gpointer iface_data);
G_DEFINE_TYPE_WITH_CODE (WpEndpointFake, wp_endpoint_fake, WP_TYPE_ENDPOINT,
G_DEFINE_TYPE_WITH_CODE (WpFakeEndpoint, wp_fake_endpoint, WP_TYPE_BASE_ENDPOINT,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE,
wp_endpoint_fake_async_initable_init))
wp_fake_endpoint_async_initable_init))
static WpProperties *
wp_endpoint_fake_get_properties (WpEndpoint * ep)
wp_fake_endpoint_get_properties (WpBaseEndpoint * ep)
{
WpEndpointFake *self = WP_ENDPOINT_FAKE (ep);
WpFakeEndpoint *self = WP_FAKE_ENDPOINT (ep);
return wp_properties_ref (self->props);
}
static const char *
wp_endpoint_fake_get_role (WpEndpoint * ep)
wp_fake_endpoint_get_role (WpBaseEndpoint * ep)
{
WpEndpointFake *self = WP_ENDPOINT_FAKE (ep);
WpFakeEndpoint *self = WP_FAKE_ENDPOINT (ep);
return self->role;
}
static gboolean
wp_endpoint_fake_prepare_link (WpEndpoint * ep, guint32 stream_id,
WpEndpointLink * link, GVariant ** properties, GError ** error)
wp_fake_endpoint_prepare_link (WpBaseEndpoint * ep, guint32 stream_id,
WpBaseEndpointLink * link, GVariant ** properties, GError ** error)
{
return TRUE;
}
static const char *
wp_endpoint_fake_get_endpoint_link_factory (WpEndpoint * ep)
wp_fake_endpoint_get_endpoint_link_factory (WpBaseEndpoint * ep)
{
return WP_ENDPOINT_LINK_FAKE_FACTORY_NAME;
return WP_FAKE_ENDPOINT_LINK_FACTORY_NAME;
}
static void
wp_endpoint_fake_constructed (GObject * object)
wp_fake_endpoint_constructed (GObject * object)
{
WpEndpointFake *self = WP_ENDPOINT_FAKE (object);
WpFakeEndpoint *self = WP_FAKE_ENDPOINT (object);
GVariantDict d;
for (guint i = 0; i < self->streams; i++) {
@ -76,17 +76,17 @@ wp_endpoint_fake_constructed (GObject * object)
g_variant_dict_init (&d, NULL);
g_variant_dict_insert (&d, "id", "u", i);
g_variant_dict_insert (&d, "name", "s", name);
wp_endpoint_register_stream (WP_ENDPOINT (self), g_variant_dict_end (&d));
wp_base_endpoint_register_stream (WP_BASE_ENDPOINT (self), g_variant_dict_end (&d));
}
G_OBJECT_CLASS (wp_endpoint_fake_parent_class)->constructed (object);
G_OBJECT_CLASS (wp_fake_endpoint_parent_class)->constructed (object);
}
static void
wp_endpoint_fake_set_property (GObject * object, guint property_id,
wp_fake_endpoint_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
WpEndpointFake *self = WP_ENDPOINT_FAKE (object);
WpFakeEndpoint *self = WP_FAKE_ENDPOINT (object);
switch (property_id) {
case PROP_PROPS:
@ -109,10 +109,10 @@ wp_endpoint_fake_set_property (GObject * object, guint property_id,
}
static void
wp_endpoint_fake_get_property (GObject * object, guint property_id,
wp_fake_endpoint_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
{
WpEndpointFake *self = WP_ENDPOINT_FAKE (object);
WpFakeEndpoint *self = WP_FAKE_ENDPOINT (object);
switch (property_id) {
case PROP_PROPS:
@ -131,69 +131,69 @@ wp_endpoint_fake_get_property (GObject * object, guint property_id,
}
static void
wp_endpoint_fake_finalize (GObject * object)
wp_fake_endpoint_finalize (GObject * object)
{
WpEndpointFake *self = WP_ENDPOINT_FAKE (object);
WpFakeEndpoint *self = WP_FAKE_ENDPOINT (object);
g_clear_pointer (&self->props, wp_properties_unref);
G_OBJECT_CLASS (wp_endpoint_fake_parent_class)->finalize (object);
G_OBJECT_CLASS (wp_fake_endpoint_parent_class)->finalize (object);
}
static void
wp_endpoint_fake_finish_creation (WpCore *core, GAsyncResult *res,
WpEndpointFake *self)
wp_fake_endpoint_finish_creation (WpCore *core, GAsyncResult *res,
WpFakeEndpoint *self)
{
g_task_return_boolean (self->init_task, TRUE);
g_clear_object (&self->init_task);
}
static void
wp_endpoint_fake_init_async (GAsyncInitable *initable, int io_priority,
wp_fake_endpoint_init_async (GAsyncInitable *initable, int io_priority,
GCancellable *cancellable, GAsyncReadyCallback callback, gpointer data)
{
WpEndpointFake *self = WP_ENDPOINT_FAKE (initable);
WpFakeEndpoint *self = WP_FAKE_ENDPOINT (initable);
self->init_task = g_task_new (initable, cancellable, callback, data);
wp_endpoint_fake_parent_interface->init_async (initable, io_priority,
wp_fake_endpoint_parent_interface->init_async (initable, io_priority,
cancellable, callback, data);
g_autoptr (WpCore) core = wp_endpoint_get_core(WP_ENDPOINT(self));
g_autoptr (WpCore) core = wp_base_endpoint_get_core(WP_BASE_ENDPOINT(self));
if (core)
wp_core_sync (core, NULL,
(GAsyncReadyCallback) wp_endpoint_fake_finish_creation, self);
(GAsyncReadyCallback) wp_fake_endpoint_finish_creation, self);
}
static void
wp_endpoint_fake_async_initable_init (gpointer iface, gpointer iface_data)
wp_fake_endpoint_async_initable_init (gpointer iface, gpointer iface_data)
{
GAsyncInitableIface *ai_iface = iface;
wp_endpoint_fake_parent_interface = g_type_interface_peek_parent (iface);
ai_iface->init_async = wp_endpoint_fake_init_async;
wp_fake_endpoint_parent_interface = g_type_interface_peek_parent (iface);
ai_iface->init_async = wp_fake_endpoint_init_async;
}
static void
wp_endpoint_fake_init (WpEndpointFake * self)
wp_fake_endpoint_init (WpFakeEndpoint * self)
{
static guint id = 0;
self->id = id++;
}
static void
wp_endpoint_fake_class_init (WpEndpointFakeClass * klass)
wp_fake_endpoint_class_init (WpFakeEndpointClass * klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
WpEndpointClass *endpoint_class = (WpEndpointClass *) klass;
WpBaseEndpointClass *endpoint_class = (WpBaseEndpointClass *) klass;
object_class->constructed = wp_endpoint_fake_constructed;
object_class->finalize = wp_endpoint_fake_finalize;
object_class->set_property = wp_endpoint_fake_set_property;
object_class->get_property = wp_endpoint_fake_get_property;
object_class->constructed = wp_fake_endpoint_constructed;
object_class->finalize = wp_fake_endpoint_finalize;
object_class->set_property = wp_fake_endpoint_set_property;
object_class->get_property = wp_fake_endpoint_get_property;
endpoint_class->get_properties = wp_endpoint_fake_get_properties;
endpoint_class->get_role = wp_endpoint_fake_get_role;
endpoint_class->prepare_link = wp_endpoint_fake_prepare_link;
endpoint_class->get_properties = wp_fake_endpoint_get_properties;
endpoint_class->get_role = wp_fake_endpoint_get_role;
endpoint_class->prepare_link = wp_fake_endpoint_prepare_link;
endpoint_class->get_endpoint_link_factory =
wp_endpoint_fake_get_endpoint_link_factory;
wp_fake_endpoint_get_endpoint_link_factory;
g_object_class_install_property (object_class, PROP_PROPS,
g_param_spec_boxed ("properties", "properties",
@ -212,13 +212,13 @@ wp_endpoint_fake_class_init (WpEndpointFakeClass * klass)
}
void
wp_endpoint_fake_new_async (WpCore *core, const char *name,
wp_fake_endpoint_new_async (WpCore *core, const char *name,
const char *media_class, guint direction,
WpProperties *props, const char *role, guint streams,
GAsyncReadyCallback ready, gpointer data)
{
g_async_initable_new_async (
wp_endpoint_fake_get_type (), G_PRIORITY_DEFAULT, NULL, ready, data,
wp_fake_endpoint_get_type (), G_PRIORITY_DEFAULT, NULL, ready, data,
"core", core,
"name", name,
"media-class", media_class,
@ -230,7 +230,7 @@ wp_endpoint_fake_new_async (WpCore *core, const char *name,
}
guint
wp_endpoint_fake_get_id (WpEndpointFake *self)
wp_fake_endpoint_get_id (WpFakeEndpoint *self)
{
return self->id;
}

View file

@ -6,23 +6,23 @@
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_ENDPOINT_FAKE_H__
#define __WIREPLUMBER_ENDPOINT_FAKE_H__
#ifndef __WIREPLUMBER_FAKE_ENDPOINT_H__
#define __WIREPLUMBER_FAKE_ENDPOINT_H__
#include <wp/wp.h>
G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (WpEndpointFake, wp_endpoint_fake, WP, ENDPOINT_FAKE,
WpEndpoint)
G_DECLARE_FINAL_TYPE (WpFakeEndpoint, wp_fake_endpoint, WP, FAKE_ENDPOINT,
WpBaseEndpoint)
void
wp_endpoint_fake_new_async (WpCore *core, const char *name,
wp_fake_endpoint_new_async (WpCore *core, const char *name,
const char *media_class, guint direction,
WpProperties *props, const char *role, guint streams,
GAsyncReadyCallback ready, gpointer data);
guint wp_endpoint_fake_get_id (WpEndpointFake *self);
guint wp_fake_endpoint_get_id (WpFakeEndpoint *self);
G_END_DECLS

View file

@ -11,9 +11,9 @@
#include "endpoint-fake.h"
#include "endpoint-link-fake.h"
struct _WpEndpointLinkFake
struct _WpFakeEndpointLink
{
WpEndpointLink parent;
WpBaseEndpointLink parent;
GTask *init_task;
guint id;
@ -26,32 +26,32 @@ enum {
PROP_CORE
};
static GAsyncInitableIface *wp_endpoint_link_fake_parent_interface = NULL;
static void wp_endpoint_link_fake_async_initable_init (gpointer iface,
static GAsyncInitableIface *wp_fake_endpoint_link_parent_interface = NULL;
static void wp_fake_endpoint_link_async_initable_init (gpointer iface,
gpointer iface_data);
G_DEFINE_TYPE_WITH_CODE (WpEndpointLinkFake, wp_endpoint_link_fake,
WP_TYPE_ENDPOINT_LINK,
G_DEFINE_TYPE_WITH_CODE (WpFakeEndpointLink, wp_fake_endpoint_link,
WP_TYPE_BASE_ENDPOINT_LINK,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE,
wp_endpoint_link_fake_async_initable_init))
wp_fake_endpoint_link_async_initable_init))
static gboolean
wp_endpoint_link_fake_create (WpEndpointLink * epl, GVariant * src_data,
wp_fake_endpoint_link_create (WpBaseEndpointLink * epl, GVariant * src_data,
GVariant * sink_data, GError ** error)
{
return TRUE;
}
static void
wp_endpoint_link_fake_destroy (WpEndpointLink * epl)
wp_fake_endpoint_link_destroy (WpBaseEndpointLink * epl)
{
}
static void
wp_endpoint_link_fake_set_property (GObject * object, guint property_id,
wp_fake_endpoint_link_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
WpEndpointLinkFake *self = WP_ENDPOINT_LINK_FAKE (object);
WpFakeEndpointLink *self = WP_FAKE_ENDPOINT_LINK (object);
switch (property_id) {
case PROP_CORE:
@ -64,10 +64,10 @@ wp_endpoint_link_fake_set_property (GObject * object, guint property_id,
}
static void
wp_endpoint_link_fake_get_property (GObject * object, guint property_id,
wp_fake_endpoint_link_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
{
WpEndpointLinkFake *self = WP_ENDPOINT_LINK_FAKE (object);
WpFakeEndpointLink *self = WP_FAKE_ENDPOINT_LINK (object);
switch (property_id) {
case PROP_CORE:
@ -80,67 +80,67 @@ wp_endpoint_link_fake_get_property (GObject * object, guint property_id,
}
static void
wp_endpoint_link_fake_finalize (GObject * object)
wp_fake_endpoint_link_finalize (GObject * object)
{
WpEndpointLinkFake *self = WP_ENDPOINT_LINK_FAKE (object);
WpFakeEndpointLink *self = WP_FAKE_ENDPOINT_LINK (object);
g_clear_object (&self->init_task);
g_weak_ref_clear (&self->core);
G_OBJECT_CLASS (wp_endpoint_link_fake_parent_class)->finalize (object);
G_OBJECT_CLASS (wp_fake_endpoint_link_parent_class)->finalize (object);
}
static void
wp_endpoint_link_fake_finish_creation (WpCore *core, GAsyncResult *res,
WpEndpointLinkFake *self)
wp_fake_endpoint_link_finish_creation (WpCore *core, GAsyncResult *res,
WpFakeEndpointLink *self)
{
g_task_return_boolean (self->init_task, TRUE);
g_clear_object (&self->init_task);
}
static void
wp_endpoint_link_fake_init_async (GAsyncInitable *initable, int io_priority,
wp_fake_endpoint_link_init_async (GAsyncInitable *initable, int io_priority,
GCancellable *cancellable, GAsyncReadyCallback callback, gpointer data)
{
WpEndpointLinkFake *self = WP_ENDPOINT_LINK_FAKE (initable);
WpFakeEndpointLink *self = WP_FAKE_ENDPOINT_LINK (initable);
self->init_task = g_task_new (initable, cancellable, callback, data);
wp_endpoint_link_fake_parent_interface->init_async (initable,
wp_fake_endpoint_link_parent_interface->init_async (initable,
io_priority, cancellable, callback, data);
g_autoptr (WpCore) core = g_weak_ref_get (&self->core);
if (core)
wp_core_sync (core, NULL,
(GAsyncReadyCallback) wp_endpoint_link_fake_finish_creation, self);
(GAsyncReadyCallback) wp_fake_endpoint_link_finish_creation, self);
}
static void
wp_endpoint_link_fake_async_initable_init (gpointer iface,
wp_fake_endpoint_link_async_initable_init (gpointer iface,
gpointer iface_data)
{
GAsyncInitableIface *ai_iface = iface;
wp_endpoint_link_fake_parent_interface = g_type_interface_peek_parent (iface);
ai_iface->init_async = wp_endpoint_link_fake_init_async;
wp_fake_endpoint_link_parent_interface = g_type_interface_peek_parent (iface);
ai_iface->init_async = wp_fake_endpoint_link_init_async;
}
static void
wp_endpoint_link_fake_init (WpEndpointLinkFake * self)
wp_fake_endpoint_link_init (WpFakeEndpointLink * self)
{
static guint id = 0;
self->id = id++;
}
static void
wp_endpoint_link_fake_class_init (WpEndpointLinkFakeClass * klass)
wp_fake_endpoint_link_class_init (WpFakeEndpointLinkClass * klass)
{
GObjectClass *object_class = (GObjectClass *) klass;
WpEndpointLinkClass *link_class = (WpEndpointLinkClass *) klass;
WpBaseEndpointLinkClass *link_class = (WpBaseEndpointLinkClass *) klass;
object_class->finalize = wp_endpoint_link_fake_finalize;
object_class->get_property = wp_endpoint_link_fake_get_property;
object_class->set_property = wp_endpoint_link_fake_set_property;
object_class->finalize = wp_fake_endpoint_link_finalize;
object_class->get_property = wp_fake_endpoint_link_get_property;
object_class->set_property = wp_fake_endpoint_link_set_property;
link_class->create = wp_endpoint_link_fake_create;
link_class->destroy = wp_endpoint_link_fake_destroy;
link_class->create = wp_fake_endpoint_link_create;
link_class->destroy = wp_fake_endpoint_link_destroy;
g_object_class_install_property (object_class, PROP_CORE,
g_param_spec_object ("core", "core", "The wireplumber core",
@ -149,7 +149,7 @@ wp_endpoint_link_fake_class_init (WpEndpointLinkFakeClass * klass)
}
void
wp_endpoint_link_fake_factory (WpFactory * factory, GType type,
wp_fake_endpoint_link_factory (WpFactory * factory, GType type,
GVariant * properties, GAsyncReadyCallback ready, gpointer data)
{
g_autoptr (WpCore) core = NULL;
@ -175,7 +175,7 @@ wp_endpoint_link_fake_factory (WpFactory * factory, GType type,
/* Create the endpoint link */
g_async_initable_new_async (
wp_endpoint_link_fake_get_type (), G_PRIORITY_DEFAULT, NULL, ready, data,
wp_fake_endpoint_link_get_type (), G_PRIORITY_DEFAULT, NULL, ready, data,
"src", (gpointer)src,
"src-stream", src_stream,
"sink", (gpointer)sink,
@ -186,7 +186,7 @@ wp_endpoint_link_fake_factory (WpFactory * factory, GType type,
}
guint
wp_endpoint_link_fake_get_id (WpEndpointLinkFake *self)
wp_fake_endpoint_link_get_id (WpFakeEndpointLink *self)
{
return self->id;
}

View file

@ -6,22 +6,22 @@
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_ENDPOINT_LINK_FAKE_H__
#define __WIREPLUMBER_ENDPOINT_LINK_FAKE_H__
#ifndef __WIREPLUMBER_FAKE_ENDPOINT_LINK_H__
#define __WIREPLUMBER_FAKE_ENDPOINT_LINK_H__
#include <wp/wp.h>
#define WP_ENDPOINT_LINK_FAKE_FACTORY_NAME "endpoint-link-fake"
#define WP_FAKE_ENDPOINT_LINK_FACTORY_NAME "endpoint-link-fake"
G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (WpEndpointLinkFake, wp_endpoint_link_fake, WP,
ENDPOINT_LINK_FAKE, WpEndpointLink)
G_DECLARE_FINAL_TYPE (WpFakeEndpointLink, wp_fake_endpoint_link, WP,
FAKE_ENDPOINT_LINK, WpBaseEndpointLink)
void wp_endpoint_link_fake_factory (WpFactory * factory, GType type,
void wp_fake_endpoint_link_factory (WpFactory * factory, GType type,
GVariant * properties, GAsyncReadyCallback ready, gpointer data);
guint wp_endpoint_link_fake_get_id (WpEndpointLinkFake *self);
guint wp_fake_endpoint_link_get_id (WpFakeEndpointLink *self);
G_END_DECLS