From 0b7152dfe25d34899f0db73558f05064777f536b Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 7 Nov 2011 19:26:00 +0000 Subject: added content based detection for some decoders git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2502 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/flac/decoderflacfactory.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/plugins/Input/flac/decoderflacfactory.cpp') diff --git a/src/plugins/Input/flac/decoderflacfactory.cpp b/src/plugins/Input/flac/decoderflacfactory.cpp index 002fe56ee..c1eee4480 100644 --- a/src/plugins/Input/flac/decoderflacfactory.cpp +++ b/src/plugins/Input/flac/decoderflacfactory.cpp @@ -41,7 +41,13 @@ bool DecoderFLACFactory::supports(const QString &source) const bool DecoderFLACFactory::canDecode(QIODevice *input) const { - Q_UNUSED(input); + char buf[36]; + if (input->peek(buf, 36) != 36) + return false; + if(!memcmp(buf, "fLaC", 4)) //native flac + return true; + if(!memcmp(buf, "OggS", 4) && !memcmp(buf + 29, "FLAC", 4)) //ogg flac + return true; return false; } @@ -51,7 +57,7 @@ const DecoderProperties DecoderFLACFactory::properties() const properties.name = tr("FLAC Plugin"); properties.filters << "*.flac" << "*.oga"; properties.description = tr("FLAC Files"); - //properties.contentType = ; + properties.contentTypes << "audio/x-flac"; properties.shortName = "flac"; properties.protocols << "flac"; properties.hasAbout = true; -- cgit v1.2.3-13-gbd6f