From 9b80a143f0ba56ba50a0108c94f005df62cbeade Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 30 May 2018 17:39:42 +0000 Subject: enabled gme plugin git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7975 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/Input.pro | 2 +- src/plugins/Input/gme/decoder_gme.cpp | 3 +-- src/plugins/Input/gme/decoder_gme.h | 2 +- src/plugins/Input/gme/decodergmefactory.cpp | 28 ++++++++++++-------------- src/plugins/Input/gme/decodergmefactory.h | 12 ++--------- src/plugins/Input/gme/gmehelper.cpp | 31 +++++++++++++++++++---------- src/plugins/Input/gme/gmehelper.h | 6 +++--- 7 files changed, 41 insertions(+), 43 deletions(-) (limited to 'src/plugins/Input') diff --git a/src/plugins/Input/Input.pro b/src/plugins/Input/Input.pro index f244f1a2a..bc82b29c8 100644 --- a/src/plugins/Input/Input.pro +++ b/src/plugins/Input/Input.pro @@ -24,7 +24,7 @@ contains(CONFIG, FFMPEG_PLUGIN){ } contains(CONFIG, GME_PLUGIN){ - #SUBDIRS += gme + SUBDIRS += gme } contains(CONFIG, OPUS_PLUGIN){ diff --git a/src/plugins/Input/gme/decoder_gme.cpp b/src/plugins/Input/gme/decoder_gme.cpp index 8d6753c96..3eca96348 100644 --- a/src/plugins/Input/gme/decoder_gme.cpp +++ b/src/plugins/Input/gme/decoder_gme.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010-2016 by Ilya Kotov * + * Copyright (C) 2010-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -69,7 +69,6 @@ bool DecoderGme::initialize() metadata.insert(Qmmp::ARTIST, track_info->author); metadata.insert(Qmmp::COMMENT, track_info->comment); metadata.insert(Qmmp::TRACK, QString("%1").arg(track)); - metadata.insert(Qmmp::URL, m_path); addMetaData(metadata); m_totalTime = track_info->length; gme_free_info(track_info); diff --git a/src/plugins/Input/gme/decoder_gme.h b/src/plugins/Input/gme/decoder_gme.h index 03121b97e..730ec3c17 100644 --- a/src/plugins/Input/gme/decoder_gme.h +++ b/src/plugins/Input/gme/decoder_gme.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010-2016 by Ilya Kotov * + * Copyright (C) 2010-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/plugins/Input/gme/decodergmefactory.cpp b/src/plugins/Input/gme/decodergmefactory.cpp index 4b9050dee..a7c8d931a 100644 --- a/src/plugins/Input/gme/decodergmefactory.cpp +++ b/src/plugins/Input/gme/decodergmefactory.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010-2017 by Ilya Kotov * + * Copyright (C) 2010-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -55,37 +55,35 @@ Decoder *DecoderGmeFactory::create(const QString &path, QIODevice *input) return new DecoderGme(path); } -QList DecoderGmeFactory::createPlayList(const QString &fileName, bool useMetaData, QStringList *ignoredFiles) +QList DecoderGmeFactory::createPlayList(const QString &path, TrackInfo::Parts parts, QStringList *ignoredFiles) { - QList list; GmeHelper helper; //is it one track? - if(fileName.contains("://")) + if(path.contains("://")) { - QString path = fileName; - path.remove("gme://"); - path.remove(QRegExp("#\\d+$")); - int track = fileName.section("#", -1).toInt(); - list = createPlayList(path, true, ignoredFiles); + QString filePath = path; + filePath.remove("gme://"); + filePath.remove(QRegExp("#\\d+$")); + int track = path.section("#", -1).toInt(); + QList list = createPlayList(filePath, parts, ignoredFiles); if (list.isEmpty() || track <= 0 || track > list.count()) { qDeleteAll(list); list.clear(); return list; } - FileInfo *info = list.takeAt(track - 1); + TrackInfo *info = list.takeAt(track - 1); qDeleteAll(list); - return QList() << info; + return QList() << info; } - Music_Emu *emu = helper.load(fileName); + Music_Emu *emu = helper.load(path); if(!emu) { qWarning("DecoderGmeFactory: unable to open file"); - return list; + return QList(); } - list = helper.createPlayList(useMetaData); - return list; + return helper.createPlayList(parts); } MetaDataModel* DecoderGmeFactory::createMetaDataModel(const QString &path, QObject *parent) diff --git a/src/plugins/Input/gme/decodergmefactory.h b/src/plugins/Input/gme/decodergmefactory.h index 4da246e70..12de413f2 100644 --- a/src/plugins/Input/gme/decodergmefactory.h +++ b/src/plugins/Input/gme/decodergmefactory.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010-2016 by Ilya Kotov * + * Copyright (C) 2010-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -20,15 +20,7 @@ #ifndef DECODERGMEFACTORY_H #define DECODERGMEFACTORY_H -#include -#include -#include -#include - -#include -#include #include -#include /** @author Ilya Kotov @@ -43,7 +35,7 @@ public: bool canDecode(QIODevice *input) const; const DecoderProperties properties() const; Decoder *create(const QString &path, QIODevice *input); - QList createPlayList(const QString &fileName, bool useMetaData, QStringList *ignoredFiles); + QList createPlayList(const QString &path, TrackInfo::Parts parts, QStringList *ignoredFiles); MetaDataModel* createMetaDataModel(const QString &path, QObject *parent = 0); void showSettings(QWidget *parent); void showAbout(QWidget *parent); diff --git a/src/plugins/Input/gme/gmehelper.cpp b/src/plugins/Input/gme/gmehelper.cpp index 074c25c99..04a335701 100644 --- a/src/plugins/Input/gme/gmehelper.cpp +++ b/src/plugins/Input/gme/gmehelper.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010-2015 by Ilya Kotov * + * Copyright (C) 2010-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -80,16 +80,16 @@ Music_Emu *GmeHelper::load(const QString &url, int sample_rate) return m_emu; } -QList GmeHelper::createPlayList(bool meta) +QList GmeHelper::createPlayList(TrackInfo::Parts parts) { - QList list; + QList list; if(!m_emu) return list; int count = gme_track_count(m_emu); gme_info_t *track_info; for(int i = 0; i < count; ++i) { - FileInfo *info = new FileInfo(); + TrackInfo *info = new TrackInfo(); if(!gme_track_info(m_emu, &track_info, i)) { if(track_info->length <= 0) @@ -99,16 +99,25 @@ QList GmeHelper::createPlayList(bool meta) track_info->length = (long) (2.5 * 60 * 1000); if(track_info->length < m_fade_length) track_info->length += m_fade_length; - if(meta) + if(parts & TrackInfo::MetaData) { - info->setMetaData(Qmmp::ALBUM, track_info->game); - info->setMetaData(Qmmp::TITLE, track_info->song); - info->setMetaData(Qmmp::ARTIST, track_info->author); - info->setMetaData(Qmmp::COMMENT, track_info->comment); - info->setMetaData(Qmmp::TRACK, i+1); + info->setValue(Qmmp::ALBUM, track_info->game); + info->setValue(Qmmp::TITLE, track_info->song); + info->setValue(Qmmp::ARTIST, track_info->author); + info->setValue(Qmmp::COMMENT, track_info->comment); + info->setValue(Qmmp::TRACK, i+1); } + if(parts & TrackInfo::Properties) + { + info->setValue(Qmmp::BITRATE, 8); + info->setValue(Qmmp::SAMPLERATE, 44100); + info->setValue(Qmmp::CHANNELS, 2); + info->setValue(Qmmp::BITS_PER_SAMPLE, 16); + info->setValue(Qmmp::FORMAT_NAME, track_info->system); + } + info->setPath("gme://" + m_path + QString("#%1").arg(i+1)); - info->setLength(track_info->length/1000); + info->setDuration(track_info->length); gme_free_info(track_info); list << info; } diff --git a/src/plugins/Input/gme/gmehelper.h b/src/plugins/Input/gme/gmehelper.h index b42eed7fe..2908308e4 100644 --- a/src/plugins/Input/gme/gmehelper.h +++ b/src/plugins/Input/gme/gmehelper.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010-2012 by Ilya Kotov * + * Copyright (C) 2010-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -24,7 +24,7 @@ #include #include #include -#include +#include /** @author Ilya Kotov @@ -35,7 +35,7 @@ public: GmeHelper(); ~GmeHelper(); Music_Emu *load(const QString &url, int sample_rate = 44100); - QList createPlayList(bool meta); + QList createPlayList(TrackInfo::Parts parts); int fadeLength(); private: -- cgit v1.2.3-13-gbd6f