mpv/demux
wm4 f37f4de849 stream: turn into a ring buffer, make size configurable
In some corner cases (see #6802), it can be beneficial to use a larger
stream buffer size. Use this as argument to rewrite everything for no
reason.

Turn stream.c itself into a ring buffer, with configurable size. The
latter would have been easily achievable with minimal changes, and the
ring buffer is the hard part. There is no reason to have a ring buffer
at all, except possibly if ffmpeg don't fix their awful mp4 demuxer, and
some subtle issues with demux_mkv.c wanting to seek back by small
offsets (the latter was handled with small stream_peek() calls, which
are unneeded now).

In addition, this turns small forward seeks into reads (where data is
simply skipped). Before this commit, only stream_skip() did this (which
also mean that stream_skip() simply calls stream_seek() now).

Replace all stream_peek() calls with something else (usually
stream_read_peek()). The function was a problem, because it returned a
pointer to the internal buffer, which is now a ring buffer with
wrapping. The new function just copies the data into a buffer, and in
some cases requires callers to dynamically allocate memory. (The most
common case, demux_lavf.c, required a separate buffer allocation anyway
due to FFmpeg "idiosyncrasies".) This is the bulk of the demuxer_*
changes.

I'm not happy with this. There still isn't a good reason why there
should be a ring buffer, that is complex, and most of the time just
wastes half of the available memory. Maybe another rewrite soon.

It also contains bugs; you're an alpha tester now.
2019-11-06 21:36:02 +01:00
..
cache.c demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
cache.h demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
codec_tags.c codec_tags: fix wrong buffer size 2019-07-03 17:47:24 +03:00
codec_tags.h
cue.c demux: support cue sheets longer than 100 minutes 2019-04-01 23:39:08 +02:00
cue.h
demux.c demux: unconditionally reposition stream to start before opening 2019-11-06 21:35:32 +01:00
demux.h demux: restore some of the DVD/BD/CDDA interaction layers 2019-10-03 00:22:18 +02:00
demux_cue.c stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00
demux_disc.c stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00
demux_edl.c stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00
demux_lavf.c stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00
demux_libarchive.c stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00
demux_mf.c demux: return packets directly from demuxer instead of using sh_stream 2019-09-19 20:37:04 +02:00
demux_mkv.c stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00
demux_mkv_timeline.c demux_edl, cue, mkv: slightly nicer file format indication 2019-09-19 20:37:04 +02:00
demux_null.c
demux_playlist.c stream: turn into a ring buffer, make size configurable 2019-11-06 21:36:02 +01:00
demux_raw.c demux_raw: fix operation with demuxer cache and backward playback 2019-09-19 20:37:04 +02:00
demux_timeline.c demux_timeline, demux_edl: correctly enable cache in pseudo-DASH mode 2019-10-08 23:55:05 +02:00
ebml.c
ebml.h
matroska.h
packet.c packet: fix theoretical UB if called on "empty" packets 2019-09-19 20:37:05 +02:00
packet.h demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
stheader.h video, demux: rip out unused spherical metadata code 2019-10-17 22:49:26 +02:00
timeline.c demux_edl, cue, mkv: slightly nicer file format indication 2019-09-19 20:37:04 +02:00
timeline.h demux_timeline, demux_edl: correctly enable cache in pseudo-DASH mode 2019-10-08 23:55:05 +02:00