diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2016-06-15 05:49:46 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2016-06-15 05:49:46 +0000 |
| commit | f196bf0eb34f01b8db35336b82ac31fd5f531ec6 (patch) | |
| tree | 7579d46c85f9b40c80fe897f10c3d4daa82fac77 /src/plugins/Input/sndfile | |
| parent | 16bb56a600c97ff5e1eb48f66755de8118561aa8 (diff) | |
| download | qmmp-f196bf0eb34f01b8db35336b82ac31fd5f531ec6.tar.gz qmmp-f196bf0eb34f01b8db35336b82ac31fd5f531ec6.tar.bz2 qmmp-f196bf0eb34f01b8db35336b82ac31fd5f531ec6.zip | |
sndfile: fixed unicode support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@6453 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/sndfile')
| -rw-r--r-- | src/plugins/Input/sndfile/decoder_sndfile.cpp | 8 | ||||
| -rw-r--r-- | src/plugins/Input/sndfile/decoder_sndfile.h | 8 | ||||
| -rw-r--r-- | src/plugins/Input/sndfile/decodersndfilefactory.cpp | 23 |
3 files changed, 28 insertions, 11 deletions
diff --git a/src/plugins/Input/sndfile/decoder_sndfile.cpp b/src/plugins/Input/sndfile/decoder_sndfile.cpp index a7a882500..4a6b9ab19 100644 --- a/src/plugins/Input/sndfile/decoder_sndfile.cpp +++ b/src/plugins/Input/sndfile/decoder_sndfile.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2012 by Ilya Kotov * + * Copyright (C) 2007-2016 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -50,7 +50,11 @@ bool DecoderSndFile::initialize() memset (&snd_info, 0, sizeof(snd_info)); snd_info.format=0; - m_sndfile = sf_open(m_path.toLocal8Bit(), SFM_READ, &snd_info); +#ifdef Q_OS_WIN + m_sndfile = sf_wchar_open(reinterpret_cast<LPCWSTR>(m_path.utf16()), SFM_READ, &snd_info); +#else + m_sndfile = sf_open(m_path.toLocal8Bit().constData(), SFM_READ, &snd_info); +#endif if (!m_sndfile) { qWarning("DecoderSndFile: failed to open: %s", qPrintable(m_path)); diff --git a/src/plugins/Input/sndfile/decoder_sndfile.h b/src/plugins/Input/sndfile/decoder_sndfile.h index 41c1ace57..1d3811971 100644 --- a/src/plugins/Input/sndfile/decoder_sndfile.h +++ b/src/plugins/Input/sndfile/decoder_sndfile.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2009 by Ilya Kotov * + * Copyright (C) 2007-2016 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -21,9 +21,11 @@ #ifndef DECODER_AUDIOFILE_H #define DECODER_AUDIOFILE_H -extern "C"{ +#ifdef Q_OS_WIN +#include <windows.h> +#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1 +#endif #include <sndfile.h> -} #include <qmmp/decoder.h> 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; |
