diff --git a/modules/module-config-endpoint/parser-endpoint.c b/modules/module-config-endpoint/parser-endpoint.c index d01859d2..a44bc7f8 100644 --- a/modules/module-config-endpoint/parser-endpoint.c +++ b/modules/module-config-endpoint/parser-endpoint.c @@ -33,6 +33,7 @@ wp_parser_endpoint_data_destroy (gpointer p) struct WpParserEndpointData *data = p; /* Free the strings */ + g_clear_pointer (&data->filename, g_free); g_clear_pointer (&data->mn.props, wp_properties_unref); g_clear_pointer (&data->e.name, g_free); g_clear_pointer (&data->e.media_class, g_free); @@ -98,7 +99,6 @@ wp_parser_endpoint_data_new (const gchar *location) /* File format: * ------------ * [match-node] - * priority (uint32) * properties (WpProperties) * * [endpoint] @@ -124,15 +124,14 @@ wp_parser_endpoint_data_new (const gchar *location) /* Create the endpoint data */ res = g_slice_new0(struct WpParserEndpointData); + /* Set the file name */ + res->filename = g_path_get_basename (location); + /* Get the match-node table */ mn = wp_toml_table_get_table (table, "match-node"); if (!mn) goto error; - /* Get the priority from the match-node table */ - res->mn.priority = 0; - wp_toml_table_get_uint32 (mn, "priority", &res->mn.priority); - /* Get the match node properties */ res->mn.props = parse_properties (mn, "properties"); @@ -181,7 +180,7 @@ compare_datas_func (gconstpointer a, gconstpointer b) struct WpParserEndpointData *da = *(struct WpParserEndpointData *const *)a; struct WpParserEndpointData *db = *(struct WpParserEndpointData *const *)b; - return db->mn.priority - da->mn.priority; + return g_strcmp0 (db->filename, da->filename); } static gboolean diff --git a/modules/module-config-endpoint/parser-endpoint.h b/modules/module-config-endpoint/parser-endpoint.h index 13028ac2..a24a41d7 100644 --- a/modules/module-config-endpoint/parser-endpoint.h +++ b/modules/module-config-endpoint/parser-endpoint.h @@ -16,8 +16,8 @@ G_BEGIN_DECLS #define WP_PARSER_ENDPOINT_EXTENSION "endpoint" struct WpParserEndpointData { + char *filename; struct MatchNode { - guint priority; WpProperties *props; } mn; struct Endpoint { diff --git a/modules/module-config-policy/parser-endpoint-link.c b/modules/module-config-policy/parser-endpoint-link.c index 1d726a73..304e2ae1 100644 --- a/modules/module-config-policy/parser-endpoint-link.c +++ b/modules/module-config-policy/parser-endpoint-link.c @@ -79,6 +79,7 @@ wp_parser_endpoint_link_data_destroy (gpointer p) struct WpParserEndpointLinkData *data = p; /* Free the strings */ + g_clear_pointer (&data->filename, g_free); g_clear_pointer (&data->me.endpoint_data.name, g_free); g_clear_pointer (&data->me.endpoint_data.media_class, g_free); g_clear_pointer (&data->me.endpoint_data.props, wp_properties_unref); @@ -144,7 +145,6 @@ wp_parser_endpoint_link_data_new (const gchar *location) /* File format: * ------------ * [match-endpoint] - * priority (uint32) * name (string) * media_class (string) * direction (string) @@ -174,15 +174,14 @@ wp_parser_endpoint_link_data_new (const gchar *location) /* Create the link data */ res = g_slice_new0(struct WpParserEndpointLinkData); + /* Set the file name */ + res->filename = g_path_get_basename (location); + /* Get the match-node table */ me = wp_toml_table_get_table (table, "match-endpoint"); if (!me) goto error; - /* Get the priority from the endpoint table */ - res->me.priority = 0; - wp_toml_table_get_uint32 (me, "priority", &res->me.priority); - /* Get the name from the match endpoint table (Optional) */ res->me.endpoint_data.name = wp_toml_table_get_string (me, "name"); @@ -247,7 +246,7 @@ compare_datas_func (gconstpointer a, gconstpointer b) struct WpParserEndpointLinkData *db = *(struct WpParserEndpointLinkData *const *)b; - return db->me.priority - da->me.priority; + return g_strcmp0 (db->filename, da->filename); } static gboolean diff --git a/modules/module-config-policy/parser-endpoint-link.h b/modules/module-config-policy/parser-endpoint-link.h index 6ffed405..4f36b8c2 100644 --- a/modules/module-config-policy/parser-endpoint-link.h +++ b/modules/module-config-policy/parser-endpoint-link.h @@ -23,8 +23,8 @@ struct WpParserEndpointLinkEndpointData { }; struct WpParserEndpointLinkData { + char *filename; struct MatchEndpoint { - guint priority; struct WpParserEndpointLinkEndpointData endpoint_data; } me; gboolean has_te; diff --git a/src/config/00-audio-sink.endpoint b/src/config/00-audio-sink.endpoint index 4bc43574..dc0e1ec0 100644 --- a/src/config/00-audio-sink.endpoint +++ b/src/config/00-audio-sink.endpoint @@ -1,5 +1,4 @@ [match-node] -priority = 0 properties = [ { name = "media.class", value = "Audio/Sink" }, ] diff --git a/src/config/00-audio-source.endpoint b/src/config/00-audio-source.endpoint index 7657f6f4..4dde2a13 100644 --- a/src/config/00-audio-source.endpoint +++ b/src/config/00-audio-source.endpoint @@ -1,5 +1,4 @@ [match-node] -priority = 0 properties = [ { name = "media.class", value = "Audio/Source" }, ] diff --git a/src/config/00-default-input-audio.endpoint-link b/src/config/00-default-input-audio.endpoint-link index 4b70dc89..fda61f38 100644 --- a/src/config/00-default-input-audio.endpoint-link +++ b/src/config/00-default-input-audio.endpoint-link @@ -1,5 +1,4 @@ [match-endpoint] -priority = 0 direction = "sink" media_class = "Stream/Input/Audio" diff --git a/src/config/00-default-output-audio.endpoint-link b/src/config/00-default-output-audio.endpoint-link index 5d6428f9..076b8833 100644 --- a/src/config/00-default-output-audio.endpoint-link +++ b/src/config/00-default-output-audio.endpoint-link @@ -1,5 +1,4 @@ [match-endpoint] -priority = 0 direction = "source" media_class = "Stream/Output/Audio" diff --git a/src/config/00-stream-input-audio.endpoint b/src/config/00-stream-input-audio.endpoint index 2993f3e4..0ef2c5b7 100644 --- a/src/config/00-stream-input-audio.endpoint +++ b/src/config/00-stream-input-audio.endpoint @@ -1,5 +1,4 @@ [match-node] -priority = 0 properties = [ { name = "media.class", value = "Stream/Input/Audio" }, ] diff --git a/src/config/00-stream-output-audio.endpoint b/src/config/00-stream-output-audio.endpoint index 1cf82ea0..4e86323e 100644 --- a/src/config/00-stream-output-audio.endpoint +++ b/src/config/00-stream-output-audio.endpoint @@ -1,5 +1,4 @@ [match-node] -priority = 0 properties = [ { name = "media.class", value = "Stream/Output/Audio" }, ] diff --git a/src/config/01-hw:0,0-audio-sink.endpoint b/src/config/01-hw:0,0-audio-sink.endpoint index 85a9b511..624d2d04 100644 --- a/src/config/01-hw:0,0-audio-sink.endpoint +++ b/src/config/01-hw:0,0-audio-sink.endpoint @@ -1,5 +1,4 @@ [match-node] -priority = 1 properties = [ { name = "media.class", value = "Audio/Sink" }, { name = "api.alsa.path", value = "hw:0,0" }, diff --git a/src/config/01-hw:0,0-audio-source.endpoint b/src/config/01-hw:0,0-audio-source.endpoint index c77701c0..3341d7ad 100644 --- a/src/config/01-hw:0,0-audio-source.endpoint +++ b/src/config/01-hw:0,0-audio-source.endpoint @@ -1,5 +1,4 @@ [match-node] -priority = 1 properties = [ { name = "media.class", value = "Audio/Source" }, { name = "api.alsa.path", value = "hw:0,0" }, diff --git a/src/config/70-usb-audio-sink.endpoint b/src/config/70-usb-audio-sink.endpoint index 62e27909..805e4a00 100644 --- a/src/config/70-usb-audio-sink.endpoint +++ b/src/config/70-usb-audio-sink.endpoint @@ -1,5 +1,4 @@ [match-node] -priority = 70 properties = [ { name = "media.class", value = "Audio/Sink" }, { name = "api.alsa.card.driver", value = "USB-Audio" }, diff --git a/src/config/70-usb-audio-source.endpoint b/src/config/70-usb-audio-source.endpoint index 505ae8d8..40955892 100644 --- a/src/config/70-usb-audio-source.endpoint +++ b/src/config/70-usb-audio-source.endpoint @@ -1,5 +1,4 @@ [match-node] -priority = 70 properties = [ { name = "media.class", value = "Audio/Source" }, { name = "api.alsa.card.driver", value = "USB-Audio" },