diff options
author | wm4 <wm4@nowhere> | 2020-01-02 23:31:02 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-01-02 23:31:02 +0100 |
commit | 99700bc52c1317716fcbaeaaf01baad121837aa4 (patch) | |
tree | a4f6295941c9dad269f491631e6bf31c0f05dc68 /demux | |
parent | daa125cb459f75378905673e2f8ee8d9341d19e6 (diff) | |
download | mpv-99700bc52c1317716fcbaeaaf01baad121837aa4.tar.bz2 mpv-99700bc52c1317716fcbaeaaf01baad121837aa4.tar.xz |
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 0e98b2ad8ec accidentally broke this.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_edl.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/demux/demux_edl.c b/demux/demux_edl.c index 36e74de5a6..9d276732fe 100644 --- a/demux/demux_edl.c +++ b/demux/demux_edl.c @@ -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; |