decoder: rewind input stream after try_decode()
The try_decode() method may have read some data from the stream, which is now lost. To make this data available to other methods, get it back by rewinding the input stream after each try_decode() invocation. The ogg and wavpack plugins did this manually and inconsistently; this code can now be removed.
This commit is contained in:
@@ -30,13 +30,7 @@ ogg_stream_type ogg_stream_type_detect(struct input_stream *inStream)
|
||||
unsigned char buf[41];
|
||||
size_t r;
|
||||
|
||||
input_stream_seek(inStream, 0, SEEK_SET);
|
||||
|
||||
r = decoder_read(NULL, inStream, buf, sizeof(buf));
|
||||
|
||||
if (r > 0)
|
||||
input_stream_seek(inStream, 0, SEEK_SET);
|
||||
|
||||
if (r >= 32 && memcmp(buf, "OggS", 4) == 0 && (
|
||||
(memcmp(buf+29, "FLAC", 4) == 0
|
||||
&& memcmp(buf+37, "fLaC", 4) == 0)
|
||||
|
||||
Reference in New Issue
Block a user