mirror of
https://github.com/mpv-player/mpv
synced 2025-01-31 04:02:06 +00:00
demux_y4m: fix failure with nonseekable input
Playback of nonseekable y4m streams was broken by a change merged from svn, r30970 which added support for multiple yuv4mpeg files concatenated together. The change included a stream_skip(stream, -1) call which only works for seekable files. Work around this by disabling the concatenated-file check for nonseekable streams. This means concatenated files are only supported if the stream is seekable, but this is an improvement compared to the svn commit which caused a regression making _all_ files fail in the nonseekable case. It would be reasonably easy to make the concatenation support work in all cases, either by modifying demux_y4m or (probably better) adding a general stream API to allow pushing back the read byte. However for now I'm only fixing the regression with the above trivial change.
This commit is contained in:
parent
f38efd166e
commit
035611f0a7
@ -31,7 +31,7 @@
|
||||
#include "mp_msg.h"
|
||||
#include "yuv4mpeg.h"
|
||||
|
||||
//#include "stream/stream.h"
|
||||
#include "stream/stream.h"
|
||||
#include "demuxer.h"
|
||||
#include "stheader.h"
|
||||
|
||||
@ -89,11 +89,14 @@ static int demux_y4m_fill_buffer(demuxer_t *demux, demux_stream_t *dsds) {
|
||||
int err, size;
|
||||
int nextc;
|
||||
|
||||
nextc = stream_read_char(demux->stream);
|
||||
stream_skip(demux->stream, -1);
|
||||
if (nextc == 'Y') {
|
||||
read_streaminfo(demux);
|
||||
demux->seekable = 0;
|
||||
// Concatenated stream check; only done if seekable so skip(-1) works
|
||||
if (demux->stream->flags & MP_STREAM_SEEK_BW) {
|
||||
nextc = stream_read_char(demux->stream);
|
||||
stream_skip(demux->stream, -1);
|
||||
if (nextc == 'Y') {
|
||||
read_streaminfo(demux);
|
||||
demux->seekable = 0;
|
||||
}
|
||||
}
|
||||
|
||||
y4m_init_frame_info(&fi);
|
||||
|
Loading…
Reference in New Issue
Block a user