diff options
author | wm4 <wm4@nowhere> | 2020-07-09 12:29:22 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-07-09 12:29:22 +0200 |
commit | 06033df715b433d41b1a0855cf7805ff8f66d664 (patch) | |
tree | 6ecca1a978736238cc05db57643aea1d95cce1dd /stream/stream.c | |
parent | adbd28b1dbe256dda82a6154b0ba2cf118c742d5 (diff) | |
download | mpv-06033df715b433d41b1a0855cf7805ff8f66d664.tar.bz2 mpv-06033df715b433d41b1a0855cf7805ff8f66d664.tar.xz |
demux_lavf: workaround reading gif from unseekable streams
FFmpeg, being the pile of trash as usual, recently broke this. Add our
own trash hack to trashily workaround this shit.
Fixes: #7893
Diffstat (limited to 'stream/stream.c')
-rw-r--r-- | stream/stream.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/stream/stream.c b/stream/stream.c index 8361cd8748..3c728eacac 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -611,11 +611,19 @@ int stream_read(stream_t *s, void *mem, int total) return total; } +// Read ahead so that at least forward_size bytes are readable ahead. Returns +// the actual forward amount available (restricted by EOF or buffer limits). +int stream_peek(stream_t *s, int forward_size) +{ + while (stream_read_more(s, forward_size)) {} + return s->buf_end - s->buf_cur; +} + // Like stream_read(), but do not advance the current position. This may resize // the buffer to satisfy the read request. int stream_read_peek(stream_t *s, void *buf, int buf_size) { - while (stream_read_more(s, buf_size)) {} + stream_peek(s, buf_size); return ring_copy(s, buf, buf_size, s->buf_cur); } |