aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Input/mad/decodermadfactory.cpp27
-rw-r--r--src/plugins/Input/sndfile/decodersndfilefactory.cpp35
2 files changed, 46 insertions, 16 deletions
diff --git a/src/plugins/Input/mad/decodermadfactory.cpp b/src/plugins/Input/mad/decodermadfactory.cpp
index 95d27c337..c33cc3eea 100644
--- a/src/plugins/Input/mad/decodermadfactory.cpp
+++ b/src/plugins/Input/mad/decodermadfactory.cpp
@@ -1,6 +1,7 @@
#include <QtGui>
#include <QDialog>
#include <QMessageBox>
+#include <QFile>
#include <mad.h>
#include <taglib/tag.h>
#include <taglib/fileref.h>
@@ -20,7 +21,21 @@
bool DecoderMADFactory::supports(const QString &source) const
{
QString ext = source.right(4).toLower();
- return ext == ".mp1" || ext == ".mp2" || ext == ".mp3";
+ if (ext == ".mp1" || ext == ".mp2" || ext == ".mp3")
+ return TRUE;
+ else if (ext == ".wav") //check for mp3 wav files
+ {
+ QFile file(source);
+ file.open(QIODevice::ReadOnly);
+ char buf[22];
+ file.peek(buf,sizeof(buf));
+ file.close();
+ if (!memcmp(buf + 8, "WAVE", 4) && !memcmp(buf + 20, "U" ,1))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
bool DecoderMADFactory::canDecode(QIODevice *input) const
@@ -50,7 +65,7 @@ const DecoderProperties DecoderMADFactory::properties() const
{
DecoderProperties properties;
properties.name = tr("MPEG Plugin");
- properties.filter = "*.mp1 *.mp2 *.mp3";
+ properties.filter = "*.mp1 *.mp2 *.mp3 *.wav";
properties.description = tr("MPEG Files");
properties.contentType = "audio/mp3;audio/mpeg";
properties.hasAbout = TRUE;
@@ -87,7 +102,7 @@ FileTag *DecoderMADFactory::createTag(const QString &source)
case SettingsDialog::ID3v1:
{
codec = QTextCodec::codecForName(settings.value("ID3v1_encoding","ISO-8859-1")
- .toByteArray ());
+ .toByteArray ());
tag = fileRef.ID3v1Tag();
break;
}
@@ -95,7 +110,7 @@ FileTag *DecoderMADFactory::createTag(const QString &source)
{
QByteArray name;
name = settings.value("ID3v2_encoding","UTF-8").toByteArray ();
- if(name.contains("UTF"))
+ if (name.contains("UTF"))
codec = QTextCodec::codecForName ("UTF-8");
else
codec = QTextCodec::codecForName(name);
@@ -113,12 +128,12 @@ FileTag *DecoderMADFactory::createTag(const QString &source)
break;
}
}
- if(tag && !tag->isEmpty())
+ if (tag && !tag->isEmpty())
break;
}
settings.endGroup();
- if(!codec)
+ if (!codec)
codec = QTextCodec::codecForName ("UTF-8");
if (tag && codec)
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 <QtGui>
+extern "C"{
#include <sndfile.h>
+}
#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;
}