summaryrefslogtreecommitdiffstats
path: root/timeline
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-08-04 08:38:39 +0300
committerUoti Urpala <uau@mplayer2.org>2011-08-04 08:38:39 +0300
commit0ece360eeaf95f2c33df2c0177cb98ffd5fc0338 (patch)
tree3717c71405b255342f75008b8d357f421f9f24f0 /timeline
parent1f3ad329601486e2e2e36ddef4d79f0f486ddc99 (diff)
downloadmpv-0ece360eeaf95f2c33df2c0177cb98ffd5fc0338.tar.bz2
mpv-0ece360eeaf95f2c33df2c0177cb98ffd5fc0338.tar.xz
demux_mkv: skip files faster in ordered chapter file search
Ordered chapter code tries opening files to find those matching the SegmentUID values specified in the timeline. Previously this scan did a full initialization of the Matroska demuxer for each file, then checked whether the UID value in the demuxer was a match. Make the scan code instead provide a list of searched-for UIDs to the demuxer open code, and make that do a comparison against the list as soon as it sees the UID in the file, aborting if there is no match. Also fix units used in "Merging timeline part" verbose message.
Diffstat (limited to 'timeline')
-rw-r--r--timeline/tl_matroska.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/timeline/tl_matroska.c b/timeline/tl_matroska.c
index 6912bac159..967ee556ae 100644
--- a/timeline/tl_matroska.c
+++ b/timeline/tl_matroska.c
@@ -112,10 +112,12 @@ static int find_ordered_chapter_sources(struct MPContext *mpctx,
struct stream *s = open_stream(filenames[i], &mpctx->opts, &format);
if (!s)
continue;
- struct demuxer *d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_MATROSKA,
- mpctx->opts.audio_id,
- mpctx->opts.video_id,
- mpctx->opts.sub_id, filenames[i]);
+ struct demuxer *d = demux_open_withparams(&mpctx->opts, s,
+ DEMUXER_TYPE_MATROSKA, mpctx->opts.audio_id,
+ mpctx->opts.video_id, mpctx->opts.sub_id, filenames[i],
+ &(struct demuxer_params){.matroska_wanted_uids = uid_map});
+
+
if (!d) {
free_stream(s);
continue;
@@ -176,7 +178,8 @@ void build_ordered_chapter_timeline(struct MPContext *mpctx)
m->num_ordered_chapters+1);
sources[0].stream = mpctx->stream;
sources[0].demuxer = mpctx->demuxer;
- unsigned char uid_map[m->num_ordered_chapters+1][16];
+ unsigned char (*uid_map)[16] = talloc_array_ptrtype(NULL, uid_map,
+ m->num_ordered_chapters + 1);
int num_sources = 1;
memcpy(uid_map[0], m->segment_uid, 16);
@@ -241,7 +244,7 @@ void build_ordered_chapter_timeline(struct MPContext *mpctx)
/* Chapter was merged at an inexact boundary;
* adjust timestamps to match. */
mp_msg(MSGT_CPLAYER, MSGL_V, "Merging timeline part %d with "
- "offset %d ms.\n", i, (int) join_diff);
+ "offset %g ms.\n", i, join_diff / 1e6);
starttime += join_diff;
}
chapters[num_chapters].start = starttime / 1e9;
@@ -250,6 +253,7 @@ void build_ordered_chapter_timeline(struct MPContext *mpctx)
num_chapters++;
}
timeline[part_count].start = starttime / 1e9;
+ talloc_free(uid_map);
if (!part_count) {
// None of the parts come from the file itself???