aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/oggvorbis_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:13 +0200
committerEric Wong <normalperson@yhbt.net>2008-08-30 19:47:56 -0700
commit5136928aef27ae6e81ef56b7f005e04455d35c2f (patch)
treeb3ddc8c03ab30d32739cf1524fa735aaa7e4dc3c /src/inputPlugins/oggvorbis_plugin.c
parentdcd1a83a07d918f1fc69d2062a6be9f1aa396659 (diff)
downloadmpd-5136928aef27ae6e81ef56b7f005e04455d35c2f.tar.gz
mpd-5136928aef27ae6e81ef56b7f005e04455d35c2f.tar.xz
mpd-5136928aef27ae6e81ef56b7f005e04455d35c2f.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 '')
-rw-r--r--src/inputPlugins/oggvorbis_plugin.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c
index 7612b1db5..a28bbc737 100644
--- a/src/inputPlugins/oggvorbis_plugin.c
+++ b/src/inputPlugins/oggvorbis_plugin.c
@@ -362,6 +362,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;
}