Skip to content
Snippets Groups Projects
Commit fb1daa0b authored by Julian Bouzas's avatar Julian Bouzas
Browse files

modules: use dots instead of dashes for session item properties

Keeps consistency with PipeWire
parent cdd6fda5
No related branches found
No related tags found
No related merge requests found
......@@ -436,10 +436,10 @@ impl_create_link (void *object, const struct spa_dict *props)
}
props = wp_properties_new_empty ();
wp_properties_setf (props, "out-item", "%p", out_endpoint);
wp_properties_setf (props, "in-item", "%p", in_endpoint);
wp_properties_setf (props, "out.item", "%p", out_endpoint);
wp_properties_setf (props, "in.item", "%p", in_endpoint);
wp_properties_setf (props, "session", "%p", session);
wp_properties_setf (props, "manage-lifetime", "%u", TRUE);
wp_properties_setf (props, "manage.lifetime", "%u", TRUE);
if (G_UNLIKELY (!wp_session_item_configure (link, props))) {
g_critical ("si-standard-link configuration failed");
......
......@@ -103,7 +103,7 @@ si_audio_adapter_configure (WpSessionItem * item, WpProperties *p)
wp_properties_set (si_props, "name", self->name);
}
str = wp_properties_get (si_props, "media-class");
str = wp_properties_get (si_props, "media.class");
if (str) {
strncpy (self->media_class, str, sizeof (self->media_class) - 1);
} else {
......@@ -112,7 +112,7 @@ si_audio_adapter_configure (WpSessionItem * item, WpProperties *p)
strncpy (self->media_class, str, sizeof (self->media_class) - 1);
else
strncpy (self->media_class, "Unknown", sizeof (self->media_class) - 1);
wp_properties_set (si_props, "media-class", self->media_class);
wp_properties_set (si_props, "media.class", self->media_class);
}
str = wp_properties_get (si_props, "role");
......@@ -138,29 +138,29 @@ si_audio_adapter_configure (WpSessionItem * item, WpProperties *p)
if (!str)
wp_properties_setf (si_props, "priority", "%u", self->priority);
str = wp_properties_get (si_props, "preferred-n-channels");
str = wp_properties_get (si_props, "preferred.n.channels");
if (str && sscanf(str, "%u", &self->preferred_n_channels) != 1)
return FALSE;
if (!str)
wp_properties_setf (si_props, "preferred-n-channels", "%u",
wp_properties_setf (si_props, "preferred.n.channels", "%u",
self->preferred_n_channels);
str = wp_properties_get (si_props, "enable-control-port");
str = wp_properties_get (si_props, "enable.control.port");
if (str && sscanf(str, "%u", &self->control_port) != 1)
return FALSE;
if (!str)
wp_properties_setf (si_props, "enable-control-port", "%u",
wp_properties_setf (si_props, "enable.control.port", "%u",
self->control_port);
str = wp_properties_get (si_props, "enable-monitor");
str = wp_properties_get (si_props, "enable.monitor");
if (str && sscanf(str, "%u", &self->monitor) != 1)
return FALSE;
if (!str)
wp_properties_setf (si_props, "enable-monitor", "%u", self->monitor);
wp_properties_setf (si_props, "enable.monitor", "%u", self->monitor);
self->node = g_object_ref (node);
wp_properties_set (si_props, "si-factory-name", SI_FACTORY_NAME);
wp_properties_set (si_props, "si.factory.name", SI_FACTORY_NAME);
wp_session_item_set_properties (WP_SESSION_ITEM (self),
g_steal_pointer (&si_props));
return TRUE;
......
......@@ -95,16 +95,16 @@ si_audio_convert_configure (WpSessionItem * item, WpProperties *p)
if (!str || sscanf(str, "%u", &self->direction) != 1)
return FALSE;
str = wp_properties_get (si_props, "enable-control-port");
str = wp_properties_get (si_props, "enable.control.port");
if (str && sscanf(str, "%u", &self->control_port) != 1)
return FALSE;
if (!str)
wp_properties_setf (si_props, "enable-control-port", "%u",
wp_properties_setf (si_props, "enable.control.port", "%u",
self->control_port);
self->target = g_object_ref (target);
wp_properties_set (si_props, "si-factory-name", SI_FACTORY_NAME);
wp_properties_set (si_props, "si.factory.name", SI_FACTORY_NAME);
wp_session_item_set_properties (WP_SESSION_ITEM (self),
g_steal_pointer (&si_props));
return TRUE;
......@@ -159,14 +159,14 @@ do_link_to_target (WpSiAudioConvert *self)
props = wp_properties_new_empty ();
if (self->direction == WP_DIRECTION_INPUT) {
/* Playback */
wp_properties_setf (props, "out-item", "%p", self);
wp_properties_setf (props, "in-item", "%p", self->target);
wp_properties_set (props, "out-item-port-context", "reverse");
wp_properties_setf (props, "out.item", "%p", self);
wp_properties_setf (props, "in.item", "%p", self->target);
wp_properties_set (props, "out.item.port.context", "reverse");
} else {
/* Capture */
wp_properties_setf (props, "out-item", "%p", self->target);
wp_properties_setf (props, "in-item", "%p", self);
wp_properties_set (props, "in-item-port-context", "reverse");
wp_properties_setf (props, "out.item", "%p", self->target);
wp_properties_setf (props, "in.item", "%p", self);
wp_properties_set (props, "in.item.port.context", "reverse");
}
/* always create passive links; that means that they won't hold the graph
......@@ -275,7 +275,7 @@ si_audio_convert_enable_active (WpSessionItem *si, WpTransition *transition)
/* set channels & rate */
target_props = wp_session_item_get_properties (self->target);
str = wp_properties_get (target_props, "preferred-n-channels");
str = wp_properties_get (target_props, "preferred.n.channels");
if (!str || sscanf(str, "%u", &channels) != 1)
channels = 2;
rate = ({
......
......@@ -127,7 +127,7 @@ si_audio_endpoint_configure (WpSessionItem * item, WpProperties *p)
if (session)
self->session = g_object_ref (session);
wp_properties_set (si_props, "si-factory-name", SI_FACTORY_NAME);
wp_properties_set (si_props, "si.factory.name", SI_FACTORY_NAME);
wp_session_item_set_properties (WP_SESSION_ITEM (self),
g_steal_pointer (&si_props));
return TRUE;
......@@ -196,14 +196,14 @@ link_to_target (WpSiAudioEndpoint * self)
props = wp_properties_new_empty ();
if (self->direction == WP_DIRECTION_INPUT) {
/* Playback */
wp_properties_setf (props, "out-item", "%p", self);
wp_properties_setf (props, "in-item", "%p", self->target);
wp_properties_set (props, "out-item-port-context", "reverse");
wp_properties_setf (props, "out.item", "%p", self);
wp_properties_setf (props, "in.item", "%p", self->target);
wp_properties_set (props, "out.item.port.context", "reverse");
} else {
/* Capture */
wp_properties_setf (props, "out-item", "%p", self->target);
wp_properties_setf (props, "in-item", "%p", self);
wp_properties_set (props, "in-item-port-context", "reverse");
wp_properties_setf (props, "out.item", "%p", self->target);
wp_properties_setf (props, "in.item", "%p", self);
wp_properties_set (props, "in.item.port.context", "reverse");
}
/* always create passive links; that means that they won't hold the graph
......
......@@ -86,7 +86,7 @@ si_node_configure (WpSessionItem * item, WpProperties *p)
wp_properties_set (si_props, "name", self->name);
}
str = wp_properties_get (si_props, "media-class");
str = wp_properties_get (si_props, "media.class");
if (str) {
strncpy (self->media_class, str, sizeof (self->media_class) - 1);
} else {
......@@ -95,7 +95,7 @@ si_node_configure (WpSessionItem * item, WpProperties *p)
strncpy (self->media_class, str, sizeof (self->media_class) - 1);
else
strncpy (self->media_class, "Unknown", sizeof (self->media_class) - 1);
wp_properties_set (si_props, "media-class", self->media_class);
wp_properties_set (si_props, "media.class", self->media_class);
}
str = wp_properties_get (si_props, "role");
......@@ -123,7 +123,7 @@ si_node_configure (WpSessionItem * item, WpProperties *p)
self->node = g_object_ref (node);
wp_properties_set (si_props, "si-factory-name", SI_FACTORY_NAME);
wp_properties_set (si_props, "si.factory.name", SI_FACTORY_NAME);
wp_session_item_set_properties (WP_SESSION_ITEM (self),
g_steal_pointer (&si_props));
return TRUE;
......
......@@ -140,29 +140,29 @@ si_standard_link_configure (WpSessionItem * item, WpProperties * p)
/* reset previous config */
si_standard_link_reset (item);
out_item = get_and_validate_item (si_props, "out-item");
out_item = get_and_validate_item (si_props, "out.item");
if (!out_item)
return FALSE;
wp_properties_setf (si_props, "out-item-id", "%u",
wp_properties_setf (si_props, "out.item.id", "%u",
wp_session_item_get_id (out_item));
in_item = get_and_validate_item (si_props, "in-item");
in_item = get_and_validate_item (si_props, "in.item");
if (!in_item)
return FALSE;
wp_properties_setf (si_props, "in-item-id", "%u",
wp_properties_setf (si_props, "in.item.id", "%u",
wp_session_item_get_id (in_item));
self->out_item_port_context = wp_properties_get (si_props,
"out-item-port-context");
"out.item.port.context");
self->out_item_port_context = wp_properties_get (si_props,
"in-item-port-context");
"in.item.port.context");
str = wp_properties_get (si_props, "manage-lifetime");
str = wp_properties_get (si_props, "manage.lifetime");
if (str && sscanf(str, "%u", &self->manage_lifetime) != 1)
return FALSE;
if (!str)
wp_properties_setf (si_props, "manage-lifetime", "%u",
wp_properties_setf (si_props, "manage.lifetime", "%u",
self->manage_lifetime);
str = wp_properties_get (si_props, "passive");
......@@ -193,7 +193,7 @@ si_standard_link_configure (WpSessionItem * item, WpProperties * p)
if (session)
self->session = g_object_ref (session);
wp_properties_set (si_props, "si-factory-name", SI_FACTORY_NAME);
wp_properties_set (si_props, "si.factory.name", SI_FACTORY_NAME);
wp_session_item_set_properties (WP_SESSION_ITEM (self),
g_steal_pointer (&si_props));
return TRUE;
......
......@@ -52,11 +52,11 @@ function createLink (si, si_target)
-- create and configure link
local si_link = SessionItem ( "si-standard-link" )
if not si_link:configure {
["out-item"] = out_item,
["in-item"] = in_item,
["out-item-port-context"] = out_context,
["in-item-port-context"] = in_context,
["manage-lifetime"] = false,
["out.item"] = out_item,
["in.item"] = in_item,
["out.item.port.context"] = out_context,
["in.item.port.context"] = in_context,
["manage.lifetime"] = false,
} then
Log.warning (si_link, "failed to configure si-standard-link")
end
......@@ -137,8 +137,8 @@ end
function getSiLinkAndSiPeer (si)
for silink in silinks_om:iterate() do
local out_id = tonumber(silink.properties["out-item-id"])
local in_id = tonumber(silink.properties["in-item-id"])
local out_id = tonumber(silink.properties["out.item.id"])
local in_id = tonumber(silink.properties["in.item.id"])
if out_id == si.id then
return silink, siportinfos_om:lookup {
Constraint { "id", "=", in_id, type = "gobject" }
......@@ -201,8 +201,8 @@ function reevaluateLinks ()
for silink in silinks_om:iterate() do
local used = false
for si in siportinfos_om:iterate() do
local out_id_str = silink.properties["out-item-id"]
local in_id_str = silink.properties["out-item-id"]
local out_id_str = silink.properties["out.item.id"]
local in_id_str = silink.properties["out.item.id"]
if tonumber (out_id_str) == si.id or tonumber (in_id_str) == si.id then
used = true
break
......
......@@ -86,7 +86,7 @@ test_si_audio_adapter_configure_activate (TestFixture * f,
str = wp_properties_get (props, "name");
g_assert_nonnull (str);
g_assert_cmpstr ("audiotestsrc.adapter", ==, str);
str = wp_properties_get (props, "media-class");
str = wp_properties_get (props, "media.class");
g_assert_nonnull (str);
g_assert_cmpstr ("Audio/Source", ==, str);
str = wp_properties_get (props, "role");
......@@ -98,16 +98,16 @@ test_si_audio_adapter_configure_activate (TestFixture * f,
str = wp_properties_get (props, "priority");
g_assert_nonnull (str);
g_assert_cmpstr ("0", ==, str);
str = wp_properties_get (props, "preferred-n-channels");
str = wp_properties_get (props, "preferred.n.channels");
g_assert_nonnull (str);
g_assert_cmpstr ("0", ==, str);
str = wp_properties_get (props, "enable-control-port");
str = wp_properties_get (props, "enable.control.port");
g_assert_nonnull (str);
g_assert_cmpstr ("0", ==, str);
str = wp_properties_get (props, "enable-monitor");
str = wp_properties_get (props, "enable.monitor");
g_assert_nonnull (str);
g_assert_cmpstr ("0", ==, str);
str = wp_properties_get (props, "si-factory-name");
str = wp_properties_get (props, "si.factory.name");
g_assert_nonnull (str);
g_assert_cmpstr ("si-audio-adapter", ==, str);
}
......
......@@ -116,10 +116,10 @@ test_si_audio_convert_configure_activate (TestFixture * f,
str = wp_properties_get (props, "direction");
g_assert_nonnull (str);
g_assert_cmpstr ("1", ==, str);
str = wp_properties_get (props, "enable-control-port");
str = wp_properties_get (props, "enable.control.port");
g_assert_nonnull (str);
g_assert_cmpstr ("0", ==, str);
str = wp_properties_get (props, "si-factory-name");
str = wp_properties_get (props, "si.factory.name");
g_assert_nonnull (str);
g_assert_cmpstr ("si-audio-convert", ==, str);
}
......
......@@ -116,7 +116,7 @@ test_si_audio_endpoint_configure_activate (TestFixture * f,
str = wp_properties_get (props, "direction");
g_assert_nonnull (str);
g_assert_cmpstr ("1", ==, str);
str = wp_properties_get (props, "si-factory-name");
str = wp_properties_get (props, "si.factory.name");
g_assert_nonnull (str);
g_assert_cmpstr ("si-audio-endpoint", ==, str);
}
......
......@@ -81,7 +81,7 @@ test_si_node_configure_activate (TestFixture * f, gconstpointer user_data)
{
WpProperties *props = wp_properties_new_empty ();
wp_properties_setf (props, "node", "%p", node);
wp_properties_set (props, "media-class", data->media_class);
wp_properties_set (props, "media.class", data->media_class);
g_assert_true (wp_session_item_configure (item, props));
g_assert_true (wp_session_item_is_configured (item));
}
......@@ -93,13 +93,13 @@ test_si_node_configure_activate (TestFixture * f, gconstpointer user_data)
str = wp_properties_get (props, "name");
g_assert_nonnull (str);
g_assert_cmpstr (data->name, ==, str);
str = wp_properties_get (props, "media-class");
str = wp_properties_get (props, "media.class");
g_assert_nonnull (str);
g_assert_cmpstr (data->expected_media_class, ==, str);
str = wp_properties_get (props, "direction");
g_assert_nonnull (str);
g_assert_cmpstr (data->expected_direction == 0 ? "0" : "1", ==, str);
str = wp_properties_get (props, "si-factory-name");
str = wp_properties_get (props, "si.factory.name");
g_assert_nonnull (str);
g_assert_cmpstr ("si-node", ==, str);
}
......@@ -158,13 +158,13 @@ test_si_node_configure_activate (TestFixture * f, gconstpointer user_data)
str = wp_properties_get (props, "name");
g_assert_nonnull (str);
g_assert_cmpstr (data->name, ==, str);
str = wp_properties_get (props, "media-class");
str = wp_properties_get (props, "media.class");
g_assert_nonnull (str);
g_assert_cmpstr (data->expected_media_class, ==, str);
str = wp_properties_get (props, "direction");
g_assert_nonnull (str);
g_assert_cmpstr (data->expected_direction == 0 ? "0" : "1", ==, str);
str = wp_properties_get (props, "si-factory-name");
str = wp_properties_get (props, "si.factory.name");
g_assert_nonnull (str);
g_assert_cmpstr ("si-node", ==, str);
}
......
......@@ -47,7 +47,7 @@ load_endpoint (TestFixture * f, const gchar * factory, const gchar * media_class
WpProperties *props = wp_properties_new_empty ();
wp_properties_setf (props, "node", "%p", target_node);
wp_properties_set (props, "name", factory);
wp_properties_set (props, "media-class", media_class);
wp_properties_set (props, "media.class", media_class);
wp_properties_set (props, "role", "role");
g_assert_true (wp_session_item_configure (target, props));
g_assert_true (wp_session_item_is_configured (target));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment