diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2007-08-04 14:35:08 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2007-08-04 14:35:08 +0000 |
| commit | afd64439fdccc8b8b1245b210d49f640e608a99d (patch) | |
| tree | 39d44b2445f452572a1a7ac097ae2fb6ccf2c2c3 /lib | |
| parent | e73a47e1fea004a1cf21b715b46685657a5716cb (diff) | |
| download | qmmp-afd64439fdccc8b8b1245b210d49f640e608a99d.tar.gz qmmp-afd64439fdccc8b8b1245b210d49f640e608a99d.tar.bz2 qmmp-afd64439fdccc8b8b1245b210d49f640e608a99d.zip | |
changed decoder API
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@58 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/decoderfactory.h | 19 | ||||
| -rw-r--r-- | lib/qmmp/Input/ffmpeg/decoderffmpegfactory.cpp | 33 | ||||
| -rw-r--r-- | lib/qmmp/Input/ffmpeg/decoderffmpegfactory.h | 7 | ||||
| -rw-r--r-- | lib/qmmp/Input/flac/decoderflacfactory.cpp | 33 | ||||
| -rw-r--r-- | lib/qmmp/Input/flac/decoderflacfactory.h | 6 | ||||
| -rw-r--r-- | lib/qmmp/Input/mad/decodermadfactory.cpp | 30 | ||||
| -rw-r--r-- | lib/qmmp/Input/mad/decodermadfactory.h | 6 | ||||
| -rw-r--r-- | lib/qmmp/Input/mpc/decodermpcfactory.cpp | 20 | ||||
| -rw-r--r-- | lib/qmmp/Input/mpc/decodermpcfactory.h | 6 | ||||
| -rw-r--r-- | lib/qmmp/Input/vorbis/decodervorbisfactory.cpp | 21 | ||||
| -rw-r--r-- | lib/qmmp/Input/vorbis/decodervorbisfactory.h | 8 |
11 files changed, 100 insertions, 89 deletions
diff --git a/lib/decoderfactory.h b/lib/decoderfactory.h index 651c19745..c73b92c62 100644 --- a/lib/decoderfactory.h +++ b/lib/decoderfactory.h @@ -1,3 +1,4 @@ + /*************************************************************************** * Copyright (C) 2006 by Ilya Kotov * * forkotov02@hotmail.ru * @@ -31,15 +32,25 @@ class Decoder; class Output; class FileTag; +struct DecoderProperties +{ + QString name; + QString filter; + QString description; + QString contentType; + bool hasAbout; + bool hasSettings; + //bool streamSupport; + //bool needInput; +}; + class DecoderFactory { public: virtual ~DecoderFactory() {} virtual bool supports(const QString &source) const = 0; - virtual const QString &name() const = 0; - virtual const QString &filter() const = 0; - virtual const QString &description() const = 0; //i.e. file description - virtual const QString &contentType() const = 0; + virtual bool canDecode(QIODevice *) const = 0; + virtual const DecoderProperties &properties() const = 0; virtual Decoder *create(QObject *, QIODevice *, Output *) = 0; virtual FileTag *createTag(const QString &source) = 0; virtual void showDetails(QWidget *parent, const QString &path) = 0; diff --git a/lib/qmmp/Input/ffmpeg/decoderffmpegfactory.cpp b/lib/qmmp/Input/ffmpeg/decoderffmpegfactory.cpp index 947dcb0b3..adccc6255 100644 --- a/lib/qmmp/Input/ffmpeg/decoderffmpegfactory.cpp +++ b/lib/qmmp/Input/ffmpeg/decoderffmpegfactory.cpp @@ -14,31 +14,22 @@ bool DecoderFFmpegFactory::supports(const QString &source) const return (source.right(4).toLower() == ".wma" || source.right(4).toLower() == ".wav"); } -const QString &DecoderFFmpegFactory::name() const +bool DecoderFFmpegFactory::canDecode(QIODevice *input) const { - static QString name (tr("FFmpeg Plugin")); - return name; + static bool c = FALSE; + return c; } - -const QString &DecoderFFmpegFactory::filter() const -{ - static QString filter("*.wma *.wav"); - return filter; -} - - -const QString &DecoderFFmpegFactory::description() const -{ - static QString desc(tr("WMA Files")); - return desc; -} - -const QString &DecoderFFmpegFactory::contentType() const +const DecoderProperties &DecoderFFmpegFactory::properties() const { - static QString types; - //types << "" << ""; - return types; + static DecoderProperties properties; + properties.name = tr("WMA Files"); + properties.filter = "*.wma *.wav"; + properties.description = tr("WMA Files"); + //properties.contentType = ""; + properties.hasAbout = TRUE; + properties.hasSettings = FALSE; + return properties; } Decoder *DecoderFFmpegFactory::create(QObject *parent, QIODevice *input, diff --git a/lib/qmmp/Input/ffmpeg/decoderffmpegfactory.h b/lib/qmmp/Input/ffmpeg/decoderffmpegfactory.h index 236d77604..7ec661318 100644 --- a/lib/qmmp/Input/ffmpeg/decoderffmpegfactory.h +++ b/lib/qmmp/Input/ffmpeg/decoderffmpegfactory.h @@ -41,11 +41,8 @@ Q_INTERFACES(DecoderFactory); public: bool supports(const QString &source) const; - const QString &name() const; - const QString &filter() const; - const QString &description() const; - const QString &contentType() const; - Decoder *create(QObject *, QIODevice *, Output *); + bool canDecode(QIODevice *input) const; + const DecoderProperties &properties() const; FileTag *createTag(const QString &source); void showDetails(QWidget *parent, const QString &path); void showSettings(QWidget *parent); diff --git a/lib/qmmp/Input/flac/decoderflacfactory.cpp b/lib/qmmp/Input/flac/decoderflacfactory.cpp index 85909ca66..d9e9123ae 100644 --- a/lib/qmmp/Input/flac/decoderflacfactory.cpp +++ b/lib/qmmp/Input/flac/decoderflacfactory.cpp @@ -16,31 +16,22 @@ bool DecoderFLACFactory::supports(const QString &source) const return (source.right(5).toLower() == ".flac"); } -const QString &DecoderFLACFactory::name() const +bool DecoderFLACFactory::canDecode(QIODevice *input) const { - static QString name (tr("FLAC Plugin")); - return name; + static bool c = FALSE; + return c; } - -const QString &DecoderFLACFactory::filter() const -{ - static QString filter("*.flac"); - return filter; -} - - -const QString &DecoderFLACFactory::description() const -{ - static QString desc(tr("FLAC Files")); - return desc; -} - -const QString &DecoderFLACFactory::contentType() const +const DecoderProperties &DecoderFLACFactory::properties() const { - static QString types; - //types << "" << ""; - return types; + static DecoderProperties properties; + properties.name = tr("FLAC Plugin"); + properties.filter = "*.flac"; + properties.description = tr("FLAC Files"); + //properties.contentType = ; + properties.hasAbout = TRUE; + properties.hasSettings = FALSE; + return properties; } Decoder *DecoderFLACFactory::create(QObject *parent, QIODevice *input, diff --git a/lib/qmmp/Input/flac/decoderflacfactory.h b/lib/qmmp/Input/flac/decoderflacfactory.h index 12998b9c6..24eba6135 100644 --- a/lib/qmmp/Input/flac/decoderflacfactory.h +++ b/lib/qmmp/Input/flac/decoderflacfactory.h @@ -41,10 +41,8 @@ Q_INTERFACES(DecoderFactory); public: bool supports(const QString &source) const; - const QString &name() const; - const QString &filter() const; - const QString &description() const; - const QString &contentType() const; + bool canDecode(QIODevice *input) const; + const DecoderProperties &properties() const; Decoder *create(QObject *, QIODevice *, Output *); FileTag *createTag(const QString &source); void showDetails(QWidget *parent, const QString &path); diff --git a/lib/qmmp/Input/mad/decodermadfactory.cpp b/lib/qmmp/Input/mad/decodermadfactory.cpp index 0e15e9997..de23d1fb4 100644 --- a/lib/qmmp/Input/mad/decodermadfactory.cpp +++ b/lib/qmmp/Input/mad/decodermadfactory.cpp @@ -22,28 +22,22 @@ bool DecoderMADFactory::supports(const QString &source) const return ext == ".mp1" || ext == ".mp2" || ext == ".mp3"; } -const QString &DecoderMADFactory::name() const +bool DecoderMADFactory::canDecode(QIODevice *input) const { - static QString name (tr("MPEG Plugin")); - return name; + static bool c = FALSE; + return c; } -const QString &DecoderMADFactory::filter() const +const DecoderProperties &DecoderMADFactory::properties() const { - static QString filter("*.mp1 *.mp2 *.mp3"); - return filter; -} - -const QString &DecoderMADFactory::description() const -{ - static QString desc(tr("MPEG Files")); - return desc; -} - -const QString &DecoderMADFactory::contentType() const -{ - static QString types("audio/mp3;audio/mpeg"); - return types; + static DecoderProperties properties; + properties.name = tr("MPEG Plugin"); + properties.filter = "*.mp1 *.mp2 *.mp3"; + properties.description = tr("MPEG Files"); + properties.contentType = "audio/mp3;audio/mpeg"; + properties.hasAbout = TRUE; + properties.hasSettings = TRUE; + return properties; } Decoder *DecoderMADFactory::create(QObject *parent, QIODevice *input, Output *output) diff --git a/lib/qmmp/Input/mad/decodermadfactory.h b/lib/qmmp/Input/mad/decodermadfactory.h index 14a95fd58..7ebfd7275 100644 --- a/lib/qmmp/Input/mad/decodermadfactory.h +++ b/lib/qmmp/Input/mad/decodermadfactory.h @@ -40,10 +40,8 @@ Q_INTERFACES(DecoderFactory); public: bool supports(const QString &source) const; - const QString &name() const; - const QString &filter() const; // file extension, ie. ".mp3" or ".ogg" - const QString &description() const; // file type, ie. "MPEG Audio Files" - const QString &contentType() const; + bool canDecode(QIODevice *input) const; + const DecoderProperties &properties() const; Decoder *create(QObject *, QIODevice *, Output *); FileTag *createTag(const QString &source); void showDetails(QWidget *parent, const QString &path); diff --git a/lib/qmmp/Input/mpc/decodermpcfactory.cpp b/lib/qmmp/Input/mpc/decodermpcfactory.cpp index 3515fa9d2..fd8ebd259 100644 --- a/lib/qmmp/Input/mpc/decodermpcfactory.cpp +++ b/lib/qmmp/Input/mpc/decodermpcfactory.cpp @@ -16,7 +16,7 @@ bool DecoderMPCFactory::supports(const QString &source) const return (source.right(4).toLower() == ".mpc"); } -const QString &DecoderMPCFactory::name() const +/*const QString &DecoderMPCFactory::name() const { static QString name (tr("Musepack Plugin")); return name; @@ -40,6 +40,24 @@ const QString &DecoderMPCFactory::contentType() const { static QString types; return types; +}*/ + +bool DecoderMPCFactory::canDecode(QIODevice *input) const +{ + static bool c = FALSE; + return c; +} + +const DecoderProperties &DecoderMPCFactory::properties() const +{ + static DecoderProperties properties; + properties.name = tr("Musepack Plugin"); + properties.filter = "*.mpc"; + properties.description = tr("Musepack Files"); + //properties.contentType = ; + properties.hasAbout = TRUE; + properties.hasSettings = FALSE; + return properties; } Decoder *DecoderMPCFactory::create(QObject *parent, QIODevice *input, diff --git a/lib/qmmp/Input/mpc/decodermpcfactory.h b/lib/qmmp/Input/mpc/decodermpcfactory.h index e1327a35f..7b008425b 100644 --- a/lib/qmmp/Input/mpc/decodermpcfactory.h +++ b/lib/qmmp/Input/mpc/decodermpcfactory.h @@ -41,10 +41,8 @@ Q_INTERFACES(DecoderFactory); public: bool supports(const QString &source) const; - const QString &name() const; - const QString &filter() const; - const QString &description() const; - const QString &contentType() const; + bool canDecode(QIODevice *input) const; + const DecoderProperties &properties() const; Decoder *create(QObject *, QIODevice *, Output *); FileTag *createTag(const QString &source); void showDetails(QWidget *parent, const QString &path); diff --git a/lib/qmmp/Input/vorbis/decodervorbisfactory.cpp b/lib/qmmp/Input/vorbis/decodervorbisfactory.cpp index bdd0a83ca..0e95ebc43 100644 --- a/lib/qmmp/Input/vorbis/decodervorbisfactory.cpp +++ b/lib/qmmp/Input/vorbis/decodervorbisfactory.cpp @@ -12,11 +12,10 @@ bool DecoderVorbisFactory::supports(const QString &source) const { - //TODO: FLAC? return source.right(4).toLower() == ".ogg"; } -const QString &DecoderVorbisFactory::name() const +/*const QString &DecoderVorbisFactory::name() const { static QString name (tr("Ogg Vorbis Plugin")); return name; @@ -39,6 +38,24 @@ const QString &DecoderVorbisFactory::contentType() const { static QString types("application/ogg;audio/x-vorbis+ogg"); return types; +}*/ + +bool DecoderVorbisFactory::canDecode(QIODevice *input) const +{ + static bool c = FALSE; + return c; +} + +const DecoderProperties &DecoderVorbisFactory::properties() const +{ + static DecoderProperties properties; + properties.name = tr("Ogg Vorbis Plugin"); + properties.filter = "*.ogg"; + properties.description = tr("Ogg Vorbis Files"); + properties.contentType = "application/ogg;audio/x-vorbis+ogg"; + properties.hasAbout = TRUE; + properties.hasSettings = FALSE; + return properties; } Decoder *DecoderVorbisFactory::create(QObject *parent, QIODevice *input, diff --git a/lib/qmmp/Input/vorbis/decodervorbisfactory.h b/lib/qmmp/Input/vorbis/decodervorbisfactory.h index 09c181a8c..156df9045 100644 --- a/lib/qmmp/Input/vorbis/decodervorbisfactory.h +++ b/lib/qmmp/Input/vorbis/decodervorbisfactory.h @@ -37,14 +37,12 @@ class DecoderVorbisFactory : public QObject, DecoderFactory { Q_OBJECT -Q_INTERFACES(DecoderFactory) +Q_INTERFACES(DecoderFactory); public: bool supports(const QString &source) const; - const QString &name() const; - const QString &filter() const; // file extension, ie. ".mp3" or ".ogg" - const QString &description() const; // file type, ie. "MPEG Audio Files" - const QString &contentType() const; + bool canDecode(QIODevice *input) const; + const DecoderProperties &properties() const; Decoder *create(QObject *, QIODevice *, Output *); FileTag *createTag(const QString &source); void showDetails(QWidget *parent, const QString &path); |
