aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/sndfile/decodersndfilefactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input/sndfile/decodersndfilefactory.cpp')
-rw-r--r--src/plugins/Input/sndfile/decodersndfilefactory.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/plugins/Input/sndfile/decodersndfilefactory.cpp b/src/plugins/Input/sndfile/decodersndfilefactory.cpp
index b6a464a6f..e800a0a95 100644
--- a/src/plugins/Input/sndfile/decodersndfilefactory.cpp
+++ b/src/plugins/Input/sndfile/decodersndfilefactory.cpp
@@ -21,11 +21,11 @@
#include <QMessageBox>
#include <QTranslator>
#include <QtPlugin>
-extern "C"
-{
+#ifdef Q_OS_WIN
+#include <windows.h>
+#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
+#endif
#include <sndfile.h>
-}
-
#include "decoder_sndfile.h"
#include "decodersndfilefactory.h"
@@ -38,9 +38,16 @@ bool DecoderSndFileFactory::supports(const QString &source) const
{
//try top open the file
SF_INFO snd_info;
- SNDFILE *sndfile = sf_open(source.toLocal8Bit(), SFM_READ, &snd_info);
+#ifdef Q_OS_WIN
+ SNDFILE *sndfile = sf_wchar_open(reinterpret_cast<LPCWSTR>(source.utf16()), SFM_READ, &snd_info);
+#else
+ SNDFILE *sndfile = sf_open(source.toLocal8Bit().constData(), SFM_READ, &snd_info);
+#endif
if (!sndfile)
+ {
+ qDebug("failed!!");
return false;
+ }
sf_close (sndfile);
sndfile = 0;
return true;
@@ -87,7 +94,11 @@ QList<FileInfo *> DecoderSndFileFactory::createPlayList(const QString &fileName,
SNDFILE *sndfile = 0;
memset (&snd_info, 0, sizeof(snd_info));
snd_info.format = 0;
- sndfile = sf_open(fileName.toLocal8Bit(), SFM_READ, &snd_info);
+#ifdef Q_OS_WIN
+ sndfile = sf_wchar_open(reinterpret_cast<LPCWSTR>(fileName.utf16()), SFM_READ, &snd_info);
+#else
+ sndfile = sf_open(fileName.toLocal8Bit().constData(), SFM_READ, &snd_info);
+#endif
if (!sndfile)
return list;