aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/oggvorbis_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-10 15:07:01 +0100
committerMax Kellermann <max@duempel.org>2008-11-10 15:07:01 +0100
commitff1acefb2115252cb27f0d0dc6219a527e258049 (patch)
treef264bf133731dfb33d0da8bb3438351f6bed570a /src/decoder/oggvorbis_plugin.c
parent10eea9d9815c37077d0d0bde98ae4daeed3d101b (diff)
downloadmpd-ff1acefb2115252cb27f0d0dc6219a527e258049.tar.gz
mpd-ff1acefb2115252cb27f0d0dc6219a527e258049.tar.xz
mpd-ff1acefb2115252cb27f0d0dc6219a527e258049.zip
decoder: removed plugin method try_decode()
Instead of having a seprate try_decode() method, let the stream_decode() and file_decode() methods decide whether they are able to decode the song.
Diffstat (limited to 'src/decoder/oggvorbis_plugin.c')
-rw-r--r--src/decoder/oggvorbis_plugin.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index 32660c2c0..cc6f8f119 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -214,6 +214,13 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
const char *errorStr;
bool initialized = false;
+ if (ogg_stream_type_detect(inStream) != VORBIS)
+ return false;
+
+ /* rewind the stream, because ogg_stream_type_detect() has
+ moved it */
+ input_stream_seek(inStream, 0, SEEK_SET);
+
data.inStream = inStream;
data.decoder = decoder;
@@ -351,12 +358,6 @@ static struct tag *oggvorbis_TagDup(const char *file)
return ret;
}
-static bool
-oggvorbis_try_decode(struct input_stream *inStream)
-{
- return ogg_stream_type_detect(inStream) == VORBIS;
-}
-
static const char *const oggvorbis_Suffixes[] = { "ogg","oga", NULL };
static const char *const oggvorbis_MimeTypes[] = {
"application/ogg",
@@ -367,7 +368,6 @@ static const char *const oggvorbis_MimeTypes[] = {
const struct decoder_plugin oggvorbisPlugin = {
.name = "oggvorbis",
- .try_decode = oggvorbis_try_decode,
.stream_decode = oggvorbis_decode,
.tag_dup = oggvorbis_TagDup,
.suffixes = oggvorbis_Suffixes,