From b822faa6cfdae2c530d68f257a811c6184d237a6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 16 Aug 2014 17:07:36 +0200 Subject: demux: add option to control the readahead buffer by a duration value --demuxer-readahead-secs now controls how much the demuxer should readahead by an amount of seconds. This is based on the raw packet timestamps. It's not always very exact. For example, h264 in Matroska does not store any linear timestamps (only PTS values which are going to be reordered by the decoder), so this heuristic is usually off by several hundred milliseconds. The decision whether to readahead is basically OR-ed with the other --demuxer-readahead-packets options. Change the manpage descriptions to subtly convey these semantics. --- options/options.c | 2 ++ options/options.h | 1 + 2 files changed, 3 insertions(+) (limited to 'options') diff --git a/options/options.c b/options/options.c index aacb1b725a..c96f6578b6 100644 --- a/options/options.c +++ b/options/options.c @@ -216,6 +216,7 @@ const m_option_t mp_opts[] = { OPT_STRING("audio-demuxer", audio_demuxer_name, 0), OPT_STRING("sub-demuxer", sub_demuxer_name, 0), OPT_FLAG("demuxer-thread", demuxer_thread, 0), + OPT_DOUBLE("demuxer-readahead-secs", demuxer_min_secs, M_OPT_MIN, .min = 0), OPT_INTRANGE("demuxer-readahead-packets", demuxer_min_packs, 0, 0, MAX_PACKS), OPT_INTRANGE("demuxer-readahead-bytes", demuxer_min_bytes, 0, 0, MAX_PACK_BYTES), @@ -600,6 +601,7 @@ const struct MPOpts mp_default_opts = { .demuxer_thread = 0, .demuxer_min_packs = MIN_PACKS, .demuxer_min_bytes = MIN_PACK_BYTES, + .demuxer_min_secs = 0.2, .network_rtsp_transport = 2, .chapterrange = {-1, -1}, .edition_id = -1, diff --git a/options/options.h b/options/options.h index 65007bd22e..7b3bf4b69d 100644 --- a/options/options.h +++ b/options/options.h @@ -184,6 +184,7 @@ typedef struct MPOpts { int demuxer_thread; int demuxer_min_packs; int demuxer_min_bytes; + double demuxer_min_secs; char *audio_demuxer_name; char *sub_demuxer_name; int mkv_subtitle_preroll; -- cgit v1.2.3