edl: make it possible to set the track "default" flag

Also, the forced flag (and in the future, potentially a number of other
flags not implemented yet). See next commit for purpose.
This commit is contained in:
wm4 2020-02-21 14:16:26 +01:00
parent 1cda73356d
commit a77780e6be
2 changed files with 22 additions and 0 deletions

View File

@ -277,6 +277,17 @@ This has the following parameters:
Above also applies for similar fields such as ``w``. These fields are
mostly to help with user track pre-selection.
``flags``
A ``+`` separated list of boolean flags. Currently defined flags:
``default``
Set the default track flag.
``forced``
Set the forced track flag.
Other values are ignored after triggering a warning.
``w``, ``h``
For video codecs: expected video size. See ``codec`` for details.

View File

@ -241,6 +241,17 @@ static struct tl_root *parse_edl(bstr str, struct mp_log *log)
sh->lang = get_param0(&ctx, sh, "lang");
sh->title = get_param0(&ctx, sh, "title");
sh->hls_bitrate = get_param_int(&ctx, "byterate", 0) * 8;
bstr flags = get_param(&ctx, "flags");
bstr flag;
while (bstr_split_tok(flags, "+", &flag, &flags) || flag.len) {
if (bstr_equals0(flag, "default")) {
sh->default_track = true;
} else if (bstr_equals0(flag, "forced")) {
sh->forced_track = true;
} else {
mp_warn(log, "Unknown flag: '%.*s'\n", BSTR_P(flag));
}
}
} else if (bstr_equals0(f_type, "delay_open")) {
struct sh_stream *sh = get_meta(tl, tl->num_sh_meta);
bstr mt = get_param(&ctx, "media_type");