From c6d40b3e63ef5af1c83546f41fde38c8f3983c8f Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Fri, 27 Jul 2007 16:39:44 +0000 Subject: added libcurl support git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@40 90c681e8-e032-0410-971d-27865f9a5e38 --- lib/decoder.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'lib/decoder.cpp') diff --git a/lib/decoder.cpp b/lib/decoder.cpp index b77b780b4..4b940520d 100644 --- a/lib/decoder.cpp +++ b/lib/decoder.cpp @@ -15,6 +15,7 @@ #include "output.h" #include "visualization.h" #include "decoderfactory.h" +#include "streamreader.h" extern "C"{ #include "equ/iir.h" } @@ -134,8 +135,14 @@ Decoder *Decoder::create(QObject *parent, const QString &source, Output *output) { Decoder *decoder = 0; - - DecoderFactory *fact = Decoder::findFactory(source); + qDebug(qPrintable(source)); + DecoderFactory *fact = 0; + + StreamReader* reader = qobject_cast(input); + if(reader) + fact = Decoder::findByContentType(reader->contentType()); + else + fact = Decoder::findFactory(source); if (fact) { decoder = fact->create(parent, input, output); @@ -159,6 +166,26 @@ DecoderFactory *Decoder::findFactory(const QString& source) return 0; } +DecoderFactory *Decoder::findByContentType(const QString& type) +{ + checkFactories(); + for (int i=0; isize(); ++i) + { + if (!blacklist.contains(files.at(i).section('/',-1))) + { + QStringList types = factories->at(i)->contentTypes(); + for(int j=0; jat(i); + } + } + } + qDebug("Decoder: unable to find factory"); + return 0; +} + FileTag *Decoder::createTag(const QString& source) { DecoderFactory *fact = Decoder::findFactory(source); -- cgit v1.2.3-13-gbd6f