mirror of
https://github.com/mpv-player/mpv
synced 2024-12-26 17:12:36 +00:00
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.
This commit is contained in:
parent
a09396ee60
commit
87db2f24e8
@ -232,6 +232,7 @@ static void build_timeline(struct timeline *tl)
|
||||
tl->num_chapters = track_count;
|
||||
MP_TARRAY_APPEND(tl, tl->pars, tl->num_pars, par);
|
||||
tl->meta = par->track_layout;
|
||||
tl->format = "cue";
|
||||
|
||||
out:
|
||||
talloc_free(ctx);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -630,4 +630,5 @@ void build_ordered_chapter_timeline(struct timeline *tl)
|
||||
tl->chapters = chapters;
|
||||
tl->num_chapters = m->num_ordered_chapters;
|
||||
tl->meta = track_layout;
|
||||
tl->format = "mkv_oc";
|
||||
}
|
||||
|
@ -466,8 +466,8 @@ static int d_open(struct demuxer *demuxer, enum demux_check check)
|
||||
demuxer->seekable = true;
|
||||
demuxer->partially_seekable = false;
|
||||
|
||||
demuxer->filetype = talloc_asprintf(p, "edl/%s%s",
|
||||
p->sources[0]->dash ? "dash/" : "",
|
||||
demuxer->filetype = talloc_asprintf(p, "%s/%s",
|
||||
p->tl->format,
|
||||
meta->filetype ? meta->filetype : meta->desc->name);
|
||||
|
||||
reselect_streams(demuxer);
|
||||
|
@ -16,6 +16,7 @@ struct timeline *timeline_load(struct mpv_global *global, struct mp_log *log,
|
||||
.log = log,
|
||||
.cancel = demuxer->cancel,
|
||||
.demuxer = demuxer,
|
||||
.format = "unknown",
|
||||
};
|
||||
|
||||
demuxer->desc->load_timeline(tl);
|
||||
|
@ -35,6 +35,8 @@ struct timeline {
|
||||
struct mp_log *log;
|
||||
struct mp_cancel *cancel;
|
||||
|
||||
const char *format;
|
||||
|
||||
// main source, and all other sources (this usually only has special meaning
|
||||
// for memory management; mostly compensates for the lack of refcounting)
|
||||
struct demuxer *demuxer;
|
||||
|
Loading…
Reference in New Issue
Block a user