diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 3423d737ec..c04b62a422 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -34,6 +34,8 @@ Interface changes - remove the --stream-capture option and property. No replacement. - add --sub-justify - add --sub-ass-justify + - internally there's a different way to enable the demuxer cache now + it can be auto-enabled even if the stream cache remains disabled --- mpv 0.23.0 --- - remove deprecated vf_vdpaurb (use "--hwdec=vdpau-copy" instead) - the following properties now have new semantics: diff --git a/demux/demux.c b/demux/demux.c index 5e43a38d81..d21b20910a 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1263,9 +1263,6 @@ static struct demuxer *open_given_type(struct mpv_global *global, pthread_mutex_init(&in->lock, NULL); pthread_cond_init(&in->wakeup, NULL); - if (stream->caching) - in->min_secs = MPMAX(in->min_secs, opts->min_secs_cache); - *in->d_thread = *demuxer; *in->d_buffer = *demuxer; @@ -1314,11 +1311,15 @@ static struct demuxer *open_given_type(struct mpv_global *global, struct demuxer *sub = open_given_type(global, log, &demuxer_desc_timeline, stream, ¶ms2, DEMUX_CHECK_FORCE); - if (sub) - return sub; - timeline_destroy(tl); + if (sub) { + demuxer = sub; + } else { + timeline_destroy(tl); + } } } + if (demuxer->is_network || stream->caching) + in->min_secs = MPMAX(in->min_secs, opts->min_secs_cache); return demuxer; } diff --git a/demux/demux_edl.c b/demux/demux_edl.c index 240c224ab7..65a18a1a41 100644 --- a/demux/demux_edl.c +++ b/demux/demux_edl.c @@ -254,6 +254,8 @@ static void build_timeline(struct timeline *tl, struct tl_parts *parts) }; starttime += part->length; + + tl->demuxer->is_network |= source->is_network; } tl->parts[parts->num_parts] = (struct timeline_part) {.start = starttime}; tl->num_parts = parts->num_parts; diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c index 8784dcf8f6..afd7eb5247 100644 --- a/demux/demux_timeline.c +++ b/demux/demux_timeline.c @@ -352,6 +352,8 @@ static int d_open(struct demuxer *demuxer, enum demux_check check) demuxer->filetype = meta->filetype ? meta->filetype : meta->desc->name; + demuxer->is_network = p->tl->demuxer->is_network; + reselect_streams(demuxer); return 0; diff --git a/player/osd.c b/player/osd.c index 2b95a10705..75f4cdcf7b 100644 --- a/player/osd.c +++ b/player/osd.c @@ -262,7 +262,7 @@ static void term_osd_print_status_lazy(struct MPContext *mpctx) if (mpctx->demuxer) { struct stream_cache_info info = {0}; demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_INFO, &info); - if (info.size > 0) { + if (info.size > 0 || mpctx->demuxer->is_network) { saddf(&line, " Cache: "); struct demux_ctrl_reader_state s = {.ts_duration = -1}; @@ -273,10 +273,12 @@ static void term_osd_print_status_lazy(struct MPContext *mpctx) } else { saddf(&line, "%2ds", (int)s.ts_duration); } - if (info.fill >= 1024 * 1024) { - saddf(&line, "+%lldMB", (long long)(info.fill / 1024 / 1024)); - } else { - saddf(&line, "+%lldKB", (long long)(info.fill / 1024)); + if (info.size > 0) { + if (info.fill >= 1024 * 1024) { + saddf(&line, "+%lldMB", (long long)(info.fill / 1024 / 1024)); + } else { + saddf(&line, "+%lldKB", (long long)(info.fill / 1024)); + } } } }