diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-04-27 09:37:40 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-04-27 09:37:40 +0000 |
| commit | bf1c573857cae1b1c24a4a6ad8b960d78de99658 (patch) | |
| tree | 38bd49a4efcb82d8fc7fa3e21653490541f92331 /src/plugins/Input/sid | |
| parent | 90645d807e875c4f72eb118fc04910070efb36ef (diff) | |
| download | qmmp-bf1c573857cae1b1c24a4a6ad8b960d78de99658.tar.gz qmmp-bf1c573857cae1b1c24a4a6ad8b960d78de99658.tar.bz2 qmmp-bf1c573857cae1b1c24a4a6ad8b960d78de99658.zip | |
sid plugin: added metadata support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3411 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/sid')
| -rw-r--r-- | src/plugins/Input/sid/decodersidfactory.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/plugins/Input/sid/decodersidfactory.cpp b/src/plugins/Input/sid/decodersidfactory.cpp index dbe0adb14..5bb703c5c 100644 --- a/src/plugins/Input/sid/decodersidfactory.cpp +++ b/src/plugins/Input/sid/decodersidfactory.cpp @@ -20,6 +20,8 @@ #include <QtGui> #include <QRegExp> +#include <sidplayfp/SidTune.h> +#include <sidplayfp/SidTuneInfo.h> #include "decoder_sid.h" #include "decodersidfactory.h" @@ -36,16 +38,19 @@ bool DecoderSIDFactory::supports(const QString &source) const return false; } -bool DecoderSIDFactory::canDecode(QIODevice *) const +bool DecoderSIDFactory::canDecode(QIODevice *input) const { - return false; + char buf[4]; + if (input->peek(buf, 4) != 4) + return false; + return (!memcmp(buf, "RSID", 4) || !memcmp(buf, "PSID", 4)); } const DecoderProperties DecoderSIDFactory::properties() const { DecoderProperties properties; properties.name = tr("SID Plugin"); - properties.filters << "*.sid"; + properties.filters << "*.sid" << "*.mus" << "*.str" << "*.prg" << "*.P00"; properties.description = tr("SID Files"); //properties.contentType = ; properties.shortName = "sid"; @@ -64,7 +69,17 @@ Decoder *DecoderSIDFactory::create(const QString &path, QIODevice *input) QList<FileInfo *> DecoderSIDFactory::createPlayList(const QString &fileName, bool useMetaData) { QList <FileInfo*> list; - list << new FileInfo(fileName); + FileInfo *info = new FileInfo(fileName); + if(useMetaData) + { + SidTune *tune = new SidTune(qPrintable(fileName)); + const SidTuneInfo *tune_info = tune->getInfo(); + info->setMetaData(Qmmp::TITLE, tune_info->infoString(0)); + info->setMetaData(Qmmp::ARTIST, tune_info->infoString(1)); + info->setMetaData(Qmmp::COMMENT, tune_info->commentString(0)); + delete tune; + } + list << info; return list; } |
