From 4ab1964bb6cd90ef26e6d6060427038b88e0c37f Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 30 May 2018 19:40:35 +0000 Subject: enabled archive reader git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7981 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/Input.pro | 2 +- src/plugins/Input/archive/archiveinputdevice.cpp | 2 +- src/plugins/Input/archive/archivetagreader.cpp | 1 - src/plugins/Input/archive/decoder_archive.cpp | 2 +- src/plugins/Input/archive/decoder_archive.h | 3 ++- .../Input/archive/decoderarchivefactory.cpp | 26 +++++++++++++++------- src/plugins/Input/archive/decoderarchivefactory.h | 15 +++---------- 7 files changed, 26 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/plugins/Input/Input.pro b/src/plugins/Input/Input.pro index def47b5be..498c5ff60 100644 --- a/src/plugins/Input/Input.pro +++ b/src/plugins/Input/Input.pro @@ -57,7 +57,7 @@ contains(CONFIG, ARCHIVE_PLUGIN){ TAGLIB_VER_MIN = $$member(TAGLIB_VERSION, 1) greaterThan(TAGLIB_VER_MAJ, 1) | equals(TAGLIB_VER_MAJ, 1) { - #greaterThan(TAGLIB_VER_MIN, 10):SUBDIRS += archive + greaterThan(TAGLIB_VER_MIN, 10):SUBDIRS += archive } else { message("Archive plugin requires at least TagLib 1.11") } diff --git a/src/plugins/Input/archive/archiveinputdevice.cpp b/src/plugins/Input/archive/archiveinputdevice.cpp index 8ecc6b3da..6056dca98 100644 --- a/src/plugins/Input/archive/archiveinputdevice.cpp +++ b/src/plugins/Input/archive/archiveinputdevice.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2016 by Ilya Kotov * + * Copyright (C) 2016-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/archive/archivetagreader.cpp b/src/plugins/Input/archive/archivetagreader.cpp index c9b94c91e..9bcfc4308 100644 --- a/src/plugins/Input/archive/archivetagreader.cpp +++ b/src/plugins/Input/archive/archivetagreader.cpp @@ -120,7 +120,6 @@ const QMap ArchiveTagReader::metaData() const m[Qmmp::YEAR] = QString::number(tag->year()); m[Qmmp::TRACK] = QString::number(tag->track()); } - m[Qmmp::URL] = m_url; return m; } diff --git a/src/plugins/Input/archive/decoder_archive.cpp b/src/plugins/Input/archive/decoder_archive.cpp index aeafd98cb..e08e7bad8 100644 --- a/src/plugins/Input/archive/decoder_archive.cpp +++ b/src/plugins/Input/archive/decoder_archive.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2016 by Ilya Kotov * + * Copyright (C) 2016-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/archive/decoder_archive.h b/src/plugins/Input/archive/decoder_archive.h index 448acadec..9356037b7 100644 --- a/src/plugins/Input/archive/decoder_archive.h +++ b/src/plugins/Input/archive/decoder_archive.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2016 by Ilya Kotov * + * Copyright (C) 2016-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -23,6 +23,7 @@ #include #include +#include #include diff --git a/src/plugins/Input/archive/decoderarchivefactory.cpp b/src/plugins/Input/archive/decoderarchivefactory.cpp index 0badf82f3..bc8588c3a 100644 --- a/src/plugins/Input/archive/decoderarchivefactory.cpp +++ b/src/plugins/Input/archive/decoderarchivefactory.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2016 by Ilya Kotov * + * Copyright (C) 2016-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -55,9 +55,9 @@ Decoder *DecoderArchiveFactory::create(const QString &url, QIODevice *) return new DecoderArchive(url); } -QList DecoderArchiveFactory::createPlayList(const QString &path, bool useMetaData, QStringList *) +QList DecoderArchiveFactory::createPlayList(const QString &path, TrackInfo::Parts parts, QStringList *) { - QList list; + QList list; struct archive_entry *entry = 0; struct archive *a = archive_read_new(); @@ -106,7 +106,7 @@ QList DecoderArchiveFactory::createPlayList(const QString &path, boo if(!filtered.isEmpty()) { - list << new FileInfo(QString("%1://%2#%3") + list << new TrackInfo(QString("%1://%2#%3") .arg(archivePath.section(".", -1)).toLower() .arg(archivePath) .arg(filePath)); @@ -114,10 +114,20 @@ QList DecoderArchiveFactory::createPlayList(const QString &path, boo ArchiveInputDevice dev(a, entry, 0); ArchiveTagReader reader(&dev, list.last()->path()); - if(useMetaData) - list.last()->setMetaData(reader.metaData()); - if(reader.audioProperties()) - list.last()->setLength(reader.audioProperties()->length()); + if(parts & TrackInfo::MetaData) + list.last()->setValues(reader.metaData()); + + TagLib::AudioProperties *ap = reader.audioProperties(); + + if((parts & TrackInfo::Properties) && ap) + { + list.last()->setValue(Qmmp::BITRATE, ap->bitrate()); + list.last()->setValue(Qmmp::SAMPLERATE, ap->sampleRate()); + list.last()->setValue(Qmmp::CHANNELS, ap->channels()); + } + + if(ap) + list.last()->setDuration(reader.audioProperties()->lengthInMilliseconds()); } } archive_read_data_skip(a); diff --git a/src/plugins/Input/archive/decoderarchivefactory.h b/src/plugins/Input/archive/decoderarchivefactory.h index 8306a38d9..804b8db3b 100644 --- a/src/plugins/Input/archive/decoderarchivefactory.h +++ b/src/plugins/Input/archive/decoderarchivefactory.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2016 by Ilya Kotov * + * Copyright (C) 2016-2018 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -21,18 +21,9 @@ #ifndef DECODERARCHIVEFACTORY_H #define DECODERARCHIVEFACTORY_H -#include -#include -#include -#include - -#include -#include #include -#include -class DecoderArchiveFactory : public QObject, - DecoderFactory +class DecoderArchiveFactory : public QObject, DecoderFactory { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qmmp.qmmp.DecoderFactoryInterface.1.0") @@ -42,7 +33,7 @@ public: bool canDecode(QIODevice *) const; const DecoderProperties properties() const; Decoder *create(const QString &url, QIODevice *); - QList createPlayList(const QString &path, bool useMetaData, QStringList *); + QList createPlayList(const QString &path, TrackInfo::Parts parts, QStringList *); MetaDataModel* createMetaDataModel(const QString &path, QObject *parent = 0); void showSettings(QWidget *parent); void showAbout(QWidget *parent); -- cgit v1.2.3-13-gbd6f