flac: make the init() method check for oggflac support
Disable flac's "oggflac" sub-plugin when libflac does not support ogg-flac files.
This commit is contained in:
parent
72eba30cf4
commit
b054ad0ea6
@ -385,6 +385,12 @@ flac_decode(struct decoder * decoder, struct input_stream *inStream)
|
|||||||
return flac_decode_internal(decoder, inStream, false);
|
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 && \
|
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
|
||||||
!defined(HAVE_OGGFLAC)
|
!defined(HAVE_OGGFLAC)
|
||||||
static struct tag *oggflac_tag_dup(const char *file)
|
static struct tag *oggflac_tag_dup(const char *file)
|
||||||
@ -426,8 +432,7 @@ oggflac_decode(struct decoder *decoder, struct input_stream *inStream)
|
|||||||
static bool
|
static bool
|
||||||
oggflac_try_decode(struct input_stream *inStream)
|
oggflac_try_decode(struct input_stream *inStream)
|
||||||
{
|
{
|
||||||
return FLAC_API_SUPPORTS_OGG_FLAC &&
|
return ogg_stream_type_detect(inStream) == FLAC;
|
||||||
ogg_stream_type_detect(inStream) == FLAC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *const oggflac_suffixes[] = { "ogg", "oga", NULL };
|
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 = {
|
const struct decoder_plugin oggflacPlugin = {
|
||||||
.name = "oggflac",
|
.name = "oggflac",
|
||||||
|
.init = oggflac_init,
|
||||||
.try_decode = oggflac_try_decode,
|
.try_decode = oggflac_try_decode,
|
||||||
.stream_decode = oggflac_decode,
|
.stream_decode = oggflac_decode,
|
||||||
.tag_dup = oggflac_tag_dup,
|
.tag_dup = oggflac_tag_dup,
|
||||||
|
Loading…
Reference in New Issue
Block a user