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(). ---
src/inputPlugins/oggflac_plugin.c | 5 +++++ src/inputPlugins/oggvorbis_plugin.c | 5 +++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 8209c06..637e4ac 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; } diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index 1dd9f36..4801cb4 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -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; } ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team