diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-05-30 19:40:35 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2018-05-30 19:40:35 +0000 |
| commit | 4ab1964bb6cd90ef26e6d6060427038b88e0c37f (patch) | |
| tree | 899db5f25a402732a4a5d3f68cde864af5862cda /src/plugins/Input/archive/decoderarchivefactory.cpp | |
| parent | 2306ed76a51553786de048e99c4f6bae42fca3ba (diff) | |
| download | qmmp-4ab1964bb6cd90ef26e6d6060427038b88e0c37f.tar.gz qmmp-4ab1964bb6cd90ef26e6d6060427038b88e0c37f.tar.bz2 qmmp-4ab1964bb6cd90ef26e6d6060427038b88e0c37f.zip | |
enabled archive reader
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7981 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/archive/decoderarchivefactory.cpp')
| -rw-r--r-- | src/plugins/Input/archive/decoderarchivefactory.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
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<FileInfo *> DecoderArchiveFactory::createPlayList(const QString &path, bool useMetaData, QStringList *) +QList<TrackInfo *> DecoderArchiveFactory::createPlayList(const QString &path, TrackInfo::Parts parts, QStringList *) { - QList <FileInfo *> list; + QList<TrackInfo *> list; struct archive_entry *entry = 0; struct archive *a = archive_read_new(); @@ -106,7 +106,7 @@ QList<FileInfo *> 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<FileInfo *> 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); |
