aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-10 14:39:42 +0100
committerMax Kellermann <max@duempel.org>2008-11-10 14:39:42 +0100
commit0e87f85598333c6e88ab115ebae15389fc23214a (patch)
tree0f8b353a8ec06dcd3bcb6cedaff2cde2d612a760 /src
parent505959f74dc1819706f20b8ca074c1324aa9fb41 (diff)
downloadmpd-0e87f85598333c6e88ab115ebae15389fc23214a.tar.gz
mpd-0e87f85598333c6e88ab115ebae15389fc23214a.tar.xz
mpd-0e87f85598333c6e88ab115ebae15389fc23214a.zip
flac: enable the oggflac plugin with older libflac versions
Since decoder_list.c does not include the libflac headers, it cannot know whether to add the oggflac plugin to the decoder list. Solve this by always enabling the oggflac sub-plugin, even with older libflac versions. When the libflac API cannot support oggflac, disable the plugin at runtime by returning "false" from its init() method.
Diffstat (limited to 'src')
-rw-r--r--src/decoder/flac_plugin.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index e574315b3..a24c97a95 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -385,14 +385,21 @@ flac_decode(struct decoder * decoder, struct input_stream *inStream)
return flac_decode_internal(decoder, inStream, false);
}
+#ifndef HAVE_OGGFLAC
+
static bool
oggflac_init(void)
{
+#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
return !!FLAC_API_SUPPORTS_OGG_FLAC;
+#else
+ /* disable oggflac when libflac is too old */
+ return false;
+#endif
}
-#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
- !defined(HAVE_OGGFLAC)
+#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
+
static struct tag *oggflac_tag_dup(const char *file)
{
struct tag *ret = NULL;
@@ -443,17 +450,21 @@ static const char *const oggflac_mime_types[] = {
NULL
};
+#endif /* FLAC_API_VERSION_CURRENT >= 7 */
+
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,
.mime_types = oggflac_mime_types
+#endif
};
-#endif /* FLAC_API_VERSION_CURRENT >= 7 */
+#endif /* HAVE_OGGFLAC */
static const char *const flacSuffixes[] = { "flac", NULL };
static const char *const flac_mime_types[] = {