Commit 9dac5fda authored by Julian Bouzas's avatar Julian Bouzas
Browse files

parser-streams: add get_lowest_stream API

parent 91e309ba
...@@ -31,6 +31,21 @@ wp_parser_streams_find_stream (const struct WpParserStreamsData *data, ...@@ -31,6 +31,21 @@ wp_parser_streams_find_stream (const struct WpParserStreamsData *data,
return NULL; 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, static void wp_parser_streams_config_parser_init (gpointer iface,
gpointer iface_data); gpointer iface_data);
......
...@@ -32,6 +32,8 @@ struct WpParserStreamsData { ...@@ -32,6 +32,8 @@ struct WpParserStreamsData {
/* Helpers */ /* Helpers */
const struct WpParserStreamsStreamData *wp_parser_streams_find_stream ( const struct WpParserStreamsStreamData *wp_parser_streams_find_stream (
const struct WpParserStreamsData *data, const char *name); 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 ()) #define WP_TYPE_PARSER_STREAMS (wp_parser_streams_get_type ())
G_DECLARE_FINAL_TYPE (WpParserStreams, wp_parser_streams, G_DECLARE_FINAL_TYPE (WpParserStreams, wp_parser_streams,
......
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