From d38a753c77724bf6a1df6bf204c58f318908ec48 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 9 Apr 2008 13:31:11 +0000 Subject: mp3 wave support git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@336 90c681e8-e032-0410-971d-27865f9a5e38 --- .../Input/sndfile/decodersndfilefactory.cpp | 35 +++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'src/plugins/Input/sndfile/decodersndfilefactory.cpp') diff --git a/src/plugins/Input/sndfile/decodersndfilefactory.cpp b/src/plugins/Input/sndfile/decodersndfilefactory.cpp index 37a42f9ff..30178aabe 100644 --- a/src/plugins/Input/sndfile/decodersndfilefactory.cpp +++ b/src/plugins/Input/sndfile/decodersndfilefactory.cpp @@ -18,7 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include +extern "C"{ #include +} #include "decoder_sndfile.h" #include "decodersndfilefactory.h" @@ -29,16 +31,27 @@ bool DecoderSndFileFactory::supports(const QString &source) const { - return (source.right(4).toLower() == ".wav") || - (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() == ".wav") || - (source.right(4).toLower() == ".sph") || - (source.right(3).toLower() == ".sf") || - (source.right(4).toLower() == ".voc"); + 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")) + 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) + return FALSE; + sf_close (sndfile); + sndfile = 0; + return TRUE; + } + return FALSE; } bool DecoderSndFileFactory::canDecode(QIODevice *) const @@ -99,6 +112,8 @@ FileTag *DecoderSndFileFactory::createTag(const QString &source) QObject* DecoderSndFileFactory::showDetails(QWidget *parent, const QString &path) { + Q_UNUSED(parent); + Q_UNUSED(path); return 0; } -- cgit v1.2.3-13-gbd6f