From a3e55825c3f38ae1bc5e67584a7f37955de3fb87 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 27 Nov 2008 23:09:03 +0000 Subject: flac plugin: embeded cue support (using cuesheet xiph comment) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@643 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/flac/decoderflacfactory.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/plugins/Input/flac/decoderflacfactory.cpp') diff --git a/src/plugins/Input/flac/decoderflacfactory.cpp b/src/plugins/Input/flac/decoderflacfactory.cpp index 1843ccac0..2da4c69de 100644 --- a/src/plugins/Input/flac/decoderflacfactory.cpp +++ b/src/plugins/Input/flac/decoderflacfactory.cpp @@ -21,7 +21,11 @@ #include #include #include +#include +#include +#include +#include "cueparser.h" #include "detailsdialog.h" #include "decoder_flac.h" #include "decoderflacfactory.h" @@ -48,22 +52,23 @@ const DecoderProperties DecoderFLACFactory::properties() const properties.filter = "*.flac"; properties.description = tr("FLAC Files"); //properties.contentType = ; + properties.protocols = "flac"; properties.hasAbout = TRUE; properties.hasSettings = FALSE; return properties; } Decoder *DecoderFLACFactory::create(QObject *parent, QIODevice *input, - Output *output, const QString &) + Output *output, const QString &path) { - return new DecoderFLAC(parent, this, input, output); + return new DecoderFLAC(parent, this, input, output, path); } QList DecoderFLACFactory::createPlayList(const QString &fileName) { FileInfo *info = new FileInfo(fileName); - TagLib::FileRef fileRef(fileName.toLocal8Bit ()); + TagLib::FLAC::File fileRef(fileName.toLocal8Bit ()); TagLib::Tag *tag = fileRef.tag(); if (tag && !tag->isEmpty()) @@ -84,8 +89,19 @@ QList DecoderFLACFactory::createPlayList(const QString &fileName) if (fileRef.audioProperties()) info->setLength(fileRef.audioProperties()->length()); + + //looking for cuesheet comment + TagLib::Ogg::XiphComment *xiph_comment = fileRef.xiphComment(); QList list; - list << info; + if (xiph_comment && xiph_comment->fieldListMap().contains("CUESHEET")) + { + qDebug(xiph_comment->fieldListMap()["CUESHEET"].toString().toCString(TRUE)); + CUEParser parser(xiph_comment->fieldListMap()["CUESHEET"].toString().toCString(TRUE), fileName); + list = parser.createPlayList(); + delete info; + } + else + list << info; return list; } -- cgit v1.2.3-13-gbd6f