diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:13 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:13 +0200 |
commit | a1b430cb882cc00cf2e0f0f7b650a39acc125c8e (patch) | |
tree | 01091840c4d01d3b5f741ea14d51973169e4c56c /src/inputPlugins/oggflac_plugin.c | |
parent | 7bbca0842de3947bf5a9a9897fd7d6c63a1eb6ec (diff) | |
download | mpd-a1b430cb882cc00cf2e0f0f7b650a39acc125c8e.tar.gz mpd-a1b430cb882cc00cf2e0f0f7b650a39acc125c8e.tar.xz mpd-a1b430cb882cc00cf2e0f0f7b650a39acc125c8e.zip |
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().
Diffstat (limited to 'src/inputPlugins/oggflac_plugin.c')
-rw-r--r-- | src/inputPlugins/oggflac_plugin.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 8209c069a..637e4ac5f 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -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; } |