modules: remove match priorities from config files and use the filename instead
This commit is contained in:
@@ -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
|
||||
|
@@ -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 {
|
||||
|
@@ -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
|
||||
|
@@ -23,8 +23,8 @@ struct WpParserEndpointLinkEndpointData {
|
||||
};
|
||||
|
||||
struct WpParserEndpointLinkData {
|
||||
char *filename;
|
||||
struct MatchEndpoint {
|
||||
guint priority;
|
||||
struct WpParserEndpointLinkEndpointData endpoint_data;
|
||||
} me;
|
||||
gboolean has_te;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-node]
|
||||
priority = 0
|
||||
properties = [
|
||||
{ name = "media.class", value = "Audio/Sink" },
|
||||
]
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-node]
|
||||
priority = 0
|
||||
properties = [
|
||||
{ name = "media.class", value = "Audio/Source" },
|
||||
]
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-endpoint]
|
||||
priority = 0
|
||||
direction = "sink"
|
||||
media_class = "Stream/Input/Audio"
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-endpoint]
|
||||
priority = 0
|
||||
direction = "source"
|
||||
media_class = "Stream/Output/Audio"
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-node]
|
||||
priority = 0
|
||||
properties = [
|
||||
{ name = "media.class", value = "Stream/Input/Audio" },
|
||||
]
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-node]
|
||||
priority = 0
|
||||
properties = [
|
||||
{ name = "media.class", value = "Stream/Output/Audio" },
|
||||
]
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-node]
|
||||
priority = 1
|
||||
properties = [
|
||||
{ name = "media.class", value = "Audio/Sink" },
|
||||
{ name = "api.alsa.path", value = "hw:0,0" },
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-node]
|
||||
priority = 1
|
||||
properties = [
|
||||
{ name = "media.class", value = "Audio/Source" },
|
||||
{ name = "api.alsa.path", value = "hw:0,0" },
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-node]
|
||||
priority = 70
|
||||
properties = [
|
||||
{ name = "media.class", value = "Audio/Sink" },
|
||||
{ name = "api.alsa.card.driver", value = "USB-Audio" },
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[match-node]
|
||||
priority = 70
|
||||
properties = [
|
||||
{ name = "media.class", value = "Audio/Source" },
|
||||
{ name = "api.alsa.card.driver", value = "USB-Audio" },
|
||||
|
Reference in New Issue
Block a user