diff --git a/modules/module-config-policy/parser-streams.c b/modules/module-config-policy/parser-streams.c index 46e7caf3..b1c718aa 100644 --- a/modules/module-config-policy/parser-streams.c +++ b/modules/module-config-policy/parser-streams.c @@ -31,6 +31,21 @@ wp_parser_streams_find_stream (const struct WpParserStreamsData *data, return NULL; } +const struct WpParserStreamsStreamData * +wp_parser_streams_get_lowest_stream (const struct WpParserStreamsData *data) +{ + const struct WpParserStreamsStreamData *res = NULL; + guint lowest = G_MAXUINT; + for (guint i = 0; i < data->n_streams; i++) { + const struct WpParserStreamsStreamData *s = data->streams + i; + if (s->priority < lowest) { + lowest = s->priority; + res = s; + } + } + return res; +} + static void wp_parser_streams_config_parser_init (gpointer iface, gpointer iface_data); diff --git a/modules/module-config-policy/parser-streams.h b/modules/module-config-policy/parser-streams.h index 79dba324..75c6209b 100644 --- a/modules/module-config-policy/parser-streams.h +++ b/modules/module-config-policy/parser-streams.h @@ -32,6 +32,8 @@ struct WpParserStreamsData { /* Helpers */ const struct WpParserStreamsStreamData *wp_parser_streams_find_stream ( const struct WpParserStreamsData *data, const char *name); +const struct WpParserStreamsStreamData *wp_parser_streams_get_lowest_stream ( + const struct WpParserStreamsData *data); #define WP_TYPE_PARSER_STREAMS (wp_parser_streams_get_type ()) G_DECLARE_FINAL_TYPE (WpParserStreams, wp_parser_streams,