aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-09 22:01:47 +0100
committerMax Kellermann <max@duempel.org>2008-11-09 22:01:47 +0100
commitb054ad0ea6fce1253fa010dd21334a3e4d96f2a9 (patch)
tree65c8ff00cca4da1c327d6549a3b091c50dda34e4 /src/decoder
parent72eba30cf442994c732c135cb77c917f534ff1d7 (diff)
downloadmpd-b054ad0ea6fce1253fa010dd21334a3e4d96f2a9.tar.gz
mpd-b054ad0ea6fce1253fa010dd21334a3e4d96f2a9.tar.xz
mpd-b054ad0ea6fce1253fa010dd21334a3e4d96f2a9.zip
flac: make the init() method check for oggflac support
Disable flac's "oggflac" sub-plugin when libflac does not support ogg-flac files.
Diffstat (limited to '')
-rw-r--r--src/decoder/flac_plugin.c10
1 files changed, 8 insertions, 2 deletions
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,