From d49ffbef1dad50fea9c03f905e4c2f21dd26c74e Mon Sep 17 00:00:00 2001
From: Julian Bouzas <julian.bouzas@collabora.com>
Date: Fri, 22 Nov 2019 09:08:11 -0500
Subject: [PATCH] endpoint: add get_properties API

---
 lib/wp/endpoint.c                                | 11 +++++++++++
 lib/wp/endpoint.h                                |  3 +++
 modules/module-pipewire/audio-softdsp-endpoint.c |  9 +++++++++
 3 files changed, 23 insertions(+)

diff --git a/lib/wp/endpoint.c b/lib/wp/endpoint.c
index 0613492e..8cc17a3d 100644
--- a/lib/wp/endpoint.c
+++ b/lib/wp/endpoint.c
@@ -451,6 +451,17 @@ wp_endpoint_get_creation_time (WpEndpoint * self)
   return priv->creation_time;
 }
 
+WpProperties *
+wp_endpoint_get_properties (WpEndpoint * self)
+{
+  g_return_val_if_fail (WP_IS_ENDPOINT (self), NULL);
+
+  if (WP_ENDPOINT_GET_CLASS (self)->get_properties)
+    return WP_ENDPOINT_GET_CLASS (self)->get_properties (self);
+
+  return NULL;
+}
+
 /**
  * wp_endpoint_register_stream:
  * @self: the endpoint
diff --git a/lib/wp/endpoint.h b/lib/wp/endpoint.h
index 5ea677c1..1869cdfa 100644
--- a/lib/wp/endpoint.h
+++ b/lib/wp/endpoint.h
@@ -28,6 +28,8 @@ struct _WpEndpointClass
 {
   GObjectClass parent_class;
 
+  WpProperties * (*get_properties) (WpEndpoint * self);
+
   GVariant * (*get_control_value) (WpEndpoint * self, guint32 control_id);
   gboolean (*set_control_value) (WpEndpoint * self, guint32 control_id,
       GVariant * value);
@@ -49,6 +51,7 @@ 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);
 
 void wp_endpoint_register_stream (WpEndpoint * self, GVariant * stream);
 GVariant * wp_endpoint_get_stream (WpEndpoint * self, guint32 stream_id);
diff --git a/modules/module-pipewire/audio-softdsp-endpoint.c b/modules/module-pipewire/audio-softdsp-endpoint.c
index 1c4ff7e1..f09a7227 100644
--- a/modules/module-pipewire/audio-softdsp-endpoint.c
+++ b/modules/module-pipewire/audio-softdsp-endpoint.c
@@ -92,6 +92,14 @@ object_safe_new_finish(WpPwAudioSoftdspEndpoint * self, GObject *initable,
   return g_steal_pointer (&object);
 }
 
+static WpProperties *
+endpoint_get_properties (WpEndpoint * ep)
+{
+  WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (ep);
+
+  return wp_proxy_node_get_properties (self->proxy_node);
+}
+
 static gboolean
 endpoint_prepare_link (WpEndpoint * ep, guint32 stream_id,
     WpEndpointLink * link, GVariant ** properties, GError ** error)
@@ -397,6 +405,7 @@ endpoint_class_init (WpPwAudioSoftdspEndpointClass * klass)
   object_class->set_property = endpoint_set_property;
   object_class->get_property = endpoint_get_property;
 
+  endpoint_class->get_properties = endpoint_get_properties;
   endpoint_class->prepare_link = endpoint_prepare_link;
   endpoint_class->get_control_value = endpoint_get_control_value;
   endpoint_class->set_control_value = endpoint_set_control_value;
-- 
GitLab