aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/oggflac_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/oggflac_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 'src/inputPlugins/oggflac_plugin.c')
-rw-r--r--src/inputPlugins/oggflac_plugin.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c
index 87444d261..d3016c9a2 100644
--- a/src/inputPlugins/oggflac_plugin.c
+++ b/src/inputPlugins/oggflac_plugin.c
@@ -327,6 +327,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;
}