mirror of
https://github.com/mpv-player/mpv
synced 2025-01-29 19:22:48 +00:00
player: ordered chapters: filter missing chapters
Ever since someone (not me) added some Matroska features which nobody ever uses (ordered edition or some bullshit), I haven't had a fucking clue what the fuck is going on in this fucking file. (Still agreed to it, so it's my fault.) mplayer2 handled missing chapters correctly (and I suppose in a somewhat clean/simple manner), but the changed code doesn't. Since I can't even follow this code because it's so arcanely complicated, just add a hack that has the same effect.
This commit is contained in:
parent
adf7f0661e
commit
546feebeb9
@ -562,6 +562,9 @@ void build_ordered_chapter_timeline(struct MPContext *mpctx)
|
||||
struct timeline_part *timeline = talloc_array_ptrtype(NULL, timeline, 0);
|
||||
struct demux_chapter *chapters =
|
||||
talloc_zero_array(NULL, struct demux_chapter, m->num_ordered_chapters);
|
||||
// Stupid hack, because fuck everything.
|
||||
for (int n = 0; n < m->num_ordered_chapters; n++)
|
||||
chapters[n].pts = -1;
|
||||
uint64_t starttime = 0;
|
||||
uint64_t missing_time = 0;
|
||||
uint64_t last_end_time = 0;
|
||||
@ -570,6 +573,12 @@ void build_ordered_chapter_timeline(struct MPContext *mpctx)
|
||||
&missing_time, &last_end_time, &timeline,
|
||||
chapters, &part_count, 0, 0);
|
||||
|
||||
// Fuck everything (2): filter out all "unset" chapters.
|
||||
for (int n = m->num_ordered_chapters - 1; n >= 0; n--) {
|
||||
if (chapters[n].pts == -1)
|
||||
MP_TARRAY_REMOVE_AT(chapters, m->num_ordered_chapters, n);
|
||||
}
|
||||
|
||||
if (!part_count) {
|
||||
// None of the parts come from the file itself???
|
||||
talloc_free(sources);
|
||||
|
Loading…
Reference in New Issue
Block a user