summaryrefslogtreecommitdiffstats
path: root/demux/demux_edl.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-01-11 14:10:41 +0100
committerwm4 <wm4@nowhere>2019-09-19 20:37:04 +0200
commit87db2f24e8eca23664dc23128b8fca2b5d07125d (patch)
treefe6250c363bad702b064533f21ccdea49890ee3f /demux/demux_edl.c
parenta09396ee609af71f49f70521320e87989577b577 (diff)
downloadmpv-87db2f24e8eca23664dc23128b8fca2b5d07125d.tar.bz2
mpv-87db2f24e8eca23664dc23128b8fca2b5d07125d.tar.xz
demux_edl, cue, mkv: slightly nicer file format indication
Instead of just using "edl/" for the file format, report mkv_oc if it's generated from ordered chapters, "cue/" if from .cue, "multi/" if it's from EDL but only for adding separate streams, "dash/" if it's from EDL but only using the DASH hack, and "edl/" for everything else. The EDL variants are mostly special-cased to the variants the ytdl wrapper usually generates. This has no effect other than what the command.c file-format property returns.
Diffstat (limited to 'demux/demux_edl.c')
-rw-r--r--demux/demux_edl.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/demux/demux_edl.c b/demux/demux_edl.c
index 1f27a971a9..27c1a527f9 100644
--- a/demux/demux_edl.c
+++ b/demux/demux_edl.c
@@ -252,7 +252,8 @@ static void resolve_timestamps(struct tl_part *part, struct demuxer *demuxer)
part->offset = demuxer->start_time;
}
-static bool build_timeline(struct timeline *root, struct tl_parts *parts)
+static struct timeline_par *build_timeline(struct timeline *root,
+ struct tl_parts *parts)
{
struct timeline_par *tl = talloc_zero(root, struct timeline_par);
MP_TARRAY_APPEND(root, root->pars, root->num_pars, tl);
@@ -365,11 +366,11 @@ static bool build_timeline(struct timeline *root, struct tl_parts *parts)
root->meta = tl->track_layout;
tl->num_parts = parts->num_parts;
- return true;
+ return tl;
error:
root->num_pars = 0;
- return false;
+ return NULL;
}
// For security, don't allow relative or absolute paths, only plain filenames.
@@ -394,13 +395,30 @@ static void build_mpv_edl_timeline(struct timeline *tl)
return;
}
+ bool all_dash = true;
+ bool all_no_clip = true;
+ bool all_single = true;
+
for (int n = 0; n < root->num_pars; n++) {
struct tl_parts *parts = root->pars[n];
if (!p->allow_any)
fix_filenames(parts, tl->demuxer->filename);
- if (!build_timeline(tl, parts))
+ struct timeline_par *par = build_timeline(tl, parts);
+ if (!par)
break;
+ all_dash &= par->dash;
+ all_no_clip &= par->no_clip;
+ all_single &= par->num_parts == 1;
}
+
+ if (all_dash) {
+ tl->format = "dash";
+ } else if (all_no_clip && all_single) {
+ tl->format = "multi";
+ } else {
+ tl->format = "edl";
+ }
+
talloc_free(root);
}