diff options
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/ffmpeg_plugin.c | 7 | ||||
-rw-r--r-- | src/decoder/flac_plugin.c | 14 | ||||
-rw-r--r-- | src/decoder/oggvorbis_plugin.c | 14 |
3 files changed, 14 insertions, 21 deletions
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index 41eb4b4d3..7eeb785bb 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -193,12 +193,6 @@ ffmpeg_helper(struct input_stream *input, return ret; } -static bool -ffmpeg_try_decode(struct input_stream *input) -{ - return ffmpeg_helper(input, NULL, NULL); -} - static enum decoder_command ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is, const AVPacket *packet, @@ -370,7 +364,6 @@ static const char *const ffmpeg_mime_types[] = { const struct decoder_plugin ffmpeg_plugin = { .name = "ffmpeg", .init = ffmpeg_init, - .try_decode = ffmpeg_try_decode, .stream_decode = ffmpeg_decode, .tag_dup = ffmpeg_tag, .suffixes = ffmpeg_suffixes, diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 0afa85431..ad64b7355 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -434,13 +434,14 @@ out: static bool oggflac_decode(struct decoder *decoder, struct input_stream *inStream) { - return flac_decode_internal(decoder, inStream, true); -} + if (ogg_stream_type_detect(inStream) != FLAC) + return false; -static bool -oggflac_try_decode(struct input_stream *inStream) -{ - return ogg_stream_type_detect(inStream) == FLAC; + /* rewind the stream, because ogg_stream_type_detect() has + moved it */ + input_stream_seek(inStream, 0, SEEK_SET); + + return flac_decode_internal(decoder, inStream, true); } static const char *const oggflac_suffixes[] = { "ogg", "oga", NULL }; @@ -457,7 +458,6 @@ const struct decoder_plugin oggflacPlugin = { .name = "oggflac", .init = oggflac_init, #if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 - .try_decode = oggflac_try_decode, .stream_decode = oggflac_decode, .tag_dup = oggflac_tag_dup, .suffixes = oggflac_suffixes, 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, |