diff options
author | wm4 <wm4@nowhere> | 2014-03-25 02:05:48 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-25 02:05:48 +0100 |
commit | 92d7dc9e88a1ec94f048f5d4c0edd077a7d9dd7a (patch) | |
tree | 71edd74fc0c502d3e50394fc4dca9aa56d291505 /player/timeline/tl_mpv_edl.c | |
parent | 2c693a47328a4faa9581a792c24448407629279b (diff) | |
download | mpv-92d7dc9e88a1ec94f048f5d4c0edd077a7d9dd7a.tar.bz2 mpv-92d7dc9e88a1ec94f048f5d4c0edd077a7d9dd7a.tar.xz |
player: remove demuxer chapoter API wrappers
Instead, always use the mpctx->chapters array. Before this commit, this
array was used only for ordered chapters and such, but now it's always
populated if there are chapters.
Diffstat (limited to 'player/timeline/tl_mpv_edl.c')
-rw-r--r-- | player/timeline/tl_mpv_edl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/player/timeline/tl_mpv_edl.c b/player/timeline/tl_mpv_edl.c index 94d46e03a5..277db5b87f 100644 --- a/player/timeline/tl_mpv_edl.c +++ b/player/timeline/tl_mpv_edl.c @@ -157,19 +157,25 @@ static struct demuxer *open_source(struct MPContext *mpctx, char *filename) return d; } +static double demuxer_chapter_time(struct demuxer *demuxer, int n) +{ + if (n < 0 || n >= demuxer->num_chapters) + return -1; + return demuxer->chapters[n].start / 1e9; +} + // Append all chapters from src to the chapters array. // Ignore chapters outside of the given time range. static void copy_chapters(struct chapter **chapters, int *num_chapters, struct demuxer *src, double start, double len, double dest_offset) { - int count = demuxer_chapter_count(src); - for (int n = 0; n < count; n++) { + for (int n = 0; n < src->num_chapters; n++) { double time = demuxer_chapter_time(src, n); if (time >= start && time <= start + len) { struct chapter ch = { .start = dest_offset + time - start, - .name = talloc_steal(*chapters, demuxer_chapter_name(src, n)), + .name = talloc_strdup(*chapters, src->chapters[n].name), }; MP_TARRAY_APPEND(NULL, *chapters, *num_chapters, ch); } |