mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-15 08:08:07 +02:00
parser-streams: add get_lowest_stream API
This commit is contained in:
parent
91e309bad0
commit
9dac5fdaf5
2 changed files with 17 additions and 0 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue