diff options
author | wm4 <wm4@nowhere> | 2015-08-12 11:10:45 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-12 11:11:23 +0200 |
commit | 828881816acbfae0451e038c45e63b6784681daa (patch) | |
tree | 204b590332a95f2e5778a3e184b676e0e719ac4c /demux/demux_mkv_timeline.c | |
parent | c7329e5118d4e26d02f74fed66747392916ceae7 (diff) | |
download | mpv-828881816acbfae0451e038c45e63b6784681daa.tar.bz2 mpv-828881816acbfae0451e038c45e63b6784681daa.tar.xz |
demux: remove redundant demux_chapter.name field
Instead, force everyone to use the metadata struct and set a "title"
field. This is only a problem for the timeline producers, which set up
chapters manually. (They do this because a timeline is a separate
struct.)
This fixes the behavior of the chapter-metadata property, which never
returned a "title" property for e.g. ordered chapters.
Diffstat (limited to 'demux/demux_mkv_timeline.c')
-rw-r--r-- | demux/demux_mkv_timeline.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/demux/demux_mkv_timeline.c b/demux/demux_mkv_timeline.c index e1491b631d..a874f9c6a7 100644 --- a/demux/demux_mkv_timeline.c +++ b/demux/demux_mkv_timeline.c @@ -372,7 +372,8 @@ static void build_timeline_loop(struct tl_ctx *ctx, break; // malformed files can cause this to happen. chapters[i].pts = ctx->start_time / 1e9; - chapters[i].name = talloc_strdup(chapters, c->name); + chapters[i].metadata = talloc_zero(chapters, struct mp_tags); + mp_tags_set_str(chapters[i].metadata, "title", c->name); } /* If we're the source or it's a non-ordered edition reference, @@ -556,9 +557,6 @@ void build_ordered_chapter_timeline(struct timeline *tl) struct demux_chapter *chapters = talloc_zero_array(tl, 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; ctx->timeline = talloc_array_ptrtype(tl, ctx->timeline, 0); ctx->num_chapters = m->num_ordered_chapters; @@ -569,9 +567,9 @@ void build_ordered_chapter_timeline(struct timeline *tl) }; build_timeline_loop(ctx, chapters, &info, 0); - // Fuck everything (2): filter out all "unset" chapters. + // Fuck everything: filter out all "unset" chapters. for (int n = m->num_ordered_chapters - 1; n >= 0; n--) { - if (chapters[n].pts == -1) + if (!chapters[n].metadata) MP_TARRAY_REMOVE_AT(chapters, m->num_ordered_chapters, n); } |