mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-05 18:18:15 +02:00
base-endpoint: add _get_global_id API
This commit is contained in:
parent
7ac9c6359c
commit
d485c1192a
6 changed files with 41 additions and 8 deletions
|
|
@ -500,6 +500,17 @@ wp_base_endpoint_get_role (WpBaseEndpoint * self)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
guint32
|
||||
wp_base_endpoint_get_global_id (WpBaseEndpoint * self)
|
||||
{
|
||||
g_return_val_if_fail (WP_IS_BASE_ENDPOINT (self), -1);
|
||||
|
||||
if (WP_BASE_ENDPOINT_GET_CLASS (self)->get_global_id)
|
||||
return WP_BASE_ENDPOINT_GET_CLASS (self)->get_global_id (self);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* wp_base_endpoint_register_stream:
|
||||
* @self: the endpoint
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ struct _WpBaseEndpointClass
|
|||
|
||||
WpProperties * (*get_properties) (WpBaseEndpoint * self);
|
||||
const char * (*get_role) (WpBaseEndpoint * self);
|
||||
guint32 (*get_global_id) (WpBaseEndpoint * self);
|
||||
|
||||
GVariant * (*get_control_value) (WpBaseEndpoint * self, guint32 control_id);
|
||||
gboolean (*set_control_value) (WpBaseEndpoint * self, guint32 control_id,
|
||||
|
|
@ -57,6 +58,7 @@ guint64 wp_base_endpoint_get_creation_time (WpBaseEndpoint * self);
|
|||
guint32 wp_base_endpoint_get_priority (WpBaseEndpoint * self);
|
||||
WpProperties * wp_base_endpoint_get_properties (WpBaseEndpoint * self);
|
||||
const char * wp_base_endpoint_get_role (WpBaseEndpoint * self);
|
||||
guint32 wp_base_endpoint_get_global_id (WpBaseEndpoint * self);
|
||||
|
||||
void wp_base_endpoint_register_stream (WpBaseEndpoint * self, GVariant * stream);
|
||||
GVariant * wp_base_endpoint_get_stream (WpBaseEndpoint * self, guint32 stream_id);
|
||||
|
|
|
|||
|
|
@ -111,6 +111,14 @@ endpoint_get_role (WpBaseEndpoint *ep)
|
|||
return self->role;
|
||||
}
|
||||
|
||||
static guint32
|
||||
endpoint_get_global_id (WpBaseEndpoint *ep)
|
||||
{
|
||||
WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (ep);
|
||||
|
||||
return wp_exported_endpoint_get_global_id (self->exported_ep);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
endpoint_prepare_link (WpBaseEndpoint * ep, guint32 stream_id,
|
||||
WpBaseEndpointLink * link, GVariant ** properties, GError ** error)
|
||||
|
|
@ -470,6 +478,7 @@ endpoint_class_init (WpPwAudioSoftdspEndpointClass * klass)
|
|||
|
||||
endpoint_class->get_properties = endpoint_get_properties;
|
||||
endpoint_class->get_role = endpoint_get_role;
|
||||
endpoint_class->get_global_id = endpoint_get_global_id;
|
||||
endpoint_class->prepare_link = endpoint_prepare_link;
|
||||
|
||||
/* Instal the properties */
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ struct _WpEndpointAudiotestsrc
|
|||
{
|
||||
WpBaseEndpoint parent;
|
||||
GTask *init_task;
|
||||
guint id;
|
||||
|
||||
/* Props */
|
||||
WpProxyNode *proxy_node;
|
||||
|
|
@ -48,6 +49,13 @@ wp_endpoint_audiotestsrc_get_role (WpBaseEndpoint * ep)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static guint32
|
||||
wp_endpoint_audiotestsrc_get_global_id (WpBaseEndpoint * ep)
|
||||
{
|
||||
WpEndpointAudiotestsrc *self = WP_ENDPOINT_AUDIOTESTSRC (ep);
|
||||
return self->id;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wp_endpoint_audiotestsrc_prepare_link (WpBaseEndpoint * ep, guint32 stream_id,
|
||||
WpBaseEndpointLink * link, GVariant ** properties, GError ** error)
|
||||
|
|
@ -172,6 +180,8 @@ wp_endpoint_audiotestsrc_async_initable_init (gpointer iface,
|
|||
static void
|
||||
wp_endpoint_audiotestsrc_init (WpEndpointAudiotestsrc * self)
|
||||
{
|
||||
static guint id = 0;
|
||||
self->id = id++;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -187,6 +197,7 @@ wp_endpoint_audiotestsrc_class_init (WpEndpointAudiotestsrcClass * klass)
|
|||
|
||||
endpoint_class->get_properties = wp_endpoint_audiotestsrc_get_properties;
|
||||
endpoint_class->get_role = wp_endpoint_audiotestsrc_get_role;
|
||||
endpoint_class->get_global_id = wp_endpoint_audiotestsrc_get_global_id;
|
||||
endpoint_class->prepare_link = wp_endpoint_audiotestsrc_prepare_link;
|
||||
endpoint_class->get_endpoint_link_factory =
|
||||
wp_endpoint_audiotestsrc_get_endpoint_link_factory;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,13 @@ wp_fake_endpoint_get_role (WpBaseEndpoint * ep)
|
|||
return self->role;
|
||||
}
|
||||
|
||||
static guint32
|
||||
wp_fake_endpoint_get_global_id (WpBaseEndpoint * ep)
|
||||
{
|
||||
WpFakeEndpoint *self = WP_FAKE_ENDPOINT (ep);
|
||||
return self->id;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wp_fake_endpoint_prepare_link (WpBaseEndpoint * ep, guint32 stream_id,
|
||||
WpBaseEndpointLink * link, GVariant ** properties, GError ** error)
|
||||
|
|
@ -192,6 +199,7 @@ wp_fake_endpoint_class_init (WpFakeEndpointClass * klass)
|
|||
|
||||
endpoint_class->get_properties = wp_fake_endpoint_get_properties;
|
||||
endpoint_class->get_role = wp_fake_endpoint_get_role;
|
||||
endpoint_class->get_global_id = wp_fake_endpoint_get_global_id;
|
||||
endpoint_class->prepare_link = wp_fake_endpoint_prepare_link;
|
||||
endpoint_class->get_endpoint_link_factory =
|
||||
wp_fake_endpoint_get_endpoint_link_factory;
|
||||
|
|
@ -230,9 +238,3 @@ wp_fake_endpoint_new_async (WpCore *core, const char *name,
|
|||
"streams", streams,
|
||||
NULL);
|
||||
}
|
||||
|
||||
guint
|
||||
wp_fake_endpoint_get_id (WpFakeEndpoint *self)
|
||||
{
|
||||
return self->id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ wp_fake_endpoint_new_async (WpCore *core, const char *name,
|
|||
WpProperties *props, const char *role, guint streams,
|
||||
GAsyncReadyCallback ready, gpointer data);
|
||||
|
||||
guint wp_fake_endpoint_get_id (WpFakeEndpoint *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue