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 --- .../Input/archive/decoderarchivefactory.cpp | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/plugins/Input/archive/decoderarchivefactory.cpp') 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); -- cgit v1.2.3-13-gbd6f