mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-08 05:48:02 +02:00
m-si-simple-node-endpoint: rename to si-node
This commit is contained in:
parent
12b2c00d0b
commit
b10a5b6b49
8 changed files with 85 additions and 92 deletions
|
|
@ -113,11 +113,11 @@ shared_library(
|
|||
)
|
||||
|
||||
shared_library(
|
||||
'wireplumber-module-si-simple-node-endpoint',
|
||||
'wireplumber-module-si-node',
|
||||
[
|
||||
'module-si-simple-node-endpoint.c',
|
||||
'module-si-node.c',
|
||||
],
|
||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-si-simple-node-endpoint"'],
|
||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-si-node"'],
|
||||
install : true,
|
||||
install_dir : wireplumber_module_dir,
|
||||
dependencies : [wp_dep, pipewire_dep],
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ enum {
|
|||
STEP_ENSURE_NODE_FEATURES,
|
||||
};
|
||||
|
||||
struct _WpSiSimpleNodeEndpoint
|
||||
struct _WpSiNode
|
||||
{
|
||||
WpSessionItem parent;
|
||||
|
||||
|
|
@ -29,27 +29,26 @@ struct _WpSiSimpleNodeEndpoint
|
|||
WpDirection direction;
|
||||
};
|
||||
|
||||
static void si_simple_node_endpoint_endpoint_init (WpSiEndpointInterface * iface);
|
||||
static void si_simple_node_endpoint_port_info_init (WpSiPortInfoInterface * iface);
|
||||
static void si_node_endpoint_init (WpSiEndpointInterface * iface);
|
||||
static void si_node_port_info_init (WpSiPortInfoInterface * iface);
|
||||
|
||||
G_DECLARE_FINAL_TYPE(WpSiSimpleNodeEndpoint, si_simple_node_endpoint,
|
||||
WP, SI_SIMPLE_NODE_ENDPOINT, WpSessionItem)
|
||||
G_DEFINE_TYPE_WITH_CODE (WpSiSimpleNodeEndpoint, si_simple_node_endpoint, WP_TYPE_SESSION_ITEM,
|
||||
G_IMPLEMENT_INTERFACE (WP_TYPE_SI_ENDPOINT, si_simple_node_endpoint_endpoint_init)
|
||||
G_IMPLEMENT_INTERFACE (WP_TYPE_SI_PORT_INFO, si_simple_node_endpoint_port_info_init))
|
||||
G_DECLARE_FINAL_TYPE(WpSiNode, si_node, WP, SI_NODE, WpSessionItem)
|
||||
G_DEFINE_TYPE_WITH_CODE (WpSiNode, si_node, WP_TYPE_SESSION_ITEM,
|
||||
G_IMPLEMENT_INTERFACE (WP_TYPE_SI_ENDPOINT, si_node_endpoint_init)
|
||||
G_IMPLEMENT_INTERFACE (WP_TYPE_SI_PORT_INFO, si_node_port_info_init))
|
||||
|
||||
static void
|
||||
si_simple_node_endpoint_init (WpSiSimpleNodeEndpoint * self)
|
||||
si_node_init (WpSiNode * self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
si_simple_node_endpoint_reset (WpSessionItem * item)
|
||||
si_node_reset (WpSessionItem * item)
|
||||
{
|
||||
WpSiSimpleNodeEndpoint *self = WP_SI_SIMPLE_NODE_ENDPOINT (item);
|
||||
WpSiNode *self = WP_SI_NODE (item);
|
||||
|
||||
/* unexport & deactivate first */
|
||||
WP_SESSION_ITEM_CLASS (si_simple_node_endpoint_parent_class)->reset (item);
|
||||
WP_SESSION_ITEM_CLASS (si_node_parent_class)->reset (item);
|
||||
|
||||
g_clear_object (&self->node);
|
||||
self->name[0] = '\0';
|
||||
|
|
@ -61,22 +60,21 @@ si_simple_node_endpoint_reset (WpSessionItem * item)
|
|||
}
|
||||
|
||||
static gpointer
|
||||
si_simple_node_endpoint_get_associated_proxy (WpSessionItem * item,
|
||||
GType proxy_type)
|
||||
si_node_get_associated_proxy (WpSessionItem * item, GType proxy_type)
|
||||
{
|
||||
WpSiSimpleNodeEndpoint *self = WP_SI_SIMPLE_NODE_ENDPOINT (item);
|
||||
WpSiNode *self = WP_SI_NODE (item);
|
||||
|
||||
if (proxy_type == WP_TYPE_NODE)
|
||||
return self->node ? g_object_ref (self->node) : NULL;
|
||||
|
||||
return WP_SESSION_ITEM_CLASS (si_simple_node_endpoint_parent_class)->
|
||||
return WP_SESSION_ITEM_CLASS (si_node_parent_class)->
|
||||
get_associated_proxy (item, proxy_type);
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
si_simple_node_endpoint_get_configuration (WpSessionItem * item)
|
||||
si_node_get_configuration (WpSessionItem * item)
|
||||
{
|
||||
WpSiSimpleNodeEndpoint *self = WP_SI_SIMPLE_NODE_ENDPOINT (item);
|
||||
WpSiNode *self = WP_SI_NODE (item);
|
||||
GVariantBuilder b;
|
||||
|
||||
/* Set the properties */
|
||||
|
|
@ -97,9 +95,9 @@ si_simple_node_endpoint_get_configuration (WpSessionItem * item)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
si_simple_node_endpoint_configure (WpSessionItem * item, GVariant * args)
|
||||
si_node_configure (WpSessionItem * item, GVariant * args)
|
||||
{
|
||||
WpSiSimpleNodeEndpoint *self = WP_SI_SIMPLE_NODE_ENDPOINT (item);
|
||||
WpSiNode *self = WP_SI_NODE (item);
|
||||
guint64 node_i;
|
||||
const gchar *tmp_str;
|
||||
g_autoptr (WpProperties) props = NULL;
|
||||
|
|
@ -159,8 +157,8 @@ si_simple_node_endpoint_configure (WpSessionItem * item, GVariant * args)
|
|||
}
|
||||
|
||||
static guint
|
||||
si_simple_node_endpoint_activate_get_next_step (WpSessionItem * item,
|
||||
WpTransition * transition, guint step)
|
||||
si_node_activate_get_next_step (WpSessionItem * item, WpTransition * transition,
|
||||
guint step)
|
||||
{
|
||||
switch (step) {
|
||||
case WP_TRANSITION_STEP_NONE:
|
||||
|
|
@ -190,18 +188,17 @@ on_node_activated (WpObject * node, GAsyncResult * res, WpTransition * transitio
|
|||
}
|
||||
|
||||
static void
|
||||
si_simple_node_endpoint_activate_execute_step (WpSessionItem * item,
|
||||
WpTransition * transition, guint step)
|
||||
si_node_activate_execute_step (WpSessionItem * item, WpTransition * transition,
|
||||
guint step)
|
||||
{
|
||||
WpSiSimpleNodeEndpoint *self = WP_SI_SIMPLE_NODE_ENDPOINT (item);
|
||||
WpSiNode *self = WP_SI_NODE (item);
|
||||
|
||||
switch (step) {
|
||||
case STEP_VERIFY_CONFIG:
|
||||
if (G_UNLIKELY (!(wp_session_item_get_flags (item) & WP_SI_FLAG_CONFIGURED))) {
|
||||
wp_transition_return_error (transition,
|
||||
g_error_new (WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_INVARIANT,
|
||||
"si-simple-node-endpoint: cannot activate item without it "
|
||||
"being configured first"));
|
||||
"si-node: cannot activate without being configured first"));
|
||||
}
|
||||
wp_transition_advance (transition);
|
||||
break;
|
||||
|
|
@ -218,24 +215,22 @@ si_simple_node_endpoint_activate_execute_step (WpSessionItem * item,
|
|||
}
|
||||
|
||||
static void
|
||||
si_simple_node_endpoint_class_init (WpSiSimpleNodeEndpointClass * klass)
|
||||
si_node_class_init (WpSiNodeClass * klass)
|
||||
{
|
||||
WpSessionItemClass *si_class = (WpSessionItemClass *) klass;
|
||||
|
||||
si_class->reset = si_simple_node_endpoint_reset;
|
||||
si_class->get_associated_proxy = si_simple_node_endpoint_get_associated_proxy;
|
||||
si_class->configure = si_simple_node_endpoint_configure;
|
||||
si_class->get_configuration = si_simple_node_endpoint_get_configuration;
|
||||
si_class->activate_get_next_step =
|
||||
si_simple_node_endpoint_activate_get_next_step;
|
||||
si_class->activate_execute_step =
|
||||
si_simple_node_endpoint_activate_execute_step;
|
||||
si_class->reset = si_node_reset;
|
||||
si_class->get_associated_proxy = si_node_get_associated_proxy;
|
||||
si_class->configure = si_node_configure;
|
||||
si_class->get_configuration = si_node_get_configuration;
|
||||
si_class->activate_get_next_step = si_node_activate_get_next_step;
|
||||
si_class->activate_execute_step = si_node_activate_execute_step;
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
si_simple_node_endpoint_get_registration_info (WpSiEndpoint * item)
|
||||
si_node_get_registration_info (WpSiEndpoint * item)
|
||||
{
|
||||
WpSiSimpleNodeEndpoint *self = WP_SI_SIMPLE_NODE_ENDPOINT (item);
|
||||
WpSiNode *self = WP_SI_NODE (item);
|
||||
GVariantBuilder b;
|
||||
|
||||
g_variant_builder_init (&b, G_VARIANT_TYPE ("(ssya{ss})"));
|
||||
|
|
@ -248,9 +243,9 @@ si_simple_node_endpoint_get_registration_info (WpSiEndpoint * item)
|
|||
}
|
||||
|
||||
static WpProperties *
|
||||
si_simple_node_endpoint_get_properties (WpSiEndpoint * item)
|
||||
si_node_get_properties (WpSiEndpoint * item)
|
||||
{
|
||||
WpSiSimpleNodeEndpoint *self = WP_SI_SIMPLE_NODE_ENDPOINT (item);
|
||||
WpSiNode *self = WP_SI_NODE (item);
|
||||
g_autoptr (WpProperties) node_props = NULL;
|
||||
WpProperties *result;
|
||||
|
||||
|
|
@ -291,16 +286,16 @@ si_simple_node_endpoint_get_properties (WpSiEndpoint * item)
|
|||
}
|
||||
|
||||
static void
|
||||
si_simple_node_endpoint_endpoint_init (WpSiEndpointInterface * iface)
|
||||
si_node_endpoint_init (WpSiEndpointInterface * iface)
|
||||
{
|
||||
iface->get_registration_info = si_simple_node_endpoint_get_registration_info;
|
||||
iface->get_properties = si_simple_node_endpoint_get_properties;
|
||||
iface->get_registration_info = si_node_get_registration_info;
|
||||
iface->get_properties = si_node_get_properties;
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
si_simple_node_endpoint_get_ports (WpSiPortInfo * item, const gchar * context)
|
||||
si_node_get_ports (WpSiPortInfo * item, const gchar * context)
|
||||
{
|
||||
WpSiSimpleNodeEndpoint *self = WP_SI_SIMPLE_NODE_ENDPOINT (item);
|
||||
WpSiNode *self = WP_SI_NODE (item);
|
||||
g_auto (GVariantBuilder) b = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_ARRAY);
|
||||
g_autoptr (WpIterator) it = NULL;
|
||||
g_auto (GValue) val = G_VALUE_INIT;
|
||||
|
|
@ -366,9 +361,9 @@ si_simple_node_endpoint_get_ports (WpSiPortInfo * item, const gchar * context)
|
|||
}
|
||||
|
||||
static void
|
||||
si_simple_node_endpoint_port_info_init (WpSiPortInfoInterface * iface)
|
||||
si_node_port_info_init (WpSiPortInfoInterface * iface)
|
||||
{
|
||||
iface->get_ports = si_simple_node_endpoint_get_ports;
|
||||
iface->get_ports = si_node_get_ports;
|
||||
}
|
||||
|
||||
WP_PLUGIN_EXPORT gboolean
|
||||
|
|
@ -389,8 +384,7 @@ wireplumber__module_init (WpCore * core, GVariant * args, GError ** error)
|
|||
WP_SI_CONFIG_OPTION_WRITEABLE, NULL);
|
||||
g_variant_builder_add (&b, "(ssymv)", "direction", "y", 0, NULL);
|
||||
|
||||
wp_si_factory_register (core, wp_si_factory_new_simple (
|
||||
"si-simple-node-endpoint", si_simple_node_endpoint_get_type (),
|
||||
g_variant_builder_end (&b)));
|
||||
wp_si_factory_register (core, wp_si_factory_new_simple ("si-node",
|
||||
si_node_get_type (), g_variant_builder_end (&b)));
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -16,10 +16,10 @@ endpoint_support.policy = {
|
|||
function endpoint_support.enable()
|
||||
-- Session item factories, building blocks for the session management graph
|
||||
-- Do not disable these unless you really know what you are doing
|
||||
load_module("si-node")
|
||||
load_module("si-adapter")
|
||||
load_module("si-convert")
|
||||
load_module("si-monitor-endpoint")
|
||||
load_module("si-simple-node-endpoint")
|
||||
load_module("si-standard-link")
|
||||
|
||||
-- Create sessions statically at startup
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ nodes_om:connect("object-added", function (om, node)
|
|||
if string.find (media_class, "Audio") then
|
||||
addEndpoint (node, "audio", "si-adapter", 1)
|
||||
else
|
||||
addEndpoint (node, "video", "si-simple-node-endpoint", 1)
|
||||
addEndpoint (node, "video", "si-node", 1)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ appdata_init (AppData * d, GError ** error)
|
|||
|
||||
/* load wireplumber modules (wireplumber.conf) */
|
||||
if (!(wp_core_load_component (d->core,
|
||||
"libwireplumber-module-si-simple-node-endpoint", "module", NULL, error)))
|
||||
"libwireplumber-module-si-node", "module", NULL, error)))
|
||||
return FALSE;
|
||||
|
||||
if (!(wp_core_load_component (d->core,
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ test(
|
|||
)
|
||||
|
||||
test(
|
||||
'test-si-simple-node-endpoint',
|
||||
executable('test-si-simple-node-endpoint', 'si-simple-node-endpoint.c',
|
||||
'test-si-node',
|
||||
executable('test-si-node', 'si-node.c',
|
||||
dependencies: common_deps, c_args: common_args),
|
||||
env: common_env,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ typedef struct {
|
|||
} TestData;
|
||||
|
||||
static void
|
||||
test_si_simple_node_endpoint_setup (TestFixture * f, gconstpointer user_data)
|
||||
test_si_node_setup (TestFixture * f, gconstpointer user_data)
|
||||
{
|
||||
wp_base_test_fixture_setup (&f->base, 0);
|
||||
|
||||
|
|
@ -40,20 +40,19 @@ test_si_simple_node_endpoint_setup (TestFixture * f, gconstpointer user_data)
|
|||
{
|
||||
g_autoptr (GError) error = NULL;
|
||||
wp_core_load_component (f->base.core,
|
||||
"libwireplumber-module-si-simple-node-endpoint", "module", NULL, &error);
|
||||
"libwireplumber-module-si-node", "module", NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_si_simple_node_endpoint_teardown (TestFixture * f, gconstpointer user_data)
|
||||
test_si_node_teardown (TestFixture * f, gconstpointer user_data)
|
||||
{
|
||||
wp_base_test_fixture_teardown (&f->base);
|
||||
}
|
||||
|
||||
static void
|
||||
test_si_simple_node_endpoint_configure_activate (TestFixture * f,
|
||||
gconstpointer user_data)
|
||||
test_si_node_configure_activate (TestFixture * f, gconstpointer user_data)
|
||||
{
|
||||
const TestData *data = user_data;
|
||||
g_autoptr (WpNode) node = NULL;
|
||||
|
|
@ -61,7 +60,7 @@ test_si_simple_node_endpoint_configure_activate (TestFixture * f,
|
|||
|
||||
/* create item */
|
||||
|
||||
item = wp_session_item_make (f->base.core, "si-simple-node-endpoint");
|
||||
item = wp_session_item_make (f->base.core, "si-node");
|
||||
g_assert_nonnull (item);
|
||||
g_assert_true (WP_IS_SI_ENDPOINT (item));
|
||||
g_assert_true (WP_IS_SI_PORT_INFO (item));
|
||||
|
|
@ -214,7 +213,7 @@ test_si_simple_node_endpoint_configure_activate (TestFixture * f,
|
|||
}
|
||||
|
||||
static void
|
||||
test_si_simple_node_endpoint_export (TestFixture * f, gconstpointer user_data)
|
||||
test_si_node_export (TestFixture * f, gconstpointer user_data)
|
||||
{
|
||||
const TestData *data = user_data;
|
||||
g_autoptr (WpNode) node = NULL;
|
||||
|
|
@ -238,7 +237,7 @@ test_si_simple_node_endpoint_export (TestFixture * f, gconstpointer user_data)
|
|||
|
||||
/* create item */
|
||||
|
||||
item = wp_session_item_make (f->base.core, "si-simple-node-endpoint");
|
||||
item = wp_session_item_make (f->base.core, "si-node");
|
||||
g_assert_nonnull (item);
|
||||
|
||||
node = wp_node_new_from_factory (f->base.core,
|
||||
|
|
@ -353,43 +352,43 @@ main (gint argc, gchar *argv[])
|
|||
|
||||
/* configure-activate */
|
||||
|
||||
g_test_add ("/modules/si-simple-node-endpoint/configure-activate/fakesink",
|
||||
g_test_add ("/modules/si-node/configure-activate/fakesink",
|
||||
TestFixture, &fakesink_data,
|
||||
test_si_simple_node_endpoint_setup,
|
||||
test_si_simple_node_endpoint_configure_activate,
|
||||
test_si_simple_node_endpoint_teardown);
|
||||
test_si_node_setup,
|
||||
test_si_node_configure_activate,
|
||||
test_si_node_teardown);
|
||||
|
||||
g_test_add ("/modules/si-simple-node-endpoint/configure-activate/fakesrc",
|
||||
g_test_add ("/modules/si-node/configure-activate/fakesrc",
|
||||
TestFixture, &fakesrc_data,
|
||||
test_si_simple_node_endpoint_setup,
|
||||
test_si_simple_node_endpoint_configure_activate,
|
||||
test_si_simple_node_endpoint_teardown);
|
||||
test_si_node_setup,
|
||||
test_si_node_configure_activate,
|
||||
test_si_node_teardown);
|
||||
|
||||
g_test_add ("/modules/si-simple-node-endpoint/configure-activate/audiotestsrc",
|
||||
g_test_add ("/modules/si-node/configure-activate/audiotestsrc",
|
||||
TestFixture, &audiotestsrc_data,
|
||||
test_si_simple_node_endpoint_setup,
|
||||
test_si_simple_node_endpoint_configure_activate,
|
||||
test_si_simple_node_endpoint_teardown);
|
||||
test_si_node_setup,
|
||||
test_si_node_configure_activate,
|
||||
test_si_node_teardown);
|
||||
|
||||
/* export */
|
||||
|
||||
g_test_add ("/modules/si-simple-node-endpoint/export/fakesink",
|
||||
g_test_add ("/modules/si-node/export/fakesink",
|
||||
TestFixture, &fakesink_data,
|
||||
test_si_simple_node_endpoint_setup,
|
||||
test_si_simple_node_endpoint_export,
|
||||
test_si_simple_node_endpoint_teardown);
|
||||
test_si_node_setup,
|
||||
test_si_node_export,
|
||||
test_si_node_teardown);
|
||||
|
||||
g_test_add ("/modules/si-simple-node-endpoint/export/fakesrc",
|
||||
g_test_add ("/modules/si-node/export/fakesrc",
|
||||
TestFixture, &fakesrc_data,
|
||||
test_si_simple_node_endpoint_setup,
|
||||
test_si_simple_node_endpoint_export,
|
||||
test_si_simple_node_endpoint_teardown);
|
||||
test_si_node_setup,
|
||||
test_si_node_export,
|
||||
test_si_node_teardown);
|
||||
|
||||
g_test_add ("/modules/si-simple-node-endpoint/export/audiotestsrc",
|
||||
g_test_add ("/modules/si-node/export/audiotestsrc",
|
||||
TestFixture, &audiotestsrc_data,
|
||||
test_si_simple_node_endpoint_setup,
|
||||
test_si_simple_node_endpoint_export,
|
||||
test_si_simple_node_endpoint_teardown);
|
||||
test_si_node_setup,
|
||||
test_si_node_export,
|
||||
test_si_node_teardown);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ load_item (TestFixture * f, const gchar * factory, const gchar * media_class)
|
|||
|
||||
/* create item */
|
||||
|
||||
item = wp_session_item_make (f->base.core, "si-simple-node-endpoint");
|
||||
item = wp_session_item_make (f->base.core, "si-node");
|
||||
g_assert_nonnull (item);
|
||||
|
||||
node = wp_node_new_from_factory (f->base.core,
|
||||
|
|
@ -87,7 +87,7 @@ test_si_standard_link_setup (TestFixture * f, gconstpointer user_data)
|
|||
{
|
||||
g_autoptr (GError) error = NULL;
|
||||
wp_core_load_component (f->base.core,
|
||||
"libwireplumber-module-si-simple-node-endpoint", "module", NULL, &error);
|
||||
"libwireplumber-module-si-node", "module", NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
wp_core_load_component (f->base.core,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue