aboutsummaryrefslogtreecommitdiffhomepage
path: root/player/timeline
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2014-12-26 19:42:03 +0100
committerGravatar wm4 <wm4@nowhere>2014-12-26 20:10:09 +0100
commit546feebeb953954d9fbce0f77d9ff743da1ddbf6 (patch)
treefee27afeea0f017239d2657aa62342b77994b1f5 /player/timeline
parentadf7f0661ec7b6c83a3a82478f28967e7a96d298 (diff)
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.
Diffstat (limited to 'player/timeline')
-rw-r--r--player/timeline/tl_matroska.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/player/timeline/tl_matroska.c b/player/timeline/tl_matroska.c
index e97a8ce594..0242623037 100644
--- a/player/timeline/tl_matroska.c
+++ b/player/timeline/tl_matroska.c
@@ -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);