oggvorbis: don't detect OGG header if stream is not seekable
If the input stream is not seekable, the try_decode() function consumes valuable data, which is not available to the decode() function anymore. This means that the decode() function does not parse the header correctly. Better skip the detection if we cannot seek. Or implement better buffering, something like unread() or buffered rewind().
This commit is contained in:
parent
7bbca0842d
commit
a1b430cb88
@ -328,6 +328,11 @@ static MpdTag *oggflac_TagDup(char *file)
|
||||
|
||||
static unsigned int oggflac_try_decode(InputStream * inStream)
|
||||
{
|
||||
if (!inStream->seekable)
|
||||
/* we cannot seek after the detection, so don't bother
|
||||
checking */
|
||||
return 1;
|
||||
|
||||
return (ogg_stream_type_detect(inStream) == FLAC) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
@ -372,6 +372,11 @@ static MpdTag *oggvorbis_TagDup(char *file)
|
||||
|
||||
static unsigned int oggvorbis_try_decode(InputStream * inStream)
|
||||
{
|
||||
if (!inStream->seekable)
|
||||
/* we cannot seek after the detection, so don't bother
|
||||
checking */
|
||||
return 1;
|
||||
|
||||
return (ogg_stream_type_detect(inStream) == VORBIS) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user