demux_cue: use stream_peek()

This could cause probing failures with unseekable streams. (Although I'm
not perfectly sure why; seeking back should work in this particular
case.)
This commit is contained in:
wm4 2014-11-16 18:13:41 +01:00
parent 613ee8f450
commit 78cbbb4c49
1 changed files with 2 additions and 6 deletions

View File

@ -35,13 +35,9 @@ static int try_open_file(struct demuxer *demuxer, enum demux_check check)
{
struct stream *s = demuxer->stream;
if (check >= DEMUX_CHECK_UNSAFE) {
char buf[PROBE_SIZE];
int len = stream_read(s, buf, sizeof(buf));
if (len <= 0)
bstr d = stream_peek(s, PROBE_SIZE);
if (d.len < 1 || !mp_probe_cue(d))
return -1;
if (!mp_probe_cue((struct bstr) { buf, len }))
return -1;
stream_seek(s, 0);
}
demuxer->file_contents = stream_read_complete(s, demuxer, 1000000);
if (demuxer->file_contents.start == NULL)