From b054ad0ea6fce1253fa010dd21334a3e4d96f2a9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 9 Nov 2008 22:01:47 +0100 Subject: flac: make the init() method check for oggflac support Disable flac's "oggflac" sub-plugin when libflac does not support ogg-flac files. --- src/decoder/flac_plugin.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/decoder/flac_plugin.c') diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 1deba8ad7..e574315b3 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -385,6 +385,12 @@ flac_decode(struct decoder * decoder, struct input_stream *inStream) return flac_decode_internal(decoder, inStream, false); } +static bool +oggflac_init(void) +{ + return !!FLAC_API_SUPPORTS_OGG_FLAC; +} + #if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \ !defined(HAVE_OGGFLAC) static struct tag *oggflac_tag_dup(const char *file) @@ -426,8 +432,7 @@ oggflac_decode(struct decoder *decoder, struct input_stream *inStream) static bool oggflac_try_decode(struct input_stream *inStream) { - return FLAC_API_SUPPORTS_OGG_FLAC && - ogg_stream_type_detect(inStream) == FLAC; + return ogg_stream_type_detect(inStream) == FLAC; } static const char *const oggflac_suffixes[] = { "ogg", "oga", NULL }; @@ -440,6 +445,7 @@ static const char *const oggflac_mime_types[] = { const struct decoder_plugin oggflacPlugin = { .name = "oggflac", + .init = oggflac_init, .try_decode = oggflac_try_decode, .stream_decode = oggflac_decode, .tag_dup = oggflac_tag_dup, -- cgit v1.2.3