aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/sid/decoder_sid.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-04-27 16:03:01 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-04-27 16:03:01 +0000
commit986b284179715143736251e6507d4af089306993 (patch)
treeb9c46c3aafa324eb7f9e1f526dd48942c7ee08d2 /src/plugins/Input/sid/decoder_sid.cpp
parentbf1c573857cae1b1c24a4a6ad8b960d78de99658 (diff)
downloadqmmp-986b284179715143736251e6507d4af089306993.tar.gz
qmmp-986b284179715143736251e6507d4af089306993.tar.bz2
qmmp-986b284179715143736251e6507d4af089306993.zip
sid plugin: added multiple tracks support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3412 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/sid/decoder_sid.cpp')
-rw-r--r--src/plugins/Input/sid/decoder_sid.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/plugins/Input/sid/decoder_sid.cpp b/src/plugins/Input/sid/decoder_sid.cpp
index bcd84e56b..4d86f7f97 100644
--- a/src/plugins/Input/sid/decoder_sid.cpp
+++ b/src/plugins/Input/sid/decoder_sid.cpp
@@ -18,12 +18,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-
+#include <QFile>
#include "decoder_sid.h"
// Decoder class
-DecoderSID::DecoderSID(QIODevice *input) : Decoder(input)
+DecoderSID::DecoderSID(const QString &url) : Decoder()
{
+ m_url = url;
m_player = new sidplayfp();
}
@@ -34,17 +35,23 @@ DecoderSID::~DecoderSID()
bool DecoderSID::initialize()
{
- QByteArray data = input()->readAll();
+ QString path = m_url;
+ path.remove("sid://");
+ path.remove(QRegExp("#\\d+$"));
+ int track = m_url.section("#", -1).toInt();
+
+ SidTune *tune = new SidTune(0);
+ tune->load(qPrintable(path));
+ int count = tune->getInfo()->songs();
- if(data.isEmpty())
+ if(track > count || track < 1)
{
- qWarning("DecoderSID: error: %s", qPrintable(input()->errorString()));
+ qWarning("DecoderSID: track number is out of range");
+ delete tune;
return false;
}
- SidTune *tune = new SidTune(0);
- tune->read((const unsigned char*)data.constData(), data.size());
- tune->selectSong(0);
+ tune->selectSong(track);
if(!tune->getStatus())
{
@@ -52,6 +59,16 @@ bool DecoderSID::initialize()
return false;
}
+ //send metadata for pseudo-protocol
+ const SidTuneInfo *tune_info = tune->getInfo();
+ QMap<Qmmp::MetaData, QString> metadata;
+ metadata.insert(Qmmp::TITLE, tune_info->infoString(0));
+ metadata.insert(Qmmp::ARTIST, tune_info->infoString(1));
+ metadata.insert(Qmmp::COMMENT, tune_info->commentString(0));
+ metadata.insert(Qmmp::TRACK, QString("%1").arg(track));
+ metadata.insert(Qmmp::URL, m_url);
+ addMetaData(metadata);
+
sidbuilder *rs = new ReSIDfpBuilder("ReSIDfp builder");
rs->create(m_player->info().maxsids());