aboutsummaryrefslogtreecommitdiff
path: root/lib/decoder.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-07-27 16:39:44 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2007-07-27 16:39:44 +0000
commitc6d40b3e63ef5af1c83546f41fde38c8f3983c8f (patch)
tree7b22bc3f0acb81c0bb68a790ee0adc765801f973 /lib/decoder.cpp
parent6f1f9ca43a8773cdfb5e3a7d72fda79c4a442016 (diff)
downloadqmmp-c6d40b3e63ef5af1c83546f41fde38c8f3983c8f.tar.gz
qmmp-c6d40b3e63ef5af1c83546f41fde38c8f3983c8f.tar.bz2
qmmp-c6d40b3e63ef5af1c83546f41fde38c8f3983c8f.zip
added libcurl support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@40 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'lib/decoder.cpp')
-rw-r--r--lib/decoder.cpp31
1 files changed, 29 insertions, 2 deletions
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<StreamReader *>(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; i<factories->size(); ++i)
+ {
+ if (!blacklist.contains(files.at(i).section('/',-1)))
+ {
+ QStringList types = factories->at(i)->contentTypes();
+ for(int j=0; j<types.size(); ++j)
+ {
+ qDebug(qPrintable(types[j]+" "+type));
+ if(type == types[j])
+ return factories->at(i);
+ }
+ }
+ }
+ qDebug("Decoder: unable to find factory");
+ return 0;
+}
+
FileTag *Decoder::createTag(const QString& source)
{
DecoderFactory *fact = Decoder::findFactory(source);