aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/flac/decoderflacfactory.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2011-11-07 19:26:00 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2011-11-07 19:26:00 +0000
commit0b7152dfe25d34899f0db73558f05064777f536b (patch)
tree6e47401ddeec8de1720becd9fb0371c8d58e0ae4 /src/plugins/Input/flac/decoderflacfactory.cpp
parent6e078f9a208f3ce31531d5ead6557cef11915e83 (diff)
downloadqmmp-0b7152dfe25d34899f0db73558f05064777f536b.tar.gz
qmmp-0b7152dfe25d34899f0db73558f05064777f536b.tar.bz2
qmmp-0b7152dfe25d34899f0db73558f05064777f536b.zip
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
Diffstat (limited to 'src/plugins/Input/flac/decoderflacfactory.cpp')
-rw-r--r--src/plugins/Input/flac/decoderflacfactory.cpp10
1 files changed, 8 insertions, 2 deletions
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;