aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/mpc/decodermpcfactory.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/mpc/decodermpcfactory.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/mpc/decodermpcfactory.cpp')
-rw-r--r--src/plugins/Input/mpc/decodermpcfactory.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/Input/mpc/decodermpcfactory.cpp b/src/plugins/Input/mpc/decodermpcfactory.cpp
index f55a2d4e9..07fd9693b 100644
--- a/src/plugins/Input/mpc/decodermpcfactory.cpp
+++ b/src/plugins/Input/mpc/decodermpcfactory.cpp
@@ -36,8 +36,20 @@ bool DecoderMPCFactory::supports(const QString &source) const
return (source.right(4).toLower() == ".mpc");
}
-bool DecoderMPCFactory::canDecode(QIODevice *) const
+bool DecoderMPCFactory::canDecode(QIODevice *input) const
{
+ char buf[36];
+ if (input->peek(buf, 4) != 4)
+ return false;
+
+ if(!memcmp(buf, "MP+", 3))
+ return true;
+
+#ifndef MPC_OLD_API
+ if(!memcmp(buf, "MPCK", 4))
+ return true;
+#endif
+
return false;
}