diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-11-28 15:46:53 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-11-28 15:46:53 +0000 |
| commit | 26724c66d4764a77ca653ce6c0a1573e9e97e97c (patch) | |
| tree | f238f84ed390de31471cb95a20e3775f2ea7e3e7 /src/plugins/Input/sndfile | |
| parent | d02787b92ad9a220539498ebbc9f1745a075d10d (diff) | |
| download | qmmp-26724c66d4764a77ca653ce6c0a1573e9e97e97c.tar.gz qmmp-26724c66d4764a77ca653ce6c0a1573e9e97e97c.tar.bz2 qmmp-26724c66d4764a77ca653ce6c0a1573e9e97e97c.zip | |
changed decoder api; fixed flac plugin
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@646 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/sndfile')
| -rw-r--r-- | src/plugins/Input/sndfile/decodersndfilefactory.cpp | 50 | ||||
| -rw-r--r-- | src/plugins/Input/sndfile/decodersndfilefactory.h | 2 |
2 files changed, 28 insertions, 24 deletions
diff --git a/src/plugins/Input/sndfile/decodersndfilefactory.cpp b/src/plugins/Input/sndfile/decodersndfilefactory.cpp index 1828b8292..38278f8dc 100644 --- a/src/plugins/Input/sndfile/decodersndfilefactory.cpp +++ b/src/plugins/Input/sndfile/decodersndfilefactory.cpp @@ -18,7 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include <QtGui> -extern "C"{ +extern "C" +{ #include <sndfile.h> } @@ -32,20 +33,20 @@ bool DecoderSndFileFactory::supports(const QString &source) const { if ((source.right(3).toLower() == ".au") || - (source.right(4).toLower() == ".snd") || - (source.right(4).toLower() == ".aif") || - (source.right(5).toLower() == ".aiff") || - (source.right(5).toLower() == ".8svx") || - (source.right(4).toLower() == ".sph") || - (source.right(3).toLower() == ".sf") || - (source.right(4).toLower() == ".voc")) + (source.right(4).toLower() == ".snd") || + (source.right(4).toLower() == ".aif") || + (source.right(5).toLower() == ".aiff") || + (source.right(5).toLower() == ".8svx") || + (source.right(4).toLower() == ".sph") || + (source.right(3).toLower() == ".sf") || + (source.right(4).toLower() == ".voc")) return TRUE; else if (source.right(4).toLower() == ".wav") { //try top open the file SF_INFO snd_info; SNDFILE *sndfile = sf_open(source.toLocal8Bit(), SFM_READ, &snd_info); - if(!sndfile) + if (!sndfile) return FALSE; sf_close (sndfile); sndfile = 0; @@ -80,7 +81,7 @@ Decoder *DecoderSndFileFactory::create(QObject *parent, QIODevice *input, return new DecoderSndFile(parent, this, output, path); } -QList<FileInfo *> DecoderSndFileFactory::createPlayList(const QString &fileName) +QList<FileInfo *> DecoderSndFileFactory::createPlayList(const QString &fileName, bool useMetaData) { QList <FileInfo *> list; SF_INFO snd_info; @@ -92,20 +93,23 @@ QList<FileInfo *> DecoderSndFileFactory::createPlayList(const QString &fileName) return list; list << new FileInfo(fileName); - if (sf_get_string(sndfile, SF_STR_TITLE)) - { - char* title = strdup(sf_get_string(sndfile, SF_STR_TITLE)); - list.at(0)->setMetaData(Qmmp::TITLE, QString::fromUtf8(title).trimmed()); - } - if (sf_get_string(sndfile, SF_STR_ARTIST)) - { - char* artist = strdup(sf_get_string(sndfile, SF_STR_ARTIST)); - list.at(0)->setMetaData(Qmmp::ARTIST, QString::fromUtf8(artist).trimmed()); - } - if (sf_get_string(sndfile, SF_STR_COMMENT)) + if (useMetaData) { - char* comment = strdup(sf_get_string(sndfile, SF_STR_COMMENT)); - list.at(0)->setMetaData(Qmmp::COMMENT, QString::fromUtf8(comment).trimmed()); + if (sf_get_string(sndfile, SF_STR_TITLE)) + { + char* title = strdup(sf_get_string(sndfile, SF_STR_TITLE)); + list.at(0)->setMetaData(Qmmp::TITLE, QString::fromUtf8(title).trimmed()); + } + if (sf_get_string(sndfile, SF_STR_ARTIST)) + { + char* artist = strdup(sf_get_string(sndfile, SF_STR_ARTIST)); + list.at(0)->setMetaData(Qmmp::ARTIST, QString::fromUtf8(artist).trimmed()); + } + if (sf_get_string(sndfile, SF_STR_COMMENT)) + { + char* comment = strdup(sf_get_string(sndfile, SF_STR_COMMENT)); + list.at(0)->setMetaData(Qmmp::COMMENT, QString::fromUtf8(comment).trimmed()); + } } list.at(0)->setLength(int(snd_info.frames / snd_info.samplerate)); diff --git a/src/plugins/Input/sndfile/decodersndfilefactory.h b/src/plugins/Input/sndfile/decodersndfilefactory.h index aab996d98..0a5b160e5 100644 --- a/src/plugins/Input/sndfile/decodersndfilefactory.h +++ b/src/plugins/Input/sndfile/decodersndfilefactory.h @@ -44,7 +44,7 @@ public: bool canDecode(QIODevice *input) const; const DecoderProperties properties() const; Decoder *create(QObject *, QIODevice *, Output *, const QString &path); - QList<FileInfo *> createPlayList(const QString &fileName); + QList<FileInfo *> createPlayList(const QString &fileName, bool useMetaData); QObject* showDetails(QWidget *parent, const QString &path); void showSettings(QWidget *parent); void showAbout(QWidget *parent); |
