demux_edl: restore relative path resolution

Playing e.g. "dir/f.edl" should make all non-absolute paths in f.edl
relative to "dir".

Commit 0e98b2ad8e accidentally broke this.
This commit is contained in:
wm4 2020-01-02 23:31:02 +01:00
parent daa125cb45
commit 99700bc52c
1 changed files with 12 additions and 0 deletions

View File

@ -397,6 +397,17 @@ error:
return NULL;
}
static void fix_filenames(struct tl_parts *parts, char *source_path)
{
if (bstr_equals0(mp_split_proto(bstr0(source_path), NULL), "edl"))
return;
struct bstr dirname = mp_dirname(source_path);
for (int n = 0; n < parts->num_parts; n++) {
struct tl_part *part = &parts->parts[n];
part->filename = mp_path_join_bstr(parts, dirname, bstr0(part->filename));
}
}
static void build_mpv_edl_timeline(struct timeline *tl)
{
struct priv *p = tl->demuxer->priv;
@ -413,6 +424,7 @@ static void build_mpv_edl_timeline(struct timeline *tl)
for (int n = 0; n < root->num_pars; n++) {
struct tl_parts *parts = root->pars[n];
fix_filenames(parts, tl->demuxer->filename);
struct timeline_par *par = build_timeline(tl, parts);
if (!par)
break;