Commit 05aba22c authored by Julian Bouzas's avatar Julian Bouzas
Browse files

si-audio-adapter: remove unneeded 'preferred.n.channels' property

parent 47ae4f28
...@@ -27,7 +27,6 @@ struct _WpSiAudioAdapter ...@@ -27,7 +27,6 @@ struct _WpSiAudioAdapter
WpNode *node; WpNode *node;
gchar name[96]; gchar name[96];
gchar media_class[32]; gchar media_class[32];
guint preferred_n_channels;
gboolean control_port; gboolean control_port;
gboolean monitor; gboolean monitor;
WpDirection direction; WpDirection direction;
...@@ -64,7 +63,6 @@ si_audio_adapter_reset (WpSessionItem * item) ...@@ -64,7 +63,6 @@ si_audio_adapter_reset (WpSessionItem * item)
self->control_port = FALSE; self->control_port = FALSE;
self->monitor = FALSE; self->monitor = FALSE;
self->direction = WP_DIRECTION_INPUT; self->direction = WP_DIRECTION_INPUT;
self->preferred_n_channels = 0;
WP_SESSION_ITEM_CLASS (si_audio_adapter_parent_class)->reset (item); WP_SESSION_ITEM_CLASS (si_audio_adapter_parent_class)->reset (item);
} }
...@@ -116,13 +114,6 @@ si_audio_adapter_configure (WpSessionItem * item, WpProperties *p) ...@@ -116,13 +114,6 @@ si_audio_adapter_configure (WpSessionItem * item, WpProperties *p)
self->direction = WP_DIRECTION_OUTPUT; self->direction = WP_DIRECTION_OUTPUT;
wp_properties_setf (si_props, "direction", "%u", self->direction); wp_properties_setf (si_props, "direction", "%u", self->direction);
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",
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) if (str && sscanf(str, "%u", &self->control_port) != 1)
return FALSE; return FALSE;
...@@ -299,7 +290,6 @@ on_node_enum_format_done (WpPipewireObject * proxy, GAsyncResult * res, ...@@ -299,7 +290,6 @@ on_node_enum_format_done (WpPipewireObject * proxy, GAsyncResult * res,
WpSiAudioAdapter *self = wp_transition_get_source_object (transition); WpSiAudioAdapter *self = wp_transition_get_source_object (transition);
g_autoptr (WpIterator) formats = NULL; g_autoptr (WpIterator) formats = NULL;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
gint pref_chan;
formats = wp_pipewire_object_enum_params_finish (proxy, res, &error); formats = wp_pipewire_object_enum_params_finish (proxy, res, &error);
if (error) { if (error) {
...@@ -309,9 +299,7 @@ on_node_enum_format_done (WpPipewireObject * proxy, GAsyncResult * res, ...@@ -309,9 +299,7 @@ on_node_enum_format_done (WpPipewireObject * proxy, GAsyncResult * res,
/* 34 is the max number of channels that SPA knows about /* 34 is the max number of channels that SPA knows about
in the spa_audio_channel enum */ in the spa_audio_channel enum */
pref_chan = self->preferred_n_channels ? self->preferred_n_channels : 34; if (!choose_sensible_raw_audio_format (formats, 34, &self->format)) {
if (!choose_sensible_raw_audio_format (formats, pref_chan, &self->format)) {
wp_warning_object (self, "failed to choose a sensible audio format"); wp_warning_object (self, "failed to choose a sensible audio format");
wp_transition_return_error (transition, wp_transition_return_error (transition,
g_error_new (WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED, g_error_new (WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED,
......
...@@ -175,7 +175,6 @@ on_node_added (WpObjectManager * om, WpNode *node, AppData * d) ...@@ -175,7 +175,6 @@ on_node_added (WpObjectManager * om, WpNode *node, AppData * d)
/* and configure it */ /* and configure it */
wp_properties_setf (props, "node", "%p", node); wp_properties_setf (props, "node", "%p", node);
wp_properties_setf (props, "session", "%p", d->session); wp_properties_setf (props, "session", "%p", d->session);
wp_properties_setf (props, "preferred-n-channels", "%u", 2);
if (!wp_session_item_configure (item, g_steal_pointer (&props))) { if (!wp_session_item_configure (item, g_steal_pointer (&props))) {
g_printerr ("Failed to configure session item\n"); g_printerr ("Failed to configure session item\n");
g_main_loop_quit (d->loop); g_main_loop_quit (d->loop);
......
...@@ -91,9 +91,6 @@ test_si_audio_adapter_configure_activate (TestFixture * f, ...@@ -91,9 +91,6 @@ test_si_audio_adapter_configure_activate (TestFixture * f,
str = wp_properties_get (props, "direction"); str = wp_properties_get (props, "direction");
g_assert_nonnull (str); g_assert_nonnull (str);
g_assert_cmpstr ("1", ==, str); g_assert_cmpstr ("1", ==, str);
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_nonnull (str);
g_assert_cmpstr ("0", ==, str); g_assert_cmpstr ("0", ==, str);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment